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