See also bug 39435. We need a folder to store js associated with a plugin.
Created attachment 179758 [details] [review] Bug 39466: Add plugins/js folder, add access in Apache Test plan: Run the adjusted koha-create-dirs (or copy it to sbin and run koha-create) and verify folder creation. Remove the folders (manually or use koha-remove in case you used koha-create). Create the js folder in your own /var/lib/koha/YOUR_INSTANCE/plugins folder. (Optionally, chmod 550 it.) Copy the change in the apache-shared file into your /etc/koha counterpart. Restart Apache. Touch /var/lib/koha/YOUR_INSTANCE/plugins/js/test.txt. Verify that you can reach it with URL /plugins/js/test.txt.
I'm not sure that I understand this one. Could you elaborate on it a bit more?
(In reply to David Cook from comment #2) > I'm not sure that I understand this one. Could you elaborate on it a bit > more? On the other bug a plugin sends back html which could include a js link to a script in this plugin folder. This js is not part of Koha, but part of the plugin.
(In reply to Marcel de Rooy from comment #3) > (In reply to David Cook from comment #2) > > I'm not sure that I understand this one. Could you elaborate on it a bit > > more? > > On the other bug a plugin sends back html which could include a js link to a > script in this plugin folder. This js is not part of Koha, but part of the > plugin. But how would the Javascript get into this folder? It seems like it would have to be manually set up?
(In reply to David Cook from comment #4) > (In reply to Marcel de Rooy from comment #3) > > (In reply to David Cook from comment #2) > > > I'm not sure that I understand this one. Could you elaborate on it a bit > > > more? > > > > On the other bug a plugin sends back html which could include a js link to a > > script in this plugin folder. This js is not part of Koha, but part of the > > plugin. > > But how would the Javascript get into this folder? It seems like it would > have to be manually set up? Yes we need some adjustment in the plugin install.
(In reply to Marcel de Rooy from comment #5) > Yes we need some adjustment in the plugin install. I don't know that it will work, since there's lots of different ways to deploy the plugins. For instance, I actually separate my plugins into /var/lib/koha/<instance>/<plugin_name> and add them as separate pluginsdir entries, as I find this makes it much easier to manage them. Some people point to places like /opt/all_my_koha_plugins and stuff like that. For the Javascript, you could use the "static_routes" plugin hook.
(In reply to David Cook from comment #6) > (In reply to Marcel de Rooy from comment #5) > > Yes we need some adjustment in the plugin install. > > I don't know that it will work, since there's lots of different ways to > deploy the plugins. > > For instance, I actually separate my plugins into > /var/lib/koha/<instance>/<plugin_name> and add them as separate pluginsdir > entries, as I find this makes it much easier to manage them. Some people > point to places like /opt/all_my_koha_plugins and stuff like that. > > For the Javascript, you could use the "static_routes" plugin hook. Ok, didnt think about the static_routes here. But it might still be easier and faster to serve directly from this plugins/js folder. When installing copy js files to that folder, and when uninstalling remove the same files again there. For common js libraries, we could define a dedicated plugin that only serves to install those common js files? Or even call it plugins/static and copy whatever you have in [your_plugin]/static to the common folder?
(In reply to Marcel de Rooy from comment #7) > Ok, didnt think about the static_routes here. But it might still be easier > and faster to serve directly from this plugins/js folder. That's true. > When installing copy js files to that folder, and when uninstalling remove > the same files again there. Maybe but that would be a big shift in how plugins work I think. It would be interesting to see what heavy plugin users thing of that. Actually, I like the idea of changing how plugin deployments work. Honestly, I think I might prefer a system where plugin code got copied/moved at install/uninstall time. (Not just the JS but all of it.) Food for tought... > For common js libraries, we could define a > dedicated plugin that only serves to install those common js files? > > Or even call it plugins/static and copy whatever you have in > [your_plugin]/static to the common folder? I'm not sure that I understand what you're saying here. If we did standardize the location of plugins, and install them under a plugin name (after all we already define namespaces in up-to-date plugins), we could use "AliasMatch" to serve static files out of /var/lib/<koha>/pluginsv2/<koha_plugin_namespace>/static or /var/lib/<koha>/pluginsv2/<koha_plugin_namespace>/public
Closing this one for now.