Bug 20568: API key management for OPAC users
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / modules / members / apikeys.tt
1 [% USE Koha %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Patrons &rsaquo; API Keys</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 </head>
6 <body id="pat_apikeys" class="pat">
7 [% INCLUDE 'header.inc' %]
8 [% INCLUDE 'patron-search.inc' %]
9
10 <div id="breadcrumbs">
11   <a href="/cgi-bin/koha/mainpage.pl">Home</a>
12   &rsaquo;
13   <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
14   &rsaquo;
15   API Keys for [% INCLUDE 'patron-title.inc' %]
16 </div>
17
18 <div id="doc3" class="yui-t2">
19   <div id="bd">
20     <div id="yui-main">
21       <div class="yui-b">
22         [% INCLUDE 'members-toolbar.inc' %]
23
24         <h1>API keys for [% INCLUDE 'patron-title.inc' %]</h1>
25         <div>
26           <form action="/cgi-bin/koha/members/apikeys.pl" method="post">
27             <input type="hidden" name="patron_id" value="[% patron.id %]">
28             <input type="hidden" name="op" value="generate">
29             <label for="description">Description: </label>
30             <input type="text" name="description">
31             <button class="btn btn-default btn-sm" type="submit"><i class="fa fa-plus"></i> Generate a new key</span></button>
32           </form>
33         </div>
34
35         <br/>
36
37         <div id="keys">
38         [% IF api_keys && api_keys.size > 0 %]
39           <table>
40             <thead>
41               <tr>
42                 <th>Description</th>
43                 <th>Key</th>
44                 <th>Active</th>
45                 <th>Actions</th>
46               </tr>
47             </thead>
48             <tbody>
49               [% FOREACH key IN api_keys %]
50                 <tr>
51                   <td>[% key.description %]</td>
52                   <td>[% key.value %]</td>
53                   <td>[% IF key.active %]Yes[% ELSE %]No[% END %]</td>
54                   <td>
55                     <form action="/cgi-bin/koha/members/apikeys.pl" method="post">
56                       <input type="hidden" name="patron_id" value="[% patron.id %]">
57                       <input type="hidden" name="key" value="[% key.value %]">
58                       <input type="hidden" name="op" value="delete">
59                       <button class="btn btn-default btn-sm" type="submit">Delete</button>
60                     </form>
61                     <form action="/cgi-bin/koha/members/apikeys.pl" method="post">
62                       <input type="hidden" name="patron_id" value="[% patron.id %]">
63                       <input type="hidden" name="key" value="[% key.value %]">
64                       [% IF key.active %]
65                         <input type="hidden" name="op" value="revoke">
66                         <button class="btn btn-default btn-sm" type="submit">Revoke</button>
67                       [% ELSE %]
68                         <input type="hidden" name="op" value="activate">
69                         <button class="btn btn-default btn-sm" type="submit">Activate</button>
70                       [% END %]
71                     </form>
72                   </td>
73                 </tr>
74               [% END %]
75             </tbody>
76           </table>
77         [% ELSE %]
78             <span class="warn">No keys defined for the current patron.</span>
79         [% END %]
80         </div>
81       </div>
82     </div>
83     <div class="yui-b">
84       [% INCLUDE 'circ-menu.inc' %]
85     </div>
86   </div>
87 [% INCLUDE 'intranet-bottom.inc' %]