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