[Koha-patches] [PATCH] [Bug 5546] syspref to hide MARC documentation links

Tomás Cohen Arazi tomascohen at gmail.com
Tue Dec 28 15:47:30 CET 2010


---
 cataloguing/addbiblio.pl                           |    6 ++++++
 installer/data/mysql/en/mandatory/sysprefs.sql     |    1 +
 installer/data/mysql/updatedatabase.pl             |    7 +++++++
 .../en/modules/admin/preferences/cataloguing.pref  |    6 ++++++
 .../prog/en/modules/cataloguing/addbiblio.tmpl     |    9 +++++++--
 5 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl
index 2c0c63d..82d5ddb 100755
--- a/cataloguing/addbiblio.pl
+++ b/cataloguing/addbiblio.pl
@@ -1023,6 +1023,12 @@ $template->param( title => $record->title() ) if ( $record ne "-1" );
 if (C4::Context->preference("marcflavour") eq "MARC21"){
     $template->param(MARC21 => 1);
 }
+
+if (C4::Context->preference("enableMARCdocs")){
+    $template->param(enableMARCdocs => 1);
+}
+
+
 $template->param(
     popup => $mode,
     frameworkcode => $frameworkcode,
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index 94d5de1..0b3d487 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -278,3 +278,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ILS-DI:AuthorizedIPs','','.','Restricts usage of ILS-DI to some IPs','Free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OverduesBlockCirc','noblock','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','noblock|confirmation|block','Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('DisplayMultiPlaceHold','1','Display the ability to place multiple holds or not','','YesNo');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('enableMARCdocs',1,'If ON, enables display of MARC documentation links',NULL,'YesNo');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index ac272ce..39d3218 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3915,6 +3915,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = 'XXX';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('enableMARCdocs',1,'If Yes, enables display of MARC documentation links',NULL,'YesNo')");
+    print "Upgrade to $DBversion done (Add enableMARCdocs syspref)\n";
+    SetVersion ($DBversion);
+}
+
 
 
 =head1 FUNCTIONS
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
index d809022..0a51ced 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
@@ -100,6 +100,12 @@ Cataloging:
                   economical: Do
             - collapse repeated tags of the same type into one tag entry on the display.
         -
+            - pref: enableMARCdocs
+              choices:
+                  yes: Display
+                  no: "Don't display"
+            - "MARC documentation links"
+        -
             - By default, display biblio records in
             - pref: IntranetBiblioDefaultView
               choices:
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 0fa4dc1..79c55ae 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl
@@ -67,6 +67,7 @@ function PopupZ3950() {
     } 
 }
 
+<!-- TMPL_IF NAME="enableMARCdocs" -->
 function PopupMARCFieldDoc(field, fieldnumber) {
     <!-- TMPL_IF NAME="MARC21" -->
         _MARC21FieldDoc(field);
@@ -101,6 +102,7 @@ function _UNIMARCFieldDoc(field,fieldnumber) {
         window.open("http://archive.ifla.org/VI/3/p1996-1/uni9.htm");
     }
 }
+<!-- /TMPL_IF -->
 
 /**
  * check if mandatory subfields are written
@@ -784,8 +786,11 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
             	<!-- TMPL_IF NAME="advancedMARCEditor" -->
 		<a href="#" tabindex="1" class="tagnum" title="<!-- TMPL_VAR NAME="tag_lib"--> - Click to Expand this Tag" onclick="ExpandField('tag_<!-- TMPL_VAR NAME="tag"-->_<!-- TMPL_VAR NAME='index' --><!-- TMPL_VAR NAME="random" -->'); return false;"><!-- TMPL_VAR NAME="tag" --></a>
 		<!-- TMPL_ELSE -->
-                        <span class="tagnum" title="<!-- TMPL_VAR NAME="tag_lib" -->"><!-- TMPL_VAR NAME="tag" --><a 
-                 onclick="PopupMARCFieldDoc(<!-- TMPL_VAR NAME="tag" -->, <!-- TMPL_VAR NAME="number" -->); return false;">&nbsp;?</a></span>
+                        <span class="tagnum" title="<!-- TMPL_VAR NAME="tag_lib" -->"><!-- TMPL_VAR NAME="tag" -->
+                            <!-- TMPL_IF NAME="enableMARCdocs" --><a 
+                 onclick="PopupMARCFieldDoc(<!-- TMPL_VAR NAME="tag" -->, <!-- TMPL_VAR NAME="number" -->); return false;">&nbsp;?</a>
+                            <!-- /TMPL_IF -->
+                        </span>
 		<!-- /TMPL_IF -->
                 <!-- TMPL_IF NAME="fixedfield" -->
 	                <input tabindex="1" class="indicator flat" type="text" style="display:none;" name="tag_<!-- TMPL_VAR NAME="tag" -->_indicator1_<!-- TMPL_VAR NAME='index'--><!-- TMPL_VAR name="random" -->" size="1" maxlength="1" value="<!-- TMPL_VAR NAME="indicator1" -->" />
-- 
1.7.1



More information about the Koha-patches mailing list