Lines 1-179
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/patroncards/manage.pl?op=delete&card_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 card 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/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id %]&" + getstr; |
43 |
} |
44 |
else { |
45 |
return; // abort delete |
46 |
} |
47 |
}; |
48 |
function Add() { |
49 |
window.open("/cgi-bin/koha/patroncards/members-search.pl?batch_id=[% batch_id %]",'FindABibIndex','width=875,height=400,toolbar=no,scrollbars=yes'); |
50 |
}; |
51 |
function DeDuplicate() { |
52 |
window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&batch_id=[% batch_id %]"; |
53 |
}; |
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); |
61 |
} |
62 |
} |
63 |
if (patroncards.length < 1) { |
64 |
alert(_("Please select at least one card to export.")); |
65 |
return; // no batch selected |
66 |
} |
67 |
getstr = patroncards.join("&"); |
68 |
} |
69 |
else if (document.items.action.checked) { |
70 |
getstr = document.items.action.value; |
71 |
} |
72 |
else { |
73 |
alert(_("Please select at least one card to export.")); |
74 |
return; // no batch selected |
75 |
} |
76 |
return GB_showCenter('Export labels', "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]&" + getstr, 700, 800); |
77 |
} |
78 |
else if (mode == 'batch') { |
79 |
return GB_showCenter('Export labels', "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]", 700, 800); |
80 |
} |
81 |
else { |
82 |
// some pass-thru error trapping just in case... |
83 |
} |
84 |
}; |
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); |
90 |
} |
91 |
}; |
92 |
} |
93 |
else { |
94 |
if (document.items.action.checked){ |
95 |
return(document.items.action.value); |
96 |
} |
97 |
}; |
98 |
alert(_("Please select at least one item.")); |
99 |
return (-1); |
100 |
}; |
101 |
|
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(); |
110 |
yuiToolbar(); |
111 |
}); |
112 |
// YUI Toolbar Functions |
113 |
function yuiToolbar() { |
114 |
new YAHOO.widget.Button({ |
115 |
id: "additems", |
116 |
type: "link", |
117 |
href: "#", |
118 |
label: _("Add item(s)"), |
119 |
container: "additemsc", |
120 |
onclick: {fn:function(){Add()}} |
121 |
}); |
122 |
|
123 |
new YAHOO.widget.Button({ |
124 |
id: "removeitems", |
125 |
type: "link", |
126 |
href: "#", |
127 |
label: _("Remove item(s)"), |
128 |
container: "removeitemsc", |
129 |
onclick: {fn:function(){Remove()}} |
130 |
}); |
131 |
|
132 |
new YAHOO.widget.Button({ |
133 |
id: "deletebatch", |
134 |
type: "link", |
135 |
href: "#", |
136 |
label: _("Delete batch"), |
137 |
container: "deletebatchc", |
138 |
onclick: {fn:function(){DeleteConfirm()}} |
139 |
}); |
140 |
|
141 |
new YAHOO.widget.Button({ |
142 |
id: "deduplicate", |
143 |
type: "link", |
144 |
href: "#", |
145 |
label: _("Remove duplicates"), |
146 |
container: "deduplicatec", |
147 |
onclick: {fn:function(){DeDuplicate()}} |
148 |
}); |
149 |
|
150 |
new YAHOO.widget.Button({ |
151 |
id: "exportitems", |
152 |
type: "link", |
153 |
href: "#", |
154 |
label: _("Export item(s)"), |
155 |
container: "exportitemsc", |
156 |
onclick: {fn:function(){Xport('label')}} |
157 |
}); |
158 |
|
159 |
new YAHOO.widget.Button({ |
160 |
id: "exportbatch", |
161 |
type: "link", |
162 |
href: "#", |
163 |
label: _("Export batch"), |
164 |
container: "exportbatchc", |
165 |
onclick: {fn:function(){Xport('batch')}} |
166 |
}); |
167 |
new YAHOO.widget.Button("deletebatch"); |
168 |
} |
169 |
//]]> |
170 |
</script> |
171 |
<ul class="toolbar"> |
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 %] |
178 |
</ul> |
179 |
</div> |