Lines 119-186
Link Here
|
119 |
[% END # / TAGLOOP%] |
119 |
[% END # / TAGLOOP%] |
120 |
[% IF ( add_op ) %] |
120 |
[% IF ( add_op ) %] |
121 |
[% IF ( added_count ) %] |
121 |
[% IF ( added_count ) %] |
122 |
<div class="dialog message">[% added_count | html %] [% IF ( added_count == 1 ) %]tag[% ELSE %]tags[% END %] successfully added.</div> |
122 |
<div class="alert alert-info">[% added_count | html %] [% IF ( added_count == 1 ) %]tag[% ELSE %]tags[% END %] successfully added.</div> |
123 |
[% END %] |
123 |
[% END %] |
124 |
[% IF ( deleted_count ) %] |
124 |
[% IF ( deleted_count ) %] |
125 |
<div class="dialog message">[% deleted_count | html %] [% IF ( deleted_count == 1 ) %]tag[% ELSE %]tags[% END %] successfully deleted.</div> |
125 |
<div class="alert alert-info">[% deleted_count | html %] [% IF ( deleted_count == 1 ) %]tag[% ELSE %]tags[% END %] successfully deleted.</div> |
126 |
[% END %] |
126 |
[% END %] |
127 |
[% END # /add_op %] |
127 |
[% END # /add_op %] |
128 |
|
128 |
|
129 |
[% IF ( MY_TAGS ) %] |
129 |
[% IF ( MY_TAGS ) %] |
130 |
<form id="deletetags" method="post" action="opac-tags.pl"> |
130 |
<form method="post" action="opac-tags.pl"> |
131 |
[% INCLUDE 'csrf-token.inc' %] |
131 |
<table id="mytagst" class="table table-bordered table-striped"> |
132 |
<table id="mytagst" class="table table-bordered table-striped"> |
132 |
<caption>Your tags</caption> |
133 |
<caption>Your tags</caption> |
133 |
<thead> |
134 |
<thead> |
|
|
135 |
<tr> |
136 |
<th> </th> |
137 |
<th>Term</th> |
138 |
<th class="all anti-the">Title</th> |
139 |
<th>Date added</th> |
140 |
<th></th> |
141 |
</tr> |
142 |
</thead> |
143 |
<tbody> |
144 |
[% FOREACH MY_TAG IN MY_TAGS %] |
145 |
[% IF MY_TAG.visible %] |
146 |
<tr> |
134 |
<tr> |
147 |
<td class="selectcol"> |
135 |
<th> </th> |
148 |
<input type="checkbox" name="del[% MY_TAG.tag_id | html %]" value="del[% MY_TAG.tag_id | html %]"> |
136 |
<th>Term</th> |
149 |
</td> |
137 |
<th class="all anti-the">Title</th> |
150 |
<td class="tagterm"> |
138 |
<th>Date added</th> |
151 |
<span class="tdlabel">Tag:</span> |
139 |
<th class="NoSort"></th> |
152 |
[% IF MY_TAG.approved == 1 %] |
140 |
<th></th> |
153 |
<a href="/cgi-bin/koha/opac-search.pl?tag=[% MY_TAG.term |uri %]&q=[% MY_TAG.term |uri %]">[% MY_TAG.term | html %]</a> |
|
|
154 |
[% ELSE %] |
155 |
[% MY_TAG.term | html %] (not approved) |
156 |
[% END %] |
157 |
</td> |
158 |
<td> |
159 |
[% IF ( MY_TAG.XSLTBloc ) %] |
160 |
[% MY_TAG.XSLTBloc | $raw %] |
161 |
[% ELSE %] |
162 |
<span class="tdlabel">Title:</span> |
163 |
[% INCLUDE 'biblio-title.inc' biblio=MY_TAG link=> 1 %] |
164 |
[% IF ( MY_TAG.author ) %] |
165 |
by [% MY_TAG.author | html %] |
166 |
[% END %] |
167 |
[% END # /IF MY_TAG.XSLTBloc %] |
168 |
|
169 |
[% INCLUDE 'title-actions-menu.inc' items=MY_TAG %] |
170 |
</td> |
171 |
<td data-order="[% MY_TAG.date_created | html %]"> |
172 |
<span class="tdlabel">Date added:</span> |
173 |
[% MY_TAG.date_created | $KohaDates %] |
174 |
</td> |
175 |
<td></td> |
176 |
</tr> |
141 |
</tr> |
|
|
142 |
</thead> |
143 |
<tbody> |
144 |
[% FOREACH MY_TAG IN MY_TAGS %] |
145 |
[% IF MY_TAG.visible %] |
146 |
<tr id="row[% MY_TAG.tag_id | html %]"> |
147 |
<td class="selectcol"> |
148 |
<input type="checkbox" class="cb" name="biblionumber" value="[% MY_TAG.biblionumber | html %]" data-title="[% MY_TAG.title | html %]" data-tagname="[% MY_TAG.term | html %]" data-tagid="[% MY_TAG.tag_id | html %]" aria-label="[% check_title | html %]"/> |
149 |
</td> |
150 |
<td class="tagterm"> |
151 |
<span class="tdlabel">Tag:</span> |
152 |
[% IF MY_TAG.approved == 1 %] |
153 |
<a href="/cgi-bin/koha/opac-search.pl?tag=[% MY_TAG.term |uri %]&q=[% MY_TAG.term |uri %]">[% MY_TAG.term | html %]</a> |
154 |
[% ELSE %] |
155 |
[% MY_TAG.term | html %] (not approved) |
156 |
[% END %] |
157 |
</td> |
158 |
<td> |
159 |
[% IF ( MY_TAG.XSLTBloc ) %] |
160 |
[% MY_TAG.XSLTBloc | $raw %] |
161 |
[% ELSE %] |
162 |
<span class="tdlabel">Title:</span> |
163 |
[% INCLUDE 'biblio-title.inc' biblio=MY_TAG link=> 1 %] |
164 |
[% IF ( MY_TAG.author ) %] |
165 |
by [% MY_TAG.author | html %] |
166 |
[% END %] |
167 |
[% END # /IF MY_TAG.XSLTBloc %] |
168 |
|
169 |
[% INCLUDE 'title-actions-menu.inc' items=MY_TAG %] |
170 |
</td> |
171 |
<td data-order="[% MY_TAG.date_created | html %]"> |
172 |
<span class="tdlabel">Date added:</span> |
173 |
[% MY_TAG.date_created | $KohaDates %] |
174 |
</td> |
175 |
<td> |
176 |
<button class="btn btn-link btn-sm remove" data-tagname="[% MY_TAG.term | html %]" data-tagid="[% MY_TAG.tag_id | html %]" data-biblionumber="[% MY_TAG.biblionumber | html %]" type="button"><i class="fa fa-times" aria-hidden="true"></i> Remove tag</button> |
177 |
</td> |
178 |
<td></td> |
179 |
</tr> |
180 |
[% END %] |
177 |
[% END %] |
181 |
[% END %] |
178 |
[% END %] |
182 |
</tbody> |
179 |
</tbody> |
183 |
</table> |
180 |
</table> |
184 |
<input type="submit" value="Remove selected tags" class="btn btn-danger remove"> |
181 |
<input type="hidden" name="op" value="cud-del" /> |
185 |
</form> |
182 |
<input type="submit" value="Delete selected tags" class="btn btn-danger btn-sm delete"> |
186 |
<form id="deletetags" name="deletetags" method="post" action="/cgi-bin/koha/opac-tags.pl"> |
183 |
</form> |
187 |
[% INCLUDE 'csrf-token.inc' %] |
|
|
188 |
<input type="hidden" name="op" value="cud-del" /> |
189 |
</form> |
184 |
[% END # /MY_TAGS %] |
190 |
[% END # /MY_TAGS %] |
185 |
</div> <!-- / .usertags --> |
191 |
</div> <!-- / .usertags --> |
186 |
</div> <!-- / .span10/12 --> |
192 |
</div> <!-- / .span10/12 --> |
Lines 193-214
Link Here
|
193 |
[% INCLUDE 'datatables.inc' %] |
199 |
[% INCLUDE 'datatables.inc' %] |
194 |
<script> |
200 |
<script> |
195 |
|
201 |
|
196 |
function checkboxesChecked() { |
|
|
197 |
if ($("#deletetags input:checkbox:checked").length > 0) { |
198 |
return 1; |
199 |
} else { |
200 |
return 0; |
201 |
} |
202 |
} |
203 |
|
204 |
$(document).ready(function(){ |
202 |
$(document).ready(function(){ |
205 |
var MSG_DELETE_TAG = _("Are you sure you want to delete the selected tag(s)?"); |
203 |
$("body").on("click", ".remove", function(e){ |
206 |
$(".delete").on("click", function(e){ |
204 |
e.preventDefault(); |
207 |
if ( checkboxesChecked() == 1 ) { |
205 |
var href; |
208 |
return confirmDelete(MSG_DELETE_TAG); |
206 |
var title; |
|
|
207 |
var yes_label; |
208 |
var no_label; |
209 |
var message = ""; |
210 |
var tag_delete_form = $("#deletetags"); |
211 |
/* Single "Remove from list" link has a biblionumber data-attribute */ |
212 |
if( $(this).data("biblionumber") ){ |
213 |
/* Use the checkbox with that value to preview the title in the confirmation */ |
214 |
var selected_titles = $("#row" + $(this).data("tagid") + " .cb[value='" + $(this).data("biblionumber") + "'"); |
215 |
var href = $(this).attr("href"); |
209 |
} else { |
216 |
} else { |
210 |
alert(_("Please select a tag to delete.")); |
217 |
var selected_titles = $(".cb:checked"); |
211 |
e.preventDefault(); |
218 |
} |
|
|
219 |
if ( selected_titles.size() < 1 ) { |
220 |
alert( _("No item was selected") ); |
221 |
} else { |
222 |
if( selected_titles.size() > 1 ){ |
223 |
message = $("<ul></ul>"); |
224 |
title = _("Are you sure you want to remove the selected tags from these titles?"); |
225 |
yes_label = _("Yes, delete tags"); |
226 |
no_label = _("No, do not delete tags"); |
227 |
selected_titles.each(function(){ |
228 |
message.append( "<li><em>" + $(this).data("title") + "</em> ... <b>Tag:</b> " + $(this).data("tagname") + "</li>" ); |
229 |
tag_delete_form.append( '<input type="hidden" name="del' + $(this).data("tagid") + '" value="del' + $(this).data("tagid") + '" />' ); |
230 |
}); |
231 |
} else { |
232 |
title = _("Are you sure you want to remove the selected tag from this title?"); |
233 |
yes_label = _("Yes, delete tag"); |
234 |
no_label = _("No, do not delete tag"); |
235 |
selected_titles.each(function(){ |
236 |
message += "<em>" + $(this).data("title") + "</em> ... <b>Tag:</b> " + $(this).data("tagname"); |
237 |
tag_delete_form.append( '<input type="hidden" name="del' + $(this).data("tagid") + '" value="del' + $(this).data("tagid") + '" />' ); |
238 |
}); |
239 |
} |
240 |
confirmModal( message, title, yes_label, no_label, function( result ){ |
241 |
if( result ){ |
242 |
$("#deletetags").submit(); |
243 |
} |
244 |
}); |
212 |
} |
245 |
} |
213 |
}); |
246 |
}); |
214 |
|
247 |
|
215 |
- |
|
|