Koha/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc

117 lines
5.6 KiB
PHP

<div id="toolbar">
<script type="text/javascript">
//<![CDATA[
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');
}
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');
}
function confirm_deletion() {
var count = <!-- TMPL_VAR NAME="count" -->;
var is_confirmed;
if (count>0){
is_confirmed= alert(_('There are [ '+ count +' ] item(s) attached to this record \n You must delete all items before deleting this record.'));
} else{
is_confirmed= confirm(_('Are you sure you want to delete this record? '));
}
if (is_confirmed) {
if (count>0){
// window.location="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->";
} else {
window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->";
}
} else {
return false;
}
}
// prepare DOM for YUI Toolbar
$(document).ready(function() {
$("#edititems").parent().remove();
$("#duplicatebiblio").parent().remove();
$("#deletebiblio").parent().remove();
$("#editmenuc").empty();
$("#addtoshelfc").empty();
$("#printbiblioc").empty();
$("#export").remove();
$("#addtoshelfc").before("<li id=\"savemenuc\"></li>");
yuiToolbar();
});
// YUI Toolbar Functions
function yuiToolbar() {
var editmenu = [
{ text: "Edit Record", url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;frameworkcode=&amp;op=" },
{ text: "Edit Items", url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" },
{ text: "Edit as New (Duplicate)", url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;frameworkcode=&amp;op=duplicate" },
{ text: "Delete Record", <!-- TMPL_IF NAME="count" -->disabled: true, <!-- /TMPL_IF --> onclick: {fn: confirm_deletion }}
];
var savemenu = [
{ text: "MODS (XML)", url: "/cgi-bin/koha/catalogue/export.pl?format=mods&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
{ text: "Dublin Core (XML)", url: "/cgi-bin/koha/catalogue/export.pl?format=dc&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
{ text: "MARCXML", url: "/cgi-bin/koha/catalogue/export.pl?format=marcxml&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
{ text: "MARC (non-Unicode/MARC-8)", url: "/cgi-bin/koha/catalogue/export.pl?format=marc8&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
{ text: "MARC (Unicode/UTF-8)", url: "/cgi-bin/koha/catalogue/export.pl?format=utf8&op=export&bib=<!-- TMPL_VAR NAME="biblionumber" -->" },
];
new YAHOO.widget.Button({
type: "menu",
label: "Save",
name: "savemenubutton",
menu: savemenu,
container: "savemenuc"
});
new YAHOO.widget.Button({
type: "menu",
label: "Edit",
name: "editmenubutton",
menu: editmenu,
container: "editmenuc",
});
var addtoshelfButton = new YAHOO.widget.Button({
id: "addtoshelf",
type: "button",
label: "Add to Shelf",
container: "addtoshelfc",
onclick: {fn: addToShelf }
});
var printbiblioButton = new YAHOO.widget.Button({
id: "printbiblio",
type: "button",
label: "Print",
container: "printbiblioc",
onclick: {fn: printBiblio }
});
var addbiblioButton = new YAHOO.widget.Button("addbiblio");
var placeholdButton = new YAHOO.widget.Button("placehold");
}
//]]>
</script>
<ul class="toolbar">
<li><a id="addbiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl">New</a></li>
<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>
<li><a id="edititems" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Edit Items</a></li>
<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>
<li><a id="deletebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Delete</a></li>
<li id="addtoshelfc"><a id="addtoshelf" href="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Add to shelf</a></li>
<li id="printbiblioc"><a id="printbiblio" href="/cgi-bin/koha/catalogue/detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Print</a></li>
<!-- TMPL_UNLESS name="bi_notforloan" -->
<!-- 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 -->
</ul></div>