1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

FullCalendar : customize edit/details url ?

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

  1. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    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 ?
     
  2. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    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: Community
    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 :

    View attachment 17231
     
    Last edited: Jun 8, 2018
  4. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    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: Community
    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: Community
    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: Community
    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: Community
    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: Community
    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: Community
    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: Community
    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 ?
     
  12. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    Hi Hugh,

    Did you find some time to have a look on this one ?

     
  13. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I think I did. :)

    I'll get that code back out on to the slab in the lab, remind myself where I was at.

    -- hugh
     
  14. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Thinking Aloud.

    Turns out it's not as easy as I'd hoped, as the links are built in the controller ...

    https://github.com/Fabrik/fabrik/bl...ullcalendar/controllers/fullcalendar.php#L113

    When you click the view/edit button on the popup, it's not calling the view/edit links direct, it's calling the fullcalendar viz controller, telling it which view it wants (form or details), and the controller then builds the links "by hand" (doesn't call the list model's methods) and redirects to that view. And the problem is, in order to call the list model's editLink() and viewDetailsLink() methods (to get the custom links if they exist) in that controller, we'd have to load the row data there, eg run a form model getData(), because those methods require the $row object as an argument (so it can get things like the rowid and have row data available for placeholders used in custom links). Which would be a huge performance hit ... loading the form data from the database just to build the redirect link to the form/details view, which would then have to load the data all over again.

    Looks like waaaay back we used to build the links when loading the event data ...

    https://github.com/Fabrik/fabrik/bl...ion/fullcalendar/models/fullcalendar.php#L523

    ... which is called (via AJAX) as the month view is loaded, and we do actually include those links in the event data we pass to the Javascript. But those aren't used any more - I seem to recall we used them in the first cut of the original (deprecated) 'calendar' plugin.

    However, at the point those (unused) links are built, we do have the row data. So I could call the list model methods, and get custom links. Then I think what I could do is then finagle the Javascript so it passes the ready built form/details links back to the controller, which could then use those, rather than building it's own.

    OK, lets try that!

    -- hugh
     
  15. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I started working on this, then ran into a nasty issue with the staging branch of J! (the 3.8.10 pre-release), which broke our caching, whereby reloading a list of viz page (with J! system cache enabled) none of our JS was loading.

    I've almost got that resolved, hopefully get back to working on the calendar stuff this evening.

    -- hugh
     
  16. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    Wowww. Thanks for the follow-up. It's clearly out my Fabrik's skills scope !) The only thing I could done is to renew my sub to support you.... :)

    BTW, is this Ajax approach could meet my popup concerns (post #11) ? In my case, the edit/detail links could be built from the ajax call :

     
  17. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    Just a cool reminder. Got any time to work on this one ?
     
  18. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Haven't had time yet, keep reminding me.

    -- hugh
     

Share This Page