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

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

Return to bug 9697