Bug 23975: Add ability to search and install plugins from GitHub
[koha-equinox.git] / koha-tmpl / intranet-tmpl / prog / en / modules / plugins / plugins-home.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Tools &rsaquo; Plugins </title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 </head>
9
10 <body id="plugins_plugins_home" class="plugins">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'prefs-admin-search.inc' %]
13
14 <div id="breadcrumbs">
15     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
16     <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
17     Plugins
18 </div>
19
20 <div class="main container-fluid">
21     <div class="row">
22         <div class="col-sm-10 col-sm-push-2">
23             <main>
24
25                 <div class="details">
26
27                     [% IF ( CAN_user_plugins_manage ) %]
28                         <div class="btn-toolbar" id="toolbar">
29                             <a href="/cgi-bin/koha/plugins/plugins-upload.pl" id="upload_plugin" class="btn btn-default"><i class="fa fa-upload"></i> Upload plugin</a>
30
31                             <div class="btn-group">
32                                 <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-eye"></i> View plugins by class <span class="caret"></span></button>
33                                 <ul class="dropdown-menu">
34                                     <li><a href="/cgi-bin/koha/plugins/plugins-home.pl">View all plugins</a></li>
35                                     <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=report">View report plugins</a></li>
36                                     <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=tool">View tool plugins</a></li>
37                                     <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=to_marc">View MARC conversion plugins</a></li>
38                                     <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=opac_online_payment">View online payment plugins</a></li>
39                                     <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=intranet_catalog_biblio_enhancements">View intranet catalog biblio enhancement plugins</a></li>
40                                 </ul>
41                             </div>
42
43                             <div class="btn-group">
44                                 <form class="form-inline">
45                                     <div class="form-group">
46                                         <div class="input-group">
47                                             <input type="text" class="form-control" name="plugin-search" id="plugin-repo-search" placeholder="Search for plugins" value="[% search_term | html %]"/>
48                                             <div class="input-group-addon"><i class="fa fa-search"></i></div>
49                                         </div>
50                                     </div>
51                                 </form>
52                             </div>
53                         </div>
54                     [% END %]
55                     <h1>Plugins</h1>
56
57                     [% IF search_results %]
58                         <h2>Search results</h2>
59                         <table class="table table-striped">
60                             <thead>
61                                 <tr>
62                                     <th>Name</th>
63                                     <th>Description</th>
64                                     <th>Organization</th>
65                                     <th>&nbsp;</th>
66                                 </tr>
67                             </thead>
68
69                             [% FOREACH sr IN search_results %]
70                                 <tr>
71                                     <td><a href="[% sr.result.html_url | url %]" target="_new">[% sr.result.name %]</a></td>
72                                     <td>[% sr.result.description %]</td>
73                                     <td>[% sr.repo.name %]</td>
74                                     <td><button class="btn btn-install-plugin"><i class="fa fa-download"></i> Install</button></td>
75                                 </tr>
76                             [% END %]
77                         </table>
78                     [% END %]
79
80                     [% UNLESS ( plugins ) %]
81                         [% UNLESS ( method ) %]
82                             <div class="dialog message">No plugins installed</div>
83                         [% ELSE %]
84                             [% IF method == 'tool' %]
85                                 <div class="dialog message">No plugins that can be used as a tool are installed</div>
86                             [% ELSIF method == 'report' %]
87                                 <div class="dialog message">No plugins that can create a report are installed</div>
88                             [% ELSIF method == 'to_marc' %]
89                                 <div class="dialog message">No plugins that can convert files to MARC records are installed</div>
90                             [% ELSIF method == 'opac_online_payment' %]
91                                 <div class="dialog message">No plugins that can process online payments via the public catalog are installed</div>
92                             [% ELSIF method == 'intranet_catalog_biblio_enhancements' %]
93                                 <div class="dialog message">No plugins that can enhance the intranet catalog biblio records are installed</div>
94                             [% ELSE %]
95                                 <div class="dialog message">Unknown plugin type <i>[% method | html %]</i></div>
96                             [% END %]
97                         [% END %]
98                     [% ELSE %]
99                         <table>
100                             <tr>
101                                 <th>Name</th>
102                                 <th>Description</th>
103                                 <th>Author</th>
104                                 <th>Plugin version</th>
105                                 <th>Minimum Koha version</th>
106                                 <th>Maximum Koha version</th>
107                                 <th>Last updated</th>
108                                 [% IF ( CAN_user_plugins_configure || CAN_user_plugins_manage || CAN_user_plugins_report || CAN_user_plugins_tool ) %]
109                                     <th>Actions</th>
110                                 [% END %]
111                             </tr>
112
113                             [% FOREACH plugin IN plugins %]
114                                 <tr>
115                                     <td>
116                                         <strong>[% plugin.metadata.name | html %]</strong>
117                                         [% IF ( plugin.is_enabled ) %]
118                                             <span class="label label-primary">ENABLED</span>
119                                         [% ELSE %]
120                                             <span class="label label-default">DISABLED</span>
121                                         [% END %]
122                                     </td>
123                                     <td>
124                                         [% plugin.metadata.description | html %]
125
126                                         [% IF ( plugin.metadata.minimum_version && koha_version < plugin.metadata.minimum_version ) %]
127                                             <div class="dialog alert">
128                                                 Warning: This report was written for a newer version of Koha. Run at your own risk.
129                                             </div>
130                                         [% END %]
131
132                                         [% IF ( plugin.metadata.maximum_version && koha_version > plugin.metadata.maximum_version ) %]
133                                             <div class="dialog alert">
134                                                 Warning: This plugin was written for an older version of Koha. Run at your own risk.
135                                             </div>
136                                         [% END %]
137                                     </td>
138                                     <td>[% plugin.metadata.author | html %]</td>
139                                     <td>[% plugin.metadata.version | html %]</td>
140                                     <td>[% plugin.metadata.minimum_version | html %]</td>
141                                     <td>[% plugin.metadata.maximum_version | html %]</td>
142                                     <td>[% plugin.metadata.date_updated | $KohaDates %]</td>
143                                     [% IF ( CAN_user_plugins_configure || CAN_user_plugins_manage || CAN_user_plugins_report || CAN_user_plugins_tool ) %]
144                                         <td class="actions">
145                                             <div class="dropdown">
146                                                 <a class="btn btn-default btn-xs dropdown-toggle" id="pluginactions[% plugin.class | html %]" role="button" data-toggle="dropdown" href="#">
147                                                    Actions <b class="caret"></b>
148                                                 </a>
149                                                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="pluginactions[% plugin.class | html %]">
150                                                     [% IF ( CAN_user_plugins_report ) %]
151                                                         [% IF plugin.can('report') %]
152                                                             <li><a href="/cgi-bin/koha/plugins/run.pl?class=[% plugin.class | uri %]&method=report"><i class="fa fa-table fa-fw"></i> Run report</a></li>
153                                                         [% END %]
154                                                     [% END %]
155
156                                                     [% IF ( CAN_user_plugins_tool ) %]
157                                                         [% IF plugin.can('tool') %]
158                                                             <li><a href="/cgi-bin/koha/plugins/run.pl?class=[% plugin.class | uri %]&method=tool"><i class="fa fa-wrench fa-fw"></i> Run tool</a></li>
159                                                         [% END %]
160                                                     [% END %]
161
162                                                     [% IF ( CAN_user_plugins_configure ) %]
163                                                         [% IF plugin.can('configure') %]
164                                                             <li><a href="/cgi-bin/koha/plugins/run.pl?class=[% plugin.class | uri %]&method=configure"><i class="fa fa-cog fa-fw"></i> Configure</a></li>
165                                                         [% END %]
166                                                     [% END %]
167                                                     [% IF ( CAN_user_plugins_manage ) %]
168                                                             <li><a class="uninstall_plugin" data-plugin-name="[% plugin.metadata.name | html %]" href="/cgi-bin/koha/plugins/plugins-uninstall.pl?class=[% plugin.class | html %]"><i class="fa fa-trash fa-fw"></i> Uninstall</a></li>
169                                                         [% IF ( plugin.is_enabled ) %]
170                                                                 <li><a class="enable_plugin" data-plugin-name="[% plugin.metadata.name | html %]" href="/cgi-bin/koha/plugins/plugins-enable.pl?class=[% plugin.class | html %]&method=disable"><i class="fa fa-pause fa-fw"></i> Disable</a></li>
171                                                         [% ELSE %]
172                                                                 <li><a class="enable_plugin" data-plugin-name="[% plugin.metadata.name | html %]" href="/cgi-bin/koha/plugins/plugins-enable.pl?class=[% plugin.class | html %]&method=enable"><i class="fa fa-play fa-fw"></i> Enable</a></li>
173                                                         [% END %]
174                                                     [% END %]
175                                                 </ul>
176                                             </div>
177                                         </td>
178                                     [% END %]
179                             [% END %]
180                         </table>
181                     [% END %]
182                 </div>
183
184             </main>
185         </div> <!-- /.col-sm-10.col-sm-push-2 -->
186
187         <div class="col-sm-2 col-sm-pull-10">
188             <aside>
189                 [% INCLUDE 'tools-menu.inc' %]
190             </aside>
191         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
192      </div> <!-- /.row -->
193
194 [% MACRO jsinclude BLOCK %]
195     [% Asset.js("js/tools-menu.js") | $raw %]
196     [% INCLUDE 'calendar.inc' %]
197     <script>
198         $(document).ready(function(){
199             $(".btn-install-plugin").on("click", function() { alert("Sorry, this functionality doesn't exist yet!"); });
200             $(".uninstall_plugin").on("click", function(){
201                 $(".dropdown").removeClass("open");
202                 var plugin_name = $(this).data("plugin-name");
203                 return confirmDelete( _("Are you sure you want to uninstall the plugin %s?").format( plugin_name ) );
204             });
205         });
206     </script>
207 [% END %]
208
209 [% INCLUDE 'intranet-bottom.inc' %]