[Koha-cvs] CVS: koha/admin systempreferences.pl,1.19,1.20

Paul POULAIN tipaul at users.sourceforge.net
Fri May 28 15:43:29 CEST 2004


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

Modified Files:
	systempreferences.pl 
Log Message:
improving systempreferences to show lists, radio button where applicable (was partially done by ?, buttemplate was not done)

Index: systempreferences.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/systempreferences.pl,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** systempreferences.pl	28 May 2004 08:24:55 -0000	1.19
--- systempreferences.pl	28 May 2004 13:43:25 -0000	1.20
***************
*** 132,143 ****
  	if ($sth->rows) {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $sth=$dbh->prepare("update systempreferences set value=?,explanation=? where variable=?");
! 			$sth->execute($value, $input->param('explanation'), $input->param('variable'));
  			$sth->finish;
  		}
      } else {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $sth=$dbh->prepare("insert into systempreferences (variable,value,explanation) values (?,?,?)");
! 			$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'));
  			$sth->finish;
  		}
--- 132,143 ----
  	if ($sth->rows) {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $sth=$dbh->prepare("update systempreferences set value=?,explanation=?,type=?,options=? where variable=?");
! 			$sth->execute($value, $input->param('explanation'), $input->param('variable'), $input->param('preftype'), $input->param('prefoptions'));
  			$sth->finish;
  		}
      } else {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $sth=$dbh->prepare("insert into systempreferences (variable,value,explanation) values (?,?,?,?,?)");
! 			$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'), $input->param('preftype'), $input->param('prefoptions'));
  			$sth->finish;
  		}
***************
*** 174,188 ****
  		$data->{'value'}=C4::Context->boolean_preference($data->{'variable'});
  		($data->{'value'} eq '1') ? ($template->param('value-yes'=>1)) : ($template->param('value-no'=>1));
- 	} elsif ($data->{'type'} eq 'free') {
- 		$template->param('type-free' => 1);
- 		$template->param('fieldlength' => $data->{'options'});
  	} elsif ($data->{'type'} eq 'Integer') {
  		$template->param('type-free' => 1);
  		$template->param('fieldlength' => $data->{'options'});
  	} elsif ($data->{'type'} eq 'Float') {
  		$template->param('type-free' => 1);
  		$template->param('fieldlength' => $data->{'options'});
  	} elsif ($data->{'type'} eq 'Themes') {
! 		$template->param('type-reorderlist' => 1);
  		my $type='';
  		($data->{'variable'}=~m#opac#i) ? ($type='opac') : ($type='intranet');
--- 174,189 ----
  		$data->{'value'}=C4::Context->boolean_preference($data->{'variable'});
  		($data->{'value'} eq '1') ? ($template->param('value-yes'=>1)) : ($template->param('value-no'=>1));
  	} elsif ($data->{'type'} eq 'Integer') {
  		$template->param('type-free' => 1);
  		$template->param('fieldlength' => $data->{'options'});
+ 	} elsif ($data->{'type'} eq 'Textarea') {
+ 		$template->param('type-textarea' => 1);
+ 		$data->{options} =~ /(.*)\|(.*)/;
+ 		$template->param('cols' => $1, 'rows' => $2);;
  	} elsif ($data->{'type'} eq 'Float') {
  		$template->param('type-free' => 1);
  		$template->param('fieldlength' => $data->{'options'});
  	} elsif ($data->{'type'} eq 'Themes') {
! 		$template->param('type-choice' => 1);
  		my $type='';
  		($data->{'variable'}=~m#opac#i) ? ($type='opac') : ($type='intranet');
***************
*** 202,206 ****
  		}
  	} elsif ($data->{'type'} eq 'Languages') {
! 		$template->param('type-reorderlist' => 1);
  		my $type='';
  		@options=();
--- 203,207 ----
  		}
  	} elsif ($data->{'type'} eq 'Languages') {
! 		$template->param('type-choice' => 1);
  		my $type='';
  		@options=();
***************
*** 220,223 ****
--- 221,227 ----
  			$counter++;
  		}
+ 	} else {
+ 		$template->param('type-free' => 1);
+ 		$template->param('fieldlength' => $data->{'options'}>0?$data->{'options'}:60);
  	}
  	$template->param(explanation => $data->{'explanation'},
***************
*** 225,228 ****
--- 229,234 ----
  			 type => $data->{'type'},
  			 options => \@options,
+ 			 preftype => $data->{'type'},
+ 			 prefoptions => $data->{'options'},
  			 searchfield => $searchfield);
  
***************
*** 235,246 ****
  	if ($sth->rows) {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $sth=$dbh->prepare("update systempreferences set value=?,explanation=? where variable=?");
! 			$sth->execute($input->param('value'), $input->param('explanation'), $input->param('variable'));
  			$sth->finish;
  		}
  	} else {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $sth=$dbh->prepare("insert into systempreferences (variable,value,explanation) values (?,?,?)");
! 			$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'));
  			$sth->finish;
  		}
--- 241,252 ----
  	if ($sth->rows) {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $sth=$dbh->prepare("update systempreferences set value=?,explanation=?,type=?,options=? where variable=?");
! 			$sth->execute($input->param('value'), $input->param('explanation'), $input->param('preftype'), $input->param('prefoptions'), $input->param('variable'));
  			$sth->finish;
  		}
  	} else {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $sth=$dbh->prepare("insert into systempreferences (variable,value,explanation,type,options) values (?,?,?)");
! 			$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'), $input->param('preftype'), $input->param('prefoptions'));
  			$sth->finish;
  		}





More information about the Koha-cvs mailing list