Koha plugins system (http://manual.koha-community.org/3.16/en/pluginsystem.html)
does not provide a ready method to show an auto-populated nav menu for the 
plugins
installed in the system. This patch adds that capability and allows plugin 
authors
to add this .inc file in the plugin's template file.
---
 .../prog/en/includes/plugins-menu.inc              | 65 ++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/plugins-menu.inc

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/plugins-menu.inc 
b/koha-tmpl/intranet-tmpl/prog/en/includes/plugins-menu.inc
new file mode 100644
index 0000000..9bfa681
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/plugins-menu.inc
@@ -0,0 +1,65 @@
+<script type="text/javascript">//<![CDATA[
+    $(document).ready(function() {
+        var path = location.pathname.substring(1);
+        var url = window.location.toString();
+        var params = '';
+        if ( url.match(/\?(.+)$/) ) {
+            params = RegExp.$1;
+            
+            var outstring = "?";
+            
+            var qstr = params.split("&");
+            
+            for (i=0; i < qstr.length; i++) {
+             var qstrkey = qstr[i].split("=");
+             for (j=0; j < qstrkey.length; j++) {
+               if (qstrkey[j] == "class" || qstrkey[j] == "method" ) {
+                 if (i > 0) {
+                   outstring = outstring + "&" + qstrkey[0] + "=" + qstrkey[1];
+                 } else {
+                   outstring = outstring + qstrkey[0] + "=" + qstrkey[1];
+                 }
+               }
+             }
+            }            
+        }
+        $('#navmenulist a[href$="/' + path + outstring + 
'"]').css('font-weight','bold');
+    });
+//]]>
+</script>
+<div id="navmenu">
+<div id="navmenulist">
+<h5>Custom Plug-ins
+</h5>
+<ul>
+    <li><a href="/cgi-bin/koha/plugins/plugins-home.pl">Plugins home</a></li>
+    <li><a href="/cgi-bin/koha/plugins/plugins-upload.pl">Upload 
plugins</a></li>
+</ul>
+
+[% IF ( reports ) %]
+  <h5>Plugin Reports</h5>
+  [% FOREACH report IN reports %]
+  <ul>
+    [% IF ( CAN_user_plugins_report ) %]
+      [% IF report.can('report') %]
+       <li><a href="/cgi-bin/koha/plugins/run.pl?class=[% report.class 
%]&method=report">[% report.metadata.name %]</a></li>
+      [% END %]
+    [% END %]
+  </ul>
+  [% END %]
+[% END %]
+
+[% IF ( tools ) %]
+  <h5>Plugin Tools</h5>
+  [% FOREACH tool IN tools %]
+  <ul>
+    [% IF ( CAN_user_plugins_report ) %]
+      [% IF tool.can('tool') %]
+       <li><a href="/cgi-bin/koha/plugins/run.pl?class=[% tool.class 
%]&method=tool">[% tool.metadata.name %]</a></li>
+      [% END %]
+    [% END %]
+  </ul>
+  [% END %]
+[% END %]
+
+</div></div>
\ No newline at end of file
-- 
1.8.1.2

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to