[Koha-cvs] CVS: koha/authorities auth_finder.pl,1.4,1.5 authorities-home.pl,1.6,1.7 authorities.pl,1.4,1.5 blinddetail-biblio-search.pl,1.1,1.2

Paul POULAIN tipaul at users.sourceforge.net
Wed Aug 18 18:05:47 CEST 2004


Update of /cvsroot/koha/koha/authorities
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10961/authorities

Modified Files:
	auth_finder.pl authorities-home.pl authorities.pl 
	blinddetail-biblio-search.pl 
Log Message:
fixes in authorities. Now, it should work well...

Index: auth_finder.pl
===================================================================
RCS file: /cvsroot/koha/koha/authorities/auth_finder.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** auth_finder.pl	15 Jul 2004 09:53:09 -0000	1.4
--- auth_finder.pl	18 Aug 2004 16:05:42 -0000	1.5
***************
*** 39,42 ****
--- 39,43 ----
  my $index = $query->param('index');
  my $category = $query->param('category');
+ my $resultstring = $query->param('result');
  my $dbh = C4::Context->dbh;
  
***************
*** 67,71 ****
  	$resultsperpage= $query->param('resultsperpage');
  	$resultsperpage = 19 if(!defined $resultsperpage);
- # 	my $orderby = $query->param('orderby');
  
  	# builds tag and subfield arrays
--- 68,71 ----
***************
*** 89,93 ****
  	my $displaynext=0;
  	my $displayprev=$startfrom;
! 	if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
  		$displaynext = 1;
  	}
--- 89,93 ----
  	my $displaynext=0;
  	my $displayprev=$startfrom;
! 	if(($total - (($startfrom+1)*($resultsperpage))) > 0 ) {
  		$displaynext = 1;
  	}
***************
*** 96,101 ****
  
  
! 	for(my $i = 0 ; $i <= $#marclist ; $i++)
! 	{
  		push @field_data, { term => "marclist", val=>$marclist[$i] };
  		push @field_data, { term => "and_or", val=>$and_or[$i] };
--- 96,100 ----
  
  
! 	for(my $i = 0 ; $i <= $#marclist ; $i++) {
  		push @field_data, { term => "marclist", val=>$marclist[$i] };
  		push @field_data, { term => "and_or", val=>$and_or[$i] };
***************
*** 107,116 ****
  	my @numbers = ();
  
! 	if ($total>$resultsperpage)
! 	{
! 		for (my $i=1; $i<$total/$resultsperpage+1; $i++)
! 		{
! 			if ($i<16)
! 			{
  	    		my $highlight=0;
  	    		($startfrom==($i-1)) && ($highlight=1);
--- 106,112 ----
  	my @numbers = ();
  
! 	if ($total>$resultsperpage) {
! 		for (my $i=1; $i<$total/$resultsperpage+1; $i++) {
! 			if ($i<16) {
  	    		my $highlight=0;
  	    		($startfrom==($i-1)) && ($highlight=1);
***************
*** 126,131 ****
  	my $to;
  
!  	if($total < (($startfrom+1)*$resultsperpage))
! 	{
  		$to = $total;
  	} else {
--- 122,126 ----
  	my $to;
  
!  	if($total < (($startfrom+1)*$resultsperpage)) {
  		$to = $total;
  	} else {
***************
*** 146,149 ****
--- 141,146 ----
  							to=>$to,
  							numbers=>\@numbers,
+ 							authtypecode =>$authtypecode,
+ 							resultstring =>$value[0],
  							);
  } else {
***************
*** 157,161 ****
  				});
  
! 	$template->param(index => $index);
  }
  
--- 154,160 ----
  				});
  
! 	$template->param(index => $index,
! 					resultstring => $resultstring
! 					);
  }
  

Index: authorities-home.pl
===================================================================
RCS file: /cvsroot/koha/koha/authorities/authorities-home.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** authorities-home.pl	30 Jul 2004 13:56:23 -0000	1.6
--- authorities-home.pl	18 Aug 2004 16:05:42 -0000	1.7
***************
*** 69,73 ****
  										\@excluding, \@operator, \@value,
  										$startfrom*$resultsperpage, $resultsperpage,$authtypecode);
- 	warn "R test : $results";
  	($template, $loggedinuser, $cookie)
  		= get_template_and_user({template_name => "authorities/searchresultlist.tmpl",
--- 69,72 ----
***************
*** 139,142 ****
--- 138,142 ----
  							to=>$to,
  							numbers=>\@numbers,
+ 							authtypecode=>$authtypecode,
  							);
  

Index: authorities.pl
===================================================================
RCS file: /cvsroot/koha/koha/authorities/authorities.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** authorities.pl	5 Jul 2004 13:38:41 -0000	1.4
--- authorities.pl	18 Aug 2004 16:05:42 -0000	1.5
***************
*** 161,165 ****
  sub build_tabs ($$$$) {
      my($template, $record, $dbh,$encoding) = @_;
! 
      # fill arrays
      my @loop_data =();
--- 161,165 ----
  sub build_tabs ($$$$) {
      my($template, $record, $dbh,$encoding) = @_;
! warn "=>".$record->as_formatted;
      # fill arrays
      my @loop_data =();

Index: blinddetail-biblio-search.pl
===================================================================
RCS file: /cvsroot/koha/koha/authorities/blinddetail-biblio-search.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** blinddetail-biblio-search.pl	5 Jul 2004 13:29:35 -0000	1.1
--- blinddetail-biblio-search.pl	18 Aug 2004 16:05:42 -0000	1.2
***************
*** 50,55 ****
  use MARC::Record;
  use C4::Koha;
- # use C4::Biblio;
- # use C4::Catalogue;
  use HTML::Template;
  
--- 50,53 ----
***************
*** 63,66 ****
--- 61,67 ----
  my $tagslib = &AUTHgettagslib($dbh,1,$authtypecode);
  
+ my $auth_type = AUTHgetauth_type($authtypecode);
+ warn "XX = ".$auth_type->{auth_tag_to_report};
+ 
  my $record =AUTHgetauthority($dbh,$authid);
  # open template
***************
*** 77,184 ****
  my @loop_data =();
  my $tag;
! # loop through each tab 0 through 9
! # for (my $tabloop = 0; $tabloop<=10;$tabloop++) {
! # loop through each tag
! 	my @fields = $record->fields();
! 	my @loop_data =();
! 	foreach my $field (@fields) {
! 			my @subfields_data;
! 		# if tag <10, there's no subfield, use the "@" trick
! 		if ($field->tag()<10) {
! # 			next if ($tagslib->{$field->tag()}->{'@'}->{tab}  ne $tabloop);
! 			next if ($tagslib->{$field->tag()}->{'@'}->{hidden});
! 			my %subfield_data;
! 			$subfield_data{marc_lib}=$tagslib->{$field->tag()}->{'@'}->{lib};
! 			$subfield_data{marc_value}=$field->data();
! 			$subfield_data{marc_subfield}='@';
! 			$subfield_data{marc_tag}=$field->tag();
! 			push(@subfields_data, \%subfield_data);
! 		} else {
! 			my @subf=$field->subfields;
  	# loop through each subfield
! 			for my $i (0..$#subf) {
! 				$subf[$i][0] = "@" unless $subf[$i][0];
! # 				next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab}  ne $tabloop);
! 				next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{hidden});
! 				my %subfield_data;
! 				$subfield_data{marc_lib}=$tagslib->{$field->tag()}->{$subf[$i][0]}->{lib};
! 				if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{isurl}) {
! 					$subfield_data{marc_value}="<a href=\"$subf[$i][1]\">$subf[$i][1]</a>";
! 				} else {
! 					$subfield_data{marc_value}=$subf[$i][1];
! 				}
! 				$subfield_data{marc_subfield}=$subf[$i][0];
! 				$subfield_data{marc_tag}=$field->tag();
! 				push(@subfields_data, \%subfield_data);
! 			}
! 		}
! 		if ($#subfields_data>=0) {
! 			my %tag_data;
! 			$tag_data{tag}=$field->tag().' -'. $tagslib->{$field->tag()}->{lib};
! 			$tag_data{subfield} = \@subfields_data;
! 			push (@loop_data, \%tag_data);
! 		}
  	}
- 	$template->param("0XX" =>\@loop_data);
- # }
- # now, build item tab !
- # the main difference is that datas are in lines and not in columns : thus, we build the <th> first, then the values...
- # loop through each tag
- # warning : we may have differents number of columns in each row. Thus, we first build a hash, complete it if necessary
- # then construct template.
- # my @fields = $record->fields();
- # my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code
- # my @big_array;
- # foreach my $field (@fields) {
- # 	next if ($field->tag()<10);
- # 	my @subf=$field->subfields;
- # 	my %this_row;
- # # loop through each subfield
- # 	for my $i (0..$#subf) {
- # 		next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab}  ne 10);
- # 		$witness{$subf[$i][0]} = $tagslib->{$field->tag()}->{$subf[$i][0]}->{lib};
- # 		$this_row{$subf[$i][0]} =$subf[$i][1];
- # 	}
- # 	if (%this_row) {
- # 		push(@big_array, \%this_row);
- # 	}
- # }
- # #fill big_row with missing datas
- # foreach my $subfield_code  (keys(%witness)) {
- # 	for (my $i=0;$i<=$#big_array;$i++) {
- # 		$big_array[$i]{$subfield_code}="&nbsp;" unless ($big_array[$i]{$subfield_code});
- # 	}
- # }
- # # now, construct template !
- # my @item_value_loop;
- # my @header_value_loop;
- # for (my $i=0;$i<=$#big_array; $i++) {
- # 	my $items_data;
- # 	foreach my $subfield_code (keys(%witness)) {
- # 		$items_data .="<td>".$big_array[$i]{$subfield_code}."</td>";
- # 	}
- # 	my %row_data;
- # 	$row_data{item_value} = $items_data;
- # 	push(@item_value_loop,\%row_data);
- # }
- # foreach my $subfield_code (keys(%witness)) {
- # 	my %header_value;
- # 	$header_value{header_value} = $witness{$subfield_code};
- # 	push(@header_value_loop, \%header_value);
- # }
- 
- my $authtypes = getauthtypes;
- my @authtypesloop;
- foreach my $thisauthtype (keys %$authtypes) {
- 	my $selected = 1 if $thisauthtype eq $authtypecode;
- 	my %row =(value => $thisauthtype,
- 				selected => $selected,
- 				authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
- 			);
- 	push @authtypesloop, \%row;
  }
  
  $template->param(authid => $authid,
! 				authtypesloop => \@authtypesloop, index => $index);
  output_html_with_http_headers $query, $cookie, $template->output;
  
--- 78,117 ----
  my @loop_data =();
  my $tag;
! my @loop_data =();
! foreach my $field ($record->fields($auth_type->{auth_tag_to_report})) {
! 		my @subfields_data;
! 		my @subf=$field->subfields;
  	# loop through each subfield
! 	for my $i (0..$#subf) {
! 		$subf[$i][0] = "@" unless $subf[$i][0];
! 		my %subfield_data;
! 			$subfield_data{marc_value}=$subf[$i][1];
! 		$subfield_data{marc_subfield}=$subf[$i][0];
! 		$subfield_data{marc_tag}=$field->tag();
! 		push(@subfields_data, \%subfield_data);
! 	}
! 	if ($#subfields_data>=0) {
! 		my %tag_data;
! 		$tag_data{tag}=$field->tag().' -'. $tagslib->{$field->tag()}->{lib};
! 		$tag_data{subfield} = \@subfields_data;
! 		push (@loop_data, \%tag_data);
  	}
  }
+ $template->param("0XX" =>\@loop_data);
+ 
+ # my $authtypes = getauthtypes;
+ # my @authtypesloop;
+ # foreach my $thisauthtype (keys %$authtypes) {
+ # 	my $selected = 1 if $thisauthtype eq $authtypecode;
+ # 	my %row =(value => $thisauthtype,
+ # 				selected => $selected,
+ # 				authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
+ # 			);
+ # 	push @authtypesloop, \%row;
+ # }
  
  $template->param(authid => $authid,
! # 				authtypesloop => \@authtypesloop,
! 				index => $index);
  output_html_with_http_headers $query, $cookie, $template->output;
  





More information about the Koha-cvs mailing list