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 / members-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     if (is_confirmed) {
8             window.location='/cgi-bin/koha/members/deletemem.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->';
9     }
10 }
11 function confirm_updatechild() {
12     var is_confirmed = window.confirm('Are you sure you want to update this child to an Adult category?  This cannot be undone.');
13    
14     if (is_confirmed) {
15             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" -->';
16     }
17 }
18
19 function confirm_reregistration() {
20     var is_confirmed = window.confirm('Are you sure you want to renew this patron\'s registration?');
21     if (is_confirmed) {
22     window.location='/cgi-bin/koha/members/moremember.pl?reregistration=y&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->';
23     }
24 }
25
26 function update_child() {
27 <!-- TMPL_IF NAME="CATCODE_MULTI" -->
28  window.open('update-child.pl?op=multi&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->','UpdateChild','width=400,height=300,toolbar=no,scrollbars=no,resizable=yes');
29 <!-- TMPL_ELSE -->
30  confirm_updatechild();
31 <!-- /TMPL_IF -->
32 }
33
34         // prepare DOM for YUI Toolbar
35
36          $(document).ready(function() {
37             $("#printslip").parent().remove();
38                 $("#patronflags").parent().remove();
39                 $("#deletepatron").parent().remove();
40                 $("#moremenuc").empty();
41             $("#printmenuc").empty();
42             yuiToolbar();
43          });
44
45         // YUI Toolbar Functions
46         function printx_window(print_type) {
47                 window.open("/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;print=" + print_type, "printwindow");
48                 return false;
49         }
50
51         function yuiToolbar() {
52             var printmenu = [
53                 { text: _("Print Page"), onclick: {fn: function(){printx_window("page")}}, },
54                 { text: _("Print Slip"), onclick: {fn: function(){printx_window("slip")}}, }
55             ];
56         
57                 var moremenu = [
58                         { text: _("Renew Patron"),  onclick: { fn: confirm_reregistration } },
59                         { text: _("Set Permissions"), url: "/cgi-bin/koha/members/member-flags.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->"<!-- TMPL_UNLESS NAME="CAN_user_permissions" -->, disabled: true<!-- /TMPL_UNLESS -->},
60                         { text: _("Delete"), onclick: { fn: confirm_deletion } },
61                         { text: _("Update Child to Adult Patron") , onclick: { fn: update_child }<!-- TMPL_UNLESS NAME="is_child" -->, disabled: true<!-- /TMPL_UNLESS -->}
62                 ];
63
64             new YAHOO.widget.Button({
65                 type: "menu",
66                 label: _("Print"),
67                 name: "printmenubutton",
68                 menu: printmenu,
69                 container: "printmenuc"
70             });   
71         
72             new YAHOO.widget.Button({
73                 type: "menu",
74                 label: _("More"),
75                 name: "moremenubutton",
76                 menu: moremenu,
77                 container: "moremenuc"
78             });
79
80             <!-- TMPL_IF name="adultborrower" -->new YAHOO.widget.Button("addchild");<!-- /TMPL_IF -->
81             new YAHOO.widget.Button("editpatron");
82             new YAHOO.widget.Button("addnote");
83             new YAHOO.widget.Button("changepassword");
84             new YAHOO.widget.Button("printslip");
85                 new YAHOO.widget.Button("printpage");
86             new YAHOO.widget.Button("renewpatron");              
87                 new YAHOO.widget.Button("patronflags");
88                 new YAHOO.widget.Button("deletepatron");
89                 new YAHOO.widget.Button("updatechild");
90         }
91
92         //]]>
93
94         </script>
95         <ul class="toolbar">
96         <!-- TMPL_IF NAME="category_type" -->
97             <!--TMPL_IF NAME="guarantor"-->
98                 <li><a id="editpatron" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;guarantorid=<!-- TMPL_VAR NAME="guarantorborrowernumber" -->&amp;category_type=<!-- TMPL_VAR NAME="category_type"-->">
99             <!--TMPL_ELSE-->
100             <li><a id="editpatron" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;category_type=<!-- TMPL_VAR NAME="category_type"-->">
101             <!--/TMPL_IF-->Edit</a></li>
102         <!-- TMPL_ELSE --> <!-- try with categorycode if no category_type -->
103             <!-- TMPL_IF NAME="categorycode" -->
104             <li><a id="editpatron" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;categorycode=<!-- TMPL_VAR NAME="categorycode"-->">Edit</a></li>
105             <!-- TMPL_ELSE --> <!-- if no categorycode, set category_type to A by default -->
106                 <li><a id="editpatron" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;category_type=A">Edit</a></li>
107             <!-- /TMPL_IF -->
108         <!-- /TMPL_IF -->
109         <!-- 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 -->
110 <!--    <li><a id="addnote" href="/cgi-bin/koha/members/addnotes.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Add Note</a></li> -->
111         <li><a id="changepassword" href="/cgi-bin/koha/members/member-password.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->">Change Password</a></li>
112         <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>
113         <li><a id="printslip" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;print=slip">Print Slip</a></li>
114         <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><!-- TMPL_IF NAME="CAN_user_permissions" --><li><a id="patronflags" href="/cgi-bin/koha/members/member-flags.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->">Set Permissions</a></li><!-- /TMPL_IF --><li><a id="deletepatron" href="javascript:confirm_deletion();">Delete</a></li>
115 </ul></div>