From birnbacs at gmail.com Thu Nov 23 08:35:20 2017 From: birnbacs at gmail.com (Sebastian Birnbach) Date: Thu, 23 Nov 2017 09:35:20 +0100 Subject: [dev] How do I use the JS-file caching mechanism of Horde? Message-ID: I am playing around with Horde_Views and the Javascript gems in /js, like tables.js or form_sections.js. It is a real pity that there is so little documentation (none at all?) on these. Anyway, I am wondering how to include JS files making use of the Horde JS caching system. For instance, I see in the HTML source of an average Horde page something like But if I replace that with addScriptFile('form_sections.js', 'horde'); ?> I see that the generated HTML code loads a cached version of the js file: only that functionality is negative. In this case, JS console complains about undefined variable sections_dossier_form which is in fact defined near the bottom of the Horde_View file: Any clues, anybody? 2017-11-23 9:35 GMT+01:00 Sebastian Birnbach : > I am playing around with Horde_Views and the Javascript gems in /js, like > tables.js or form_sections.js. It is a real pity that there is so little > documentation (none at all?) on these. > > Anyway, I am wondering how to include JS files making use of the Horde JS > caching system. For instance, I see in the HTML source of an average Horde > page something like > > > > But if I replace that with > > $GLOBALS['page_output']->addScriptFile('form_sections.js', 'horde'); > ?> > > I see that the generated HTML code loads a cached version of the js file: > > > > only that functionality is negative. > > > In this case, JS console complains about undefined variable > sections_dossier_form > which is in fact defined near the bottom of the Horde_View file: > > > > Any clues, anybody? > > 2017-11-23 9:35 GMT+01:00 Sebastian Birnbach : > >> I am playing around with Horde_Views and the Javascript gems in /js, like >> tables.js or form_sections.js. It is a real pity that there is so little >> documentation (none at all?) on these. >> >> Anyway, I am wondering how to include JS files making use of the Horde JS >> caching system. For instance, I see in the HTML source of an average Horde >> page something like >> >> >> >> But if I replace that with >> >> > $GLOBALS['page_output']->addScriptFile('form_sections.js', 'horde'); >> ?> >> >> I see that the generated HTML code loads a cached version of the js file: >> >> >> >> only that functionality is negative. >> >> >> In this case, JS console complains about undefined variable >> sections_dossier_form >> which is in fact defined near the bottom of the Horde_View file: >> >> >> >> Any clues, anybody? >> >> 2017-11-23 9:35 GMT+01:00 Sebastian Birnbach : >> >> I am playing around with Horde_Views and the Javascript gems in /js, like >>> tables.js or form_sections.js. It is a real pity that there is so little >>> documentation (none at all?) on these. >>> >>> Anyway, I am wondering how to include JS files making use of the Horde JS >>> caching system. For instance, I see in the HTML source of an average >>> Horde >>> page something like >>> >>> -- I noticed that things work well if in the HTML file the JS file is included before the CDATA section. I don't see how I can include the JS any sooner, so the question is what controls the CDATA section?