dcd1f5d48c
Here we go, next step then. As we did not fix the performance issue when autofiltering the variables (see bug 20975), the only solution we have is to add the filters explicitely. This patch has been autogenerated (using add_html_filters.pl, see next pathces) and add the html filter to all the variables displayed in the template. Exceptions are made (using the new 'raw' TT filter) to the variable we already listed in the previous versions of this patch. To test: - Use t/db_dependent/Koha/Patrons.t to populate your DB with autogenerated data which contain <script> tags - Remove them from borrower_debarments.comments (there are allowed here) update borrower_debarments set comment="html tags possible here"; - From the interface hit page and try to catch alert box. If you find one it means you find a possible XSS. To know where it comes from: * note the exact URL where you found it * note the alert box content * Dump your DB and search for the string in the dump to identify its location (for instance table.field) Next: * Ideally we would like to use the raw filter when it is not necessary to HTML escape the variables (in big loop for instance) * Provide a QA script to catch missing filters (we want html, uri, url or raw, certainly others that I am forgetting now) * Replace the html filters with uri when needed (!) Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
196 lines
10 KiB
Text
196 lines
10 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% SET footerjs = 1 %]
|
|
[% BLOCK translate_label_element %]
|
|
[%- SWITCH element -%]
|
|
[%- CASE 'layout' -%]layout
|
|
[%- CASE 'Layouts' -%]Layouts
|
|
[%- CASE 'template' -%]template
|
|
[%- CASE 'Templates' -%]Templates
|
|
[%- CASE 'profile' -%]profile
|
|
[%- CASE 'Profiles' -%]Profiles
|
|
[%- CASE 'batch' -%]batch
|
|
[%- CASE 'Batches' -%]Batches
|
|
[%- END -%]
|
|
[% END %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Tools › Label creator › [% PROCESS translate_label_element element=label_element_title %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% Asset.css("css/datatables.css") | $raw %]
|
|
</head>
|
|
|
|
<body id="labels_label-manage" class="tools labels">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cat-search.inc' %]
|
|
<div id="breadcrumbs">
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
|
|
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
|
|
<a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a> ›
|
|
[% PROCESS translate_label_element element=label_element_title %]
|
|
</div>
|
|
|
|
<div class="main container-fluid">
|
|
<div class="row">
|
|
<div class="col-sm-10 col-sm-push-2">
|
|
<main>
|
|
|
|
[% INCLUDE 'labels-toolbar.inc' %]
|
|
|
|
[% IF ( error ) %]
|
|
<div class="dialog alert">
|
|
<strong>WARNING:</strong> An error was encountered and the [% op | html %] operation for [% label_element | html %] [% element_id | html %] was not completed. Please have your system administrator check the error log for details.
|
|
</div>
|
|
[% END %]
|
|
|
|
<div id="manage-label-layouts">
|
|
<div class="hint">Current library: [% LoginBranchname | html %]</div>
|
|
[% IF ( table_loop ) %]
|
|
<form name="layouts" action="/cgi-bin/koha/label-manage.pl?label_element=[% label_element | html %]">
|
|
[% IF ( label_element == 'layout' ) %]
|
|
<h2>Currently available layouts</h2>
|
|
[% ELSIF ( label_element == 'template' ) %]
|
|
<h2>Currently available templates</h2>
|
|
[% ELSIF ( label_element == 'profile' ) %]
|
|
<h2>Currently available profiles</h2>
|
|
[% ELSIF ( label_element == 'batch' ) %]
|
|
<h2>Currently available batches</h2>
|
|
[% END %]
|
|
<table id="labels-table">
|
|
[% FOREACH table_loo IN table_loop %]
|
|
[% IF ( table_loo.header_fields ) %]
|
|
<thead>
|
|
<tr>
|
|
[% FOREACH header_field IN table_loo.header_fields %]
|
|
[% SWITCH header_field.field_label %]
|
|
[% CASE 'Layout ID' %]<th>Layout ID</th>
|
|
[% CASE 'Layout' %]<th>Layout</th>
|
|
[% CASE 'Barcode Type' %]<th>Barcode type</th>
|
|
[% CASE 'Print Type' %]<th>Print type</th>
|
|
[% CASE 'Template ID' %]<th>Template ID</th>
|
|
[% CASE 'Template Name' %]<th>Template name</th>
|
|
[% CASE 'Description' %]<th>Description</th>
|
|
[% CASE 'Actions' %]<th>Actions</th>
|
|
[% CASE 'Profile ID' %]<th>Profile ID</th>
|
|
[% CASE 'Printer Name' %]<th>Printer name</th>
|
|
[% CASE 'Paper Bin' %]<th>Paper bin</th>
|
|
[% CASE 'Batch ID' %]<th>Batch ID</th>
|
|
[% CASE 'Item Count' %]<th>Item count</th>
|
|
[% CASE 'Fields to Print' %]<th>Fields to print</th>
|
|
[% CASE %]<th>[% header_field.field_label | html %]</th>
|
|
[% END %]
|
|
[% END %]
|
|
</tr>
|
|
</thead>
|
|
[% ELSE %]
|
|
<tr>
|
|
[% FOREACH text_field IN table_loo.text_fields %]
|
|
[% IF ( text_field.select_field ) %]
|
|
<td class="actions">
|
|
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/labels/label-edit-[% label_element |url %].pl?op=edit&element_id=[% text_field.field_value |url %]"><i class="fa fa-edit"></i> Edit</a>
|
|
<a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/labels/label-manage.pl?op=delete&label_element=[% label_element | html %]&element_id=[% text_field.field_value |url %]"><i class="fa fa-trash"></i> Delete</a>
|
|
</td>
|
|
[% IF label_element == 'batch' %] <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>[% END %]
|
|
[% ELSIF ( text_field.field_value ) %]
|
|
<td>[% text_field.field_value | html %]</td>
|
|
[% ELSE %]
|
|
<td> </td>
|
|
[% END %]
|
|
[% END %]
|
|
</tr>
|
|
[% END %]
|
|
[% END %]
|
|
</table>
|
|
[% IF ( print ) %]<button type="button" class="btn btn-default btn-sm" id="print">Export selected</button>[% END %]
|
|
</fieldset>
|
|
</form>
|
|
[% ELSE %]
|
|
<div class="dialog message">
|
|
<h4>There are no
|
|
[% PROCESS translate_label_element element=label_element_title %]
|
|
currently available.</h4>
|
|
<p>Use the toolbar above to create a new
|
|
[% PROCESS translate_label_element element=label_element %].</p></div>
|
|
[% END %]
|
|
</div>
|
|
</main>
|
|
</div> <!-- /.col-sm-10.col-sm-push-2 -->
|
|
|
|
<div class="col-sm-2 col-sm-pull-10">
|
|
<aside>
|
|
[% INCLUDE 'tools-menu.inc' %]
|
|
</aside>
|
|
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
|
|
</div> <!-- /.row -->
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/tools-menu.js") | $raw %]
|
|
[% INCLUDE 'greybox.inc' %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
<script>
|
|
function Xport() {
|
|
batches= new Array;
|
|
if(document.layouts.action.length > 0) {
|
|
for (var i=0; i < document.layouts.action.length; i++) {
|
|
if (document.layouts.action[i].checked) {
|
|
batches.push("batch_id=" + document.layouts.action[i].value);
|
|
}
|
|
}
|
|
if (batches.length < 1) {
|
|
alert(_("Please select at least one batch to export."));
|
|
return; // no batch selected
|
|
}
|
|
getstr = batches.join("&");
|
|
}
|
|
else if (document.layouts.action.checked) {
|
|
getstr = "batch_id="+document.layouts.action.value;
|
|
}
|
|
else {
|
|
alert(_("Please select at least one batch to export."));
|
|
return; // no batch selected
|
|
}
|
|
return GB_showCenter(_("Export Labels"), "/cgi-bin/koha/labels/label-print.pl?" + getstr, 400, 800);
|
|
}
|
|
function selected_layout(op) {
|
|
var selected = new Array;
|
|
if (document.layouts.action.length) {
|
|
for (i=0;i<document.layouts.action.length;i++){
|
|
if (document.layouts.action[i].checked){
|
|
selected.push(i);
|
|
}
|
|
};
|
|
if (selected.length == 1) {
|
|
return(document.layouts.action[selected[0]].value);
|
|
}
|
|
else {
|
|
alert(_("Please select only one %s to %s.").format("[% label_element | html %]", op));
|
|
return (-1);
|
|
}
|
|
}
|
|
else {
|
|
if (document.layouts.action.checked){
|
|
return(document.layouts.action.value);
|
|
}
|
|
};
|
|
alert(_("Please select a %s.").format("[% label_element | html %]"));
|
|
return (-1);
|
|
}
|
|
$(document).ready(function(){
|
|
$("#print").click(function(e){
|
|
e.preventDefault();
|
|
Xport();
|
|
});
|
|
$(".delete").on("click", function(){
|
|
return confirmDelete( _("Are you sure you want to delete this?") );
|
|
});
|
|
$("#labels-table").dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
"sPaginationType": "four_button",
|
|
"aaSorting": [[ 1, "asc" ]],
|
|
"aoColumnDefs": [
|
|
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
|
|
]
|
|
}));
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|