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         // prepare DOM for YUI Toolbar
48
49          $(document).ready(function() {
50             $("#edititems").parent().remove();
51             $("#duplicatebiblio").parent().remove();
52                 $("#deletebiblio").parent().remove();
53                 $("#newitem").parent().remove();
54                 $("#newsub").parent().remove();
55             $("#editmenuc").empty();
56                 $("#newmenuc").empty();
57                 $("#addtoshelfc").empty();
58                 $("#printbiblioc").empty();
59                 $("#export").remove();
60                 $("#addtoshelfc").before("<li id=\"savemenuc\"><\/li>");
61                 $("#z3950searchc").empty();
62             yuiToolbar();
63          });
64
65         // YUI Toolbar Functions
66
67         function yuiToolbar() {
68                 var newmenu = [
69                         {text: _("New Record"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl" },
70                         {text: _("New Item"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->#additema" },
71                         {text: _("New Subscription"), url: "/cgi-bin/koha/serials/subscription-add.pl?biblionumber_for_new_subscription=<!-- TMPL_VAR NAME="biblionumber" -->"},
72                 ];
73         
74             var editmenu = [
75                 { text: _("Edit Record"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;frameworkcode=&amp;op=" },
76                 { text: _("Edit Items"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" },
77                 { text: _("Edit as New (Duplicate)"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;frameworkcode=&amp;op=duplicate" },
78                         { text: _("Delete Record"), onclick: {fn: confirm_deletion }<!-- TMPL_IF NAME="count" -->,id:'disabled'<!-- /TMPL_IF --> }
79             ];
80                 
81                 var savemenu = [
82                 { text: _("MODS (XML)"), url: "/cgi-bin/koha/catalogue/export.pl?format=mods&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
83                 { text: _("Dublin Core (XML)"), url: "/cgi-bin/koha/catalogue/export.pl?format=dc&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
84                 { text: _("MARCXML"), url: "/cgi-bin/koha/catalogue/export.pl?format=marcxml&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
85                 { text: _("MARC (non-Unicode/MARC-8)"), url: "/cgi-bin/koha/catalogue/export.pl?format=marc8&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
86                 { text: _("MARC (Unicode/UTF-8)"), url: "/cgi-bin/koha/catalogue/export.pl?format=utf8&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" }
87                 ];
88
89             new YAHOO.widget.Button({
90                 type: "menu",
91                 label: _("Save"),
92                 name: "savemenubutton",
93                 menu: savemenu,
94                 container: "savemenuc"
95             });
96             
97                 new YAHOO.widget.Button({
98                 type: "menu",
99                 label: _("Edit"),
100                 name: "editmenubutton",
101                 menu: editmenu,
102                 container: "editmenuc"
103             });
104             
105                 new YAHOO.widget.Button({
106                 type: "menu",
107                 label: _("New"),
108                 name: "newmenubutton",
109                 menu: newmenu,
110                 container: "newmenuc"
111             });
112                 
113                 new YAHOO.widget.Button({
114                         id: "z3950search", 
115                         type: "button", 
116                         label: _("z39.50 Search"), 
117                         container: "z3950searchc",
118                         onclick: {fn:function(){PopupZ3950()}}
119                 });
120
121                 var addtoshelfButton = new YAHOO.widget.Button({
122                                             id: "addtoshelf", 
123                                             type: "button", 
124                                             label: _("Add to List"), 
125                                             container: "addtoshelfc",
126                                                                                         onclick: {fn: addToShelf }
127                                         });
128                                                                                 
129                 var printbiblioButton = new YAHOO.widget.Button({
130                                             id: "printbiblio", 
131                                             type: "button", 
132                                             label: _("Print"), 
133                                             container: "printbiblioc",
134                                                                                         onclick: {fn: printBiblio }
135                                         });
136
137             var newbiblioButton = new YAHOO.widget.Button("newbiblio");
138             var placeholdButton = new YAHOO.widget.Button("placehold");
139                 
140         }
141
142         //]]>
143         </script>
144         
145 <form method="post" name="f" id="f" action="/cgi-bin/koha/cataloguing/addbiblio.pl" onsubmit="return Check();">
146
147 <ul class="toolbar">
148         <!-- TMPL_IF NAME="CAN_user_editcatalogue" -->
149         <li id="newmenuc"><a id="newbiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl">New Record</a></li>
150         <li><a id="newitem" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">New Item</a></li>
151         <li><a id="newsub" href="/cgi-bin/koha/serials/subscription-add.pl?biblionumber_for_new_subscription=<!-- TMPL_VAR NAME="biblionumber" -->">New Subscription</a></li>
152         <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>
153         <li><a id="edititems" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Edit Items</a></li>
154         <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>
155         <li><a id="deletebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Delete</a></li>
156         <!-- /TMPL_IF -->       
157         <li id="addtoshelfc"><a id="addtoshelf" href="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Add to shelf</a></li>
158         <li id="printbiblioc"><a id="printbiblio" href="/cgi-bin/koha/catalogue/detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Print</a></li>
159         <!-- TMPL_IF NAME="CAN_user_reserveforothers" -->
160         <!-- TMPL_UNLESS name="bi_notforloan" -->
161         <!-- 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 -->
162         <!-- /TMPL_IF -->
163         <li id="z3950searchc"><input type="button" id="z3950search" value="z39.50 Search" onclick="PopupZ3950(); return false;" /></li>
164 </form>
165 </ul></div>
166