Merge branch 'new/bug_5277' into kcmaster
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / cat-toolbar.inc
1 <div id="toolbar">
2         
3         <script type="text/javascript">
4         //<![CDATA[
5         <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_catalogue" -->
6         /* this function open a popup to search on z3950 server.  */
7         function PopupZ3950() {
8                 var strQuery = GetZ3950Terms();
9                 if(strQuery){
10                         window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
11                 } 
12         }
13
14         /* provide Z3950 search points */
15         function GetZ3950Terms(){
16                 var strQuery="&frameworkcode=";
17                 <!-- TMPL_LOOP NAME='z3950_search_params' -->
18                         strQuery += "&" + "<!-- TMPL_VAR NAME="name" -->" + "=" + "<!-- TMPL_VAR NAME="encvalue" -->";
19                 <!-- /TMPL_LOOP -->
20                 return strQuery;
21         }
22         <!-- /TMPL_IF -->
23         function addToCart() { addRecord('<!-- TMPL_VAR NAME="biblionumber" -->'); }
24         function addToShelf() { window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->','Add_to_virtualshelf','width=500,height=400,toolbar=false,scrollbars=yes');
25         }
26         function printBiblio() {window.open('/cgi-bin/koha/catalogue/detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->','Print_Biblio','width=700,height=500,toolbar=false,scrollbars=yes');
27         }
28 <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_catalogue" -->
29 function confirm_deletion() {
30                 var count = <!-- TMPL_VAR NAME="count" -->;
31         var is_confirmed;
32         if (count>0){
33                     is_confirmed= alert(_('There are [ '+ count +' ] item(s) attached to this record \n You must delete all items before deleting this record.'));
34                     } else{
35                     is_confirmed= confirm(_('Are you sure you want to delete this record? '));
36         }
37
38      if (is_confirmed) {
39         if (count>0){
40         //      window.location="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->";
41                 } else {
42                         window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->";
43                 }
44         } else {
45                 return false;
46         }
47 }
48 <!-- /TMPL_IF -->
49 <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_items" -->
50 function confirm_items_deletion() {
51         var count = <!-- TMPL_VAR NAME="count" -->;
52         if(count > 0){
53             if(confirm(_('Are you sure you want to delete the ' + count + ' attached items? '))){
54                 window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->";
55             }else{
56                 return false;
57             }
58                 }
59 }
60 <!-- /TMPL_IF -->
61         // prepare DOM for YUI Toolbar
62
63          $(document).ready(function() {
64             <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_items" -->$("#edititems").parent().remove();
65                 $("#newitem").parent().remove();<!-- /TMPL_IF -->
66             <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_catalogue" -->$("#duplicatebiblio").parent().remove();
67                 $("#deletebiblio").parent().remove();
68                 $("#z3950searchc").empty();<!-- /TMPL_IF -->
69                 <!-- TMPL_IF NAME="CAN_user_serials_create_subscription" -->$("#newsub").parent().remove();<!-- /TMPL_IF -->
70             $("#newbiblio").parent().remove();
71                 $("#editbiblio").parent().remove();
72                 $("#addtoshelf").parent().remove();
73                 $("#printbiblio").parent().remove();
74                 $("#placehold").parent().remove();
75                 $("#export").remove();
76          });
77
78         YAHOO.util.Event.onContentReady("cattoolbar", function () {
79                 //      Menu for new record, new item, new subscription
80                 var newmenu = [
81                         <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_catalogue" -->{text: _("New Record"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl" },<!-- /TMPL_IF -->
82                         <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_items" -->{text: _("New Item"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->#additema" },<!-- /TMPL_IF -->
83                         <!-- TMPL_IF NAME="CAN_user_serials_create_subscription" -->
84                         {text: _("New Subscription"), url: "/cgi-bin/koha/serials/subscription-add.pl?biblionumber_for_new_subscription=<!-- TMPL_VAR NAME="biblionumber" -->"},<!-- /TMPL_IF -->
85                 ];
86                 if(newmenu.length){
87                         new YAHOO.widget.Button({
88                                 type: "menu",
89                                 label: _("New"),
90                                 id: "newmenuc",
91                                 name: "newmenubutton",
92                                 menu: newmenu,
93                                 container: this
94                          });
95                  }
96             var editmenu = [
97                 <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_catalogue" -->{ text: _("Edit Record"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;frameworkcode=&amp;op=" },<!-- /TMPL_IF -->
98                 <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_items" -->{ text: _("Edit Items"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" },<!-- /TMPL_IF -->
99                 <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_items" -->{ text: _("Attach Item"), url: "/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" },<!-- /TMPL_IF -->
100                 <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_catalogue" -->{ text: _("Edit as New (Duplicate)"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;frameworkcode=&amp;op=duplicate" },<!-- /TMPL_IF -->
101                         <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_catalogue" -->{ text: _("Delete Record"), onclick: {fn: confirm_deletion }<!-- TMPL_IF NAME="count" -->,id:'disabled'<!-- /TMPL_IF --> },<!-- /TMPL_IF -->
102                 <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_items" -->{ text: _("Delete all Items"), onclick: {fn: confirm_items_deletion } }<!-- /TMPL_IF -->
103             ];
104                 if(editmenu.length){
105                         new YAHOO.widget.Button({
106                                 type: "menu",
107                                 label: _("Edit"),
108                                 id: "editmenuc",
109                                 name: "editmenubutton",
110                                 menu: editmenu,
111                                 container: this
112                          });
113                 }
114                 var savemenu = [
115                         { text: _("MODS (XML)"), url: "/cgi-bin/koha/catalogue/export.pl?format=mods&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
116                         { text: _("Dublin Core (XML)"), url: "/cgi-bin/koha/catalogue/export.pl?format=dc&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
117                         { text: _("MARCXML"), url: "/cgi-bin/koha/catalogue/export.pl?format=marcxml&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
118                         { text: _("MARC (non-Unicode/MARC-8)"), url: "/cgi-bin/koha/catalogue/export.pl?format=marc8&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
119                         { text: _("MARC (Unicode/UTF-8)"), url: "/cgi-bin/koha/catalogue/export.pl?format=utf8&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" }
120                 ];
121
122             new YAHOO.widget.Button({
123                 type: "menu",
124                 label: _("Save"),
125                 id: "savemenuc",
126                 name: "savemenubutton",
127                 menu: savemenu,
128                 container: this
129             });
130
131             var addtomenu = [
132                         { text: _("Cart"), onclick: { fn: addToCart } },
133                         { text: _("List"),  onclick: { fn: addToShelf } }
134                 ];
135
136                 new YAHOO.widget.Button({
137                 type: "menu",
138                 label: _("Add to"),
139                 name: "addtomenubutton",
140                 menu: addtomenu,
141                 container: this
142             });
143
144                 new YAHOO.widget.Button({
145                 id: "printbiblio",
146                 type: "button",
147                 label: _("Print"),
148                 container: this,
149                         onclick: {fn: printBiblio }
150                 });
151
152             new YAHOO.widget.Button({
153                         id: "placehold",
154                         type: "link",
155                         label: _("Place hold"),
156                         container: this,
157                         href: "/cgi-bin/koha/reserve/request.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"
158              });
159             <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_catalogue" -->
160                 new YAHOO.widget.Button({
161                         id: "z3950search",
162                         type: "button", 
163                         label: _("Z39.50 Search"),
164                         container: this,
165                         onclick: {fn:function(){PopupZ3950()}}
166                 });
167                 <!-- /TMPL_IF -->
168         });
169         //]]>
170         </script>
171         
172 <form method="post" name="f" id="f" action="/cgi-bin/koha/cataloguing/addbiblio.pl" onsubmit="return Check();">
173
174 <ul class="toolbar" id="cattoolbar">
175
176         <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_catalogue" -->
177         <li><a id="newbiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl">New Record</a></li>
178         <!-- /TMPL_IF -->
179         <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_items" -->
180         <li><a id="newitem" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">New Item</a></li>
181         <!-- /TMPL_IF -->
182         <!-- TMPL_IF NAME="CAN_user_serials_create_subscription" -->
183         <li><a id="newsub" href="/cgi-bin/koha/serials/subscription-add.pl?biblionumber_for_new_subscription=<!-- TMPL_VAR NAME="biblionumber" -->">New Subscription</a></li>
184         <!-- /TMPL_IF -->
185
186         <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_catalogue" -->
187         <li><a id="editbiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;frameworkcode=<!--TMPL_VAR Name="current_framework" -->&amp;op=">Edit Record</a></li>
188         <!-- /TMPL_IF -->
189         <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_items" -->
190         <li><a id="edititems" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Edit Items</a></li>
191         <!-- /TMPL_IF -->
192         <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_catalogue" -->
193         <li><a id="duplicatebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;frameworkcode=<!--TMPL_VAR Name="current_framework" -->&amp;op=duplicate">Duplicate Record</a></li>
194         <!-- /TMPL_IF -->
195         <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_catalogue" -->
196         <li><a id="deletebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Delete</a></li>
197         <!-- /TMPL_IF -->       
198
199         <li><a id="addtoshelf" href="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Add to shelf</a></li>
200         <li><a id="printbiblio" href="/cgi-bin/koha/catalogue/detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Print</a></li>
201         <!-- TMPL_IF NAME="CAN_user_reserveforothers" -->
202         <!-- TMPL_UNLESS NAME="norequests" --><li><a id="placehold" href="/cgi-bin/koha/reserve/request.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a></li><!-- /TMPL_UNLESS -->
203         <!-- /TMPL_IF -->
204         <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_catalogue" --><li id="z3950searchc"><input type="button" id="z3950search" value="Z39.50 Search" onclick="PopupZ3950(); return false;" /></li><!-- /TMPL_IF -->
205     </ul>
206 </form>
207 </div>
208