3 [% PROCESS 'i18n.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Quote editor › Tools › Koha</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% Asset.css("css/quotes.css") | $raw %]
11 <body id="tools_quotes" class="tools">
12 [% WRAPPER 'header.inc' %]
13 [% INCLUDE 'cat-search.inc' %]
16 [% WRAPPER 'sub-header.inc' %]
17 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
20 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
23 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
26 <a href="#" aria-current="page">
34 <div class="main container-fluid">
36 <div class="col-sm-10 col-sm-push-2">
39 [% FOREACH m IN messages %]
40 <div class="dialog [% m.type | html %]" id="quote_action_result_dialog">
42 [% CASE 'error_on_update' %]
43 <span>An error occurred when updating this quote. Perhaps it already exists</span>
44 [% CASE 'error_on_insert' %]
45 <span>An error occurred when adding this quote</span>
46 [% CASE 'success_on_update' %]
47 <span>Quote updated successfully</span>
48 [% CASE 'success_on_insert' %]
49 <span>Quote added successfully</span>
51 <span>[% m.code | html %]</span>
56 <div class="dialog message" id="quote_delete_success" style="display: none;"></div>
57 <div class="dialog alert" id="quote_delete_error" style="display: none;"></div>
60 <div id="toolbar" class="btn-toolbar">
61 <a class="btn btn-default" id="newquote" href="/cgi-bin/koha/tools/quotes.pl?op=add_form"><i class="fa fa-plus"></i> New quote</a>
62 <a class="btn btn-default" id="import_quotes" href="/cgi-bin/koha/tools/quotes-upload.pl"><i class="fa fa-folder-open"></i> Import quotes</a>
66 [% IF op == 'add_form' %]
67 <h1>[% IF quote %]Modify quote[% ELSE %]New quote[% END %]</h1>
68 <form action="/cgi-bin/koha/tools/quotes.pl" id="Aform" name="Aform" class="validated" method="post">
69 <fieldset class="rows">
70 <input type="hidden" name="op" value="add_validate" />
73 <label for="text" class="required">Source: </label>
74 <input type="text" name="source" id="source" value="[% quote.source | html %]" class="required" required="required" />
75 <span class="required">Required</span>
78 <label for="text" class="required">Text: </label>
79 <textarea name="text" id="text" class="required" required="required" />[% quote.text | html %]</textarea>
80 <span class="required">Required</span>
84 <fieldset class="action">
85 <input type="hidden" name="id" value="[% quote.id | html %]" />
86 <input type="submit" class="btn btn-primary" value="Submit" />
87 <a class="cancel" href="/cgi-bin/koha/tools/quotes.pl">Cancel</a>
92 [% IF op == 'delete_confirm' %]
93 <div class="dialog alert">
94 <form action="/cgi-bin/koha/tools/quotes.pl" method="post">
95 <h1>Are you sure you want to delete the following quote?</h1>
96 [% quote.source | html %] - [% quote.text | html %]
97 <input type="hidden" name="op" value="delete_confirmed" />
98 <input type="hidden" name="id" value="[% quote.id | html %]" />
99 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
101 <form action="/cgi-bin/koha/tools/quotes.pl" method="get">
102 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
107 [% IF op == 'list' %]
108 <h1>[% tp('citations', 'Quotes') | html %]</h1>
109 [% IF quotes_count > 0 %]
110 <div class="page-section">
117 <th>Last display</th>
118 <th data-class-name="actions" class="noExport">Actions</th>
122 </div> <!-- /.page-section -->
124 <div class="dialog message">There are no quotes defined. <a href="/cgi-bin/koha/tools/quotes.pl?op=add_form">Start defining quotes</a>.</div>
127 <div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true">
128 <div class="modal-dialog">
129 <div class="modal-content">
130 <div class="modal-header">
131 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
132 <h3 id="delete_confirm_modal_label">Delete quote</h3>
134 <div class="modal-body">
135 <div id="delete_confirm_dialog"></div>
137 <div class="modal-footer">
138 <a href="#" class="btn btn-default" id="delete_confirm_modal_button" role="button" data-toggle="modal">Delete</a>
139 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
141 </div> <!-- /.modal-content -->
142 </div> <!-- /.modal-dialog -->
143 </div> <!-- #delete_confirm_modal -->
147 </div> <!-- /.col-sm-10.col-sm-push-2 -->
149 <div class="col-sm-2 col-sm-pull-10">
151 [% INCLUDE 'tools-menu.inc' %]
153 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
154 </div> <!-- /.row -->
156 [% MACRO jsinclude BLOCK %]
157 [% Asset.js("js/tools-menu.js") | $raw %]
158 [% INCLUDE 'datatables.inc' %]
161 $(document).ready(function() {
163 var quotes_url = '/api/v1/quotes';
164 var quotes = $("#quotes").kohaTable({
168 'emptyTable': '<div class="dialog message">'+_("There are no quotes defined.")+' <a href="/cgi-bin/koha/tools/quotes.pl?op=add_form">'+_("Start defining quotes")+'</a>.</div>',
170 "targets": [0,1,2,3],
171 "render": function (data, type, row, meta) {
172 if ( type == 'display' ) {
173 if ( data != null ) {
174 return data.escapeHtml();
200 "data": "displayed_on",
201 "render": function(data, type, row, meta) {
202 return $datetime(row.displayed_on);
208 "data": function( row, type, val, meta ) {
210 var result = '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/quotes.pl?op=add_form&id='+encodeURIComponent(row.quote_id)+'" role="button"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>';
211 result += '<form action="/cgi-bin/koha/tools/quotes.pl" method="post">';
212 result += '<input type="hidden" name="id" value="'+row.quote_id.escapeHtml()+'" />'+"\n";
214 result += '<a class="btn btn-default btn-xs delete_quote" role="button" href="#" data-toggle="modal" data-target="#delete_confirm_modal" data-quote-id="'+ encodeURIComponent(row.quote_id) +'"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Delete")+'</a>';
224 $('#quotes').on( "click", '.delete_quote', function () {
225 var quote_id = decodeURIComponent($(this).data('quote-id'));
227 $("#delete_confirm_dialog").html(
228 _("You are about to delete the quote #%s.").format(quote_id)
231 $("#delete_confirm_modal_button").unbind("click").on( "click", function () {
234 url: "/api/v1/quotes/"+quote_id
235 }).success(function() {
236 $("#delete_confirm_modal").modal('hide');
237 quotes.api().ajax.reload(function (data) {
238 $("#quote_action_result_dialog").hide();
239 $("#quote_delete_success").html(_("Quote #%s deleted successfully.").format(quote_id)).show();
241 }).error(function () {
242 $("#quote_delete_error").html(_("Error deleting quote #%s. Check the logs.").format(quote_id)).show();
251 [% INCLUDE 'intranet-bottom.inc' %]