Bug 23975: (QA follow-up) Search button style and functionality
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / plugins / plugins-home.tt
blob243d4da885737be89951ac5a9af46d747154d4db
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>
10 <body id="plugins_plugins_home" class="plugins">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'prefs-admin-search.inc' %]
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>
20 <div class="main container-fluid">
21     <div class="row">
22         <div class="col-sm-10 col-sm-push-2">
23             <main>
25                 <div class="details">
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>
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>
43                             <div class="btn-group">
44                                 <form class="form-inline" id="plugin-search-form">
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-btn">
49                                                 <button class="btn btn-default" type="button" id="plugin-search-button"><i class="fa fa-search"></i></button>
50                                             </div>
51                                         </div>
52                                     </div>
53                                 </form>
54                             </div>
55                         </div>
56                     [% END %]
57                     <h1>Plugins</h1>
59                     [% IF search_results %]
60                         <h2>Search results</h2>
61                         <table class="table table-striped">
62                             <thead>
63                                 <tr>
64                                     <th>Name</th>
65                                     <th>Description</th>
66                                     <th>Organization</th>
67                                     <th>&nbsp;</th>
68                                 </tr>
69                             </thead>
71                             [% FOREACH sr IN search_results %]
72                                 <tr>
73                                     <td><a href="[% sr.result.html_url | url %]" target="_new">[% sr.result.name %]</a></td>
74                                     <td>[% sr.result.description %]</td>
75                                     <td>[% sr.repo.name %]</td>
76                                     <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>
77                                 </tr>
78                             [% END %]
79                         </table>
80                     [% END %]
82                     [% UNLESS ( plugins ) %]
83                         [% UNLESS ( method ) %]
84                             <div class="dialog message">No plugins installed</div>
85                         [% ELSE %]
86                             [% IF method == 'tool' %]
87                                 <div class="dialog message">No plugins that can be used as a tool are installed</div>
88                             [% ELSIF method == 'report' %]
89                                 <div class="dialog message">No plugins that can create a report are installed</div>
90                             [% ELSIF method == 'to_marc' %]
91                                 <div class="dialog message">No plugins that can convert files to MARC records are installed</div>
92                             [% ELSIF method == 'opac_online_payment' %]
93                                 <div class="dialog message">No plugins that can process online payments via the public catalog are installed</div>
94                             [% ELSIF method == 'intranet_catalog_biblio_enhancements' %]
95                                 <div class="dialog message">No plugins that can enhance the intranet catalog biblio records are installed</div>
96                             [% ELSE %]
97                                 <div class="dialog message">Unknown plugin type <i>[% method | html %]</i></div>
98                             [% END %]
99                         [% END %]
100                     [% ELSE %]
101                         <table>
102                             <tr>
103                                 <th>Name</th>
104                                 <th>Description</th>
105                                 <th>Author</th>
106                                 <th>Plugin version</th>
107                                 <th>Minimum Koha version</th>
108                                 <th>Maximum Koha version</th>
109                                 <th>Last updated</th>
110                                 [% IF ( CAN_user_plugins_configure || CAN_user_plugins_manage || CAN_user_plugins_report || CAN_user_plugins_tool ) %]
111                                     <th>Actions</th>
112                                 [% END %]
113                             </tr>
115                             [% FOREACH plugin IN plugins %]
116                                 <tr>
117                                     <td>
118                                         <strong>[% plugin.metadata.name | html %]</strong>
119                                         [% IF ( plugin.is_enabled ) %]
120                                             <span class="label label-primary">ENABLED</span>
121                                         [% ELSE %]
122                                             <span class="label label-default">DISABLED</span>
123                                         [% END %]
124                                     </td>
125                                     <td>
126                                         [% plugin.metadata.description | html %]
128                                         [% IF ( plugin.metadata.minimum_version && koha_version < plugin.metadata.minimum_version ) %]
129                                             <div class="dialog alert">
130                                                 Warning: This report was written for a newer version of Koha. Run at your own risk.
131                                             </div>
132                                         [% END %]
134                                         [% IF ( plugin.metadata.maximum_version && koha_version > plugin.metadata.maximum_version ) %]
135                                             <div class="dialog alert">
136                                                 Warning: This plugin was written for an older version of Koha. Run at your own risk.
137                                             </div>
138                                         [% END %]
139                                     </td>
140                                     <td>[% plugin.metadata.author | html %]</td>
141                                     <td>[% plugin.metadata.version | html %]</td>
142                                     <td>[% plugin.metadata.minimum_version | html %]</td>
143                                     <td>[% plugin.metadata.maximum_version | html %]</td>
144                                     <td>[% plugin.metadata.date_updated | $KohaDates %]</td>
145                                     [% IF ( CAN_user_plugins_configure || CAN_user_plugins_manage || CAN_user_plugins_report || CAN_user_plugins_tool ) %]
146                                         <td class="actions">
147                                             <div class="dropdown">
148                                                 <a class="btn btn-default btn-xs dropdown-toggle" id="pluginactions[% plugin.class | html %]" role="button" data-toggle="dropdown" href="#">
149                                                    Actions <b class="caret"></b>
150                                                 </a>
151                                                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="pluginactions[% plugin.class | html %]">
152                                                     [% IF ( CAN_user_plugins_report ) %]
153                                                         [% IF plugin.can('report') %]
154                                                             <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>
155                                                         [% END %]
156                                                     [% END %]
158                                                     [% IF ( CAN_user_plugins_tool ) %]
159                                                         [% IF plugin.can('tool') %]
160                                                             <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>
161                                                         [% END %]
162                                                     [% END %]
164                                                     [% IF ( CAN_user_plugins_configure ) %]
165                                                         [% IF plugin.can('configure') %]
166                                                             <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>
167                                                         [% END %]
168                                                     [% END %]
169                                                     [% IF ( CAN_user_plugins_manage ) %]
170                                                             <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>
171                                                         [% IF ( plugin.is_enabled ) %]
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=disable"><i class="fa fa-pause fa-fw"></i> Disable</a></li>
173                                                         [% ELSE %]
174                                                                 <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>
175                                                         [% END %]
176                                                     [% END %]
177                                                 </ul>
178                                             </div>
179                                         </td>
180                                     [% END %]
181                             [% END %]
182                         </table>
183                     [% END %]
184                 </div>
186             </main>
187         </div> <!-- /.col-sm-10.col-sm-push-2 -->
189         <div class="col-sm-2 col-sm-pull-10">
190             <aside>
191                 [% INCLUDE 'tools-menu.inc' %]
192             </aside>
193         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
194      </div> <!-- /.row -->
196 [% MACRO jsinclude BLOCK %]
197     [% Asset.js("js/tools-menu.js") | $raw %]
198     [% INCLUDE 'calendar.inc' %]
199     <script>
200         $(document).ready(function(){
201             $(".uninstall_plugin").on("click", function(){
202                 $(".dropdown").removeClass("open");
203                 var plugin_name = $(this).data("plugin-name");
204                 return confirmDelete( _("Are you sure you want to uninstall the plugin %s?").format( plugin_name ) );
205             });
207             $("#plugin-search-button").on("click", function(){
208                 $("#plugin-search-form").submit();
209             });
210         });
211     </script>
212 [% END %]
214 [% INCLUDE 'intranet-bottom.inc' %]