View | Details | Raw Unified | Return to bug 9635
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/labels-batches-toolbar.inc (-185 lines)
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&amp;label_element=batch&amp;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&amp;batch_id=[% batch_id %]&amp;" + 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 %]&amp;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&amp;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>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt (-3 / +138 lines)
Lines 1-4 Link Here
1
    <!-- PLEASE MAINTAIN PROPER INDENTATION!!!!  -->
2
    [% INCLUDE 'doc-head-open.inc' %]
1
    [% INCLUDE 'doc-head-open.inc' %]
3
    <title>Koha &rsaquo; Tools &rsaquo; Labels &rsaquo; Manage label batches</title>
2
    <title>Koha &rsaquo; Tools &rsaquo; Labels &rsaquo; Manage label batches</title>
4
    [% INCLUDE 'doc-head-close.inc' %]
3
    [% INCLUDE 'doc-head-close.inc' %]
Lines 17-22 Link Here
17
                return true;    // ok
16
                return true;    // ok
18
            };
17
            };
19
        }
18
        }
19
           function DeleteConfirm() {
20
                var msg = "Are you sure you want to delete batch [% batch_id %]?"
21
                var answer = confirm(msg);
22
                if (answer) {
23
                    window.location = "/cgi-bin/koha/labels/label-manage.pl?op=delete&amp;label_element=batch&amp;element_id=[% batch_id %]";
24
                }
25
                else {
26
                    return; // abort delete
27
                }
28
            };
29
            function Remove() {
30
                items = new Array;
31
                item_num = new Array;
32
                if(document.items.action.length > 0) {
33
                    for (var i=0; i < document.items.action.length; i++) {
34
                        if (document.items.action[i].checked) {
35
                            items.push("label_id=" +  document.items.action[i].value);
36
                            item_num.push(i+1);
37
                        }
38
                    }
39
                    if (items.length < 1) {
40
                        alert(_("Please select at least one item to delete."));
41
                        return;     // no item selected
42
                    }
43
                    getstr = items.join("&");
44
                    item_msg = item_num.join(", ");
45
                    var msg = "Are you sure you want to remove label number(s): " + item_msg + " from this batch?"
46
                }
47
//                else if (document.items.action.checked) {
48
//                    getstr = "label_id="+document.items.action.value;
49
//                    var msg = "Are you sure you want to remove selected item from this batch?"
50
//                }
51
                else {
52
                    alert(_("Please select at least label to delete."));
53
                    return;     // no item selected
54
                }
55
                var answer = confirm(msg);
56
                if (answer) {
57
                    window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&amp;batch_id=[% batch_id %]&amp;" + getstr;
58
                }
59
                else {
60
                    return; // abort delete
61
                }
62
            };
63
            function Add() {
64
                var barcodes = document.getElementById("barcode");
65
                if (barcodes.value == '') {
66
                    window.open("/cgi-bin/koha/labels/label-item-search.pl?batch_id=[% batch_id %]&amp;type=labels",'FindABibIndex','width=875,height=400,toolbar=no,scrollbars=yes');
67
                }
68
                else {
69
                    document.forms["add_by_barcode"].submit();
70
                }
71
            };
72
            function DeDuplicate() {
73
                window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=de_duplicate&amp;batch_id=[% batch_id %]";
74
            };
75
            function Xport(mode) {
76
                if (mode == 'label') {
77
                    labels= new Array;
78
                    if(document.items.action.length > 0) {
79
                        for (var i=0; i < document.items.action.length; i++) {
80
                            if (document.items.action[i].checked) {
81
                                labels.push("label_id=" +  document.items.action[i].value);
82
                            }
83
                        }
84
                        if (labels.length < 1) {
85
                            alert(_("Please select at least one label to export."));
86
                            return;     // no batch selected
87
                        }
88
                        getstr = labels.join("&");
89
                    }
90
                    else if (document.items.action.checked) {
91
                        getstr = document.items.action.value;
92
                    }
93
                    else {
94
                        alert(_("Please select at least one label to export."));
95
                        return;     // no batch selected
96
                    }
97
                    return GB_showCenter('Export labels', "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id %]&" + getstr, 700, 800);
98
                }
99
                else if (mode == 'batch') {
100
                    return GB_showCenter('Export labels', "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id %]", 700, 800);
101
                }
102
                else {
103
                    // some pass-thru error trapping just in case...
104
                }
105
            };
106
           function selected_layout() {
107
                if (document.items.action.length) {
108
                for (i=0;i<document.items.action.length;i++){
109
                    if (document.items.action[i].checked==true){
110
                        return(document.items.action[i].value);
111
                    }
112
                };
113
                }
114
                else {
115
                    if (document.items.action.checked){
116
                        return(document.items.action.value);
117
                    }
118
                };
119
                alert(_("Please select at least one item."));
120
                return (-1);
121
            };
122
123
         $(document).ready(function() {
124
            $("#additems").click(function(){
125
                Add();
126
                return false;
127
            });
128
            $("#removeitems").click(function(){
129
                Remove();
130
                return false;
131
            });
132
            $("#deletebatch").click(function(){
133
                DeleteConfirm();
134
                return false;
135
            });
136
            $("#deduplicate").click(function(){
137
                DeDuplicate();
138
                return false;
139
            });
140
            $("#exportitems").click(function(){
141
                Xport('label');
142
                return false;
143
            });
144
            $("#exportbatch").click(function(){
145
                Xport('batch');
146
                return false;
147
            });
148
         });
20
    //]]>
149
    //]]>
21
    </script>
150
    </script>
22
</head>
151
</head>
Lines 34-40 Link Here
34
        <div id="bd">
163
        <div id="bd">
35
            <div id="yui-main">
164
            <div id="yui-main">
36
                <div class="yui-b">
165
                <div class="yui-b">
37
                    [% INCLUDE 'labels-batches-toolbar.inc' %]
166
                    <div id="toolbar" class="btn-toolbar">
167
                            <a class="btn btn-small" id="additems" href="#">Add item(s)</a>[% IF ( table_loop ) %]
168
                            <a class="btn btn-small" id="removeitems" href="#">Remove item(s)</a>
169
                            <a class="btn btn-small" id="deletebatch" href="#">Delete batch</a>
170
                            <a class="btn btn-small" id="deduplicate" href="#">Remove duplicates</a>
171
                            <a class="btn btn-small" id="exportitems" href="#">Export item(s)</a>
172
                            <a class="btn btn-small" id="exportbatch" href="#">Export batch</a>[% END %]
173
                    </div>
38
                    <div class="yui-g">
174
                    <div class="yui-g">
39
                        <div class="yui-u first" id="manage-label-batches">
175
                        <div class="yui-u first" id="manage-label-batches">
40
                            <div class="hint">Current library: [% LoginBranchname %]</div>
176
                            <div class="hint">Current library: [% LoginBranchname %]</div>
41
- 

Return to bug 9635