[Koha-patches] [PATCH] AutoPopulateClickableFieldsInMarcEditor

Kyle M Hall kyle.m.hall at gmail.com
Mon Oct 12 14:43:32 CEST 2009


New system preference. If set, any MARC editor field that is auto-filled when clicked on will be filled in as soon as the record is loaded
---
 cataloguing/addbiblio.pl                           |    1 +
 installer/data/mysql/en/mandatory/sysprefs.sql     |    1 +
 .../1-Obligatoire/unimarc_standard_systemprefs.sql |    1 +
 installer/data/mysql/updatedatabase.pl             |    7 +++++++
 .../prog/en/modules/cataloguing/addbiblio.tmpl     |   18 +++++++++++++++++-
 5 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl
index b974d28..7ad9fb4 100755
--- a/cataloguing/addbiblio.pl
+++ b/cataloguing/addbiblio.pl
@@ -1003,6 +1003,7 @@ $template->param(
     popup => $mode,
     frameworkcode => $frameworkcode,
     itemtype => $frameworkcode,
+    AutoPopulateClickableFieldsInMarcEditor => C4::Context->preference('AutoPopulateClickableFieldsInMarcEditor'),
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index 6f60fa7..679559b 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -262,3 +262,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'If ON, displays the format, audience, type icons in XSLT MARC21 results and display pages.', 'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowAllMessageDeletion','0','Allow any Library to delete any message','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('ShowPatronImageInWebBasedSelfCheck', '0', 'If ON, displays patron image when a patron uses web-based self-checkout', '', 'YesNo');
+INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( 'AutoPopulateClickableFieldsInMarcEditor', '0', '', 'If set, any MARC editor field that is auto-filled when clicked on will be filled in as soon as the record is loaded.', 'YesNo' );
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
index bee360a..5e9e9e2 100644
--- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
@@ -261,3 +261,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('H
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'Si activé, affiche le format, le type de public et les icônes de type en XSLT (MARC21)).', 'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowAllMessageDeletion','0','Allow any Library to delete any message','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('ShowPatronImageInWebBasedSelfCheck', '0', 'Si activé, affiche la photo de l''adhérent lors de l''utilisation de la console de prêt auto-contrôlé', '', 'YesNo');
+INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( 'AutoPopulateClickableFieldsInMarcEditor', '0', '', 'If set, any MARC editor field that is auto-filled when clicked on will be filled in as soon as the record is loaded.', 'YesNo' );
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 10c3451..39e15e2 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2675,6 +2675,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = '3.01.00.062';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( 'AutoPopulateClickableFieldsInMarcEditor', '0', '', 'If set, any MARC editor field that is auto-filled when clicked on will be filled in as soon as the record is loaded.', 'YesNo' )");
+	print "Upgrade to $DBversion done ( Added AutoPopulateClickableFieldsInMarcEditor system preference )\n";
+    SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
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 3557cc2..1475ba2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl
@@ -2,6 +2,22 @@
 <title>Koha &rsaquo; Cataloging &rsaquo; <!-- TMPL_IF NAME="biblionumber" -->Editing <!-- TMPL_VAR NAME="title" escape="html" --> (Record Number <!-- TMPL_VAR name="biblionumber" -->)<!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF --></title>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/yui/plugins/bubbling-min.js"></script>
+
+<!-- TMPL_IF NAME="AutoPopulateClickableFieldsInMarcEditor" -->
+<script type="text/javascript">
+	function fillFields() {
+		var fElts = document.f.elements;
+		for( i=0; i < fElts.length; i++ ) {
+			if ( fElts[i].type == 'text' ) {
+				fElts[i].focus();
+			}
+		}
+
+		fElts[0].focus();
+	}
+</script>
+<!-- /TMPL_IF -->
+
 <script type="text/javascript">
 //<![CDATA[
 
@@ -556,7 +572,7 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
 </script>
 <link type="text/css" rel="stylesheet" href="<!-- TMPL_VAR NAME="themelang" -->/css/addbiblio.css" />
 </head>
-<body>
+<body <!-- TMPL_IF NAME="AutoPopulateClickableFieldsInMarcEditor" -->onload="fillFields()"<!-- /TMPL_IF -->>
 <div id="yui-cms-loading">
       <div id="yui-cms-float">
           Loading, please wait...
-- 
1.5.6.5




More information about the Koha-patches mailing list