[Koha-cvs] koha authorities/detail.pl C4/AuthoritiesMarc.p... [rel_2_2]

Henri-Damien LAURENT laurenthdl at alinto.com
Mon Jul 31 12:15:43 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_2_2
Changes by:	Henri-Damien LAURENT <hdl>	06/07/31 10:15:43

Modified files:
	authorities    : detail.pl 
	C4             : AuthoritiesMarc.pm 
	koha-tmpl/intranet-tmpl/default/en/catalogue: MARCdetail.tmpl 
	updater        : updatedatabase 
Added files:
	koha-tmpl/intranet-tmpl/default/en/includes: hierarchy.css 

Log message:
	BugFixing : MARCdetail : displayin field values with ESCAPE=HTML  (in order to manage  '<''>' characters)
	
	Adding  Hierarchy display for authorities.
	Please Note That it relies on the fact that authorities id are stored in $3 of authorities notice.
	And Broader terms is supposed to be indicated by a g for 550$5 subfield, narrower term : an h for the same subfield.
	
	It CAN SURELY be generalised but only with a bunch of sytem preferences.
	
	I added the ability to do a search on ANY authtypecode.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/authorities/detail.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.2.2.4&r2=1.2.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/C4/AuthoritiesMarc.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.9.2.18&r2=1.9.2.19
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/default/en/catalogue/MARCdetail.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.30.2.11&r2=1.30.2.12
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/default/en/includes/hierarchy.css?cvsroot=koha&only_with_tag=rel_2_2&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/updater/updatedatabase?cvsroot=koha&only_with_tag=rel_2_2&r1=1.100.2.48&r2=1.100.2.49

Patches:
Index: authorities/detail.pl
===================================================================
RCS file: /sources/koha/koha/authorities/detail.pl,v
retrieving revision 1.2.2.4
retrieving revision 1.2.2.5
diff -u -b -r1.2.2.4 -r1.2.2.5
--- authorities/detail.pl	5 Feb 2006 21:59:21 -0000	1.2.2.4
+++ authorities/detail.pl	31 Jul 2006 10:15:42 -0000	1.2.2.5
@@ -54,6 +54,15 @@
 use HTML::Template;
 
 my $query=new CGI;
+# open template
+my ($template, $loggedinuser, $cookie)
+		= get_template_and_user({template_name => "authorities/detail.tmpl",
+			     query => $query,
+			     type => "intranet",
+			     authnotrequired => 0,
+			     flagsrequired => {catalogue => 1},
+			     debug => 1,
+			     });
 
 my $dbh=C4::Context->dbh;
 
@@ -61,7 +70,37 @@
 my $authtypecode = &AUTHfind_authtypecode($dbh,$authid);
 my $tagslib = &AUTHgettagslib($dbh,1,$authtypecode);
 
-my $record =AUTHgetauthority($dbh,$authid);
+my $record;
+if (C4::Context->preference("AuthDisplayHierarchy")){
+  my $trees=BuildUnimarcHierarchies($authid);
+#   warn "trees :$trees";
+  my @trees = split /;/,$trees ;
+  push @trees,$trees unless (@trees);
+  my @loophierarchies;
+  foreach my $tree (@trees){
+#     warn "tree :$tree";
+
+    my @tree=split /,/,$tree;
+    push @tree,$tree unless (@tree);
+    my $cnt=0;
+    my @loophierarchy;
+    foreach my $element (@tree){
+#       warn "tree :$element";
+      my %cell;
+      my $elementdata = AUTHgetauthority($dbh,$element);
+      $record= $elementdata if ($authid==$element);
+      push @loophierarchy, BuildUnimarcHierarchy($elementdata,"child".$cnt);
+      $cnt++;
+    }
+    push @loophierarchies, { 'loopelement' =>\@loophierarchy};
+    $template->param(
+      'displayhierarchy' =>C4::Context->preference("AuthDisplayHierarchy"),
+      'loophierarchies' =>\@loophierarchies,
+    );
+  }
+} else {
+  $record=AUTHgetauthority($dbh,$authid);
+}
 my $count = AUTHcount_usage($authid);
 
 # find the marc field/subfield used in biblio by this authority
@@ -73,15 +112,6 @@
 }
 chop $biblio_fields;
 
-# open template
-my ($template, $loggedinuser, $cookie)
-		= get_template_and_user({template_name => "authorities/detail.tmpl",
-			     query => $query,
-			     type => "intranet",
-			     authnotrequired => 0,
-			     flagsrequired => {catalogue => 1},
-			     debug => 1,
-			     });
 
 # fill arrays
 my @loop_data =();

Index: C4/AuthoritiesMarc.pm
===================================================================
RCS file: /sources/koha/koha/C4/AuthoritiesMarc.pm,v
retrieving revision 1.9.2.18
retrieving revision 1.9.2.19
diff -u -b -r1.9.2.18 -r1.9.2.19
--- C4/AuthoritiesMarc.pm	25 Jul 2006 12:30:51 -0000	1.9.2.18
+++ C4/AuthoritiesMarc.pm	31 Jul 2006 10:15:42 -0000	1.9.2.19
@@ -52,6 +52,11 @@
 	&MARCaddword &MARCdelword
 	&char_decode
 	&FindDuplicate
+	&BuildSummary
+	&BuildUnimarcHierarchies
+	&BuildUnimarcHierarchy
+    &AUTHsavetrees
+    &AUTHgetheader
  );
 
 sub authoritysearch {
@@ -66,8 +71,14 @@
 	# the authtypecode. Then, search on $a of this tag_to_report
 	# also store main entry MARC tag, to extract it at end of search
 	my $mainentrytag;
-	my $sth = $dbh->prepare("select auth_tag_to_report from auth_types where authtypecode=?");
+	my $sth;
+    if ($authtypecode){
+      $sth= $dbh->prepare('select auth_tag_to_report from auth_types where authtypecode=?');
 	$sth->execute($authtypecode);
+    }else{
+      $sth= $dbh->prepare('select auth_tag_to_report from auth_types');
+      $sth->execute;
+    }
 	my ($tag_to_report) = $sth->fetchrow;
 	$mainentrytag = $tag_to_report;
 	for (my $i=0;$i<$#{$tags};$i++) {
@@ -123,6 +134,7 @@
 
 	my $sth;
 
+	if ($authtypecode){
 	if ($sql_where2) {
 		$sth = $dbh->prepare("select distinct m1.authid from auth_header,$sql_tables where  m1.authid=auth_header.authid and auth_header.authtypecode=? and $sql_where2 and ($sql_where1)");
 		warn "Q2 : select distinct m1.authid from auth_header,$sql_tables where  m1.authid=auth_header.authid and auth_header.authtypecode=? and $sql_where2 and ($sql_where1)";
@@ -130,7 +142,17 @@
 		$sth = $dbh->prepare("select distinct m1.authid from auth_header,$sql_tables where  m1.authid=auth_header.authid and auth_header.authtypecode=? and $sql_where1");
 		warn "Q : select distinct m1.authid from auth_header,$sql_tables where  m1.authid=auth_header.authid and auth_header.authtypecode=? and $sql_where1";
 	}
-	$sth->execute($authtypecode);
+      $sth->execute("$authtypecode");
+    } else {
+      if ($sql_where2) {
+          $sth = $dbh->prepare("select distinct m1.authid from auth_header,$sql_tables where  m1.authid=auth_header.authid and $sql_where2 and ($sql_where1)");
+          warn "Q2 : select distinct m1.authid from auth_header,$sql_tables where  m1.authid=auth_header.authid  and $sql_where2 and ($sql_where1)";
+      } else {
+          $sth = $dbh->prepare("select distinct m1.authid from auth_header,$sql_tables where  m1.authid=auth_header.authid and $sql_where1");
+          warn "Q : select distinct m1.authid from auth_header,$sql_tables where  m1.authid=auth_header.authid and $sql_where1";
+      }
+      $sth->execute;
+    }
 	my @result = ();
 	while (my ($authid) = $sth->fetchrow) {
 			push @result,$authid;
@@ -1079,6 +1101,195 @@
 	return;
 }
 
+sub BuildSummary{
+	my $record = shift @_;
+	my $summary = shift @_;
+    ##TODO : use langages from authorised_values
+    ## AND Thesaurii from auth_types
+	my %language;
+	$language{'fre'}="Français";
+	$language{'eng'}="Anglais";
+	$language{'ger'}="Allemand";
+	$language{'ita'}="Italien";
+	$language{'spa'}="Espagnol";
+	my %thesaurus;
+	$thesaurus{'1'}="Peuples";
+	$thesaurus{'2'}="Anthroponymes";
+	$thesaurus{'3'}="Oeuvres";
+	$thesaurus{'4'}="Chronologie";
+	$thesaurus{'5'}="Lieux";
+	$thesaurus{'6'}="Sujets";
+	#thesaurus a remplir
+	if ($summary) {
+		my @fields = $record->fields();
+		foreach my $field (@fields) {
+			my $tag = $field->tag();
+			my $tagvalue = $field->as_string();
+			$summary =~ s/\[(.?.?.?.?)$tag\*(.*?)]/$1$tagvalue$2\[$1$tag$2]/g;
+			if ($tag<10) {
+			} else {
+				my @subf = $field->subfields;
+				for my $i (0..$#subf) {
+					my $subfieldcode = $subf[$i][0];
+					my $subfieldvalue = $subf[$i][1];
+					my $tagsubf = $tag.$subfieldcode;
+					$summary =~ s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g;
+				}
+			}
+		}
+		$summary =~ s/\[(.*?)]//g;
+		$summary =~ s/\n/<br>/g;
+	} else {
+		my $heading; 
+		my $authid; 
+		my $altheading;
+		my $seealso;
+		my $broaderterms;
+		my $narrowerterms;
+		my $see;
+		my $seeheading;
+        my $notes;
+		my @fields = $record->fields();
+		if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
+		# construct UNIMARC summary, that is quite different from MARC21 one
+			# accepted form
+			foreach my $field ($record->field('2..')) {
+				$heading.= $field->subfield('a');
+                $authid=$field->subfield('3');
+			}
+			# rejected form(s)
+			foreach my $field ($record->field('3..')) {
+			  $notes.= '<span class="note">'.$field->subfield('a')."</span>\n";
+			}
+			foreach my $field ($record->field('4..')) {
+			  my $thesaurus = "thes. : ".$thesaurus{"$field->subfield('2')"}." : " if ($field->subfield('2'));
+			  $see.= '<span class="UF">'.$thesaurus.$field->subfield('a')."</span> -- \n";
+			}
+			# see :
+			foreach my $field ($record->field('5..')) {
+		        
+				if (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'g')) {
+				  $broaderterms.= '<span class="BT"> <a href="detail.pl?authid='.$field->subfield('3').'">'.$field->subfield('a')."</a></span> -- \n";
+				} elsif (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'h')){
+				  $narrowerterms.= '<span class="NT"><a href="detail.pl?authid='.$field->subfield('3').'">'.$field->subfield('a')."</a></span> -- \n";
+				} elsif ($field->subfield('a')) {
+				  $seealso.= '<span class="RT"><a href="detail.pl?authid='.$field->subfield('3').'">'.$field->subfield('a')."</a></span> -- \n";
+				}
+			}
+			# // form
+			foreach my $field ($record->field('7..')) {
+				my $lang = substr($field->subfield('8'),3,3);
+				$seeheading.= '<span class="langue"> En '.$language{$lang}.' : </span><span class="OT"> '.$field->subfield('a')."</span><br />\n";	
+			}
+            $broaderterms =~s/-- \n$//;
+            $narrowerterms =~s/-- \n$//;
+            $seealso =~s/-- \n$//;
+            $see =~s/-- \n$//;
+			$summary = "<b><a href=\"detail.pl?authid=$authid\">".$heading."</a></b><br />".($notes?"$notes <br />":"");
+			$summary.= '<p><div class="label">TG : '.$broaderterms.'</div></p>' if ($broaderterms);
+			$summary.= '<p><div class="label">TS : '.$narrowerterms.'</div></p>' if ($narrowerterms);
+			$summary.= '<p><div class="label">TA : '.$seealso.'</div></p>' if ($seealso);
+			$summary.= '<p><div class="label">EP : '.$see.'</div></p>' if ($see);
+			$summary.= '<p><div class="label">'.$seeheading.'</div></p>' if ($seeheading);
+		}
+	}
+	return $summary;
+}
+
+sub BuildUnimarcHierarchies{
+  my $authid = shift @_;
+#   warn "authid : $authid";
+  my $force = shift @_;
+  my @globalresult;
+  my $dbh=C4::Context->dbh;
+  my $hierarchies;
+  my $data = AUTHgetheader($dbh,$authid);
+  
+  if ($data->{'authtrees'} and not $force){
+    return $data->{'authtrees'};
+  } elsif ($data->{'authtrees'}){
+    $hierarchies=$data->{'authtrees'};
+  } else {
+    my $record = AUTHgetauthority($dbh,$authid);
+    my $found;
+    my ($result,$total)=authoritysearch($dbh,['5503'],['and'],'',['='],[$authid],0,100);
+    if ($total){
+      foreach my $parentauthid (map { $_->{'authid'} } @$result){
+        my $parentrecord = AUTHgetauthority($dbh,$parentauthid);
+        #checking results
+        foreach my $field ($parentrecord->field('550')){
+          if (($field->subfield('3')) && ($field->subfield('3') eq $authid) && ($field->subfield('5')) && ($field->subfield('5') eq 'h')) {
+            my $localresult=$hierarchies;
+            my $trees;
+            $trees = BuildUnimarcHierarchies($parentauthid);
+            my @trees;
+            if ($trees=~/;/){
+              @trees = split(/;/,$trees);
+            } else {
+              push @trees, $trees;
+            }
+            foreach (@trees){
+              $_.= ",$authid";
+            }
+            @globalresult = (@globalresult, at trees);
+          }
+          $found=1;
+        }
+      }
+      $hierarchies=join(";", at globalresult);
+    }
+    #Unless there is no ancestor, I am alone.
+    $hierarchies="$authid" unless ($hierarchies);
+  }
+  AUTHsavetrees($authid,$hierarchies);
+  return $hierarchies;
+}
+
+sub BuildUnimarcHierarchy{
+	my $record = shift @_;
+    my $class = shift @_;
+	my $authid=$record->subfield('250','3');
+    my %cell;
+	my $parents=""; my $children="";
+    my (@loopparents, at loopchildren);
+	foreach my $field ($record->field('550')){
+		if ($field->subfield('5') && $field->subfield('a')){
+		  if ($field->subfield('5') eq 'h'){
+            push @loopchildren, { "childauthid"=>$field->subfield('3'),"childvalue"=>$field->subfield('a')};
+		  }elsif ($field->subfield('5') eq 'g'){
+            push @loopparents, { "parentauthid"=>$field->subfield('3'),"parentvalue"=>$field->subfield('a')};
+		  }
+		# brothers could get in there with an else
+		}
+	}
+    $cell{"ifparents"}=1 if (scalar(@loopparents)>0);
+    $cell{"ifchildren"}=1 if (scalar(@loopchildren)>0);
+    $cell{"loopparents"}=\@loopparents if (scalar(@loopparents)>0);
+    $cell{"loopchildren"}=\@loopchildren if (scalar(@loopchildren)>0);
+    $cell{"class"}=$class;
+    $cell{"authid"}=$authid;
+    $cell{"value"}=$record->subfield('250',"a");
+	return \%cell;
+}
+
+sub AUTHgetheader{
+	my $authid = shift @_;
+	my $sql= "SELECT * from auth_header WHERE authid = ?";
+	my $dbh=C4::Context->dbh;
+	my $rq= $dbh->prepare($sql);
+    $rq->execute($authid);
+	my $data= $rq->fetchrow_hashref;
+	return $data;
+}
+
+sub AUTHsavetrees{
+	my $authid = shift @_;
+	my $trees = shift @_;
+	my $sql= "UPDATE IGNORE auth_header set authtrees=? WHERE authid = ?";
+	my $dbh=C4::Context->dbh;
+	my $rq= $dbh->prepare($sql);
+    $rq->execute($trees,$authid);
+}
 
 END { }       # module clean-up code here (global destructor)
 
@@ -1092,8 +1303,19 @@
 
 =cut
 
-# $Id: AuthoritiesMarc.pm,v 1.9.2.18 2006/07/25 12:30:51 tipaul Exp $
+# $Id: AuthoritiesMarc.pm,v 1.9.2.19 2006/07/31 10:15:42 hdl Exp $
 # $Log: AuthoritiesMarc.pm,v $
+# Revision 1.9.2.19  2006/07/31 10:15:42  hdl
+# BugFixing : MARCdetail : displayin field values with ESCAPE=HTML  (in order to manage  '<''>' characters)
+#
+# Adding  Hierarchy display for authorities.
+# Please Note That it relies on the fact that authorities id are stored in $3 of authorities notice.
+# And Broader terms is supposed to be indicated by a g for 550$5 subfield, narrower term : an h for the same subfield.
+#
+# It CAN SURELY be generalised but only with a bunch of sytem preferences.
+#
+# I added the ability to do a search on ANY authtypecode.
+#
 # Revision 1.9.2.18  2006/07/25 12:30:51  tipaul
 # adding some informations to the array that is passed as result to an authority search : mainly, the tag_to_report & the $3 information (unimarc specific)
 #

Index: koha-tmpl/intranet-tmpl/default/en/catalogue/MARCdetail.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/default/en/catalogue/MARCdetail.tmpl,v
retrieving revision 1.30.2.11
retrieving revision 1.30.2.12
diff -u -b -r1.30.2.11 -r1.30.2.12
--- koha-tmpl/intranet-tmpl/default/en/catalogue/MARCdetail.tmpl	25 Oct 2005 12:41:13 -0000	1.30.2.11
+++ koha-tmpl/intranet-tmpl/default/en/catalogue/MARCdetail.tmpl	31 Jul 2006 10:15:42 -0000	1.30.2.12
@@ -96,9 +96,9 @@
 					<label class="labelsubfield">&nbsp;
 					<!-- TMPL_UNLESS name="hide_marc" --><!-- TMPL_VAR NAME="marc_subfield" --><!-- /TMPL_UNLESS -->
 					<!-- TMPL_VAR NAME="marc_lib" --></label>
-					<!-- TMPL_VAR NAME="marc_value" -->
+					<!-- TMPL_VAR NAME="marc_value" ESCAPE=HTML -->
 					<!-- TMPL_IF name="link" -->
-						<a href="search.marc/search.pl?op=do_search&amp;marclist=<!-- TMPL_VAR NAME="link" -->&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
+						<a href="search.marc/search.pl?op=do_search&amp;marclist=\'<!-- TMPL_VAR NAME="link" -->\'&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
 							<img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/filefind.png" height="15" title="Search on <!-- TMPL_VAR name="marc_value" -->">
 						</a>
 					<!-- /TMPL_IF -->
@@ -124,7 +124,7 @@
 					<label class="labelsubfield">&nbsp;
 					<!-- TMPL_UNLESS name="hide_marc" --><!-- TMPL_VAR NAME="marc_subfield" --><!-- /TMPL_UNLESS -->
 					<!-- TMPL_VAR NAME="marc_lib" --></label>
-					<!-- TMPL_VAR NAME="marc_value" -->
+					<!-- TMPL_VAR NAME="marc_value" ESCAPE=HTML -->
 					<!-- TMPL_IF name="link" -->
 						<a href="search.marc/search.pl?op=do_search&amp;marclist=<!-- TMPL_VAR NAME="link" -->&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
 							<img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/filefind.png" height="15" title="Search on <!-- TMPL_VAR name="marc_value" -->">
@@ -152,9 +152,9 @@
 					<label class="labelsubfield">&nbsp;
 					<!-- TMPL_UNLESS name="hide_marc" --><!-- TMPL_VAR NAME="marc_subfield" --><!-- /TMPL_UNLESS -->
 					<!-- TMPL_VAR NAME="marc_lib" --></label>
-					<!-- TMPL_VAR NAME="marc_value" -->
+					<!-- TMPL_VAR NAME="marc_value" ESCAPE=HTML -->
 					<!-- TMPL_IF name="link" -->
-						<a href="search.marc/search.pl?op=do_search&amp;marclist=<!-- TMPL_VAR NAME="link" -->&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
+						<a href="search.marc/search.pl?op=do_search&amp;marclist=\'<!-- TMPL_VAR NAME="link" -->\'&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
 							<img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/filefind.png" height="15" title="Search on <!-- TMPL_VAR name="marc_value" -->">
 						</a>
 					<!-- /TMPL_IF -->
@@ -180,9 +180,9 @@
 					<label class="labelsubfield">&nbsp;
 					<!-- TMPL_UNLESS name="hide_marc" --><!-- TMPL_VAR NAME="marc_subfield" --><!-- /TMPL_UNLESS -->
 					<!-- TMPL_VAR NAME="marc_lib" --></label>
-					<!-- TMPL_VAR NAME="marc_value" -->
+					<!-- TMPL_VAR NAME="marc_value" ESCAPE=HTML -->
 					<!-- TMPL_IF name="link" -->
-						<a href="search.marc/search.pl?op=do_search&amp;marclist=<!-- TMPL_VAR NAME="link" -->&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
+						<a href="search.marc/search.pl?op=do_search&amp;marclist=\'<!-- TMPL_VAR NAME="link" -->\'&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
 							<img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/filefind.png" height="15" title="Search on <!-- TMPL_VAR name="marc_value" -->">
 						</a>
 					<!-- /TMPL_IF -->
@@ -208,9 +208,9 @@
 					<label class="labelsubfield">&nbsp;
 					<!-- TMPL_UNLESS name="hide_marc" --><!-- TMPL_VAR NAME="marc_subfield" --><!-- /TMPL_UNLESS -->
 					<!-- TMPL_VAR NAME="marc_lib" --></label>
-					<!-- TMPL_VAR NAME="marc_value" -->
+					<!-- TMPL_VAR NAME="marc_value" ESCAPE=HTML -->
 					<!-- TMPL_IF name="link" -->
-						<a href="search.marc/search.pl?op=do_search&amp;marclist=<!-- TMPL_VAR NAME="link" -->&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
+						<a href="search.marc/search.pl?op=do_search&amp;marclist=\'<!-- TMPL_VAR NAME="link" -->\'&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
 							<img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/filefind.png" height="15" title="Search on <!-- TMPL_VAR name="marc_value" -->">
 						</a>
 					<!-- /TMPL_IF -->
@@ -236,9 +236,9 @@
 					<label class="labelsubfield">&nbsp;
 					<!-- TMPL_UNLESS name="hide_marc" --><!-- TMPL_VAR NAME="marc_subfield" --><!-- /TMPL_UNLESS -->
 					<!-- TMPL_VAR NAME="marc_lib" --></label>
-					<!-- TMPL_VAR NAME="marc_value" -->
+					<!-- TMPL_VAR NAME="marc_value" ESCAPE=HTML -->
 					<!-- TMPL_IF name="link" -->
-						<a href="search.marc/search.pl?op=do_search&amp;marclist=<!-- TMPL_VAR NAME="link" -->&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
+						<a href="search.marc/search.pl?op=do_search&amp;marclist=\'<!-- TMPL_VAR NAME="link" -->\'&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
 							<img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/filefind.png" height="15" title="Search on <!-- TMPL_VAR name="marc_value" -->">
 						</a>
 					<!-- /TMPL_IF -->
@@ -264,9 +264,9 @@
 					<label class="labelsubfield">&nbsp;
 					<!-- TMPL_UNLESS name="hide_marc" --><!-- TMPL_VAR NAME="marc_subfield" --><!-- /TMPL_UNLESS -->
 					<!-- TMPL_VAR NAME="marc_lib" --></label>
-					<!-- TMPL_VAR NAME="marc_value" -->
+					<!-- TMPL_VAR NAME="marc_value" ESCAPE=HTML -->
 					<!-- TMPL_IF name="link" -->
-						<a href="search.marc/search.pl?op=do_search&amp;marclist=<!-- TMPL_VAR NAME="link" -->&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
+						<a href="search.marc/search.pl?op=do_search&amp;marclist=\'<!-- TMPL_VAR NAME="link" -->\'&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
 							<img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/filefind.png" height="15" title="Search on <!-- TMPL_VAR name="marc_value" -->">
 						</a>
 					<!-- /TMPL_IF -->
@@ -292,9 +292,9 @@
 					<label class="labelsubfield">&nbsp;
 					<!-- TMPL_UNLESS name="hide_marc" --><!-- TMPL_VAR NAME="marc_subfield" --><!-- /TMPL_UNLESS -->
 					<!-- TMPL_VAR NAME="marc_lib" --></label>
-					<!-- TMPL_VAR NAME="marc_value" -->
+					<!-- TMPL_VAR NAME="marc_value" ESCAPE=HTML -->
 					<!-- TMPL_IF name="link" -->
-						<a href="search.marc/search.pl?op=do_search&amp;marclist=<!-- TMPL_VAR NAME="link" -->&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
+						<a href="search.marc/search.pl?op=do_search&amp;marclist=\'<!-- TMPL_VAR NAME="link" -->\'&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
 							<img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/filefind.png" height="15" title="Search on <!-- TMPL_VAR name="marc_value" -->">
 						</a>
 					<!-- /TMPL_IF -->
@@ -320,9 +320,9 @@
 					<label class="labelsubfield">&nbsp;
 					<!-- TMPL_UNLESS name="hide_marc" --><!-- TMPL_VAR NAME="marc_subfield" --><!-- /TMPL_UNLESS -->
 					<!-- TMPL_VAR NAME="marc_lib" --></label>
-					<!-- TMPL_VAR NAME="marc_value" -->
+					<!-- TMPL_VAR NAME="marc_value" ESCAPE=HTML -->
 					<!-- TMPL_IF name="link" -->
-						<a href="search.marc/search.pl?op=do_search&amp;marclist=<!-- TMPL_VAR NAME="link" -->&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
+						<a href="search.marc/search.pl?op=do_search&amp;marclist=\'<!-- TMPL_VAR NAME="link" -->\'&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
 							<img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/filefind.png" height="15" title="Search on <!-- TMPL_VAR name="marc_value" -->">
 						</a>
 					<!-- /TMPL_IF -->
@@ -348,9 +348,9 @@
 					<label class="labelsubfield">&nbsp;
 					<!-- TMPL_UNLESS name="hide_marc" --><!-- TMPL_VAR NAME="marc_subfield" --><!-- /TMPL_UNLESS -->
 					<!-- TMPL_VAR NAME="marc_lib" --></label>
-					<!-- TMPL_VAR NAME="marc_value" -->
+					<!-- TMPL_VAR NAME="marc_value" ESCAPE=HTML -->
 					<!-- TMPL_IF name="link" -->
-						<a href="search.marc/search.pl?op=do_search&amp;marclist=<!-- TMPL_VAR NAME="link" -->&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
+						<a href="search.marc/search.pl?op=do_search&amp;marclist=\'<!-- TMPL_VAR NAME="link" -->\'&amp;operator==&amp;type=intranet&amp;value=<!-- TMPL_VAR NAME="marc_value" ESCAPE=URL -->">
 							<img border="0" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/filefind.png" height="15" title="Search on <!-- TMPL_VAR name="marc_value" -->">
 						</a>
 					<!-- /TMPL_IF -->

Index: updater/updatedatabase
===================================================================
RCS file: /sources/koha/koha/updater/updatedatabase,v
retrieving revision 1.100.2.48
retrieving revision 1.100.2.49
diff -u -b -r1.100.2.48 -r1.100.2.49
--- updater/updatedatabase	28 Jul 2006 01:13:41 -0000	1.100.2.48
+++ updater/updatedatabase	31 Jul 2006 10:15:42 -0000	1.100.2.49
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: updatedatabase,v 1.100.2.48 2006/07/28 01:13:41 sushi Exp $
+# $Id: updatedatabase,v 1.100.2.49 2006/07/31 10:15:42 hdl Exp $
 
 # Database Updater
 # This script checks for required updates to the database.
@@ -871,7 +871,9 @@
             },
             value       => 'Fill with appropriate value...',
             explanation => 'ISBD',
-            type        => 'free'
+            type        => 'Textarea',
+            options => '150|50'
+
         },
         {
             uniquefieldrequired => 'variable',
@@ -1395,6 +1397,21 @@
 "contains the MARC biblio tags of person authorities to fill biblio.author with when importing biblio",
             type => 'free',
         },
+        {
+            uniquefieldrequired => 'variable',
+            variable            => 'AuthDisplayHierarchy',
+            value               => '1',
+            forceupdate         => {
+                'explanation' => 1,
+                '
+                                        type' => 1
+            },
+            explanation =>
+"Display hierarchies in details for Authorities.",
+            type => 'YesNo',
+            value =>0,
+        },
+
     ],
 
 );
@@ -1476,6 +1493,17 @@
             extra   => ''
         },
     ],
+    auth_header =>[
+        {
+            field => 'authtrees',
+            type  => 'text',
+            null    => 'NULL',
+            key     => '',
+            default => '',
+            extra   => ''
+        },
+     ],
+
 );
 
 #-------------------
@@ -2138,6 +2166,17 @@
 exit;
 
 # $Log: updatedatabase,v $
+# Revision 1.100.2.49  2006/07/31 10:15:42  hdl
+# BugFixing : MARCdetail : displayin field values with ESCAPE=HTML  (in order to manage  '<''>' characters)
+#
+# Adding  Hierarchy display for authorities.
+# Please Note That it relies on the fact that authorities id are stored in $3 of authorities notice.
+# And Broader terms is supposed to be indicated by a g for 550$5 subfield, narrower term : an h for the same subfield.
+#
+# It CAN SURELY be generalised but only with a bunch of sytem preferences.
+#
+# I added the ability to do a search on ANY authtypecode.
+#
 # Revision 1.100.2.48  2006/07/28 01:13:41  sushi
 # updated 'labels_conf' table.
 #

Index: koha-tmpl/intranet-tmpl/default/en/includes/hierarchy.css
===================================================================
RCS file: koha-tmpl/intranet-tmpl/default/en/includes/hierarchy.css
diff -N koha-tmpl/intranet-tmpl/default/en/includes/hierarchy.css
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ koha-tmpl/intranet-tmpl/default/en/includes/hierarchy.css	31 Jul 2006 10:15:42 -0000	1.1.2.1
@@ -0,0 +1,108 @@
+#hierarchies {
+	background-color:#FFF;
+	color:#000000;
+	border:2px solid #000000;
+	padding:5px;
+	width:90%;
+	-moz-border-radius:6px;
+	position:relative;
+	display:block;
+}
+#hierarchy {
+	border:1px solid #000000;
+	padding:5px;
+	width:90%;
+	-moz-border-radius:6px;
+	position:relative;
+	display:block;
+}
+.child {
+	display:none;
+    margin-left : 50%;
+    width:150%;
+}
+.child a:hover{
+  background-color:#BFCFFF;
+}
+.parent {
+	display:none;
+    margin-left : -50%;
+}
+.parent a:hover{
+  background-color:#BFCFFF;
+}
+.child0{
+  width : 10%;
+  text-align : left;
+}
+.child0 a:hover{
+  background-color:#BFCFFF;
+}
+.child1{
+  width : 10%;
+  text-align : left;
+  margin-left : 11%;
+}
+.child1 a:hover{
+  background-color:#BFCFFF;
+}
+.child2{
+  width : 10%;
+  text-align : left;
+  margin-left : 22%;
+}
+.child2 a:hover{
+  background-color:#BFCFFF;
+}
+.child3{
+  width : 10%;
+  text-align : left;
+  margin-left : 33%;
+}
+.child3 a:hover{
+  background-color:#BFCFFF;
+}
+.child4{
+  width : 10%;
+  text-align : left;
+  margin-left : 44%;
+}
+.child4 a:hover{
+  background-color:#BFCFFF;
+}
+.child5{
+  width : 10%;
+  text-align : left;
+  margin-left : 55%;
+}
+.child5 a:hover{
+  background-color:#BFCFFF;
+}
+.child6{
+  width : 10%;
+  text-align : left;
+  margin-left : 66%;
+}
+.child6 a:hover{
+  background-color:#BFCFFF;
+}
+.child7{
+  width : 10%;
+  text-align : left;
+  margin-left : 77%;
+}
+.child7 a:hover{
+  background-color:#BFCFFF;
+}
+.child8{
+  width : 10%;
+  text-align : left;
+  margin-left : 88%;
+}
+.child8 a:hover{
+  background-color:#BFCFFF;
+}
+.parents{
+  display:inline;
+  cursor:crosshair;
+}
\ No newline at end of file





More information about the Koha-cvs mailing list