More changes to update-child process. Many scripts missing necessary data for checkin...
[wip/koha-chris_n.git] / koha-tmpl / intranet-tmpl / prog / en / includes / circ-toolbar.inc
1 <div id="toolbar">
2         <script type="text/javascript">
3         //<![CDATA[
4
5 function confirm_deletion() {
6     var is_confirmed = window.confirm('Are you sure you want to delete this patron? This cannot be undone.');
7     var borrowernumbervalue = $("#borrowernumber").attr("value"); 
8     if (is_confirmed) {
9                 window.location='/cgi-bin/koha/members/deletemem.pl?member='+borrowernumbervalue+'';
10     } else {
11                 return false;
12         }
13 }
14
15 function confirm_updatechild() {
16     var is_confirmed = window.confirm('Are you sure you want to update this child to an Adult category?  This cannot be undone.');
17    
18     if (is_confirmed) {
19             window.location='/cgi-bin/koha/members/update-child.pl?op=update&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&catcode=<!-- TMPL_VAR NAME="catcode" -->&catcode_multi=<!-- TMPL_VAR NAME="CATCODE_MULTI" -->';
20     }
21 }
22
23 function confirm_reregistration() {
24     var is_confirmed = window.confirm('Are you sure you want to renew this patron\'s registration?');
25     var borrowernumbervalue1 = $("#borrowernumber").attr("value");
26     if (is_confirmed) {
27         window.location = '/cgi-bin/koha/members/setstatus.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;cardnumber=<!-- TMPL_VAR NAME="cardnumber" -->&amp;destination=circ&amp;reregistration=y';
28     }
29 }
30
31 function update_child() {
32     var borrowernumbervalue= $("#borrowernumber").attr("value"); 
33 <!-- TMPL_IF NAME="CATCODE_MULTI" -->
34  window.open('/cgi-bin/koha/members/update-child.pl?op=multi&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->','UpdateChild','width=400,height=300,toolbar=no,scrollbars=no,resizable=yes');
35 <!-- TMPL_ELSE -->
36  confirm_updatechild();
37 <!-- /TMPL_IF -->
38 }
39
40         // prepare DOM for YUI Toolbar
41
42          $(document).ready(function() {
43             $("#printslip").parent().remove();
44                 $("#patronflags").parent().remove();
45                 $("#deletepatron").parent().remove();
46                 $("#moremenuc").empty();
47             $("#printmenuc").empty();
48             yuiToolbar();
49          });
50
51         // YUI Toolbar Functions
52         function printx_window(print_type) {
53                 window.open("/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;print=" + print_type, "printwindow");
54                 return false;
55         }
56
57         function yuiToolbar() {
58             var printmenu = [
59                 { text: _("Print Page"), onclick: {fn: function(){printx_window("page")}}, },
60                 { text: _("Print Slip"), onclick: {fn: function(){printx_window("slip")}}, }
61             ];
62         
63                 var moremenu = [
64                         { text: _("Renew Patron"),  onclick: { fn: confirm_reregistration } },
65             { text: _("Set Permissions"), url: "/cgi-bin/koha/members/member-flags.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->"
66                 <!-- TMPL_IF NAME="CAN_user_permissions" --><!-- TMPL_IF NAME="StaffMember" -->
67                     <!-- TMPL_UNLESS NAME="CAN_user_staffaccess" -->, disabled: true<!-- /TMPL_UNLESS-->
68                     <!-- TMPL_ELSE --><!-- /TMPL_IF -->
69                 <!-- TMPL_ELSE -->, disabled: true<!-- /TMPL_IF-->},
70             { text: _("Delete"), <!-- TMPL_IF NAME="StaffMember" --><!-- TMPL_UNLESS NAME="CAN_user_staffaccess" -->disabled: true, <!-- /TMPL_UNLESS --><!-- /TMPL_IF --> onclick: { fn: confirm_deletion } },
71                         { text: _("Update Child to Adult Patron") , onclick: { fn: update_child }<!-- TMPL_UNLESS NAME="is_child" -->, disabled: true<!-- /TMPL_UNLESS -->}
72                 ];
73
74             new YAHOO.widget.Button({
75                 type: "menu",
76                 label: _("Print"),
77                 name: "printmenubutton",
78                 menu: printmenu,
79                 container: "printmenuc"
80             });   
81         
82             new YAHOO.widget.Button({
83                 type: "menu",
84                 label: _("More"),
85                 name: "moremenubutton",
86                 menu: moremenu,
87                 container: "moremenuc"
88             });
89         
90             <!-- TMPL_IF name="adultborrower" -->new YAHOO.widget.Button("addchild");<!-- /TMPL_IF -->
91             new YAHOO.widget.Button("editpatron");
92             new YAHOO.widget.Button("addnote");
93         <!-- TMPL_IF NAME="StaffMember" --><!-- TMPL_IF NAME="CAN_user_staffaccess" --> new YAHOO.widget.Button("changepassword");  <!-- /TMPL_IF-->
94             <!-- TMPL_ELSE--> new YAHOO.widget.Button("changepassword"); <!-- /TMPL_IF -->
95             new YAHOO.widget.Button("printslip");
96                 new YAHOO.widget.Button("printpage");
97             new YAHOO.widget.Button("renewpatron");              
98         <!-- TMPL_IF NAME="CAN_user_permissions" -->
99           <!-- TMPL_IF NAME="StaffMember" -->
100             <!-- TMPL_IF NAME="CAN_user_staffaccess" -->
101               new YAHOO.widget.Button("patronflags");
102             <!-- /TMPL_IF -->
103           <!-- TMPL_ELSE-->
104           new YAHOO.widget.Button("patronflags");
105           <!-- /TMPL_IF -->
106         <!-- /TMPL_IF -->
107         <!-- TMPL_IF NAME="StaffMember" --><!-- TMPL_UNLESS NAME="CAN_user_staffaccess" -->new YAHOO.widget.Button("deletepatron");<!-- /TMPL_UNLESS -->
108             <!-- TMPL_ELSE -->new YAHOO.widget.Button("deletepatron");<!-- /TMPL_IF -->
109         }
110
111         //]]>
112         </script>
113         <ul class="toolbar">
114         <!-- TMPL_IF NAME="CAN_user_borrowers" -->
115         <!-- TMPL_IF NAME="category_type" -->
116             <!--TMPL_IF NAME="guarantor"-->
117                 <li><a id="editpatron" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;guarantorid=<!-- TMPL_VAR NAME="guarantorborrowernumber" -->&amp;category_type=<!-- TMPL_VAR NAME="category_type"-->">
118             <!--TMPL_ELSE-->
119             <li><a id="editpatron" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;category_type=<!-- TMPL_VAR NAME="category_type"-->">
120             <!--/TMPL_IF-->Edit</a></li>
121         <!-- TMPL_ELSE --> <!-- try with categorycode if no category_type -->
122             <!-- TMPL_IF NAME="categorycode" -->
123             <li><a id="editpatron" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;categorycode=<!-- TMPL_VAR NAME="categorycode"-->">Edit</a></li>
124             <!-- TMPL_ELSE --> <!-- if no categorycode, set category_type to A by default -->
125                 <li><a id="editpatron" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;category_type=A">Edit</a></li>
126             <!-- /TMPL_IF -->
127         <!-- /TMPL_IF -->
128         <!-- /TMPL_IF -->
129         <!-- TMPL_IF NAME="CAN_user_borrowers" -->
130         <!-- TMPL_IF name="adultborrower" --><li><a id="addchild" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;category_type=C">Add child</a></li><!-- /TMPL_IF -->
131 <!--    <li><a id="addnote" href="/cgi-bin/koha/members/addnotes.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Add Note</a></li> -->
132 <!-- TMPL_IF NAME="StaffMember" --><!-- TMPL_IF NAME="CAN_user_staffaccess" --> <li><a id="changepassword" href="/cgi-bin/koha/members/member-password.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->">Change Password</a></li><!-- /TMPL_IF-->
133           <!-- TMPL_ELSE--> <li><a id="changepassword" href="/cgi-bin/koha/members/member-password.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->">Change Password</a></li><!-- /TMPL_IF --> 
134           <!-- /TMPL_IF -->
135         <li id="printmenuc"><a id="printpage" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;print=page">Print Page</a></li>
136         <li><a id="printslip" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;print=slip">Print Slip</a></li>
137         <li id="moremenuc"><a id="renewpatron" href="/cgi-bin/koha/members/moremember.pl?reregistration=y&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Renew Account</a></li>
138     <!-- TMPL_IF NAME="CAN_user_permissions" -->
139         <!-- TMPL_IF NAME="StaffMember" -->
140             <!-- TMPL_IF NAME="CAN_user_staffaccess" -->
141                 <li><a id="patronflags" href="/cgi-bin/koha/members/member-flags.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->">Set Permissions</a></li>
142             <!-- /TMPL_IF -->
143           <!-- TMPL_ELSE-->
144                 <li><a id="patronflags" href="/cgi-bin/koha/members/member-flags.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->">Set Permissions</a></li>
145         <!-- /TMPL_IF -->
146     <!-- /TMPL_IF -->
147     <!-- TMPL_IF NAME="StaffMember" --><!-- TMPL_UNLESS NAME="CAN_user_staffaccess" --><li><a id="deletepatron" href="javascript:confirm_deletion();">Delete</a></li><!-- /TMPL_UNLESS -->
148     <!-- TMPL_ELSE --><li><a id="deletepatron" href="javascript:confirm_deletion();">Delete</a></li><!-- /TMPL_IF -->
149
150 </ul></div>