koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha thesaurus_popup.pl,NONE,1.1 modbib.pl,1.3,1.4


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha thesaurus_popup.pl,NONE,1.1 modbib.pl,1.3,1.4
Date: Tue, 14 May 2002 04:26:12 -0700

Update of /cvsroot/koha/koha
In directory usw-pr-cvs1:/tmp/cvs-serv32679

Modified Files:
        modbib.pl 
Added Files:
        thesaurus_popup.pl 
Log Message:
First, run updater/thesaurus_create.pl.
It creates a thesaurus table and fills it with data in bibliosubject. Thesaurus
contains 2 columns : freelib and stdlib. This permits connecting differents 
forms for a word/sentence (HUGO may be mapped to V. Hugo, Victor Hugo...)
In modbib.pl, you will see "..." near subject. If you   click on this ..., a 
popup appear. It has 4 parts : the Subject field, a search field with Search 
button. If you enter a value here and click Search, a list of thesaurus entries 
starting by what you enter appear.
If you select a value and click "OK", the value is added to the subject list.
When you've finished, click END. the window is closed, and the value copied to 
main subject window.

Make heavy use of javascript. TESTED UNDER MOZILLA 0.99. Please test under IE.

Administration of thesaurus table will come soon (with html::template) ...



--- NEW FILE ---
#!/usr/bin/perl

# written 10/5/2002 by Paul
# build Subject field using bibliothesaurus table

use strict;
use CGI;
use C4::Database;
use C4::Search;
use C4::Circulation::Circ2;
use C4::Output;

# get all the data ....
my %env;

my $input = new CGI;
my $subject = $input->param('subject');
my $search_string= $input->param('search_string');
my $op = $input->param('op');
my $freelib_text = $input->param('freelib_text');

my $dbh=C4Connect;

# make the page ...
print $input->header;
if ($op eq "select") {
        $subject = $subject."|$freelib_text";
}
print <<"EOF";
        <html>
        <head>
        <title>Subject builder</title>
        </head>
        <body>
        <form name="f_pop" action="thesaurus_popup.pl" method="post">
        <textarea name="subject" rows=10 cols=60>$subject </textarea></br>
        <p><input type="text" name="search_string" value="$search_string">
        <input type="hidden" name="op" value="search">
        <input type="submit" value="Search"></p>
        </form>
EOF
# /search thesaurus terms starting by search_string
        if ($search_string) {
                print '<form name="f2_pop" action="thesaurus_popup.pl" 
method="post">';
                print '<select name="freelib_text">';
                my $sti=$dbh->prepare("select freelib,stdlib from 
bibliothesaurus where freelib like '".$search_string."%'");
                $sti->execute;
                while (my $line=$sti->fetchrow_hashref) {
                        print "<option 
value='$line->{'stdlib'}'>$line->{freelib}</option>";
                }
        print <<"EOF";
                </select>
                <input type="hidden" name="op" value="select">
                <input type="hidden" name="subject" value="$subject">
                <input type="submit" name="OK" value="OK">
                </form>
EOF
        }
        print <<"EOF";
                <form name="f3_pop" onSubmit="javascript:report()">
                <input type="submit" value="END">
                </form>
                <script>
                function report() {
                        alert("REPORT");
                        opener.document.f.subject.value= 
document.f_pop.subject.value;
                        self.close();
                        return false;
                }
                </script>
                </body>
                </html>
EOF

Index: modbib.pl
===================================================================
RCS file: /cvsroot/koha/koha/modbib.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** modbib.pl   12 May 2002 15:37:53 -0000      1.3
--- modbib.pl   14 May 2002 11:26:09 -0000      1.4
***************
*** 64,68 ****
  print << "EOF";
  <a href="modwebsites.pl?biblionumber=$data->{'biblionumber'}">Modify Website 
Links</a>
! <form action="updatebiblio.pl" method="post">
  <input type="hidden" name="biblionumber" value="$data->{'biblionumber'}">
  <input type="hidden" name="biblioitemnumber" 
value="$data=>{'biblioitemnumber'}">
--- 64,68 ----
  print << "EOF";
  <a href="modwebsites.pl?biblionumber=$data->{'biblionumber'}">Modify Website 
Links</a>
! <form action="updatebiblio.pl" method="post" name="f">
  <input type="hidden" name="biblionumber" value="$data->{'biblionumber'}">
  <input type="hidden" name="biblioitemnumber" 
value="$data=>{'biblioitemnumber'}">
***************
*** 82,86 ****
  <tr valign="top">
  <td>Subject</td>
! <td><textarea name="subject" cols="40" rows="4">$sub</textarea></td>
  </tr>
  <tr valign="top">
--- 82,88 ----
  <tr valign="top">
  <td>Subject</td>
! <td><textarea name="subject" cols="40" rows="4">$sub</textarea>
! <a href="javascript:Dopop()">...</a>
! </td>
  </tr>
  <tr valign="top">
***************
*** 124,127 ****
--- 126,134 ----
  <input type="submit" name="submit" value="Save Changes">
  </form>
+ <script>
+ function Dopop() {
+         
newin=window.open("thesaurus_popup.pl?subject="+document.f.subject.value,"thesaurus",'width=500,height=400,toolbar=false,scrollbars=yes');
+ }
+ </script>
  EOF
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]