Bug 20568: Move value => client_id + secret
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / apikeys.tt
1 [% USE Koha %]
2 [% SET footerjs = 1 %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Patrons &rsaquo; API Keys</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 </head>
7 <body id="pat_apikeys" class="pat">
8 [% INCLUDE 'header.inc' %]
9 [% INCLUDE 'patron-search.inc' %]
10
11 <div id="breadcrumbs">
12     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
13     &rsaquo;
14     <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
15     &rsaquo;
16     API Keys for [% INCLUDE 'patron-title.inc' %]
17 </div>
18
19 <div id="doc3" class="yui-t2">
20     <div id="bd">
21         <div id="yui-main">
22             <div class="yui-b">
23                 [% INCLUDE 'members-toolbar.inc' %]
24
25                 <h1>API keys for [% INCLUDE 'patron-title.inc' %]</h1>
26                 <form id="add-api-key" action="/cgi-bin/koha/members/apikeys.pl" method="post" style="display:none">
27                     <input type="hidden" name="patron_id" value="[% patron.id %]" />
28                     <input type="hidden" name="op" value="generate" />
29                     <fieldset class="brief">
30                         <legend>Generate new client id/secret pair</legend>
31                         <ol>
32                             <li>
33                                 <label for="description">Description: </label>
34                                 <input type="text" name="description" />
35                                 <input type="submit" value="Save" />
36                                 <a href="#" class="cancel toggle_element" data-element="#add-api-key">Cancel</a>
37                             </li>
38                         </ol>
39                     </fieldset>
40                 </form>
41
42                 <div id="keys">
43                     [% IF api_keys && api_keys.size > 0 %]
44                         <p>
45                             <button class="btn btn-default btn-xs toggle_element" type="submit" id="show-api-form" data-element="#add-api-key"><i class="fa fa-plus"></i> Generate a new client id/key pair</button>
46                         </p>
47                         <table>
48                             <thead>
49                                 <tr>
50                                     <th>Description</th>
51                                     <th>Client ID</th>
52                                     <th>Secret</th>
53                                     <th>Active</th>
54                                     <th>Actions</th>
55                                 </tr>
56                             </thead>
57                             <tbody>
58                                 [% FOREACH key IN api_keys %]
59                                     <tr>
60                                         <td>[% key.description %]</td>
61                                         <td>[% key.client_id %]</td>
62                                         <td>[% key.secret %]</td>
63                                         <td>[% IF key.active %]Yes[% ELSE %]No[% END %]</td>
64                                         <td>
65                                             <form action="/cgi-bin/koha/members/apikeys.pl" method="post">
66                                                 <input type="hidden" name="patron_id" value="[% patron.id %]" />
67                                                 <input type="hidden" name="key" value="[% key.id %]" />
68                                                 <input type="hidden" name="op" value="delete" />
69                                                 <button class="btn btn-default btn-xs delete" type="submit"><i class="fa fa-trash"></i> Delete</button>
70                                             </form>
71                                             <form action="/cgi-bin/koha/members/apikeys.pl" method="post">
72                                                 <input type="hidden" name="patron_id" value="[% patron.id %]" />
73                                                 <input type="hidden" name="key" value="[% key.id %]" />
74                                                 [% IF key.active %]
75                                                     <input type="hidden" name="op" value="revoke" />
76                                                     <button class="btn btn-default btn-xs" type="submit"><i class="fa fa-remove"></i> Revoke</button>
77                                                 [% ELSE %]
78                                                     <input type="hidden" name="op" value="activate" />
79                                                     <button class="btn btn-default btn-xs" type="submit"><i class="fa fa-play"></i> Activate</button>
80                                                 [% END %]
81                                             </form>
82                                         </td>
83                                     </tr>
84                                 [% END %]
85                             </tbody>
86                         </table>
87                     [% ELSE %]
88                         <div class="dialog message">No keys defined for the current patron. <a href="#" class="toggle_element" data-element="#add-api-key" id="show-api-form"><i class="fa fa-plus"></i> Generate a new client id/secret pair</div>
89                     [% END %]
90                 </div>
91             </div>
92         </div>
93         <div class="yui-b">
94             [% INCLUDE 'circ-menu.inc' %]
95         </div>
96     </div>
97
98 [% MACRO jsinclude BLOCK %]
99         <script>
100             $(document).ready(function(){
101                 $(".delete").on("click", function(e){
102                     return confirmDelete(_("Are you sure you want to delete this key?"));
103                 });
104             });
105         </script>
106 [% END %]
107
108 [% INCLUDE 'intranet-bottom.inc' %]