X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=thesaurus_popup.pl;h=3038b67157004213c9895723d608530b4ca99e25;hb=a913fc3bca627fcc9ccba659b0ee2915a3325846;hp=b08749331a5eaaa56defa75bb8d996e9cf9375bc;hpb=1e67687742e36bbb90746ecdd78a0c6a63aad890;p=koha_gimpoz diff --git a/thesaurus_popup.pl b/thesaurus_popup.pl index b08749331a..3038b67157 100755 --- a/thesaurus_popup.pl +++ b/thesaurus_popup.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl # written 10/5/2002 by Paul -# build Subject field using bibliothesaurus table +# build result field using bibliothesaurus table # Copyright 2000-2002 Katipo Communications @@ -22,70 +22,77 @@ # Suite 330, Boston, MA 02111-1307 USA use strict; +use C4::Auth; use CGI; -use C4::Database; +use C4::Context; +use HTML::Template; use C4::Search; -use C4::Circulation::Circ2; use C4::Output; - +use C4::Authorities; # get all the data .... my %env; my $input = new CGI; -my $subject = $input->param('subject'); +my $result = $input->param('result'); my $search_string= $input->param('search_string'); my $op = $input->param('op'); -my $freelib_text = $input->param('freelib_text'); +my $id = $input->param('id'); +my $category = $input->param('category'); +my $index= $input->param('index'); +my $insert = $input->param('insert'); -my $dbh=C4Connect; +my $dbh = C4::Context->dbh; # make the page ... -print $input->header; +#print $input->header; if ($op eq "select") { - $subject = $subject."|$freelib_text"; + my $sti = $dbh->prepare("select stdlib from bibliothesaurus where id=?"); + $sti->execute($id); + my ($freelib_text) = $sti->fetchrow_array; + if (length($result)>0) { + $result .= "|$freelib_text"; + } else { + $result = $freelib_text; + } +} +if ($op eq "add") { + newauthority($dbh,$category,$insert,$insert,'',1,''); + $search_string=$insert; } -print <<"EOF"; - - - Subject builder - - -
-
-

- -

-
-EOF +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "thesaurus_popup.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {parameters => 1}, + debug => 1, + }); # /search thesaurus terms starting by search_string - if ($search_string) { - print '
'; - print ' - - - -
-EOF + while (my $line=$sti->fetchrow_hashref) { + $stdlib{$line->{'id'}} = "$line->{'freelib'}"; + push(@freelib,$line->{'id'}); } - print <<"EOF"; -
- -
- - - -EOF + $select_list= CGI::scrolling_list( -name=>'id', + -values=> \@freelib, + -default=> "", + -size=>1, + -multiple=>0, + -labels=> \%stdlib + ); +} +$template->param(select_list => $select_list, + search_string => $search_string, + result => $result, + category => $category, + index => $index + ); +print $input->header(-cookie => $cookie),$template->output; + +