Bug 12150 - Use more javascript string formatting in intranet for translated strings.
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / members-toolbar.inc
1 <script type="text/javascript">
2 //<![CDATA[
3 $(document).ready(function(){
4     [% IF ( CAN_user_borrowers ) %]
5         $("#deletepatron").click(function(){
6                 confirm_deletion();
7                 $(".btn-group").removeClass("open");
8                 return false;
9             });
10         $("#renewpatron").click(function(){
11             confirm_reregistration();
12             $(".btn-group").removeClass("open");
13             return false;
14         });
15         [% IF ( is_child ) %]$("#updatechild").click(function(){
16             update_child();
17             $(".btn-group").removeClass("open");
18         });[% END %]
19     [% END %]
20     $("#updatechild, #patronflags, #renewpatron, #deletepatron").tooltip();
21     $("#exportcheckins").click(function(){
22         export_barcodes();
23         $(".btn-group").removeClass("open");
24         return false;
25     });
26     $("#printsummary").click(function(){
27         printx_window("page");
28         $(".btn-group").removeClass("open");
29         return false;
30     });
31     $("#printslip").click(function(){
32         printx_window("slip");
33         $(".btn-group").removeClass("open");
34         return false;
35     });
36     $("#printquickslip").click(function(){
37         printx_window("qslip");
38         $(".btn-group").removeClass("open");
39         return false;
40     });
41     $("#searchtohold").click(function(){
42         searchToHold();
43         return false;
44     })
45 });
46 function confirm_deletion() {
47     var is_confirmed = window.confirm(_("Are you sure you want to delete this patron? This cannot be undone."));
48     if (is_confirmed) {
49         window.location='/cgi-bin/koha/members/deletemem.pl?member=[% borrowernumber %]';
50     }
51 }
52
53 [% IF ( is_child ) %]function confirm_updatechild() {
54     var is_confirmed = window.confirm(_("Are you sure you want to update this child to an Adult category?  This cannot be undone."));
55     if (is_confirmed) {
56         window.location='/cgi-bin/koha/members/update-child.pl?op=update&borrowernumber=[% borrowernumber %]&catcode=[% catcode %]&catcode_multi=[% CATCODE_MULTI %]';
57     }
58 }
59
60 function update_child() {
61     [% IF ( CATCODE_MULTI ) %]
62         window.open('/cgi-bin/koha/members/update-child.pl?op=multi&borrowernumber=[% borrowernumber %]','UpdateChild','width=400,height=300,toolbar=no,scrollbars=yes,resizable=yes');
63     [% ELSE %]
64         confirm_updatechild();
65     [% END %]
66 }
67 [% END %]
68
69 function confirm_reregistration() {
70     var is_confirmed = window.confirm(_("Are you sure you want to renew this patron's registration?"));
71     if (is_confirmed) {
72     window.location = '/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;cardnumber=[% cardnumber %]&amp;desintation=[% destination %]&amp;reregistration=y';
73     }
74 }
75 function export_barcodes() {
76     window.open('/cgi-bin/koha/members/readingrec.pl?borrowernumber=[% borrowernumber %]&amp;op=export_barcodes');
77 }
78 var slip_re = /slip/;
79 function printx_window(print_type) {
80     var handler = print_type.match(slip_re) ? "printslip" : "moremember";
81     window.open("/cgi-bin/koha/members/" + handler + ".pl?borrowernumber=[% borrowernumber %]&amp;print=" + print_type, "printwindow");
82     return false;
83 }
84 function searchToHold(){
85     var date = new Date();
86     date.setTime(date.getTime() + (10 * 60 * 1000));
87     $.cookie("holdfor", "[% borrowernumber %]", { path: "/", expires: date });
88     location.href="/cgi-bin/koha/catalogue/search.pl";
89 }
90 //]]>
91 </script>
92
93 <div id="toolbar" class="btn-toolbar">
94     [% IF ( CAN_user_borrowers ) %]
95         [% IF ( category_type ) %]
96             [% IF ( guarantor ) %]
97                 <a id="editpatron" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;guarantorid=[% guarantorborrowernumber %]&amp;category_type=[% category_type %]">
98             [% ELSE %]
99                 <a id="editpatron" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;category_type=[% category_type %]">
100             [% END %]
101                 <i class="icon-pencil"></i> Edit</a>
102         [% ELSE %] <!-- try with categorycode if no category_type -->
103             [% IF ( categorycode ) %]
104                 <a id="editpatron" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]"><i class="icon-pencil"></i> Edit</a>
105             [% ELSE %] <!-- if no categorycode, set category_type to A by default -->
106                 <a id="editpatron" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;category_type=A"><i class="icon-pencil"></i> Edit</a>
107             [% END %]
108         [% END %]
109     [% END %]
110
111     [% IF ( CAN_user_borrowers ) %]
112         [% IF ( adultborrower AND activeBorrowerRelationship ) %]
113             <a id="addchild" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% borrowernumber %]&amp;category_type=C"><i class="icon-plus"></i> Add child</a>
114         [% END %]
115         [% IF ( CAN_user_borrowers ) %]
116             <a id="changepassword" class="btn btn-small" href="/cgi-bin/koha/members/member-password.pl?member=[% borrowernumber %]"><i class="icon-lock"></i> Change password</a>
117         [% END %]
118         <a id="duplicate" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=duplicate&amp;borrowernumber=[% borrowernumber %]&amp;category_type=[% category_type %]"><i class="icon-copy"></i>Duplicate</a>
119     [% END %]
120
121     <div class="btn-group">
122         <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="icon-print"></i> Print <span class="caret"></span></button>
123             <ul class="dropdown-menu">
124                 [% IF ( CAN_user_borrowers ) %]<li><a id="printsummary" href="#">Print summary</a></li>[% END %]
125                 <li><a id="printslip" href="#">Print slip</a></li>
126                 <li><a id="printquickslip" href="#">Print quick slip</a></li>
127             </ul>
128     </div>
129     <a id="searchtohold" class="btn btn-small" href="#"><i class="icon-search"></i> Search to hold</a>
130     <div class="btn-group">
131         <button class="btn btn-small dropdown-toggle" data-toggle="dropdown">More <span class="caret"></span></button>
132             <ul class="dropdown-menu">
133                 [% IF ( CAN_user_borrowers ) %]
134                     <li><a id="renewpatron" href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;cardnumber=[% cardnumber %]&amp;destination=[% destination %]&amp;reregistration=y">Renew patron</a></li>
135                 [% ELSE %]
136                     <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="You are not authorized to renew patrons" id="renewpatron" href="#">Renew patron</a></li>
137                 [% END %]
138                 [% IF ( CAN_user_permissions ) %]
139                     <li><a id="patronflags" href="/cgi-bin/koha/members/member-flags.pl?member=[% borrowernumber %]">Set permissions</a></li>
140                 [% ELSE %]
141                     <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="You are not authorized to set permissions" id="patronflags" href="#">Set permissions</a></li>
142                 [% END %]
143                 [% IF ( CAN_user_borrowers ) %]
144                     <li><a id="deletepatron" href="#">Delete</a></li>
145                 [% ELSE %]
146                     <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="You are not authorized to delete patrons" id="deletepatron" href="#">Delete</a></li>
147                 [% END %]
148                 [% IF ( is_child ) %]
149                     <li><a id="updatechild" href="#">Update child to adult patron</a></li>
150                 [% ELSE %]
151                     <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="Patron is an adult" id="updatechild" href="#">Update child to adult patron</a></li></li>
152                 [% END %]
153                 <li><a id="exportcheckins" href="#">Export today's checked in barcodes</a></li>
154             </ul>
155     </div>
156 </div>