Bug 30952: Staff interface redesign (header)
[koha.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>Plugins &rsaquo; Tools &rsaquo; Koha </title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 </head>
9
10 <body id="plugins_plugins_home" class="plugins">
11 [% WRAPPER 'header.inc' %]
12     [% INCLUDE 'prefs-admin-search.inc' %]
13 [% END %]
14
15 [% WRAPPER 'sub-header.inc' %]
16 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
17     <ol>
18         <li>
19             <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
20         </li>
21         <li>
22             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
23         </li>
24         <li>
25             <a href="#" aria-current="page">
26                 Plugins
27             </a>
28         </li>
29     </ol>
30 </nav>
31 [% END %]
32
33 <div class="main container-fluid">
34     <div class="row">
35         <div class="col-sm-10 col-sm-push-2">
36             <main>
37                     <h1>Plugins</h1>
38
39                 <div class="details">
40
41                     [% IF ( CAN_user_plugins_manage ) %]
42                         <div class="btn-toolbar" id="toolbar">
43                             <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>
44
45                             <div class="btn-group">
46                                 <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>
47                                 <ul class="dropdown-menu">
48                                     <li><a href="/cgi-bin/koha/plugins/plugins-home.pl">View all plugins</a></li>
49                                     <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=report">View report plugins</a></li>
50                                     <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=tool">View tool plugins</a></li>
51                                     <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=to_marc">View MARC conversion plugins</a></li>
52                                     <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=opac_online_payment">View online payment plugins</a></li>
53                                     <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=intranet_catalog_biblio_enhancements">View staff catalog biblio enhancement plugins</a></li>
54                                     <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=ill_availability_services">View ILL availability plugins</a></li>
55                                 </ul>
56                             </div>
57
58                             [% IF can_search %]
59                             <div class="btn-group">
60                                 <form class="form-inline" id="plugin-search-form">
61                                     <div class="form-group">
62                                         <div class="input-group">
63                                             <input type="text" class="form-control" name="plugin-search" id="plugin-repo-search" placeholder="Search for plugins" value="[% search_term | html %]"/>
64                                             <div class="input-group-btn">
65                                                 <button class="btn btn-default" type="button" id="plugin-search-button"><i class="fa fa-search"></i></button>
66                                             </div>
67                                         </div>
68                                     </div>
69                                 </form>
70                             </div>
71                             [% END %]
72                         </div>
73                     [% END %]
74
75                     [% IF search_results %]
76                         <h2>Search results</h2>
77                         <table class="table table-striped">
78                             <thead>
79                                 <tr>
80                                     <th>Name</th>
81                                     <th>Description</th>
82                                     <th>Organization</th>
83                                     <th>Latest version</th>
84                                     <th>&nbsp;</th>
85                                 </tr>
86                             </thead>
87
88                             [% FOREACH sr IN search_results %]
89                                 <tr>
90                                     <td><a href="[% sr.result.html_url | url %]" target="_new">[% sr.result.name | html %]</a></td>
91                                     <td>[% sr.result.description | html %]</td>
92                                     <td>[% sr.repo.name | html %]</td>
93                                     <td>[% sr.result.tag_name | html %]</td>
94                                     <td><a class="btn btn-default btn-sm btn-install-plugin" href="/cgi-bin/koha/plugins/plugins-upload.pl?op=Upload&uploadfile=[% sr.result.install_name | uri %]&uploadlocation=[% sr.result.install_url | uri %]"><i class="fa fa-download"></i> Install</a></td>
95                                 </tr>
96                             [% END %]
97                         </table>
98                     [% END %]
99
100                     [% UNLESS ( plugins ) %]
101                         [% UNLESS ( method ) %]
102                             <div class="dialog message">No plugins installed</div>
103                         [% ELSE %]
104                             [% IF method == 'tool' %]
105                                 <div class="dialog message">No plugins that can be used as a tool are installed</div>
106                             [% ELSIF method == 'report' %]
107                                 <div class="dialog message">No plugins that can create a report are installed</div>
108                             [% ELSIF method == 'to_marc' %]
109                                 <div class="dialog message">No plugins that can convert files to MARC records are installed</div>
110                             [% ELSIF method == 'opac_online_payment' %]
111                                 <div class="dialog message">No plugins that can process online payments via the public catalog are installed</div>
112                             [% ELSIF method == 'intranet_catalog_biblio_enhancements' %]
113                                 <div class="dialog message">No plugins that can enhance the intranet catalog biblio records are installed</div>
114                             [% ELSE %]
115                                 <div class="dialog message">Unknown plugin type <em>[% method | html %]</em></div>
116                             [% END %]
117                         [% END %]
118                     [% ELSE %]
119                         <table id="installed_plugins">
120                             <thead>
121                                 <tr>
122                                     <th>Name</th>
123                                     <th>Description</th>
124                                     <th>Author</th>
125                                     <th>Plugin version</th>
126                                     <th>Minimum Koha version</th>
127                                     <th>Maximum Koha version</th>
128                                     <th>Last updated</th>
129                                     [% IF ( CAN_user_plugins_configure || CAN_user_plugins_manage || CAN_user_plugins_report || CAN_user_plugins_tool ) %]
130                                         <th class="noExport">Actions</th>
131                                     [% END %]
132                                 </tr>
133                             </thead>
134
135                             [% FOREACH plugin IN plugins %]
136                                 [% IF plugin.error %]
137                                 <tr class="warn">
138                                     <td>
139                                         <strong>[% plugin.name | html %]</strong>
140                                         <span class="label label-warning">ERRORS</span>
141                                     </td>
142                                     [% IF ( CAN_user_plugins_configure || CAN_user_plugins_manage || CAN_user_plugins_report || CAN_user_plugins_tool ) %]
143                                     <td colspan="7">Error found whilst attempting to load plugin</td>
144                                     [% ELSE %]
145                                     <td colspan="6">Error found whilst attempting to load plugin</td>
146                                     [% END %]
147                                 </tr>
148                                 [% ELSE %]
149                                 <tr>
150                                     <td>
151                                         <strong>[% plugin.metadata.name | html %]</strong>
152                                         [% IF ( plugin.is_enabled ) %]
153                                             <span class="label label-primary">ENABLED</span>
154                                         [% ELSE %]
155                                             <span class="label label-default">DISABLED</span>
156                                         [% END %]
157                                     </td>
158                                     <td>
159                                         [% plugin.metadata.description | html %]
160
161                                         [% IF ( plugin.metadata.minimum_version && koha_version < plugin.metadata.minimum_version ) %]
162                                             <div class="dialog alert">
163                                                 Warning: This plugin was written for a newer version of Koha. Use at your own risk.
164                                             </div>
165                                         [% END %]
166
167                                         [% IF ( plugin.metadata.maximum_version && koha_version > plugin.metadata.maximum_version ) %]
168                                             <div class="dialog alert">
169                                                 Warning: This plugin was written for an older version of Koha. Use at your own risk.
170                                             </div>
171                                         [% END %]
172                                     </td>
173                                     <td>[% plugin.metadata.author | html %]</td>
174                                     <td>[% plugin.metadata.version | html %]</td>
175                                     <td>[% plugin.metadata.minimum_version | html %]</td>
176                                     <td>[% plugin.metadata.maximum_version | html %]</td>
177                                     <td>[% plugin.metadata.date_updated | $KohaDates %]</td>
178                                     [% IF ( CAN_user_plugins_configure || CAN_user_plugins_manage || CAN_user_plugins_report || CAN_user_plugins_tool ) %]
179                                         <td class="actions">
180                                             <div class="btn-group dropup">
181                                                 <a class="btn btn-default btn-xs dropdown-toggle" id="pluginactions[% plugin.class | html %]" role="button" data-toggle="dropdown" href="#">
182                                                    Actions <b class="caret"></b>
183                                                 </a>
184                                                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="pluginactions[% plugin.class | html %]">
185                                                     [% IF ( CAN_user_plugins_report ) %]
186                                                         [% IF plugin.can('report') %]
187                                                             <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>
188                                                         [% END %]
189                                                     [% END %]
190
191                                                     [% IF ( CAN_user_plugins_tool ) %]
192                                                         [% IF plugin.can('tool') %]
193                                                             <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>
194                                                         [% END %]
195                                                     [% END %]
196
197                                                     [% IF ( CAN_user_plugins_configure ) %]
198                                                         [% IF plugin.can('configure') %]
199                                                             <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>
200                                                         [% END %]
201                                                     [% END %]
202                                                     [% IF ( CAN_user_plugins_manage ) %]
203                                                             <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>
204                                                         [% IF ( plugin.is_enabled ) %]
205                                                                 <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>
206                                                         [% ELSE %]
207                                                                 <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>
208                                                         [% END %]
209                                                     [% END %]
210                                                 </ul>
211                                             </div>
212                                         </td>
213                                     [% END %]
214                                 </tr>
215                                 [% END %]
216                             [% END %]
217                         </table>
218                     [% END %]
219                 </div>
220
221             </main>
222         </div> <!-- /.col-sm-10.col-sm-push-2 -->
223
224         <div class="col-sm-2 col-sm-pull-10">
225             <aside>
226                 [% INCLUDE 'tools-menu.inc' %]
227             </aside>
228         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
229      </div> <!-- /.row -->
230
231 [% MACRO jsinclude BLOCK %]
232     [% Asset.js("js/tools-menu.js") | $raw %]
233     [% INCLUDE 'calendar.inc' %]
234     [% INCLUDE 'datatables.inc' %]
235     [% INCLUDE 'columns_settings.inc' %]
236     <script>
237         $(document).ready(function(){
238             $(".uninstall_plugin").on("click", function(){
239                 $(".dropdown").removeClass("open");
240                 var plugin_name = $(this).data("plugin-name");
241                 return confirmDelete( _("Are you sure you want to uninstall the plugin %s?").format( plugin_name ) );
242             });
243
244             $("#plugin-search-button").on("click", function(){
245                 $("#plugin-search-form").submit();
246             });
247
248             KohaTable("installed_plugins", {
249                 "bPaginate": false
250             });
251         });
252     </script>
253 [% END %]
254
255 [% INCLUDE 'intranet-bottom.inc' %]