2a7765130fe6051aff55d80cb17a7219201226ce
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / labels / label-manage.tmpl
1     <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2     <title>Koha &rsaquo; Tools &rsaquo; Labels &rsaquo; Manage Label Elements</title>
3     <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
4     <!-- TMPL_INCLUDE NAME="greybox.inc" -->
5     <script type="text/JavaScript" language="JavaScript">
6         //<![CDATA[
7             function DeleteConfirm() {
8                 var element_id = selected_layout("delete");
9                 if (element_id>-1) {
10                     var msg = "Are you sure you want to delete <!-- TMPL_VAR NAME="label_element" --> " + element_id + "?"
11                     var answer = confirm(msg);
12                     if (answer) {
13                         window.location = "/cgi-bin/koha/labels/label-manage.pl?op=delete&amp;label_element=<!-- TMPL_VAR NAME="label_element" -->&amp;element_id=" + element_id;
14                     }
15                     else {
16                         return; // abort delete
17                     }
18                 }
19                 else {
20                     return;     // no layout selected
21                 };
22             };
23             function Edit() {
24                 var element_id = selected_layout("edit");
25                 if (element_id>-1) {
26                     window.location = "/cgi-bin/koha/labels/label-edit-<!-- TMPL_VAR NAME="label_element" -->.pl?op=edit&amp;element_id=" + element_id;
27                 }
28                 else {
29                     return;     // no layout selected
30                 };
31             };
32             function Xport() {
33                 batches= new Array;
34                 if(document.layouts.action.length > 0) {
35                     for (var i=0; i < document.layouts.action.length; i++) {
36                         if (document.layouts.action[i].checked) {
37                             batches.push("batch_id=" +  document.layouts.action[i].value);
38                         }
39                     }
40                     if (batches.length < 1) {
41                         alert("Please select at least one batch to export.");
42                         return;     // no batch selected
43                     }
44                     getstr = batches.join("&");
45                 }
46                 else if (document.layouts.action.checked) {
47                     getstr = "batch_id="+document.layouts.action.value;
48                 }
49                 else {
50                     alert("Please select at least one batch to export.");
51                     return;     // no batch selected
52                 }
53                 var msg = "Are you sure you want to export the selected batch(s)?"
54                 var answer = confirm(msg);
55                 if (answer) {
56                     return GB_showCenter('Export Labels', "/cgi-bin/koha/labels/label-print.pl?" + getstr, 700, 800);
57 //                    window.location = "/cgi-bin/koha/labels/label-print.pl?" + getstr;
58                 }
59                 else {
60                     return; // abort export
61                 }
62             };
63             function selected_layout(op) {
64                 var selected = new Array;
65                 if (document.layouts.action.length) {
66                     for (i=0;i<document.layouts.action.length;i++){
67                         if (document.layouts.action[i].checked){
68                             selected.push(i);
69                         }
70                     };
71                     if (selected.length == 1) {
72                         return(document.layouts.action[selected[0]].value);
73                     }
74                     else {
75                         alert("Please select only one <!-- TMPL_VAR NAME="label_element" --> to " + op + ".");
76                         return (-1);
77                     }
78                 }
79                 else {
80                     if (document.layouts.action.checked){
81                         return(document.layouts.action.value);
82                     }
83                     //var x=document.getElementsByName("action");
84                     //if (x[0].checked) {
85                     //    alert(x[0].value);
86                     //    return(x[0].value);
87                     //};
88                 };
89                 alert("Please select a <!-- TMPL_VAR NAME="label_element" -->.");
90                 return (-1);
91             };
92         //]]>
93     </script>
94 </head>
95 <body>
96     <!-- TMPL_INCLUDE NAME="header.inc" -->
97     <!-- TMPL_INCLUDE NAME="cat-search.inc" -->
98     <div id="breadcrumbs">
99         <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; 
100         <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
101         <a href="/cgi-bin/koha/labels/labels-home.pl">Labels</a> &rsaquo;
102         Manage Label <!-- TMPL_VAR NAME="label_element_title" -->
103     </div>
104     <div id="doc3" class="yui-t2">
105         <div id="bd">
106             <div id="yui-main">
107                 <div class="yui-b">
108                     <!-- TMPL_INCLUDE NAME="labels-new-toolbar.inc" -->
109                     <div class="yui-gc">
110                         <div class="yui-u first" id="manage-label-layouts">
111                             <div class="hint">Current Branch: <!-- TMPL_VAR NAME="LoginBranchname" --></div>
112                             <form name="layouts">
113                             <h2>Currently Available <!-- TMPL_VAR NAME="label_element_title" --></h2>
114                             <table>
115                                 <!-- TMPL_LOOP NAME="table_loop" -->
116                                 <!-- TMPL_IF NAME="header_fields" -->
117                                 <tr>
118                                 <!-- TMPL_LOOP NAME="header_fields" -->
119                                     <th><!-- TMPL_VAR NAME="field_label" --></th>
120                                 <!-- /TMPL_LOOP -->
121                                 </tr>
122                                 <!-- TMPL_ELSE -->
123                                 <tr>
124                                 <!-- TMPL_LOOP NAME="text_fields" -->
125                                 <!-- TMPL_IF NAME="select_field" -->
126                                     <td align="center"><input type="checkbox" name="action" value="<!-- TMPL_VAR NAME="field_value" -->"></td>
127                                 <!-- TMPL_ELSE -->
128                                     <td><!-- TMPL_VAR NAME="field_value" --></td>
129                                 <!-- /TMPL_IF -->
130                                 <!-- /TMPL_LOOP -->
131                                 </tr>
132                                 <!-- /TMPL_IF -->
133                                 <!-- /TMPL_LOOP -->
134                             </table>
135                             <div style="margin: 10px 10px 10px 0px;">
136                                 <span class="yui-button yui-link-button"><span class="first-child"><input type="button" id="edit" onclick="Edit()" value="Edit"></span></span>
137                                 <span class="yui-button yui-link-button"><span class="first-child"><input type="button" id="delete" onclick="DeleteConfirm()" value="Delete"></span></span>
138                                 <!-- TMPL_IF NAME="print" --><span class="yui-button yui-link-button"><span class="first-child"><input type="button" id="print" onclick="Xport()" value="Export"></span></span><!-- /TMPL_IF -->
139                             </div>
140                             </form>
141                         </div>
142                         <!-- TMPL_IF NAME="error" -->
143                         <div class="yui-u">
144                             <div class="alert">
145                                 <strong>WARNING: An error was encountered and <!-- TMPL_VAR NAME="label_element" --> <!-- TMPL_VAR NAME="element_id" --> was not deleted. Please have your system administrator check the syslog for details.</strong>
146                             </div>
147                         </div>
148                         <!-- /TMPL_IF -->
149                     </div>
150                 </div>
151             </div>
152             <div class="yui-b">
153                 <!-- TMPL_INCLUDE NAME="labels-menu.inc" -->
154             </div>
155         </div>
156     <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->