From 2091f7567dfb8d58566ee15b4cec2f6ead3b475a Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 23 Jul 2010 14:08:26 -0400 Subject: [PATCH] Fix for Bug 2170, Adding 'edititems' user-permission This patch follows up on the addition of the 'edititems' permission by adding a check of the new permission to places in the interface which link to the edit item screen. The catalogue toolbar had to be extensively re-worked in order to ensure that the "New" and "Edit" menus would appear (or not) whether or not edit_catalogue, edit_items, or create_subscription permissions are on. --- .../intranet-tmpl/prog/en/css/staff-global.css | 6 +- .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 173 +++++++++++--------- .../prog/en/modules/catalogue/moredetail.tmpl | 2 +- .../prog/en/modules/cataloguing/addbooks.tmpl | 16 +-- .../prog/en/modules/tools/batchMod-del.tmpl | 2 +- .../prog/en/modules/tools/batchMod-edit.tmpl | 2 +- 6 files changed, 112 insertions(+), 89 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css index 13ac2c7..1e1a502 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -432,6 +432,9 @@ ul.toolbar { padding-left : 0; } +ul.toolbar button { + padding-bottom : 2px; +} .yui-menu-button { } @@ -916,7 +919,8 @@ fieldset.rows .inputnote { background-repeat : no-repeat; } -#placehold a { +#placehold a, +#placehold button { padding-left : 34px; background-image: url("../../img/toolbar-hold.gif"); background-position : center left; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc index eda7985..8d4e02e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -25,6 +25,7 @@ } function printBiblio() {window.open('/cgi-bin/koha/catalogue/detailprint.pl?biblionumber=','Print_Biblio','width=700,height=500,toolbar=false,scrollbars=yes'); } + function confirm_deletion() { var count = ; var is_confirmed; @@ -44,6 +45,8 @@ function confirm_deletion() { return false; } } + + function confirm_items_deletion() { var count = ; if(count > 0){ @@ -54,125 +57,147 @@ function confirm_items_deletion() { } } } + // prepare DOM for YUI Toolbar $(document).ready(function() { - $("#edititems").parent().remove(); - $("#duplicatebiblio").parent().remove(); + $("#edititems").parent().remove(); + $("#newitem").parent().remove(); + $("#duplicatebiblio").parent().remove(); $("#deletebiblio").parent().remove(); - $("#newitem").parent().remove(); - $("#newsub").parent().remove(); - $("#editmenuc").empty(); - $("#newmenuc").empty(); - $("#addtoshelfc").empty(); - $("#printbiblioc").empty(); + $("#z3950searchc").empty(); + $("#newsub").parent().remove(); + $("#newbiblio").parent().remove(); + $("#editbiblio").parent().remove(); + $("#addtoshelf").parent().remove(); + $("#printbiblio").parent().remove(); + $("#placehold").parent().remove(); $("#export").remove(); - $("#addtoshelfc").before("
  • <\/li>"); - $("#z3950searchc").empty(); - yuiToolbar(); }); - // YUI Toolbar Functions - - function yuiToolbar() { + YAHOO.util.Event.onContentReady("cattoolbar", function () { + // Menu for new record, new item, new subscription var newmenu = [ - {text: _("New Record"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl" }, - {text: _("New Item"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=#additema" }, - {text: _("New Subscription"), url: "/cgi-bin/koha/serials/subscription-add.pl?biblionumber_for_new_subscription="}, + {text: _("New Record"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl" }, + {text: _("New Item"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=#additema" }, + + {text: _("New Subscription"), url: "/cgi-bin/koha/serials/subscription-add.pl?biblionumber_for_new_subscription="}, ]; - + if(newmenu.length){ + new YAHOO.widget.Button({ + type: "menu", + label: _("New"), + id: "newmenuc", + name: "newmenubutton", + menu: newmenu, + container: this + }); + } var editmenu = [ - { text: _("Edit Record"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=&frameworkcode=&op=" }, - { text: _("Edit Items"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=" }, - { text: _("Attach Item"), url: "/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=" }, - { text: _("Edit as New (Duplicate)"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=&frameworkcode=&op=duplicate" }, - { text: _("Delete Record"), onclick: {fn: confirm_deletion },id:'disabled' }, - { text: _("Delete all Items"), onclick: {fn: confirm_items_deletion } } + { text: _("Edit Record"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=&frameworkcode=&op=" }, + { text: _("Edit Items"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=" }, + { text: _("Attach Item"), url: "/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=" }, + { text: _("Edit as New (Duplicate)"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=&frameworkcode=&op=duplicate" }, + { text: _("Delete Record"), onclick: {fn: confirm_deletion },id:'disabled' }, + { text: _("Delete all Items"), onclick: {fn: confirm_items_deletion } } ]; - + if(editmenu.length){ + new YAHOO.widget.Button({ + type: "menu", + label: _("Edit"), + id: "editmenuc", + name: "editmenubutton", + menu: editmenu, + container: this + }); + } var savemenu = [ - { text: _("MODS (XML)"), url: "/cgi-bin/koha/catalogue/export.pl?format=mods&op=export&bib=" }, - { text: _("Dublin Core (XML)"), url: "/cgi-bin/koha/catalogue/export.pl?format=dc&op=export&bib=" }, - { text: _("MARCXML"), url: "/cgi-bin/koha/catalogue/export.pl?format=marcxml&op=export&bib=" }, - { text: _("MARC (non-Unicode/MARC-8)"), url: "/cgi-bin/koha/catalogue/export.pl?format=marc8&op=export&bib=" }, - { text: _("MARC (Unicode/UTF-8)"), url: "/cgi-bin/koha/catalogue/export.pl?format=utf8&op=export&bib=" } - ]; - - var addtomenu = [ - { text: _("Cart"), onclick: { fn: addToCart } }, - { text: _("List"), onclick: { fn: addToShelf } } + { text: _("MODS (XML)"), url: "/cgi-bin/koha/catalogue/export.pl?format=mods&op=export&bib=" }, + { text: _("Dublin Core (XML)"), url: "/cgi-bin/koha/catalogue/export.pl?format=dc&op=export&bib=" }, + { text: _("MARCXML"), url: "/cgi-bin/koha/catalogue/export.pl?format=marcxml&op=export&bib=" }, + { text: _("MARC (non-Unicode/MARC-8)"), url: "/cgi-bin/koha/catalogue/export.pl?format=marc8&op=export&bib=" }, + { text: _("MARC (Unicode/UTF-8)"), url: "/cgi-bin/koha/catalogue/export.pl?format=utf8&op=export&bib=" } ]; new YAHOO.widget.Button({ type: "menu", label: _("Save"), + id: "savemenuc", name: "savemenubutton", menu: savemenu, - container: "savemenuc" - }); - - new YAHOO.widget.Button({ - type: "menu", - label: _("Edit"), - name: "editmenubutton", - menu: editmenu, - container: "editmenuc" + container: this }); - new YAHOO.widget.Button({ - type: "menu", - label: _("New"), - name: "newmenubutton", - menu: newmenu, - container: "newmenuc" - }); + var addtomenu = [ + { text: _("Cart"), onclick: { fn: addToCart } }, + { text: _("List"), onclick: { fn: addToShelf } } + ]; new YAHOO.widget.Button({ type: "menu", label: _("Add to"), name: "addtomenubutton", menu: addtomenu, - container: "addtoshelfc" + container: this }); new YAHOO.widget.Button({ - id: "z3950search", + id: "printbiblio", + type: "button", + label: _("Print"), + container: this, + onclick: {fn: printBiblio } + }); + + new YAHOO.widget.Button({ + id: "placehold", + type: "link", + label: _("Place hold"), + container: this, + href: "/cgi-bin/koha/reserve/request.pl?biblionumber=" + }); + + new YAHOO.widget.Button({ + id: "z3950search", type: "button", - label: _("Z39.50 Search"), - container: "z3950searchc", + label: _("Z39.50 Search"), + container: this, onclick: {fn:function(){PopupZ3950()}} }); - - var printbiblioButton = new YAHOO.widget.Button({ - id: "printbiblio", - type: "button", - label: _("Print"), - container: "printbiblioc", - onclick: {fn: printBiblio } - }); - - var newbiblioButton = new YAHOO.widget.Button("newbiblio"); - var placeholdButton = new YAHOO.widget.Button("placehold"); - - } - + + }); //]]>
    -