[Koha-cvs] CVS: koha/admin systempreferences.pl,1.23,1.24

Henri-Damien LAURENT hdl at users.sourceforge.net
Fri Jun 17 18:37:03 CEST 2005


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

Modified Files:
	systempreferences.pl 
Log Message:
Displaying system preferences by category

Index: systempreferences.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/systempreferences.pl,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** systempreferences.pl	11 Feb 2005 16:24:11 -0000	1.23
--- systempreferences.pl	17 Jun 2005 16:37:01 -0000	1.24
***************
*** 50,53 ****
--- 50,79 ----
  
  
+ my %tabsysprefs;
+ $tabsysprefs{acquisitions}="Acquisitions";
+ $tabsysprefs{gist}="Acquisitions";
+ $tabsysprefs{authoritysep}="Authorities";
+ $tabsysprefs{ISBD}="Catalogue";
+ $tabsysprefs{marc}="Catalogue";
+ $tabsysprefs{marcflavour}="Catalogue";
+ $tabsysprefs{SubscriptionHistory}="Catalogue";
+ $tabsysprefs{maxoutstanding}="Circulation";
+ $tabsysprefs{printcirculationslips}="Circulation";
+ $tabsysprefs{suggestion}="Circulation";
+ $tabsysprefs{automembernum}="Members";
+ $tabsysprefs{noissuescharge}="Circulation";
+ $tabsysprefs{opacthemes}="OPAC";
+ $tabsysprefs{opaclanguages}="OPAC";
+ $tabsysprefs{LibraryName}="OPAC";
+ $tabsysprefs{opacstylesheet}="OPAC";
+ $tabsysprefs{BiblioDefaultView}="OPAC";
+ $tabsysprefs{hidelostitem}="OPAC";
+ $tabsysprefs{KohaAdmin}="Admin";
+ $tabsysprefs{checkdigit}="Admin";
+ $tabsysprefs{dateformat}="Admin";
+ $tabsysprefs{insecure}="Admin";
+ $tabsysprefs{ldapinfos}="Admin";
+ $tabsysprefs{ldapserver}="Admin";
+ 
  sub StringSearch  {
  	my ($env,$searchstring,$type)=@_;
***************
*** 56,71 ****
  	my @data=split(' ',$searchstring);
  	my $count=@data;
- 	my $sth=$dbh->prepare("Select variable,value,explanation,type,options from systempreferences where (variable like ?) order by variable");
- 	$sth->execute("$data[0]%");
  	my @results;
  	my $cnt=0;
! 	while (my $data=$sth->fetchrow_hashref){
! 		push(@results,$data);
! 		$cnt ++;
  	}
- 	$sth->finish;
  	return ($cnt,\@results);
  }
  
  my $input = new CGI;
  my $searchfield=$input->param('searchfield');
--- 82,119 ----
  	my @data=split(' ',$searchstring);
  	my $count=@data;
  	my @results;
  	my $cnt=0;
! 	if ($type){
! 		foreach my $syspref (sort keys %tabsysprefs){
! 			if ($tabsysprefs{$syspref} eq $type){
! 				my $sth=$dbh->prepare("Select variable,value,explanation,type,options from systempreferences where (variable like ?) order by variable");
! 				$sth->execute($syspref);
! 				while (my $data=$sth->fetchrow_hashref){
! 					push(@results,$data);
! 					$cnt ++;
! 				}
! 				$sth->finish;
! 			}
! 		}
! 	}else {
! 		my $strsth ="Select variable,value,explanation,type,options from systempreferences where variable not in (";  
! 		foreach my $syspref (keys %tabsysprefs){
! 			$strsth .= $dbh->quote($syspref).",";
! 		}
! 		$strsth =~ s/,$/) /;
! 		$strsth .= " order by variable";
! 		warn $strsth;
! 		my $sth=$dbh->prepare($strsth);
! 		$sth->execute();
! 		while (my $data=$sth->fetchrow_hashref){
! 			push(@results,$data);
! 			$cnt ++;
! 		}
! 		$sth->finish;
  	}
  	return ($cnt,\@results);
  }
  
+ 
  my $input = new CGI;
  my $searchfield=$input->param('searchfield');
***************
*** 279,295 ****
  ################## DEFAULT ##################################
  } else { # DEFAULT
  	if  ($searchfield ne '') {
  		 $template->param(searchfield => "<p>You Searched for <strong>$searchfield</strong></p>");
  	}
  	my $env;
! 	my ($count,$results)=StringSearch($env,$searchfield,'web');
  	my $toggle=0;
  	my @loop_data = ();
  	for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
! 	  	if ($toggle eq 0){
  			$toggle=1;
! 	  	} else {
  			$toggle=0;
! 	  	}
  		my %row_data;  # get a fresh hash for the row data
  		$row_data{variable} = $results->[$i]{'variable'};
--- 327,346 ----
  ################## DEFAULT ##################################
  } else { # DEFAULT
+ 	#Adding tab management for system preferences
+ 	my $tab=$input->param('tab');
+ 	
  	if  ($searchfield ne '') {
  		 $template->param(searchfield => "<p>You Searched for <strong>$searchfield</strong></p>");
  	}
  	my $env;
! 	my ($count,$results)=StringSearch($env,$searchfield,$tab);
  	my $toggle=0;
  	my @loop_data = ();
  	for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
! 		if ($toggle eq 0){
  			$toggle=1;
! 		} else {
  			$toggle=0;
! 		}
  		my %row_data;  # get a fresh hash for the row data
  		$row_data{variable} = $results->[$i]{'variable'};





More information about the Koha-cvs mailing list