1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your API keys</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 [% BLOCK cssinclude %][% END %]
6 [% INCLUDE 'bodytag.inc' bodyid='opac-user' bodyclass='scrollto' %]
7 [% INCLUDE 'masthead.inc' %]
10 <ul class="breadcrumb">
11 <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li>
13 <a href="/cgi-bin/koha/opac-user.pl">
14 [% INCLUDE 'patron-title.inc' category_type=patron.category.category_type firstname=patron.firstname surname=patron.surname othernames=patron.othernames %]
16 <span class="divider">›</span>
18 <li><a href="/cgi-bin/koha/opac-apikeys.pl">Your API keys</a></li>
21 <div class="container-fluid">
22 <div class="row-fluid">
25 [% INCLUDE 'navigation.inc' IsPatronPage = 1 %]
29 <div id="apikeys" class="maincontent">
30 <h1>Your API keys</h1>
32 <button id="show-api-form" style="display:none" class="btn btn-default btn-sm" type="button"><i class="fa fa-plus"></i> Generate new key</button>
34 <form id="add-api-key" action="/cgi-bin/koha/opac-apikeys.pl" method="post">
36 <legend>Generate new client id/secret pair</legend>
37 <input type="hidden" name="patron_id" value="[% patron.id %]" />
38 <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
39 <input type="hidden" name="op" value="generate" />
40 <label for="description">Description: </label>
41 <input type="text" name="description" />
43 <fieldset class="action">
44 <button class="btn btn-default btn-sm" type="submit">Save</button> <a href="#" style="display:none" class="cancel cancel-api-key">Cancel</a>
47 [% IF api_keys && api_keys.size > 0 %]
48 <table class="table table-bordered table-striped">
59 [% FOREACH key IN api_keys %]
61 <td>[% key.description %]</td>
62 <td>[% key.client_id %]</td>
63 <td>[% key.secret %]</td>
64 <td>[% IF key.active %]Yes[% ELSE %]No[% END %]</td>
66 <form action="/cgi-bin/koha/opac-apikeys.pl" method="post" class="form-inline">
67 <input type="hidden" name="key" value="[% key.id %]" />
68 <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
69 <input type="hidden" name="op" value="delete" />
70 <button class="btn btn-link btn-xs delete-key" type="submit"><i class="fa fa-trash"></i> Delete</button>
72 <form action="/cgi-bin/koha/opac-apikeys.pl" method="post" class="form-inline">
73 <input type="hidden" name="key" value="[% key.id %]" />
74 <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
76 <input type="hidden" name="op" value="revoke" />
77 <button class="btn btn-link btn-xs" type="submit"><i class="fa fa-remove"></i> Revoke</button>
79 <input type="hidden" name="op" value="activate" />
80 <button class="btn btn-link btn-xs" type="submit"><i class="fa fa-play"></i> Activate</button>
89 <p>No keys defined for the current patron.</p>
91 </div> <!-- /#apikeys -->
92 </div> <!-- /.span10 -->
93 </div> <!-- /.row-fluid -->
94 </div> <!-- /.container-fluid -->
95 </div> <!-- /#main -->
99 $(document).ready(function(){
100 $("#add-api-key, #show-api-form, .cancel-api-key").toggle();
101 $("#show-api-form, .cancel-api-key").on("click", function(){
102 $("#add-api-key, #show-api-form").toggle();
104 $(".delete-key").on("click", function(){
105 return confirm(_("Are you sure you want to delete this key?"));
110 [% INCLUDE 'opac-bottom.inc' %]