Lines 40-45
Link Here
|
40 |
|
40 |
|
41 |
[% INCLUDE 'members-toolbar.inc' %] |
41 |
[% INCLUDE 'members-toolbar.inc' %] |
42 |
|
42 |
|
|
|
43 |
|
43 |
<form id="flag_form" method="post" action="/cgi-bin/koha/members/member-flags.pl"> |
44 |
<form id="flag_form" method="post" action="/cgi-bin/koha/members/member-flags.pl"> |
44 |
[% INCLUDE 'csrf-token.inc' %] |
45 |
[% INCLUDE 'csrf-token.inc' %] |
45 |
<input type="hidden" name="member" id="borrowernumber" value="[% patron.borrowernumber | html %]" /> |
46 |
<input type="hidden" name="member" id="borrowernumber" value="[% patron.borrowernumber | html %]" /> |
Lines 58-69
Link Here
|
58 |
<a id="UncheckAllFlags" class="btn btn-link" href="#"> |
59 |
<a id="UncheckAllFlags" class="btn btn-link" href="#"> |
59 |
<i class="fa fa-times"></i> Clear all |
60 |
<i class="fa fa-times"></i> Clear all |
60 |
</a> |
61 |
</a> |
|
|
62 |
|
63 |
<div class="btn-group"> |
64 |
<button id="copyPermissions" class="btn btn-link"><i class="fa fa-copy"></i> Copy settings</button> |
65 |
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button> |
66 |
<ul class="dropdown-menu"> |
67 |
<li><a id="clearCopied" href="#">Forget copied settings</a></li> |
68 |
</ul> |
69 |
</div> |
70 |
|
71 |
<a href="#" id="pastePermissions" class="btn btn-link disabled"><i class="fa fa-paste"></i> Paste settings</a> |
61 |
<div class="btn-group pull-right"> |
72 |
<div class="btn-group pull-right"> |
62 |
Filter: <input type="text" name="permissions_filter" id="permissions_filter" size="20" /> |
73 |
Filter: <input type="text" name="permissions_filter" id="permissions_filter" size="20" /> |
63 |
<a href="#" id="clear_filter" style="display:none"><i class="fa fa-times"></i></a> |
74 |
<a href="#" id="clear_filter" style="display:none"><i class="fa fa-times"></i></a> |
64 |
</div> |
75 |
</div> |
65 |
</div> |
76 |
</div> |
66 |
<div class="permissions"> |
77 |
<div class="permissions page-section"> |
67 |
[% FOREACH loo IN loop %] |
78 |
[% FOREACH loo IN loop %] |
68 |
[% IF ( loo.expand ) %] |
79 |
[% IF ( loo.expand ) %] |
69 |
<div id="parent-flag-[% loo.flag | html %]" class="open parent"> |
80 |
<div id="parent-flag-[% loo.flag | html %]" class="open parent"> |
Lines 272-279
Link Here
|
272 |
} |
283 |
} |
273 |
} |
284 |
} |
274 |
}); |
285 |
}); |
|
|
286 |
|
287 |
if( copied = getCopiedPermissions() ){ |
288 |
$("#pastePermissions").removeClass("disabled"); |
289 |
} |
290 |
|
291 |
/* write to the clipboard now */ |
292 |
$("#copyPermissions").on("click", function(e){ |
293 |
e.preventDefault(); |
294 |
let flags = new Object(); |
295 |
$("#flag_form input:checkbox").each(function(){ |
296 |
flags[ $(this).attr('id') ] = $(this).prop("checked"); |
297 |
}); |
298 |
formText = JSON.stringify( flags ); |
299 |
localStorage.setItem("copiedPermissions", formText ); |
300 |
toggleBtnIcon( $(this), "fa-copy", "fa-check" ); |
301 |
$("#pastePermissions").removeClass("disabled"); |
302 |
}); |
303 |
|
304 |
$("#pastePermissions").on("click", function(e){ |
305 |
e.preventDefault(); |
306 |
$(".toggleall_on").click(); |
307 |
let copiedPermissions = getCopiedPermissions(); |
308 |
|
309 |
let checkBox; |
310 |
let checked; |
311 |
for( const permission in copiedPermissions ){ |
312 |
checkBox = `${permission}`; |
313 |
checked = `${copiedPermissions[permission]}` == "true" ? true : false; |
314 |
$("#" + checkBox).prop("checked", checked ); |
315 |
} |
316 |
}); |
317 |
|
318 |
$("#clearCopied").on("click", function(e){ |
319 |
e.preventDefault(); |
320 |
localStorage.removeItem("copiedPermissions"); |
321 |
$("#pastePermissions").addClass("disabled"); |
322 |
}); |
275 |
}); |
323 |
}); |
276 |
|
324 |
|
|
|
325 |
function getCopiedPermissions(){ |
326 |
const copied = localStorage.getItem("copiedPermissions"); |
327 |
let copiedPermissions; |
328 |
try { |
329 |
copiedPermissions = JSON.parse( copied ); |
330 |
return copiedPermissions; |
331 |
} catch ( ex ){ |
332 |
console.error("Bad parse: ", ex.message ); |
333 |
return false; |
334 |
} |
335 |
} |
336 |
|
277 |
function setLibrarian(){ |
337 |
function setLibrarian(){ |
278 |
$('input[name="flag"]').each(function() { |
338 |
$('input[name="flag"]').each(function() { |
279 |
if($(this).attr('id') != "flag-0" && !$(this).hasClass('superlib') ){ |
339 |
if($(this).attr('id') != "flag-0" && !$(this).hasClass('superlib') ){ |