bug 3263: Staff Search Results Interface Changes
[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         
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
23         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');
24         }
25         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');
26         }
27 function confirm_deletion() {
28                 var count = <!-- TMPL_VAR NAME="count" -->;
29         var is_confirmed;
30         if (count>0){
31                     is_confirmed= alert(_('There are [ '+ count +' ] item(s) attached to this record \n You must delete all items before deleting this record.'));
32                     } else{
33                     is_confirmed= confirm(_('Are you sure you want to delete this record? '));
34         }
35
36      if (is_confirmed) {
37         if (count>0){
38         //      window.location="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->";
39                 } else {
40                         window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->";
41                 }
42         } else {
43                 return false;
44         }
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: _("Edit as New (Duplicate)"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;frameworkcode=&amp;op=duplicate" },
88                         { text: _("Delete Record"), onclick: {fn: confirm_deletion }<!-- TMPL_IF NAME="count" -->,id:'disabled'<!-- /TMPL_IF --> },
89             { text: _("Delete all Items"), onclick: {fn: confirm_items_deletion }<!-- TMPL_UNLESS NAME="count" -->,id:'disabled'<!-- /TMPL_IF --> }
90             ];
91                 
92                 var savemenu = [
93                 { text: _("MODS (XML)"), url: "/cgi-bin/koha/catalogue/export.pl?format=mods&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
94                 { text: _("Dublin Core (XML)"), url: "/cgi-bin/koha/catalogue/export.pl?format=dc&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
95                 { text: _("MARCXML"), url: "/cgi-bin/koha/catalogue/export.pl?format=marcxml&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
96                 { text: _("MARC (non-Unicode/MARC-8)"), url: "/cgi-bin/koha/catalogue/export.pl?format=marc8&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
97                 { text: _("MARC (Unicode/UTF-8)"), url: "/cgi-bin/koha/catalogue/export.pl?format=utf8&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" }
98                 ];
99
100             new YAHOO.widget.Button({
101                 type: "menu",
102                 label: _("Save"),
103                 name: "savemenubutton",
104                 menu: savemenu,
105                 container: "savemenuc"
106             });
107             
108                 new YAHOO.widget.Button({
109                 type: "menu",
110                 label: _("Edit"),
111                 name: "editmenubutton",
112                 menu: editmenu,
113                 container: "editmenuc"
114             });
115             
116                 new YAHOO.widget.Button({
117                 type: "menu",
118                 label: _("New"),
119                 name: "newmenubutton",
120                 menu: newmenu,
121                 container: "newmenuc"
122             });
123                 
124                 new YAHOO.widget.Button({
125                         id: "z3950search", 
126                         type: "button", 
127                         label: _("z39.50 Search"), 
128                         container: "z3950searchc",
129                         onclick: {fn:function(){PopupZ3950()}}
130                 });
131
132                 var addtoshelfButton = new YAHOO.widget.Button({
133                                             id: "addtoshelf", 
134                                             type: "button", 
135                                             label: _("Add to List"), 
136                                             container: "addtoshelfc",
137                                                                                         onclick: {fn: addToShelf }
138                                         });
139                                                                                 
140                 var printbiblioButton = new YAHOO.widget.Button({
141                                             id: "printbiblio", 
142                                             type: "button", 
143                                             label: _("Print"), 
144                                             container: "printbiblioc",
145                                                                                         onclick: {fn: printBiblio }
146                                         });
147
148             var newbiblioButton = new YAHOO.widget.Button("newbiblio");
149             var placeholdButton = new YAHOO.widget.Button("placehold");
150                 
151         }
152
153         //]]>
154         </script>
155         
156 <form method="post" name="f" id="f" action="/cgi-bin/koha/cataloguing/addbiblio.pl" onsubmit="return Check();">
157
158 <ul class="toolbar">
159         <!-- TMPL_IF NAME="CAN_user_editcatalogue" -->
160         <li id="newmenuc"><a id="newbiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl">New Record</a></li>
161         <li><a id="newitem" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">New Item</a></li>
162         <li><a id="newsub" href="/cgi-bin/koha/serials/subscription-add.pl?biblionumber_for_new_subscription=<!-- TMPL_VAR NAME="biblionumber" -->">New Subscription</a></li>
163         <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>
164         <li><a id="edititems" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Edit Items</a></li>
165         <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>
166         <li><a id="deletebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Delete</a></li>
167         <!-- /TMPL_IF -->       
168         <li id="addtoshelfc"><a id="addtoshelf" href="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Add to shelf</a></li>
169         <li id="printbiblioc"><a id="printbiblio" href="/cgi-bin/koha/catalogue/detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Print</a></li>
170         <!-- TMPL_IF NAME="CAN_user_reserveforothers" -->
171         <!-- TMPL_UNLESS name="bi_notforloan" -->
172         <!-- 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 --><!-- /TMPL_UNLESS -->
173         <!-- /TMPL_IF -->
174         <li id="z3950searchc"><input type="button" id="z3950search" value="z39.50 Search" onclick="PopupZ3950(); return false;" /></li>
175 </form>
176 </ul></div>
177