From 3f9017b3496a6751b9ee91d33f1a029d8c68a9a7 Mon Sep 17 00:00:00 2001 From: Paul POULAIN Date: Wed, 8 Aug 2007 17:39:46 +0200 Subject: [PATCH] adding a ExpandField feature to MARC editor : all subfields that are empty and not mandatory are hidden by default. a click on the tag title expand all of them. This is better imho than the previous minimizer, because : Note that the minimize/expand by default behaviour could be changed to use the hidden property. Il let LibLime guys say what they think of this proposal, and discuss another behaviour. Anyway, it proves that the new editor is better than the previous one as it can evolve easily ;-) Signed-off-by: Chris Cormack --- cataloguing/addbiblio.pl | 5 +++-- .../prog/en/cataloguing/addbiblio.tmpl | 18 ++++++++++++++++-- .../prog/en/includes/intranet2.css | 10 +++------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 9ebe8dce3f..a4f0cfab8d 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -302,8 +302,9 @@ sub create_input { } $subfield_data{visibility} = "display:none;" - unless ( ( $tagslib->{$tag}->{$subfield}->{hidden} % 2 == 0 ) - or $value ne '' ); #check parity + if ( ($tagslib->{$tag}->{$subfield}->{hidden} % 2 == 1) and $value ne '' + or ($value eq '' and !$tagslib->{$tag}->{$subfield}->{mandatory}) + ); # it's an authorised field if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl b/koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl index 8f24263fdb..fdcd932b7f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl @@ -111,9 +111,8 @@ - + _')"> - _')">+ @@ -324,6 +323,21 @@ function openAuth(tagid,authtype,X) { newin=window.open("../authorities/auth_finder.pl?authtypecode="+ authtype+ "&tagid="+Y, "value builder",'width=700,height=550,toolbar=false,scrollbars=yes'); } + +function ExpandField(index) { + var original = document.getElementById(index); //original
+ var divs = original.getElementsByTagName('div'); + for(var i=0,divslen = divs.length ; i