2 <script type="text/JavaScript">
4 function DeleteConfirm() {
5 var msg = "Are you sure you want to delete batch [% batch_id %]?"
6 var answer = confirm(msg);
8 window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=batch&element_id=[% batch_id %]";
11 return; // abort delete
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);
24 if (items.length < 1) {
25 alert(_("Please select at least one item to delete."));
26 return; // no item selected
28 getstr = items.join("&");
29 item_msg = item_num.join(", ");
30 var msg = "Are you sure you want to remove card number(s): " + item_msg + " from this batch?"
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?"
37 alert(_("Please select at least label to delete."));
38 return; // no item selected
40 var answer = confirm(msg);
42 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id %]&" + getstr;
45 return; // abort delete
49 window.open("/cgi-bin/koha/patroncards/members-search.pl?batch_id=[% batch_id %]",'FindABibIndex','width=875,height=400,toolbar=no,scrollbars=yes');
51 function DeDuplicate() {
52 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&batch_id=[% batch_id %]";
54 function Xport(mode) {
55 if (mode == 'label') {
56 patroncards= new Array;
57 if(document.items.action.length > 0) {
58 for (var i=0; i < document.items.action.length; i++) {
59 if (document.items.action[i].checked) {
60 patroncards.push("label_id=" + document.items.action[i].value);
63 if (patroncards.length < 1) {
64 alert(_("Please select at least one card to export."));
65 return; // no batch selected
67 getstr = patroncards.join("&");
69 else if (document.items.action.checked) {
70 getstr = document.items.action.value;
73 alert(_("Please select at least one card to export."));
74 return; // no batch selected
76 return GB_showCenter('Export Labels', "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]&" + getstr, 700, 800);
78 else if (mode == 'batch') {
79 return GB_showCenter('Export Labels', "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]", 700, 800);
82 // some pass-thru error trapping just in case...
85 function selected_layout() {
86 if (document.items.action.length) {
87 for (i=0;i<document.items.action.length;i++){
88 if (document.items.action[i].checked==true){
89 return(document.items.action[i].value);
94 if (document.items.action.checked){
95 return(document.items.action.value);
98 alert(_("Please select at least one item."));
102 // prepare DOM for YUI Toolbar
103 $(document).ready(function() {
104 $("#additemsc").empty();
105 $("#removeitemsc").empty();
106 $("#deletebatchc").empty();
107 $("#deduplicatec").empty();
108 $("#exportitemsc").empty();
109 $("#exportbatchc").empty();
112 // YUI Toolbar Functions
113 function yuiToolbar() {
114 new YAHOO.widget.Button({
118 label: _("Add Item(s)"),
119 container: "additemsc",
120 onclick: {fn:function(){Add()}}
123 new YAHOO.widget.Button({
127 label: _("Remove Item(s)"),
128 container: "removeitemsc",
129 onclick: {fn:function(){Remove()}}
132 new YAHOO.widget.Button({
136 label: _("Delete Batch"),
137 container: "deletebatchc",
138 onclick: {fn:function(){DeleteConfirm()}}
141 new YAHOO.widget.Button({
145 label: _("Remove Duplicates"),
146 container: "deduplicatec",
147 onclick: {fn:function(){DeDuplicate()}}
150 new YAHOO.widget.Button({
154 label: _("Export Item(s)"),
155 container: "exportitemsc",
156 onclick: {fn:function(){Xport('label')}}
159 new YAHOO.widget.Button({
163 label: _("Export Batch"),
164 container: "exportbatchc",
165 onclick: {fn:function(){Xport('batch')}}
167 new YAHOO.widget.Button("deletebatch");
172 <li id="additemsc"><a id="additems" href="#">Add Item(s)</a></li>[% IF ( table_loop ) %]
173 <li id="removeitemsc"><a id="removeitems" href="#">Remove Item(s)</a></li>
174 <li id="deletebatchc"><a id="deletebatch" href="#">Delete Batch</a></li>
175 <li id="deduplicatec"><a id="deduplicate" href="#">Remove Duplicates</a></li>
176 <li id="exportitemsc"><a id="exportitems" href="#">Export Item(s)</a></li>
177 <li id="exportbatchc"><a id="exportbatch" href="#">Export Batch</a></li>[% END %]