[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/admin thesaurus.pl,1.2,1.3
From: |
Paul POULAIN |
Subject: |
[Koha-cvs] CVS: koha/admin thesaurus.pl,1.2,1.3 |
Date: |
Mon, 02 Dec 2002 06:59:52 -0800 |
Update of /cvsroot/koha/koha/admin
In directory sc8-pr-cvs1:/tmp/cvs-serv8315/admin
Modified Files:
thesaurus.pl
Log Message:
bugfixes and improvments
Index: thesaurus.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/thesaurus.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** thesaurus.pl 12 Nov 2002 16:43:16 -0000 1.2
--- thesaurus.pl 2 Dec 2002 14:59:50 -0000 1.3
***************
*** 29,33 ****
my $input = new CGI;
my $search_category=$input->param('search_category');
! my $toponly = $input->param('toponly');
my $branch = $input->param('branch');
my $searchstring = $input->param('searchstring');
--- 29,34 ----
my $input = new CGI;
my $search_category=$input->param('search_category');
! $search_category=$input->param('category') unless $search_category;
! #my $toponly = $input->param('toponly');
my $branch = $input->param('branch');
my $searchstring = $input->param('searchstring');
***************
*** 37,49 ****
my $father=$input->param('father');
! my $reqsel="select category,stdlib,freelib from authorised_values where
id='$id'";
! my $reqdel="delete from authorised_values where id='$id'";
my $script_name="/cgi-bin/koha/admin/thesaurus.pl";
my $dbh = C4::Context->dbh;
my $authoritysep = C4::Context->preference("authoritysep");
- warn "authority : $authoritysep";
my $template = gettemplate("parameters/thesaurus.tmpl",0);
my $pagesize=20;
my $op = $input->param('op');
--- 38,53 ----
my $father=$input->param('father');
! my $reqsel="select category,stdlib,freelib from bibliothesaurus where
id='$id'";
! my $reqdel="delete from bibliothesaurus where id='$id'";
my $script_name="/cgi-bin/koha/admin/thesaurus.pl";
my $dbh = C4::Context->dbh;
my $authoritysep = C4::Context->preference("authoritysep");
my $template = gettemplate("parameters/thesaurus.tmpl",0);
my $pagesize=20;
+
+ my $prevpage = $offset-$pagesize;
+ my $nextpage =$offset+$pagesize;
+
my $op = $input->param('op');
***************
*** 60,64 ****
my $data;
if ($id) {
- warn "id => $id";
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("select id,category,freelib,stdlib from
bibliothesaurus where id='$id'");
--- 64,67 ----
***************
*** 80,84 ****
id => $data->{'id'},
branch => $branch,
! toponly => $toponly,
search_category =>
$search_category,
searchstring =>
$searchstring,
--- 83,87 ----
id => $data->{'id'},
branch => $branch,
! # toponly => $toponly,
search_category =>
$search_category,
searchstring =>
$searchstring,
***************
*** 95,102 ****
} elsif ($op eq 'add_validate') {
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("replace bibliothesaurus
(id,category,stdlib,freelib,father,hierarchy) values (?,?,?,?,?)");
! $sth->execute($input->param('id'), $input->param('category'),
$input->param('stdlib'), $input->param('freelib'),$father);
! $sth->finish;
! print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=thesaurus.pl?branch=$branch&toponly=$toponly&search_category=$search_category&searchstring=$searchstring&offset=$offset\"></html>";
exit;
################## DELETE_CONFIRM ##################################
--- 98,103 ----
} elsif ($op eq 'add_validate') {
my $dbh = C4::Context->dbh;
! newauthority($dbh,$input->param('category'),$input->param('stdlib'),
$input->param('freelib'),'',1,'');
! print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=thesaurus.pl?branch=$branch&search_category=$search_category&searchstring=$searchstring&offset=$offset\"></html>";
exit;
################## DELETE_CONFIRM ##################################
***************
*** 117,125 ****
# called by delete_confirm, used to effectively confirm deletion of data in DB
} elsif ($op eq 'delete_confirmed') {
! my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare($reqdel);
! $sth->execute;
! $sth->finish;
! print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=thesaurus.pl?search_category=$search_category\"></html>";
exit;
# END $OP eq DELETE_CONFIRMED
--- 118,127 ----
# called by delete_confirm, used to effectively confirm deletion of data in DB
} elsif ($op eq 'delete_confirmed') {
! # my $dbh = C4::Context->dbh;
! # my $sth=$dbh->prepare($reqdel);
! # $sth->execute;
! # $sth->finish;
! &delauthority($id);
! print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=thesaurus.pl?search_category=$search_category&searchstring=$searchstring\"></html>";
exit;
# END $OP eq DELETE_CONFIRMED
***************
*** 143,152 ****
}
my $env;
! my $sth = $dbh->prepare("select stdlib,category from bibliothesaurus
where id=?");
$sth->execute($id);
! my ($stdlib,$category) = $sth->fetchrow_array;
$sth->finish;
! $sth= $dbh->prepare("select id,freelib from bibliothesaurus where
stdlib=?");
! $sth->execute($stdlib);
my $toggle="white";
# builds value list
--- 145,154 ----
}
my $env;
! my $sth = $dbh->prepare("select father,stdlib,category,hierarchy from
bibliothesaurus where id=?");
$sth->execute($id);
! my ($father,$stdlib,$category,$suphierarchy) = $sth->fetchrow_array;
$sth->finish;
! $sth= $dbh->prepare("select id,freelib from bibliothesaurus where
father=? and stdlib=?");
! $sth->execute($father,$stdlib);
my $toggle="white";
# builds value list
***************
*** 168,172 ****
tab_list => $tab_list,
category =>
$search_category,
! toponly => $toponly,
searchstring =>
$searchstring,
stdlib => $stdlib,
--- 170,174 ----
tab_list => $tab_list,
category =>
$search_category,
! # toponly => $toponly,
searchstring =>
$searchstring,
stdlib => $stdlib,
***************
*** 191,213 ****
}
my $env;
! my
($count,$results)=searchauthority($env,$search_category,$toponly,$branch,$searchstring);
my $toggle="white";
my @loop_data = ();
# builds value list
! for (my $i=$offset; $i <
($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
! if ($toggle eq 'white'){
! $toggle="#ffffcc";
! } else {
! $toggle="white";
! }
! my %row_data; # get a fresh hash for the row data
! $row_data{category} = $results->[$i]{'category'};
! $row_data{stdlib} = (" " x
$results->[$i]{'level'}).$results->[$i]{'stdlib'};
! $row_data{stdlib} = $results->[$i]{'stdlib'};
! $row_data{dig} ="<a
href=thesaurus.pl?branch=$results->[$i]{'hierarchy'}".($results->[$i]{'hierarchy'}?"|":"")."$results->[$i]{'id'}&toponly=$toponly&search_category=$search_category>";
! $row_data{related} ="<a
href=thesaurus.pl?id=$results->[$i]{'id'}&search_category=$search_category&op=detail_form>";
! $row_data{edit} =
"$script_name?op=add_form&branch=$branch&toponly=$toponly&search_category=$search_category&searchstring=$searchstring&offset=$offset&id=".$results->[$i]{'id'};
! $row_data{delete} =
"$script_name?op=delete_confirm&search_category=$search_category&id=".$results->[$i]{'id'};
! push(@loop_data, \%row_data);
}
# rebuild complete hierarchy
--- 193,220 ----
}
my $env;
! my
($count,$results)=searchauthority($env,$search_category,$branch,$searchstring,$offset,$pagesize);
my $toggle="white";
my @loop_data = ();
# builds value list
! for (my $i=0; $i < $pagesize; $i++){
! if ($results->[$i]{'stdlib'}) {
! if ($toggle eq 'white'){
! $toggle="#ffffcc";
! } else {
! $toggle="white";
! }
! my %row_data; # get a fresh hash for the row data
! $row_data{category} = $results->[$i]{'category'};
! # $row_data{stdlib} = (" " x
$results->[$i]{'level'}).$results->[$i]{'stdlib'};
! $row_data{stdlib} = $results->[$i]{'stdlib'};
! $row_data{freelib} = $results->[$i]{'freelib'};
! $row_data{freelib} =~ s/($searchstring)/<b>$1<\/b>/gi;
! $row_data{father} = $results->[$i]{'father'};
! $row_data{dig} ="<a
href=thesaurus.pl?branch=$results->[$i]{'hierarchy'}$results->[$i]{'id'}|&search_category=$search_category>";
! $row_data{related} ="<a
href=thesaurus.pl?id=$results->[$i]{'id'}&search_category=$search_category&op=detail_form>";
! $row_data{edit} =
"$script_name?op=add_form&branch=$branch&search_category=$search_category&searchstring=$searchstring&offset=$offset&id=".$results->[$i]{'id'};
! $row_data{delete} =
"$script_name?op=delete_confirm&search_category=$search_category&id=".$results->[$i]{'id'};
! push(@loop_data, \%row_data);
! }
}
# rebuild complete hierarchy
***************
*** 221,235 ****
$sth->execute($hierarchy[$xi]);
my ($t) = $sth->fetchrow_array;
! $x.=$hierarchy[$xi];
$link{'string'}=$t;
$link{'branch'}=$x;
push (@hierarchy_loop, \%link);
! $x.='|';
! $father = $t." $authoritysep ";
}
$template->param(loop => address@hidden,
tab_list => $tab_list,
category =>
$search_category,
! toponly => $toponly,
searchstring =>
$searchstring,
hierarchy_loop =>
address@hidden,
--- 228,241 ----
$sth->execute($hierarchy[$xi]);
my ($t) = $sth->fetchrow_array;
! $x.=$hierarchy[$xi]."|";
$link{'string'}=$t;
$link{'branch'}=$x;
push (@hierarchy_loop, \%link);
! $father .= $t." $authoritysep ";
}
$template->param(loop => address@hidden,
tab_list => $tab_list,
category =>
$search_category,
! # toponly => $toponly,
searchstring =>
$searchstring,
hierarchy_loop =>
address@hidden,
***************
*** 237,246 ****
father => $father);
if ($offset>0) {
! my $prevpage = $offset-$pagesize;
! $template->param(previous => "<a
href=$script_name?branch=$branch&toponly=$toponly&search_category=$search_category&searchstring=$searchstring&offset=$prevpage><<
Prev</a>");
}
! if ($offset+$pagesize<$count) {
! my $nextpage =$offset+$pagesize;
! $template->param(next => "<a
href=$script_name?branch=$branch&toponly=$toponly&search_category=$search_category&searchstring=$searchstring&offset=$nextpage>Next
>></a>");
}
} #---- END $OP eq DEFAULT
--- 243,250 ----
father => $father);
if ($offset>0) {
! $template->param(previous => "<a
href=$script_name?branch=$branch&search_category=$search_category&searchstring=$searchstring&offset=$prevpage><<
Prev</a>");
}
! if ($pagesize<$count) {
! $template->param(next => "<a
href=$script_name?branch=$branch&search_category=$search_category&searchstring=$searchstring&offset=$nextpage>Next
>></a>");
}
} #---- END $OP eq DEFAULT
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/admin thesaurus.pl,1.2,1.3,
Paul POULAIN <=