Merge branch 'translation' of git://git.workbuffer.org/git/koha into master
[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 function confirm_deletion() {
29                 var count = <!-- TMPL_VAR NAME="count" -->;
30         var is_confirmed;
31         if (count>0){
32                     is_confirmed= alert(_('There are [ '+ count +' ] item(s) attached to this record \n You must delete all items before deleting this record.'));
33                     } else{
34                     is_confirmed= confirm(_('Are you sure you want to delete this record? '));
35         }
36
37      if (is_confirmed) {
38         if (count>0){
39         //      window.location="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->";
40                 } else {
41                         window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->";
42                 }
43         } else {
44                 return false;
45         }
46 }
47 function confirm_items_deletion() {
48         var count = <!-- TMPL_VAR NAME="count" -->;
49         if(count > 0){
50             if(confirm(_('Are you sure you want to delete the ' + count + ' attached items? '))){
51                 window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->";
52             }else{
53                 return false;
54             }
55                 }
56 }
57         // prepare DOM for YUI Toolbar
58
59          $(document).ready(function() {
60             $("#edititems").parent().remove();
61             $("#duplicatebiblio").parent().remove();
62                 $("#deletebiblio").parent().remove();
63                 $("#newitem").parent().remove();
64                 $("#newsub").parent().remove();
65             $("#editmenuc").empty();
66                 $("#newmenuc").empty();
67                 $("#addtoshelfc").empty();
68                 $("#printbiblioc").empty();
69                 $("#export").remove();
70                 $("#addtoshelfc").before("<li id=\"savemenuc\"><\/li>");
71                 $("#z3950searchc").empty();
72             yuiToolbar();
73          });
74
75         // YUI Toolbar Functions
76
77         function yuiToolbar() {
78                 var newmenu = [
79                         {text: _("New Record"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl" },
80                         {text: _("New Item"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->#additema" },
81                         {text: _("New Subscription"), url: "/cgi-bin/koha/serials/subscription-add.pl?biblionumber_for_new_subscription=<!-- TMPL_VAR NAME="biblionumber" -->"},
82                 ];
83         
84             var editmenu = [
85                 { text: _("Edit Record"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;frameworkcode=&amp;op=" },
86                 { text: _("Edit Items"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" },
87                 { text: _("Attach Item"), url: "/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" },
88                 { text: _("Edit as New (Duplicate)"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;frameworkcode=&amp;op=duplicate" },
89                         { text: _("Delete Record"), onclick: {fn: confirm_deletion }<!-- TMPL_IF NAME="count" -->,id:'disabled'<!-- /TMPL_IF --> },
90             { text: _("Delete all Items"), onclick: {fn: confirm_items_deletion }<!-- TMPL_UNLESS NAME="count" -->,id:'disabled'<!-- /TMPL_UNLESS --> }
91             ];
92                 
93                 var savemenu = [
94                 { text: _("MODS (XML)"), url: "/cgi-bin/koha/catalogue/export.pl?format=mods&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
95                 { text: _("Dublin Core (XML)"), url: "/cgi-bin/koha/catalogue/export.pl?format=dc&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
96                 { text: _("MARCXML"), url: "/cgi-bin/koha/catalogue/export.pl?format=marcxml&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
97                 { text: _("MARC (non-Unicode/MARC-8)"), url: "/cgi-bin/koha/catalogue/export.pl?format=marc8&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
98                 { text: _("MARC (Unicode/UTF-8)"), url: "/cgi-bin/koha/catalogue/export.pl?format=utf8&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" }
99                 ];
100
101                 var addtomenu = [
102                 { text: _("Cart"), onclick: { fn: addToCart } },
103                 { text: _("List"),  onclick: { fn: addToShelf } }
104                 ];
105
106             new YAHOO.widget.Button({
107                 type: "menu",
108                 label: _("Save"),
109                 name: "savemenubutton",
110                 menu: savemenu,
111                 container: "savemenuc"
112             });
113
114                 new YAHOO.widget.Button({
115                 type: "menu",
116                 label: _("Edit"),
117                 name: "editmenubutton",
118                 menu: editmenu,
119                 container: "editmenuc"
120             });
121
122                 new YAHOO.widget.Button({
123                 type: "menu",
124                 label: _("New"),
125                 name: "newmenubutton",
126                 menu: newmenu,
127                 container: "newmenuc"
128             });
129
130                 new YAHOO.widget.Button({
131                 type: "menu",
132                 label: _("Add to"),
133                 name: "addtomenubutton",
134                 menu: addtomenu,
135                 container: "addtoshelfc"
136             });
137
138                 new YAHOO.widget.Button({
139                         id: "z3950search", 
140                         type: "button", 
141                         label: _("Z39.50 Search"), 
142                         container: "z3950searchc",
143                         onclick: {fn:function(){PopupZ3950()}}
144                 });
145
146                 var printbiblioButton = new YAHOO.widget.Button({
147                                             id: "printbiblio", 
148                                             type: "button", 
149                                             label: _("Print"), 
150                                             container: "printbiblioc",
151                                                                                         onclick: {fn: printBiblio }
152                                         });
153
154             var newbiblioButton = new YAHOO.widget.Button("newbiblio");
155             var placeholdButton = new YAHOO.widget.Button("placehold");
156                 
157         }
158
159         //]]>
160         </script>
161         
162 <form method="post" name="f" id="f" action="/cgi-bin/koha/cataloguing/addbiblio.pl" onsubmit="return Check();">
163
164 <ul class="toolbar">
165         <!-- TMPL_IF NAME="CAN_user_editcatalogue_edit_catalogue" -->
166         <li id="newmenuc"><a id="newbiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl">New Record</a></li>
167         <li><a id="newitem" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">New Item</a></li>
168         <li><a id="newsub" href="/cgi-bin/koha/serials/subscription-add.pl?biblionumber_for_new_subscription=<!-- TMPL_VAR NAME="biblionumber" -->">New Subscription</a></li>
169         <li id="editmenuc"><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>
170         <li><a id="edititems" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Edit Items</a></li>
171         <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>
172         <li><a id="deletebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Delete</a></li>
173         <!-- /TMPL_IF -->       
174         <li id="addtoshelfc"><a id="addtoshelf" href="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Add to shelf</a></li>
175         <li id="printbiblioc"><a id="printbiblio" href="/cgi-bin/koha/catalogue/detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Print</a></li>
176         <!-- TMPL_IF NAME="CAN_user_reserveforothers" -->
177         <!-- 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 -->
178         <!-- /TMPL_IF -->
179         <!-- 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 -->
180     </ul>
181 </form>
182 </div>
183