[Koha-cvs] koha koha-tmpl/opac-tmpl/css/en/includes/opac.c... [rel_2_2]

paul poulain paul at koha-fr.org
Wed Aug 2 14:20:26 CEST 2006


CVSROOT:	/cvsroot/koha
Module name:	koha
Branch:		rel_2_2
Changes by:	paul poulain <tipaul>	06/08/02 12:20:26

Modified files:
	koha-tmpl/opac-tmpl/css/en/includes: opac.css 
	koha-tmpl/opac-tmpl/css/en: opac-authoritiesdetail.tmpl 
	                            opac-detail.tmpl 
	opac           : opac-authoritiesdetail.pl opac-dictionary.pl 
Added files:
	koha-tmpl/opac-tmpl/css/en/includes: hierarchy.css 

Log message:
	update to :
	- handle authorities hierarchies in OPAC
	- have links to search & authorities in normal view of OPAC

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/opac-tmpl/css/en/includes/opac.css?cvsroot=koha&only_with_tag=rel_2_2&r1=1.17.2.22&r2=1.17.2.23
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/opac-tmpl/css/en/includes/hierarchy.css?cvsroot=koha&only_with_tag=rel_2_2&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/opac-tmpl/css/en/opac-authoritiesdetail.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.2.3&r2=1.1.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/opac-tmpl/css/en/opac-detail.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.15.2.22&r2=1.15.2.23
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-authoritiesdetail.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.2.2&r2=1.1.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-dictionary.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.2.3&r2=1.1.2.4

Patches:
Index: koha-tmpl/opac-tmpl/css/en/includes/opac.css
===================================================================
RCS file: /cvsroot/koha/koha/koha-tmpl/opac-tmpl/css/en/includes/opac.css,v
retrieving revision 1.17.2.22
retrieving revision 1.17.2.23
diff -u -b -r1.17.2.22 -r1.17.2.23
--- koha-tmpl/opac-tmpl/css/en/includes/opac.css	25 Jul 2006 12:35:58 -0000	1.17.2.22
+++ koha-tmpl/opac-tmpl/css/en/includes/opac.css	2 Aug 2006 12:20:26 -0000	1.17.2.23
@@ -57,14 +57,14 @@
 }
 
 /* images */
-img {
+/*img {
 	border-width:0px;
 	text-align:left;
 	display:inline;
 	float:left;
 	padding-left:10px;
 	padding-right:10px;
-}
+}*/
 
 .relative { /* for images in relative position */
 	border-width:5px;

Index: koha-tmpl/opac-tmpl/css/en/opac-authoritiesdetail.tmpl
===================================================================
RCS file: /cvsroot/koha/koha/koha-tmpl/opac-tmpl/css/en/Attic/opac-authoritiesdetail.tmpl,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -b -r1.1.2.3 -r1.1.2.4
--- koha-tmpl/opac-tmpl/css/en/opac-authoritiesdetail.tmpl	25 Jul 2006 12:36:24 -0000	1.1.2.3
+++ koha-tmpl/opac-tmpl/css/en/opac-authoritiesdetail.tmpl	2 Aug 2006 12:20:26 -0000	1.1.2.4
@@ -1,9 +1,61 @@
     <!-- TMPL_INCLUDE NAME="opac-top.inc" -->
 <div id="mainbloc">
 
+
 <div name="0XX" id="0XX" class="tab" style="visibility:visible">
 	<h1>Authority #<!-- TMPL_VAR NAME="authid" --> (<!-- TMPL_VAR name="authtypetext" -->)</h1>
-	<!-- TMPL_LOOP NAME="0XX" -->
+	<a href="opac-search.pl?type=intranet&amp;op=do_search&amp;marclist=<!-- TMPL_VAR NAME="biblio_fields" -->&amp;operator==&amp;value=<!-- TMPL_VAR NAME="authid" -->&amp;and_or=and&amp;excluding=" class="button authority"><!-- TMPL_VAR name="count" --> biblios</a>
+	
+<!-- TMPL_IF Name="displayhierarchy"-->
+<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/includes/hierarchy.css">
+<script language="JavaScript" type="text/javascript">
+function showParents(mynumber) {
+  var parents=document.getElementsByName(mynumber+'p')
+  for(i=0;i<parents.length;i++){
+    if (parents[i].style.display == "none") {
+      parents[i].style.display ="block";
+    } else {
+      parents[i].style.display ="none";
+    }
+  } 
+}
+function showChildren(mynumber) {
+  var children=document.getElementsByName(mynumber+'c')
+  for(i=0;i<children.length;i++){
+    if (children[i].style.display == "none") {
+      children[i].style.display = "block";
+    } else {
+      children[i].style.display = "none";
+    }
+  }
+}
+</script>
+
+<div class="hierarchies">
+<!--TMPL_LOOP Name="loophierarchies" -->
+  <div class="hierarchy">
+  <!--TMPL_LOOP Name="loopelement" -->
+    <div id="<!--TMPL_VAR Name="loopauthid" -->" class="<!--TMPL_VAR Name="class" -->">
+    <!-- TMPL_IF name="current_value" -->
+        <!--TMPL_VAR Name="value" -->
+    <!-- TMPL_ELSE -->
+        <a href="opac-authoritiesdetail.pl?authid=<!--TMPL_VAR Name="loopauthid" -->" title="Term"><!--TMPL_VAR Name="value" --></a>
+    <!-- /TMPL_IF -->
+    <!--TMPL_IF Name="ifchildren" -->
+      <sub><a class="parents" title="Narrower terms" href="JavaScript:showChildren('<!--TMPL_VAR Name="loopauthid" -->');">+</a></sub><br/>
+      <!--TMPL_LOOP Name="loopchildren" -->
+        <div name="<!--TMPL_VAR Name="loopauthid" -->c" class="child"> <a href="opac-authoritiesdetail.pl?authid=<!--TMPL_VAR Name="childauthid" -->"><!--TMPL_VAR Name="childvalue" --></a></div>
+      <!--/TMPL_LOOP-->
+    <!-- /TMPL_IF -->
+    </div>
+  <!--/TMPL_LOOP-->
+    
+  </div>
+<!--/TMPL_LOOP-->
+</div>
+<!-- /TMPL_IF -->
+
+<!-- TMPL_LOOP NAME="0XX" -->
 			<p class="MARCtag">
 				<!-- TMPL_VAR NAME="tag" -->
 			</p>

Index: koha-tmpl/opac-tmpl/css/en/opac-detail.tmpl
===================================================================
RCS file: /cvsroot/koha/koha/koha-tmpl/opac-tmpl/css/en/opac-detail.tmpl,v
retrieving revision 1.15.2.22
retrieving revision 1.15.2.23
diff -u -b -r1.15.2.22 -r1.15.2.23
--- koha-tmpl/opac-tmpl/css/en/opac-detail.tmpl	31 Jul 2006 13:27:31 -0000	1.15.2.22
+++ koha-tmpl/opac-tmpl/css/en/opac-detail.tmpl	2 Aug 2006 12:20:26 -0000	1.15.2.23
@@ -63,7 +63,7 @@
 						<!-- TMPL_LOOP NAME="MARCSUBJCTS" -->
 							<p>-
 							<!-- TMPL_IF name="linkvalue" -->
-								<a href="/cgi-bin/koha/opac-search.pl?op=do_search&marclist=<!-- TMPL_VAR name="link" -->&and_or=and&operator==&value=<!-- TMPL_VAR NAME="linkvalue" escape="HTML"-->"><!-- TMPL_VAR NAME="marcsubjct" --></a>, </p>
+								<a href="/cgi-bin/koha/opac-search.pl?op=do_search&marclist=<!-- TMPL_VAR name="link" -->&and_or=and&operator==&value=<!-- TMPL_VAR NAME="linkvalue" escape="HTML"-->"><img border="0"" src="<!-- TMPL_VAR name="themelang"-->/images/filefind.png" height="15" title="Search on this"/></a><a href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<!-- TMPL_VAR name="linkvalue" -->"><!-- TMPL_VAR NAME="marcsubjct" --></a></p>
 							<!-- TMPL_ELSE -->
 								<a href="/cgi-bin/koha/opac-search.pl?op=do_search&marclist=bibliosubject.subject&and_or=and&operator=contains&value=<!-- TMPL_VAR NAME="marcsubjct" escape="HTML"-->"><!-- TMPL_VAR NAME="marcsubjct" --></a>, </p>
 							<!-- /TMPL_IF -->

Index: opac/opac-authoritiesdetail.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/Attic/opac-authoritiesdetail.pl,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- opac/opac-authoritiesdetail.pl	4 Mar 2006 06:55:13 -0000	1.1.2.2
+++ opac/opac-authoritiesdetail.pl	2 Aug 2006 12:20:26 -0000	1.1.2.3
@@ -61,7 +61,46 @@
 my $authtypecode = &AUTHfind_authtypecode($dbh,$authid);
 my $tagslib = &AUTHgettagslib($dbh,1,$authtypecode);
 
-my $record =AUTHgetauthority($dbh,$authid);
+# open template
+my ($template, $loggedinuser, $cookie)
+		= get_template_and_user({template_name => "opac-authoritiesdetail.tmpl",
+			     query => $query,
+			     type => "opac",
+			     authnotrequired => 1,
+			     debug => 1,
+			     });
+
+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, $authid);
+      $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 => "opac-authoritiesdetail.tmpl",
-			     query => $query,
-			     type => "opac",
-			     authnotrequired => 1,
-			     debug => 1,
-			     });
-
 # fill arrays
 my @loop_data =();
 my $tag;

Index: opac/opac-dictionary.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-dictionary.pl,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -b -r1.1.2.3 -r1.1.2.4
--- opac/opac-dictionary.pl	7 Mar 2006 22:28:23 -0000	1.1.2.3
+++ opac/opac-dictionary.pl	2 Aug 2006 12:20:26 -0000	1.1.2.4
@@ -106,11 +106,11 @@
 	}
 	$listtags =~s/,$/)/;
 	$strsth .= $listtags." and marc_word.tagsubfield=concat(marc_subfield_table.tag,marc_subfield_table.subfieldcode) group by subfieldvalue ";
-# 	warn "search in biblio : ".$strsth;
+	warn "search in biblio : ".$strsth;
 	my $value = uc($search[0]);
 	$value=~s/\*/%/g;
-	$value.= "%" if not($value=~m/%/);
-# 	warn " texte : ".$value;
+# 	$value.= "%" if not($value=~m/%/);
+	warn " texte : ".$value;
 
 	$sth=$dbh->prepare($strsth);
 	$sth->execute($value);
@@ -146,10 +146,12 @@
 	my @authresults;
 	my $authnbresults;
 	while ((my $authtypecode) = $sth->fetchrow) {
+	warn "AUTH search $authtypecode";
 		my ($curauthresults,$nbresults) = authoritysearch($dbh,[''],[''],[''],['contains'],
 														\@search,$startfrom*$resultsperpage, $resultsperpage,$authtypecode);
 		push @authresults, @$curauthresults;
 		$authnbresults+=$nbresults;
+		warn "AUTH SEARCH DONE";
 #		warn "auth : $authtypecode nbauthresults : $nbresults";
 	}
 	

Index: koha-tmpl/opac-tmpl/css/en/includes/hierarchy.css
===================================================================
RCS file: koha-tmpl/opac-tmpl/css/en/includes/hierarchy.css
diff -N koha-tmpl/opac-tmpl/css/en/includes/hierarchy.css
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ koha-tmpl/opac-tmpl/css/en/includes/hierarchy.css	2 Aug 2006 12:20:25 -0000	1.1.2.1
@@ -0,0 +1,110 @@
+.hierarchies {
+	background-color:#fff;
+	color:#000000;
+	padding:5px;
+	margin-left:50px;
+	-moz-border-radius:6px;
+	display:block;
+	font-size:10px;
+}
+.hierarchy {
+	padding:5px;
+	width:90%;
+	-moz-border-radius:6px;
+	display:block;
+}
+.child {
+	display:none;
+    margin-left : 50px;
+    width:150%;
+}
+
+.child {
+    text-decoration:none;
+}
+.child a:hover{
+  background-color:#993366;
+  text-decoration:none;
+}
+.parent {
+	display:none;
+    margin-left : -50px;
+}
+.parent a:hover{
+  background-color:#993366;
+}
+.child0{
+  width : 25%;
+  text-align : left;
+}
+.child0 a:hover{
+  background-color:#993366;
+}
+.child1{
+  width : 25%;
+  text-align : left;
+  margin-left : 50px;
+}
+.child1 a:hover{
+  background-color:#993366;
+}
+.child2{
+  width : 25%;
+  text-align : left;
+  margin-left : 100px;
+}
+.child2 a:hover{
+  background-color:#993366;
+}
+.child3{
+  width : 25%;
+  text-align : left;
+  margin-left : 150px;
+}
+.child3 a:hover{
+  background-color:#993366;
+}
+.child4{
+  width : 25%;
+  text-align : left;
+  margin-left : 200px;
+}
+.child4 a:hover{
+  background-color:#993366;
+}
+.child5{
+  width : 25%;
+  text-align : left;
+  margin-left : 250px;
+}
+.child5 a:hover{
+  background-color:#993366;
+}
+.child6{
+  width : 25%;
+  text-align : left;
+  margin-left : 300px;
+}
+.child6 a:hover{
+  background-color:#993366;
+}
+.child7{
+  width : 25%;
+  text-align : left;
+  margin-left : 350px;
+}
+.child7 a:hover{
+  background-color:#993366;
+}
+.child8{
+  width : 25%;
+  text-align : left;
+  margin-left : 400px;
+}
+.child8 a:hover{
+  background-color:#993366;
+}
+.parents{
+  display:inline;
+  cursor:crosshair;
+}
\ No newline at end of file





More information about the Koha-cvs mailing list