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