Fixing and refining toolbars, including fixes for Bug 1509.
[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=document.form.borrowernumber.value; 
8    
9     if (is_confirmed) {
10             window.location='/cgi-bin/koha/members/deletemem.pl?member='+borrowernumbervalue+'';
11     }
12 }
13
14 function confirm_reregistration() {
15     var is_confirmed = window.confirm('Are you sure you want to renew this patron\'s registration?');
16     var borrowernumbervalue1=document.form.borrowernumber.value;
17     if (is_confirmed) {
18     window.location='/cgi-bin/koha/members/moremember.pl?reregistration=y&borrowernumber='+borrowernumbervalue1+'';
19     }
20 }
21
22         // prepare DOM for YUI Toolbar
23
24          $(document).ready(function() {
25             $("#printslip").parent().remove();
26                 $("#patronflags").parent().remove();
27                 $("#deletepatron").parent().remove();
28                 $("#moremenuc").empty();
29             $("#printmenuc").empty();
30             yuiToolbar();
31          });
32
33         // YUI Toolbar Functions
34
35         function yuiToolbar() {
36             var printmenu = [
37                 { text: "Print Page", url: "/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;print=page" },
38                 { text: "Print Slip", url: "/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;print=slip" }
39             ];
40         
41                 var moremenu = [
42                         { text: "Renew Patron",  onclick: { fn: confirm_reregistration } },
43                         { text: "Set Permissions", url: "/cgi-bin/koha/members/member-flags.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->"},
44                         { text: "Delete", onclick: { fn: confirm_deletion } },
45                 ]
46
47             new YAHOO.widget.Button({
48                 type: "menu",
49                 label: "Print",
50                 name: "printmenubutton",
51                 menu: printmenu,
52                 container: "printmenuc"
53             });   
54         
55             new YAHOO.widget.Button({
56                 type: "menu",
57                 label: "More",
58                 name: "moremenubutton",
59                 menu: moremenu,
60                 container: "moremenuc"
61             });
62         
63             new YAHOO.widget.Button("checkout");
64             new YAHOO.widget.Button("addchild");
65             new YAHOO.widget.Button("editpatron");
66             new YAHOO.widget.Button("addnote");
67             new YAHOO.widget.Button("changepassword");
68             new YAHOO.widget.Button("printslilp");
69                 new YAHOO.widget.Button("printpage");
70             new YAHOO.widget.Button("renewpatron");              
71                 new YAHOO.widget.Button("patronflags");
72                 new YAHOO.widget.Button("deletepatron");
73         }
74
75         //]]>
76         </script>
77         <ul class="toolbar">
78         <li><a id="checkout" href="/cgi-bin/koha/circ/circulation.pl?findborrower=<!-- TMPL_VAR NAME="cardnumber" -->">Check Out</a></li>
79         <!-- 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 -->
80         <!-- TMPL_IF NAME="category_type" -->
81             <!--TMPL_IF NAME="guarantor"-->
82                 <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"-->">
83             <!--TMPL_ELSE-->
84             <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"-->">
85             <!--/TMPL_IF-->Edit</a></li>
86         <!-- TMPL_ELSE --> <!-- try with categorycode if no category_type -->
87             <!-- TMPL_IF NAME="categorycode" -->
88             <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>
89             <!-- TMPL_ELSE --> <!-- if no categorycode, set category_type to A by default -->
90                 <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>
91             <!-- /TMPL_IF -->
92         <!-- /TMPL_IF -->
93         <li><a id="addnote" href="/cgi-bin/koha/members/addnotes.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Add Note</a></li>
94         <li><a id="changepassword" href="/cgi-bin/koha/members/member-password.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->">Change Password</a></li>
95         <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>
96         <li><a id="printslip" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;print=slip">Print Slip</a></li>
97         <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_permission" --><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>
98 </ul></div>