From 4d50b4f4f0a96c0808ade6fb6dba935adcb060a8 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 29 Apr 2010 11:06:54 -0400 Subject: [PATCH] Fix for Bug 4271, Offer choice of destination for save biblio operation A follow-up to the fix for Bug 4121, the user should be able to control whether the action of saving a bibliographic record takes them to the add item screen or the detail screen, independently of whether they are adding or modifying the record. The addition of a "split button" would leave the default action in place if the user clicked the "main" part of the button. Clicking on the menu would give the user specific choices. Signed-off-by: Galen Charlton --- cataloguing/addbiblio.pl | 5 +- .../en/modules/cataloguing/addbiblio.tmpl | 47 +++++++++++++++---- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 7a1ed65eae..fc560474f4 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -829,6 +829,7 @@ my $z3950 = $input->param('z3950'); my $op = $input->param('op'); my $mode = $input->param('mode'); my $frameworkcode = $input->param('frameworkcode'); +my $redirect = $input->param('redirect'); my $dbh = C4::Context->dbh; my $userflags = ($frameworkcode eq 'FA') ? "fast_cataloging" : "edit_catalogue"; @@ -930,13 +931,13 @@ if ( $op eq "addbiblio" ) { ( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); } - if ($mode ne "popup" && !$is_a_modif){ + if (($mode ne "popup" && !$is_a_modif) || $redirect eq "items"){ print $input->redirect( "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode" ); exit; } - elsif($is_a_modif){ + elsif($is_a_modif || $redirect eq "view"){ my $defaultview = C4::Context->preference('IntranetBiblioDefaultView'); my $views = { C4::Search::enabled_staff_search_views }; if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl index c3f92a4013..a091adc2fa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl @@ -41,7 +41,7 @@ function confirmnotdup(){ * * */ -function Check(){ +function Check(dest){ var StrAlert = AreMandatoriesNotOk(); if( ! StrAlert ){ document.f.submit(); @@ -631,6 +631,7 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
+ @@ -643,27 +644,55 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ? $(document).ready(function() { $("#z3950searchc").empty(); + $("#savebutton").empty(); yuiToolbar(); }); + var onOption = function () { + return Check(); + } + + function redirect(dest){ + $("#redirect").attr("value",dest); + return Check(); + } + + var savemenu = [ + { text: _("Save and view record"), value: 1, onclick: {fn:function(){redirect("view");}} }, + { text: _("Save and edit items"), value: 2, onclick: {fn:function(){redirect("items");}} } + ]; + + // YUI Toolbar Functions function yuiToolbar() { - new YAHOO.widget.Button("addbiblio"); + // new YAHOO.widget.Button("addbiblio"); + + var savesplitmenu = new YAHOO.widget.Button({ + type: "split", + label: _("Save"), + id: "addbiblio", + name: "savemenubutton", + menu: savemenu, + container: "savebutton" + }); + + savesplitmenu.on("click", onOption); + new YAHOO.widget.Button({ - id: "z3950search", - type: "button", - label: _("Z39.50 Search"), - container: "z3950searchc", - onclick: {fn:function(){PopupZ3950()}} - }); + id: "z3950search", + type: "button", + label: _("Z39.50 Search"), + container: "z3950searchc", + onclick: {fn:function(){PopupZ3950()}} + }); } //]]>
    -
  • +