1. Fabrik 3.8.1 has been released. It is mostly bug fixes and feature enhancements, but does include two new plugins (push notifications, and the sequence element). As usual we strongly recommend testing the new release on a sandbox if your application is mission critical, and always do an Akeeba backup before updating.

FullCalendar : customize edit/details url ?

Discussion in 'Professional Support' started by lcollong, Jun 7, 2018.

  1. lcollong

    lcollong FabriKant d'applications web

    Level: Professional
    Hi,

    Full calendar is doing great, but my table is huge. I need to display a simplified version of the table (copy) in the viz in order to enhance display speed. But the edit form displayed in the popup (as well as the details one) has to refer to the original table (form). Easy to do with Fabrik's list but the custom url field in the viz's params seems not being able to handle the three ones (add, edit, view).

    Currently, I made a popup of the simplified list, hide the regular button in the popup and added a link in the popup html to the edit page. It's not very "nice" but it works. However I can't stay inside the popup. It has to open in "same" or "_blank".

    I don't think php template or layout will help as everything is done in JS.

    Any solution ?
     

    Attached Files:

  2. lcollong

    lcollong FabriKant d'applications web

    Level: Professional
    How complicated would it be to use the Fabrik'list (custom) "link" parameters to build the underlying popup button (edit/view) ? Hence we could display in the popup "edit" whatever is indicated in the custom edit link of the list associated with the calendar.
     
  3. lcollong

    lcollong FabriKant d'applications web

    Level: Professional
    Jlayouts override for this viz is not yet implemented. Right ?
    If not, would be nice to add a class to the start/end rows in order to not display or style all the thing. Here is the proposed modified plugins/fabrik_visualization/fullcalendar/layouts/fabrik-visualization-fullcalendar-viewevent.php file :

    PHP:
    <?php
    defined('JPATH_BASE') or die;
    ?>
    <div class="form-horizontal" id="viewDetails">

        <div class="row calEventStart">
            <div class="span4"><?php echo FText::_('PLG_VISUALIZATION_FULLCALENDAR_START') ?>:</div>
            <div class="span8" id="viewstart"></div>
        </div>
        <div class="row calEventEnd">
            <div class="span4"><?php echo FText::_('PLG_VISUALIZATION_FULLCALENDAR_END') ?>:</div>
            <div class="span8" id="viewend"></div>
        </div>
        <div class="row">
            <div class="span12" data-role="fabrik-popup-template">

            </div>
        </div>
    </div>
    as it allows to use fabrik's placeholders rather than raw date/time :

    upload_2018-6-8_18-29-39.png
     
    Last edited: Jun 8, 2018
  4. lcollong

    lcollong FabriKant d'applications web

    Level: Professional
    Strange thing : all the text in the previous pic are placeholders element. The first one "Epicerie du coin" gives the right data, the second one is a date element which does not want to render (always "raw"). The third one is a drop down (60 mn) which gives the right data, not the raw one. However the last one (interv) which is also a regular dropdown gives the raw data instead of the element label. Is there some limitations to the placeholder parsing ?
     
  5. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    I'll take a look.

    Should be. The layout paths we're using for the layout you mentioned on my system are:

    Code (Text):

    array (
        0 => 'C:\\xampp\\htdocs\\joomla34\\plugins/fabrik_visualization/fullcalendar/layouts/',
        1 => 'C:\\xampp\\htdocs\\joomla34\\templates/yootheme/html/layouts/com_fabrik',
        2 => 'C:\\xampp\\htdocs\\joomla34\\templates/yootheme/html/layouts',
        3 => 'C:\\xampp\\htdocs\\joomla34/layouts',
        4 => 'C:\\xampp\\htdocs\\joomla34\\components/com_fabrik/layouts',
        5 => 'C:\\xampp\\htdocs\\joomla34\\templates/yootheme/html/layouts/com_fabrik',
        6 => 'C:\\xampp\\htdocs\\joomla34/components/com_fabrik/layouts',
        7 => 'C:\\xampp\\htdocs\\joomla34\\templates/yootheme/html/layouts',
        8 => 'C:\\xampp\\htdocs\\joomla34/layouts',
      ),
     
    So it should find an override in any of the usual places - the site template, the main com_fabrik/layouts, etc.

    Which location were you trying?

    -- hugh
     
  6. lcollong

    lcollong FabriKant d'applications web

    Level: Professional
    Hi Hugh,

    thanks for looking to this one.

    I did my test with : templates/yoo_avenue/html/layouts/com_fabrik/fullcalendar
    I tried with or without "fullcalendar" as well as templates/yoo_avenue/html/layouts/com_fabrik/fabrik_visualization/fullcalendar/fabrik-visualization-fullcalendar-viewevent.php

    As for by my understanding, the modified file should be : templates/yoo_avenue/html/layouts/com_fabrik/fabrik-visualization-fullcalendar-viewevent.php ?
    But it does not load. Even after cleaning all possible caches.
     
  7. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Ooops, I see the problem. OK, after this commit, the locations you'd expect will work:

    C:\xampp\htdocs\joomla34\templates/protostar/html/layouts/com_fabrik/visualization
    C:\xampp\htdocs\joomla34\templates/protostar/html/layouts/com_fabrik
    C:\xampp\htdocs\joomla34/plugins/fabrik_visualization/fullcalendar/views/fullcalendar/tmpl/bootstrap/layouts
    C:\xampp\htdocs\joomla34/plugins/fabrik_visualization/fullcalendar/layouts

    https://github.com/Fabrik/fabrik/commit/ce99696a96bb2199c44a8fa74b5b2a6c19480553

    -- hugh
     
  8. lcollong

    lcollong FabriKant d'applications web

    Level: Professional
    Perfect. Now I can override :)
    Regarding my post #4, could you indicate me where I could start to debug the reason why some placeholders in the popup template render as expected and some give back the raw value (ie BD value) ? Both are regular drop downs.
     
  9. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Btw, I'm working on having the view and edit links use the list's settings, so if custom links are specified, it'll use those.

    The issue with placeholders is that we're not "rendering" the data. So the placeholders are working on the result of a simple query, without the element rendering. So, for example, dates are MySQL format. Dropdowns will be the raw data. Etc. Nothing is being run through the element's renderListData() method.

    Code (Text):

    SELECT SQL_CALC_FOUND_ROWS DISTINCT `fab_more_events`.`date_time` AS `fab_more_events___date_time`,
     `fab_more_events`.`date_time` AS `fab_more_events___date_time_raw`,
     `fab_more_events`.`id` AS `fab_more_events___id`,
     `fab_more_events`.`id` AS `fab_more_events___id_raw`,
     `fab_more_events`.`name` AS `fab_more_events___name`,
     `fab_more_events`.`name` AS `fab_more_events___name_raw`,
    etc etc
     
    ... and that's what you get.

    The reason we're not rendering the data is for performance. It's the element rendering that takes the time when building a list view. And in a calendar, where you may have dozens (or hundreds) of events in a month, it would kill performance. And for most people, they would be gaining nothing, as very few people use that popup, so have no need for the rendered data.

    I'm not sure why / how you are seeing "rendered" data for one of your dropdowns, unless it's actually a join element, not a dropdown element. I don't see any way in the code that you could be seeing the "label" (non-raw) of a dropdown, as the label is only present in the #__fabrik_elements metadata table (in JSON format, in the params), and requires element rendering to display.

    I don't really have a good solution for you at the moment.

    -- hugh
     
  10. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    About the only "easy" solution would be to make the popup option eval'able, so you could do your own individual element rendering.

    -- hugh
     
  11. lcollong

    lcollong FabriKant d'applications web

    Level: Professional
    Taking a much closer look : none of the placeholders are actually rendered. Only raw values are displayed indeed. My mistake.
    I do understand the performance issue. It's important in my case also.

    However, the popup view is ideal to have an appointment quick look whereas a direct detail view link would give too much informations most of the case. So the option to substitute the popup by directly opening the target detailed view is not the right solution.

    Being able to link to the edit/details view from the popup using the list custom url would be ideal (second level deeper informations). I'll wait your current investigations.

    The eval thing in the popup makes senses. But if it is done on page load, I'm concerned about performance issue as well.

    Could we consider an ajax solution ? opening the popup would trigger an ajax call giving back the html to display in the popup ? Ideally, in a separate div. On popup opening the current custom content would be displayed (constant and raw values from the sql request as now). Thus without waiting the server answer. A second div would be populated from the server meanwhile (spinner on display, then replaced by the actual content).
    I'm not expecting all of this "out of the box". Just the "entry point" to write the right js and, may be, load the userAjax.php file in order to trigger my own function ?

    What do you think ?
     

Share This Page