[Koha-patches] [PATCH] Fix for Bug 4271, Offer choice of destination for save biblio operation
Owen Leonard
oleonard at myacpl.org
Thu Apr 29 17:06:54 CEST 2010
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.
---
cataloguing/addbiblio.pl | 5 +-
.../prog/en/modules/cataloguing/addbiblio.tmpl | 47 ++++++++++++++++----
2 files changed, 41 insertions(+), 11 deletions(-)
diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl
index 7a1ed65..fc56047 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 c3f92a4..a091adc 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 ?
</script>
<!--TMPL_ELSE-->
<form method="post" name="f" id="f" action="/cgi-bin/koha/cataloguing/addbiblio.pl" onsubmit="return Check();">
+ <input type="hidden" value="" id="redirect" name="redirect" />
<input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
<!-- /TMPL_IF -->
@@ -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()}}
+ });
}
//]]>
</script>
<ul class="toolbar">
- <li><input id="addbiblio" type="submit" value="Save" /></li>
+ <li id="savebutton"><input id="addbiblio" type="submit" value="Save" /></li>
<li id="z3950searchc"><input type="button" id="z3950search" value="Z39.50 Search" onclick="PopupZ3950(); return false;" /></li>
<li id="changeframework"><label for="Frameworks">Change framework: </label>
<select name="Frameworks" id="Frameworks" onchange="Changefwk(this);">
--
1.6.3.3
More information about the Koha-patches
mailing list