|
Lines 1-185
Link Here
|
| 1 |
<div id="toolbar"> |
|
|
| 2 |
<script type="text/JavaScript"> |
| 3 |
//<![CDATA[ |
| 4 |
function DeleteConfirm() { |
| 5 |
var msg = "Are you sure you want to delete batch [% batch_id %]?" |
| 6 |
var answer = confirm(msg); |
| 7 |
if (answer) { |
| 8 |
window.location = "/cgi-bin/koha/labels/label-manage.pl?op=delete&label_element=batch&element_id=[% batch_id %]"; |
| 9 |
} |
| 10 |
else { |
| 11 |
return; // abort delete |
| 12 |
} |
| 13 |
}; |
| 14 |
function Remove() { |
| 15 |
items = new Array; |
| 16 |
item_num = new Array; |
| 17 |
if(document.items.action.length > 0) { |
| 18 |
for (var i=0; i < document.items.action.length; i++) { |
| 19 |
if (document.items.action[i].checked) { |
| 20 |
items.push("label_id=" + document.items.action[i].value); |
| 21 |
item_num.push(i+1); |
| 22 |
} |
| 23 |
} |
| 24 |
if (items.length < 1) { |
| 25 |
alert(_("Please select at least one item to delete.")); |
| 26 |
return; // no item selected |
| 27 |
} |
| 28 |
getstr = items.join("&"); |
| 29 |
item_msg = item_num.join(", "); |
| 30 |
var msg = "Are you sure you want to remove label number(s): " + item_msg + " from this batch?" |
| 31 |
} |
| 32 |
// else if (document.items.action.checked) { |
| 33 |
// getstr = "label_id="+document.items.action.value; |
| 34 |
// var msg = "Are you sure you want to remove selected item from this batch?" |
| 35 |
// } |
| 36 |
else { |
| 37 |
alert(_("Please select at least label to delete.")); |
| 38 |
return; // no item selected |
| 39 |
} |
| 40 |
var answer = confirm(msg); |
| 41 |
if (answer) { |
| 42 |
window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&batch_id=[% batch_id %]&" + getstr; |
| 43 |
} |
| 44 |
else { |
| 45 |
return; // abort delete |
| 46 |
} |
| 47 |
}; |
| 48 |
function Add() { |
| 49 |
var barcodes = document.getElementById("barcode"); |
| 50 |
if (barcodes.value == '') { |
| 51 |
window.open("/cgi-bin/koha/labels/label-item-search.pl?batch_id=[% batch_id %]&type=labels",'FindABibIndex','width=875,height=400,toolbar=no,scrollbars=yes'); |
| 52 |
} |
| 53 |
else { |
| 54 |
document.forms["add_by_barcode"].submit(); |
| 55 |
} |
| 56 |
}; |
| 57 |
function DeDuplicate() { |
| 58 |
window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=de_duplicate&batch_id=[% batch_id %]"; |
| 59 |
}; |
| 60 |
function Xport(mode) { |
| 61 |
if (mode == 'label') { |
| 62 |
labels= new Array; |
| 63 |
if(document.items.action.length > 0) { |
| 64 |
for (var i=0; i < document.items.action.length; i++) { |
| 65 |
if (document.items.action[i].checked) { |
| 66 |
labels.push("label_id=" + document.items.action[i].value); |
| 67 |
} |
| 68 |
} |
| 69 |
if (labels.length < 1) { |
| 70 |
alert(_("Please select at least one label to export.")); |
| 71 |
return; // no batch selected |
| 72 |
} |
| 73 |
getstr = labels.join("&"); |
| 74 |
} |
| 75 |
else if (document.items.action.checked) { |
| 76 |
getstr = document.items.action.value; |
| 77 |
} |
| 78 |
else { |
| 79 |
alert(_("Please select at least one label to export.")); |
| 80 |
return; // no batch selected |
| 81 |
} |
| 82 |
return GB_showCenter('Export labels', "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id %]&" + getstr, 700, 800); |
| 83 |
} |
| 84 |
else if (mode == 'batch') { |
| 85 |
return GB_showCenter('Export labels', "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id %]", 700, 800); |
| 86 |
} |
| 87 |
else { |
| 88 |
// some pass-thru error trapping just in case... |
| 89 |
} |
| 90 |
}; |
| 91 |
function selected_layout() { |
| 92 |
if (document.items.action.length) { |
| 93 |
for (i=0;i<document.items.action.length;i++){ |
| 94 |
if (document.items.action[i].checked==true){ |
| 95 |
return(document.items.action[i].value); |
| 96 |
} |
| 97 |
}; |
| 98 |
} |
| 99 |
else { |
| 100 |
if (document.items.action.checked){ |
| 101 |
return(document.items.action.value); |
| 102 |
} |
| 103 |
}; |
| 104 |
alert(_("Please select at least one item.")); |
| 105 |
return (-1); |
| 106 |
}; |
| 107 |
|
| 108 |
// prepare DOM for YUI Toolbar |
| 109 |
$(document).ready(function() { |
| 110 |
$("#additemsc").empty(); |
| 111 |
$("#removeitemsc").empty(); |
| 112 |
$("#deletebatchc").empty(); |
| 113 |
$("#deduplicatec").empty(); |
| 114 |
$("#exportitemsc").empty(); |
| 115 |
$("#exportbatchc").empty(); |
| 116 |
yuiToolbar(); |
| 117 |
}); |
| 118 |
// YUI Toolbar Functions |
| 119 |
function yuiToolbar() { |
| 120 |
new YAHOO.widget.Button({ |
| 121 |
id: "additems", |
| 122 |
type: "link", |
| 123 |
href: "#", |
| 124 |
label: _("Add item(s)"), |
| 125 |
container: "additemsc", |
| 126 |
onclick: {fn:function(){Add()}} |
| 127 |
}); |
| 128 |
|
| 129 |
new YAHOO.widget.Button({ |
| 130 |
id: "removeitems", |
| 131 |
type: "link", |
| 132 |
href: "#", |
| 133 |
label: _("Remove item(s)"), |
| 134 |
container: "removeitemsc", |
| 135 |
onclick: {fn:function(){Remove()}} |
| 136 |
}); |
| 137 |
|
| 138 |
new YAHOO.widget.Button({ |
| 139 |
id: "deletebatch", |
| 140 |
type: "link", |
| 141 |
href: "#", |
| 142 |
label: _("Delete batch"), |
| 143 |
container: "deletebatchc", |
| 144 |
onclick: {fn:function(){DeleteConfirm()}} |
| 145 |
}); |
| 146 |
|
| 147 |
new YAHOO.widget.Button({ |
| 148 |
id: "deduplicate", |
| 149 |
type: "link", |
| 150 |
href: "#", |
| 151 |
label: _("Remove duplicates"), |
| 152 |
container: "deduplicatec", |
| 153 |
onclick: {fn:function(){DeDuplicate()}} |
| 154 |
}); |
| 155 |
|
| 156 |
new YAHOO.widget.Button({ |
| 157 |
id: "exportitems", |
| 158 |
type: "link", |
| 159 |
href: "#", |
| 160 |
label: _("Export item(s)"), |
| 161 |
container: "exportitemsc", |
| 162 |
onclick: {fn:function(){Xport('label')}} |
| 163 |
}); |
| 164 |
|
| 165 |
new YAHOO.widget.Button({ |
| 166 |
id: "exportbatch", |
| 167 |
type: "link", |
| 168 |
href: "#", |
| 169 |
label: _("Export batch"), |
| 170 |
container: "exportbatchc", |
| 171 |
onclick: {fn:function(){Xport('batch')}} |
| 172 |
}); |
| 173 |
new YAHOO.widget.Button("deletebatch"); |
| 174 |
} |
| 175 |
//]]> |
| 176 |
</script> |
| 177 |
<ul class="toolbar"> |
| 178 |
<li id="additemsc"><a id="additems" href="#">Add item(s)</a></li>[% IF ( table_loop ) %] |
| 179 |
<li id="removeitemsc"><a id="removeitems" href="#">Remove item(s)</a></li> |
| 180 |
<li id="deletebatchc"><a id="deletebatch" href="#">Delete batch</a></li> |
| 181 |
<li id="deduplicatec"><a id="deduplicate" href="#">Remove duplicates</a></li> |
| 182 |
<li id="exportitemsc"><a id="exportitems" href="#">Export item(s)</a></li> |
| 183 |
<li id="exportbatchc"><a id="exportbatch" href="#">Export batch</a></li>[% END %] |
| 184 |
</ul> |
| 185 |
</div> |