[Koha-cvs] CVS: koha admin-home.pl,NONE,1.1.2.1 catalogue-home.pl,NONE,1.1.2.1 logout.pl,NONE,1.2.2.1 mainpage.pl,NONE,1.1.2.1 member-password.pl,NONE,1.1.2.1 members-home.pl,NONE,1.1.2.1 reports-home.pl,NONE,1.1.2.1 detail.pl,1.3.2.2,1.3.2.3 memberentry.pl,1.6.2.2,1.6.2.3 moredetail.pl,1.4.2.1,1.4.2.2 moremember.pl,1.11.2.2,1.11.2.3 search.pl,1.6.2.8,1.6.2.9 shelves.pl,1.2.2.1,1.2.2.2

Steve Tonnesen tonnesen at users.sourceforge.net
Thu Jul 11 20:05:31 CEST 2002


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

Modified Files:
      Tag: rel-1-2
	detail.pl memberentry.pl moredetail.pl moremember.pl search.pl 
	shelves.pl 
Added Files:
      Tag: rel-1-2
	admin-home.pl catalogue-home.pl logout.pl mainpage.pl 
	member-password.pl members-home.pl reports-home.pl 
Log Message:
Committing changes to add authentication and opac templating to rel-1-2 branch


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

use strict;
use CGI;
use C4::Auth;
use C4::Output;

my $query = new CGI;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query);

print $query->header(-cookie => $cookie);

print startpage();
print startmenu('catalogue');


print "<p align=left>Logged in as: $loggedinuser [<a href=/cgi-bin/koha/logout.pl>Log Out</a>]</p>\n";

open H, "/usr/local/koha/intranet/htdocs/admin/index.html";
while (<H>) {
    print $_;
}
close H;


print endpage();
print endmenu('catalogue');

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

use strict;
use CGI;
use C4::Auth;
use C4::Output;

my $query = new CGI;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query);

print $query->header(-cookie => $cookie);

print startpage();
print startmenu('catalogue');

print "<p align=left>Logged in as: $loggedinuser [<a href=/cgi-bin/koha/logout.pl>Log Out</a>]</p>\n";

my $classlist='';
open C, "/usr/local/koha/intranet/htdocs/includes/cat-class-list.inc";
while (<C>) {
    $classlist.=$_;
}
open H, "/usr/local/koha/intranet/htdocs/catalogue/index.html";
while (<H>) {
    s/<!-- CLASSLIST -->/$classlist/;
    print $_;
}
close H;


print endpage();
print endmenu('catalogue');

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

use CGI;
use C4::Database;

my $query=new CGI;

my $sessionID=$query->cookie('sessionID');

my $sessions;
open (S, "/tmp/sessions");
while (my ($sid, $u, $lasttime) = split(/:/, <S>)) {
    chomp $lasttime;
    (next) unless ($sid);
    (next) if ($sid eq $sessionID);
    $sessions->{$sid}->{'userid'}=$u;
    $sessions->{$sid}->{'lasttime'}=$lasttime;
}
open (S, ">/tmp/sessions");
foreach (keys %$sessions) {
    my $userid=$sessions->{$_}->{'userid'};
    my $lasttime=$sessions->{$_}->{'lasttime'};
    print S "$_:$userid:$lasttime\n";
}

my $dbh=C4Connect;

# Check that this is the ip that created the session before deleting it

my $sth=$dbh->prepare("select userid,ip from sessions where sessionID=?");
$sth->execute($sessionID);
my ($userid, $ip);
if ($sth->rows) {
    ($userid,$ip) = $sth->fetchrow;
    if ($ip ne $ENV{'REMOTE_ADDR'}) {
       # attempt to logout from a different ip than cookie was created at
       exit;
    }
}

$sth=$dbh->prepare("delete from sessions where sessionID=?");
$sth->execute($sessionID);
open L, ">>/tmp/sessionlog";
my $time=localtime(time());
printf L "%20s from %16s logged out at %30s (manual log out).\n", $userid, $ip, $time;
close L;

my $cookie=$query->cookie(-name => 'sessionID',
			  -value => '',
			  -expires => '+1y');

# Should redirect to intranet home page after logging out

print $query->redirect("mainpage.pl");

exit;
if ($sessionID) {
    print "Logged out of $sessionID<br>\n";
    print "<a href=shelves.pl>Login</a>";
} else {
    print "Not logged in.<br>\n";
    print "<a href=shelves.pl>Login</a>";
}




--- NEW FILE ---
#!/usr/bin/perl
use HTML::Template;
use strict;
require Exporter;
use C4::Database;
use C4::Output;  # contains picktemplate
use CGI;
use C4::Auth;

my $query = new CGI;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query);

my %configfile;
open (KC, "/etc/koha.conf");
while (<KC>) {
 chomp;
 (next) if (/^\s*#/);
 if (/(.*)\s*=\s*(.*)/) {
   my $variable=$1;
   my $value=$2;
   # Clean up white space at beginning and end
   $variable=~s/^\s*//g;
   $variable=~s/\s*$//g;
   $value=~s/^\s*//g;
   $value=~s/\s*$//g;
   $configfile{$variable}=$value;
 }
}

my $includes=$configfile{'includes'};
($includes) || ($includes="/usr/local/www/hdl/htdocs/includes");
my $templatebase="catalogue/intranet-main.tmpl";
my $theme=picktemplate($includes, $templatebase);

my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]);

#$template->param(SITE_RESULTS => $sitearray);
print "Content-Type: text/html\n\n", $template->output;

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

#script to delete items
#written 2/5/00
#by chris at katipo.co.nz

use strict;

use C4::Search;
use CGI;
use Digest::MD5 qw(md5_base64);
use C4::Output;
use C4::Database;
use C4::Circulation::Circ2;
#use C4::Acquisitions;

my $input = new CGI;
#print $input->header;
my $member=$input->param('member');
my %env;
$env{'nottodayissues'}=1;
my %member2;
$member2{'borrowernumber'}=$member;
my $issues=currentissues(\%env,\%member2);
my $i=0;
foreach (sort keys %$issues) {
    $i++;
}
if ($input->param('newpassword')) {
    my $digest=md5_base64($input->param('newpassword'));
    my $dbh=C4Connect();
    my $sth=$dbh->prepare("update borrowers set password=? where borrowernumber=?");
    $sth->execute($digest, $member);
    warn "$member $digest";
    print $input->redirect("/members/");
} else {
    my ($bor,$flags)=getpatroninformation(\%env, $member,'');

    my $chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
    my $length=int(rand(2))+4;
    my $defaultnewpassword='';
    for (my $i=0; $i<$length; $i++) {
	$defaultnewpassword.=substr($chars, int(rand(length($chars))),1);
    }
    my $spellitout=$defaultnewpassword;
    $spellitout=~s/l/\001/g;
    $spellitout=~s/1/\002/g;
    $spellitout=~s/O/\003/g;
    $spellitout=~s/o/\004/g;
    $spellitout=~s/0/\005/g;
    $spellitout=~s/\001/ <b>el<\/b> /g;
    $spellitout=~s/\002/ <b>one<\/b> /g;
    $spellitout=~s/\003/ <b>Oh<\/b> /g;
    $spellitout=~s/\004/ <b>oh<\/b> /g;
    $spellitout=~s/\005/ <b>zero<\/b> /g;

    print $input->header;
    print startpage();
    print startmenu('member');
    print qq|
    <h2>$bor->{'surname'}, $bor->{'firstname'}</h2>
    <form method=post>
    <input type=hidden name=member value=$member>
    New Password: <input name=newpassword size=20 value=$defaultnewpassword> (default is $spellitout)
    <p>
    <input type=submit value="Set Password">
    </form>
    |;

    print endmenu('member');
    print endpage();
}

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

use strict;
use CGI;
use C4::Auth;
use C4::Output;

my $query = new CGI;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query);

print $query->header(-cookie => $cookie);

print startpage();
print startmenu('member');

print "<p align=left>Logged in as: $loggedinuser [<a href=/cgi-bin/koha/logout.pl>Log Out</a>]</p>\n";

open H, "/usr/local/koha/intranet/htdocs/members/index.html";
while (<H>) {
    print $_;
}
close H;


print endpage();
print endmenu('member');

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

use strict;
use CGI;
use C4::Auth;
use C4::Output;

my $query = new CGI;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query);

print $query->header(-cookie => $cookie);

print startpage();
print startmenu('report');

print "<p align=left>Logged in as: $loggedinuser [<a href=/cgi-bin/koha/logout.pl>Log Out</a>]</p>\n";

open H, "/usr/local/koha/intranet/htdocs/reports/index.html";
while (<H>) {
    print $_;
}
close H;


print endpage();
print endmenu('report');

Index: detail.pl
===================================================================
RCS file: /cvsroot/koha/koha/detail.pl,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -C2 -r1.3.2.2 -r1.3.2.3
*** detail.pl	9 Jul 2002 13:15:41 -0000	1.3.2.2
--- detail.pl	11 Jul 2002 18:05:28 -0000	1.3.2.3
***************
*** 1,250 ****
  #!/usr/bin/perl
! 
! #script to display detailed information
! #written 8/11/99
! 
  use strict;
! #use DBI;
! use C4::Search;
  use CGI;
! use C4::Output;
! 
! my $input = new CGI;
! print $input->header;
! #whether it is called from the opac of the intranet
! my $type=$input->param('type');
! if ($type eq ''){
!   $type='intra';
! }
! #setup colours
! my $main;
! my $secondary;
! if ($type eq 'opac'){
!   $main='#99cccc';
!   $secondary='#efe5ef';
! } else {
!   $main='#cccc99';
!   $secondary='#ffffcc';
! }
! print startpage();
! print startmenu($type);
! #print $type;
! my $blah;
! my $bib=$input->param('bib');
! my $title=$input->param('title');
! if ($type ne 'opac'){
!   print "<a href=request.pl?bib=$bib><img height=42  WIDTH=120 BORDER=0 src=\"/images/requests.gif\" align=right border=0></a>";
! }
! 
! 
! my @items=ItemInfo(\$blah,$bib,$type);
! my $dat=bibdata($bib);
! my $count=@items;
! my ($count3,$addauthor)=addauthor($bib);
! my $additional=$addauthor->[0]->{'author'};                                                             
! for (my $i=1;$i<$count3;$i++){                                                                          
!   $additional=$additional."|".$addauthor->[$i]->{'author'};                                             
! }  
! my @temp=split('\t',$items[0]);
! if ($type eq 'catmain'){
!   print mkheadr(3,"Catalogue Maintenance");
! }
! if ($dat->{'author'} ne ''){
!   print mkheadr(3,"$dat->{'title'} ($dat->{'author'}) $temp[4]");
! } else {
!   print mkheadr(3,"$dat->{'title'} $temp[4]");
! }
! print <<printend
! 
! <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 align=left width="220">
! 
! <!-----------------BIBLIO RECORD TABLE--------->
! 
! 
! <form action=/cgi-bin/koha/modbib.pl method=post>
! <input type=hidden name=bibnum value=$bib>
! <TR VALIGN=TOP>
! 
! <td  bgcolor="$main" 
! printend
! ;
! if ($type ne 'opac'){
!  print "background=\"/images/background-mem.gif\"";
! }
! print <<printend
! ><B>BIBLIO RECORD 
! printend
! ;
! if ($type ne 'opac'){
!   print "$bib";
! }
! print <<printend
! </TD></TR>
! 
! 
! <tr VALIGN=TOP  >
! <TD>
! printend
! ;
! if ($type ne 'opac'){
!   print "<INPUT TYPE=\"image\" name=\"submit\"  VALUE=\"modify\" height=42  WIDTH=93 BORDER=0 src=\"/images/modify-mem.gif\"> 
!   <INPUT TYPE=\"image\" name=\"delete\"  VALUE=\"delete\" height=42  WIDTH=93 BORDER=0 src=\"/images/delete-mem.gif\">";
! }
! print <<printend
! <br>
! <FONT SIZE=2  face="arial, helvetica">
! printend
! ;
! 
! 
! if ($type ne 'opac'){
! print <<printend
! <b>Subtitle:</b> $dat->{'subtitle'}<br>
! <b>Author:</b> $dat->{'author'}<br>
! <b>Additional Author:</b> $additional<br>
! <b>Series Title:</b> $dat->{'seriestitle'}<br>
! <b>Subject:</b> $dat->{'subject'}<br>
! <b>Copyright:</b> $dat->{'copyrightdate'}<br>
! <b>Notes:</b> $dat->{'notes'}<br>
! <b>Unititle:</b> $dat->{'unititle'}<br>
! <b>Analytical Author:</b> <br>
! <b>Analytical Title:</b> <br>
! <b>Serial:</b> $dat->{'serial'}<br>
! <b>Total Number of Items:</b> $count
! <p>
! printend
! ;
! }
! else {
! if ($dat->{'subtitle'} ne ''){
!   print "<b>Subtitle:</b> $dat->{'subtitle'}<br>";
! }
! if ($dat->{'author'} ne ''){
!   print "<b>Author:</b> $dat->{'author'}<br>";
! }
! #Additional Author: <br>
! if ($dat->{'seriestitle'} ne ''){
!   print "<b>Seriestitle:</b> $dat->{'seriestitle'}<br>";
! }
! if ($dat->{'subject'} ne ''){
!   print "<b>Subject:</b> $dat->{'subject'}<br>";
! }
! if ($dat->{'copyrightdate'} ne ''){
!   print "<b>Copyright:</b> $dat->{'copyrightdate'}<br>";
! }
! if ($dat->{'notes'} ne ''){
!   print "<b>Notes:</b> $dat->{'notes'}<br>";
! }
! if ($dat->{'unititle'} ne ''){
!   print "<b>Unititle:</b> $dat->{'unititle'}<br>";
! }
! #Analytical Author: <br>
! #Analytical Title: <br>
! if ($dat->{'serial'} ne '0'){
!  print "<b>Serial:</b> Yes<br>";
! }
! print "<b>Total Number of Items:</b> $count
! <p>
! ";
! 
! }
! print <<printend
! </form>
! </font></TD>
! </TR>
! 
! </TABLE>
! <img src="/images/holder.gif" width=16 height=300 align=left>
! 
! printend
! ;
! 
! 
! #print @items;
! 
! my $i=0;
! print center();
! print mktablehdr;
! if ($type eq 'opac'){
! 
!   print mktablerow(6,$main,'Item Type','Class','Branch','Date Due','Last Seen'); 
! } else {
!   print mktablerow(6,$main,'Itemtype','Class','Location','Date Due','Last Seen','Barcode',"/images/background-mem.gif"); 
! }
! my $colour=1;
! while ($i < $count){
! #  print $items[$i],"<br>";
!   my @results=split('\t',$items[$i]);
!   if ($type ne 'opac'){
!     $results[1]=mklink("/cgi-bin/koha/moredetail.pl?item=$results[5]&bib=$bib&bi=$results[8]&type=$type",$results[1]);
!   }
!   if ($results[2] eq ''){
!     $results[2]='Available';
!   }
!   if ($type eq 'catmain'){
!     $results[10]=mklink("/cgi-bin/koha/maint/catmaintain.pl?type=fixitemtype&bi=$results[8]&item=$results[6]","Fix Itemtype");
!   }
!   if ($colour == 1){
!     if ($type ne 'opac'){
!       if ($type eq 'catmain'){
!         print mktablerow(8,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9],$results[10]);
!       } else {
!         print mktablerow(7,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9]);
!       }
!     } else {
!       $results[6]=ItemType($results[6]);
!       print mktablerow(6,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[9]);
!     } 
!     $colour=0;                                                                                
!   } else{                                                                                     
!     if ($type ne 'opac'){
!       if ($type eq 'catmain'){
!         print mktablerow(8,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9],$results[10]);
!       } else {
!         print mktablerow(7,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9]);
!       }
!     } else {
!       $results[6]=ItemType($results[6]);
!       print mktablerow(6,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[9]);
!     }
!     $colour=1;                                                                                
!   }
!    $i++;
! }
  
- print mktableft();
- print "<p>";
- print mktablehdr();
- if ($type ne 'opac'){
- print <<printend
- <TR VALIGN=TOP>
- <TD  bgcolor="99cc33" background="/images/background-mem.gif" colspan=2><p><b>HELP</b><br>
- <b>Update Biblio for all Items:</b> Click on the <b>Modify</b> button [left] to amend the biblio.  Any changes you make will update the record for <b>all</b> the items listed above. <p>
- <b>Updating the Biblio for only ONE or SOME Items:</b> 
- printend
- ;
- if ($type eq 'catmain'){
- print <<printend
- If some of the items listed above need a different biblio, 
- you need to click on the wrong item, then shift the group it belongs to, to the correct biblio.
- You will need to know the correct biblio number
- <p>
- 
-    </TR>
- printend
- ;
- } else {
- print <<printend
- If some of the items listed above need a different biblio, or are on the wrong biblio, you must use the <a href="/cgi-bin/koha/loadmodules.pl?module=acquisitions">acquisitions</a> process to fix this. You will need to "re-order" the items, and delete them from this biblio.
- <p>
- 
-    </TR>
- printend
- ;
- }
- }
- print mktableft();
- print endcenter();
- print "<br clear=all>";
- print endmenu($type);
- print endpage();
--- 1,94 ----
  #!/usr/bin/perl
! use HTML::Template;
  use strict;
! require Exporter;
! use C4::Database;
! use C4::Output;  # contains picktemplate
  use CGI;
! use C4::Search;
! use C4::Auth;
!  
! my $query=new CGI;
! my $type=$query->param('type');
! ($type) || ($type='intra');
! my ($loggedinuser, $cookie, $sessionID) = checkauth($query, ($type eq 'opac') ? (1) : (0));
! 
! 
! my $language='french';
! 
! 
! my %configfile;
! open (KC, "/etc/koha.conf");
! while (<KC>) {
!  chomp;
!  (next) if (/^\s*#/);
!  if (/(.*)\s*=\s*(.*)/) {
!    my $variable=$1;
!    my $value=$2;
!    # Clean up white space at beginning and end
!    $variable=~s/^\s*//g;
!    $variable=~s/\s*$//g;
!    $value=~s/^\s*//g;
!    $value=~s/\s*$//g;
!    $configfile{$variable}=$value;
!  }
! }
! 
! my $biblionumber=$query->param('bib');
! 
! 
! # change back when ive fixed request.pl
! my @items = ItemInfo(undef, $biblionumber, $type);
! my $dat=bibdata($biblionumber);
! my ($authorcount, $addauthor)= &addauthor($biblionumber);
! my ($webbiblioitemcount, @webbiblioitems) = &getwebbiblioitems($biblionumber);
! my ($websitecount, @websites)             = &getwebsites($biblionumber);
! 
! $dat->{'count'}=@items;
! 
! $dat->{'additional'}=$addauthor->[0]->{'author'};
! for (my $i = 1; $i < $authorcount; $i++) {
!         $dat->{'additional'} .= "|" . $addauthor->[$i]->{'author'};
! } # for
! 
! my @results;
! 
! $results[0]=$dat;
! 
! my $resultsarray=\@results;
! my $itemsarray=\@items;
! my $webarray=\@webbiblioitems;
! my $sitearray=\@websites;
! 
! my $includes=$configfile{'includes'};
! ($includes) || ($includes="/usr/local/www/hdl/htdocs/includes");
! my $templatebase="catalogue/detail.tmpl";
! ($type eq 'opac') && ($templatebase="catalogue/detail-opac.tmpl");
! my $startfrom=$query->param('startfrom');
! ($startfrom) || ($startfrom=0);
! my $theme=picktemplate($includes, $templatebase);
! 
! my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]);
! 
! my $count=1;
! 
! # now to get the items into a hash we can use and whack that thru
! 
! 
! $template->param(startfrom => $startfrom+1);
! $template->param(endat => $startfrom+20);
! $template->param(numrecords => $count);
! my $nextstartfrom=($startfrom+20<$count-20) ? ($startfrom+20) : ($count-20);
! my $prevstartfrom=($startfrom-20>0) ? ($startfrom-20) : (0);
! $template->param(nextstartfrom => $nextstartfrom);
! $template->param(prevstartfrom => $prevstartfrom);
! # $template->param(template => $templatename);
! # $template->param(search => $search);
! $template->param(includesdir => $includes);
! $template->param(BIBLIO_RESULTS => $resultsarray);
! $template->param(ITEM_RESULTS => $itemsarray);
! $template->param(WEB_RESULTS => $webarray);
! $template->param(SITE_RESULTS => $sitearray);
! $template->param(loggedinuser => $loggedinuser);
! print $query->header(-cookie => $cookie), $template->output;
  

Index: memberentry.pl
===================================================================
RCS file: /cvsroot/koha/koha/memberentry.pl,v
retrieving revision 1.6.2.2
retrieving revision 1.6.2.3
diff -C2 -r1.6.2.2 -r1.6.2.3
*** memberentry.pl	27 Jun 2002 21:03:03 -0000	1.6.2.2
--- memberentry.pl	11 Jul 2002 18:05:28 -0000	1.6.2.3
***************
*** 19,24 ****
--- 19,27 ----
  my $modify=$input->param('modify.x'); 
  my $delete=$input->param('delete.x');
+ my $password=$input->param('password.x');
  if ($delete){
    print $input->redirect("/cgi-bin/koha/deletemem.pl?member=$member");
+ } elsif ($password) {
+   print $input->redirect("/cgi-bin/koha/member-password.pl?member=$member");
  } else {
  print $input->header;

Index: moredetail.pl
===================================================================
RCS file: /cvsroot/koha/koha/moredetail.pl,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -C2 -r1.4.2.1 -r1.4.2.2
*** moredetail.pl	14 Jun 2002 21:20:26 -0000	1.4.2.1
--- moredetail.pl	11 Jul 2002 18:05:28 -0000	1.4.2.2
***************
*** 1,199 ****
  #!/usr/bin/perl
! 
! #script to display detailed information
! #written 8/11/99
! 
  use strict;
! #use DBI;
! use C4::Search;
  use C4::Koha;
! use C4::Output;
  use C4::Acquisitions;
! use C4::Biblio;
  
- use CGI;
- my $input = new CGI;
- print $input->header;
- #whether it is called from the opac of the intranet
- my $type=$input->param('type');
- #setup colours
- my $main;
- my $secondary;
- if ($type eq 'opac'){
-   $main='#99cccc';
-   $secondary='#efe5ef';
- } else {
-   $main='#cccc99';
-   $secondary='#ffffcc';
- }
- print startpage();
- print startmenu($type);
- my $blah;
- 
- my $bib=$input->param('bib');
- my $title=$input->param('title');
- my $bi=$input->param('bi');
  my $data=bibitemdata($bi);
! 
! my (@items)=itemissues($bi);
! my ($order,$ordernum)=getorder($bi,$bib);
! #print @items;
! my $count=@items;
! 
! my $i=0;
! print center();
! 
! my $dewey = $data->{'dewey'};                                                  
! $dewey =~ s/0+$//;                                                             
! if ($dewey eq "000.") { $dewey = "";};                                         
! if ($dewey < 10){$dewey='00'.$dewey;}                                          
! if ($dewey < 100 && $dewey > 10){$dewey='0'.$dewey;}                           
  if ($dewey <= 0){
!   $dewey='';                                                                   
! }               
! $dewey=~ s/\.$//;
! print <<printend
! <br>
! <a href=/cgi-bin/koha/request.pl?bib=$bib><img src=/images/requests.gif width=120 height=42 border=0 align=right border=0></a>
! printend
! ;
! if ($type eq 'catmain'){
!   print "<FONT SIZE=6><em>Catalogue Maintenance</em></FONT><br>";
! }
! print <<printend
! <FONT SIZE=6><em><a href=/cgi-bin/koha/detail.pl?bib=$bib&type=intra>$data->{'title'} ($data->{'author'})</a></em></FONT><P>
! <p>
! <form action=/cgi-bin/koha/modbibitem.pl>
! <input type=hidden name=bibitem value=$bi>
! <input type=hidden name=biblio value=$bib>
! <!-------------------BIBLIO ITEM------------>
! <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 align=left>
! <TR VALIGN=TOP>
! <td  bgcolor="99cc33" background="/images/background-mem.gif" ><B>$data->{'biblioitemnumber'} GROUP - $data->{'description'} </b> </TD>
! </TR>
! <tr VALIGN=TOP  >
! <TD width=210 >
! <INPUT TYPE="image" name="submit"  VALUE="modify" height=42  WIDTH=93 BORDER=0 src="/images/modify-mem.gif"> 
! <INPUT TYPE="image" name="delete"  VALUE="delete" height=42  WIDTH=93 BORDER=0 src="/images/delete-mem.gif"> 
! <br>
! <FONT SIZE=2  face="arial, helvetica">
! <b>Biblionumber:</b> $bib<br>
! <b>Item Type:</b> $data->{'itemtype'}<br>
! <b>Loan Length:</b> $data->{'loanlength'}<br>
! <b>Rental Charge:</b> $data->{'rentalcharge'}<br>
! <b>Classification:</b> $data->{'classification'}$dewey$data->{'subclass'}<br>
! <b>ISBN:</b> $data->{'isbn'}<br>
! <b>Publisher:</b> $data->{'publishercode'} <br>
! <b>Place:</b> $data->{'place'}<br>
! <b>Date:</b> $data->{'publicationyear'}<br>
! <b>Volume:</b> $data->{'volumeddesc'}<br>
! <b>Pages:</b> $data->{'pages'}<br>
! <b>Illus:</b> $data->{'illus'}<br>
! <b>Size:</b> $data->{'size'}<br>
! <b>Notes:</b> $data->{'bnotes'}<br>
! <b>No. of Items:</b> $count
! 
! printend
! ;
! if ($type eq 'catmain'){
!   print "<br><a href=/cgi-bin/koha/maint/shiftbib.pl?bi=$data->{'biblioitemnumber'}&bib=$data->{'biblionumber'}>Shift to another biblio</a>";
!  
! }
! print <<printend
! 
! </font>
! </TD>
! </tr>
! </table>
! </form>
! printend
! ;
! 
! for (my $i=0;$i<$count;$i++){
! print <<printend
! <img src="/images/holder.gif" width=16 height=300 align=left>
! <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 align=left width=220 >				
! <TR VALIGN=TOP>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>BARCODE $items[$i]->{'barcode'}</b></TD>
! </TR>
! <tr VALIGN=TOP  >
! <TD width=220 >
! <form action=/cgi-bin/koha/moditem.pl method=post>
! <input type=hidden name=bibitem value=$bi>
! <input type=hidden name=item value=$items[$i]->{'itemnumber'}>
! <input type=hidden name=type value=$type>
! <INPUT TYPE="image" name="submit"  VALUE="modify" height=42  WIDTH=93 BORDER=0 src="/images/modify-mem.gif"> 
! <INPUT TYPE="image" name="delete"  VALUE="delete" height=42  WIDTH=93 BORDER=0 src="/images/delete-mem.gif"> 
! <br>
! printend
! ;
! $items[$i]->{'itemlost'}=~ s/0/No/;
! $items[$i]->{'itemlost'}=~ s/1/Yes/;
! $items[$i]->{'withdrawn'}=~ s/0/No/;
! $items[$i]->{'withdrawn'}=~ s/1/Yes/;
! $items[$i]->{'replacementprice'}+=0.00;
! 
! my $year=substr($items[$i]->{'timestamp0'},0,4);
! my $mon=substr($items[$i]->{'timestamp0'},4,2);
! my $day=substr($items[$i]->{'timestamp0'},6,2);
! $items[$i]->{'timestamp0'}="$day/$mon/$year";
! 
! $items[$i]->{'dateaccessioned'} = slashifyDate($items[$i]->{'dateaccessioned'});
! $items[$i]->{'datelastseen'} = slashifyDate($items[$i]->{'datelastseen'});
! 
! print <<printend
! <FONT SIZE=2  face="arial, helvetica">
! <b>Home Branch:</b> $items[$i]->{'homebranch'}<br>
! <b>Last seen:</b> $items[$i]->{'datelastseen'}<br>
! <b>Last borrowed:</b> $items[$i]->{'timestamp0'}<br>
! printend
! ;
! if ($items[$i] eq 'Available'){
!   print "<b>Currently on issue to:</b><br>";
! } else {
!   print "<b>Currently on issue to:</b> <a href=/cgi-bin/koha/moremember.pl?bornum=$items[$i]->{'borrower0'}>$items[$i]->{'card'}</a><br>";
  }
! print <<printend
! <b>Last Borrower 1:</b> $items[$i]->{'card0'}<br>
! <b>Last Borrower 2:</b> $items[$i]->{'card1'}<br>
! <b>Current Branch:</b> $items[$i]->{'holdingbranch'}<br>
! <b>Replacement Price:</b> $items[$i]->{'replacementprice'}<br>
! <b>Item lost:</b> $items[$i]->{'itemlost'}<br>
! <b>Paid for:</b> $items[$i]->{'paidfor'}<br>
! <b>Notes:</b> $items[$i]->{'itemnotes'}<br>
! <b>Renewals:</b> $items[$i]->{'renewals'}<br>
! <b><a href=/cgi-bin/koha/acqui/acquire.pl?recieve=$ordernum&biblio=$bib&invoice=$order->{'booksellerinvoicenumber'}&catview=yes>Accession</a> Date: $items[$i]->{'dateaccessioned'}<br>
! printend
! ;
! if ($items[$i]->{'wthdrawn'} eq '1'){
!   $items[$i]->{'wthdrawn'}="Yes";
! } else {
!   $items[$i]->{'wthdrawn'}="No";
! }
! print <<printend
! <b>Cancelled: $items[$i]->{'wthdrawn'}<br>
! <b>Total Issues:</b> $items[$i]->{'issues'}<br>
! <b>Group Number:</b> $bi <br>
! <b>Biblio number:</b> $bib <br>
  
  
  
! </font>
! </TD>
! </tr>
! </table>
! </form>
! printend
! ;
! }
! print <<printend
! <p>
! </form>
! printend
! ;
  
  
! print endcenter();
  
- print endmenu($type);
- print endpage();
--- 1,102 ----
  #!/usr/bin/perl
! use HTML::Template;
  use strict;
! require Exporter;
  use C4::Koha;
! use CGI;
! use C4::Search;
  use C4::Acquisitions;
! use C4::Output; # contains picktemplate
!   
! my $query=new CGI;
! 
! 
! my $language='french';
! 
! 
! my %configfile;
! open (KC, "/etc/koha.conf");
! while (<KC>) {
!  chomp;
!  (next) if (/^\s*#/);
!  if (/(.*)\s*=\s*(.*)/) {
!    my $variable=$1;
!    my $value=$2;
!    # Clean up white space at beginning and end
!    $variable=~s/^\s*//g;
!    $variable=~s/\s*$//g;
!    $value=~s/^\s*//g;
!    $value=~s/\s*$//g;
!    $configfile{$variable}=$value;
!  }
! }
! 
! my $includes=$configfile{'includes'};
! ($includes) || ($includes="/usr/local/www/hdl/htdocs/includes");
! my $templatebase="catalogue/moredetail.tmpl";
! my $startfrom=$query->param('startfrom');
! ($startfrom) || ($startfrom=0);
! my $theme=picktemplate($includes, $templatebase);
! 
! my $subject=$query->param('subject');
! # if its a subject we need to use the subject.tmpl
! if ($subject){
!   $templatebase=~ s/searchresults\.tmpl/subject\.tmpl/;
! }
! my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]);
! 
! # get variables 
! 
! my $biblionumber=$query->param('bib');
! my $title=$query->param('title');
! my $bi=$query->param('bi');
  
  my $data=bibitemdata($bi);
! my $dewey = $data->{'dewey'};
! $dewey =~ s/0+$//;
! if ($dewey eq "000.") { $dewey = "";};
! if ($dewey < 10){$dewey='00'.$dewey;}
! if ($dewey < 100 && $dewey > 10){$dewey='0'.$dewey;}
  if ($dewey <= 0){
!       $dewey='';
  }
! $dewey=~ s/\.$//;
! $data->{'dewey'}=$dewey;
  
+ my @results;
  
+ my (@items)=itemissues($bi);
+ my $count=@items;
+ $data->{'count'}=$count;
+ my ($order,$ordernum)=getorder($bi,$biblionumber);
  
! my $env;
! $env->{itemcount}=1;
  
+ $results[0]=$data;
  
! foreach my $item (@items){
!     $item->{'itemlost'}=~ s/0/No/;
!     $item->{'itemlost'}=~ s/1/Yes/;
!     $item->{'withdrawn'}=~ s/0/No/;
!     $item->{'withdrawn'}=~ s/1/Yes/;
!     $item->{'replacementprice'}+=0.00;
!     my $year=substr($item->{'timestamp0'},0,4);
!     my $mon=substr($item->{'timestamp0'},4,2);
!     my $day=substr($item->{'timestamp0'},6,2);
!     $item->{'timestamp0'}="$day/$mon/$year";
!     $item->{'dateaccessioned'} = slashifyDate($item->{'dateaccessioned'});
!     $item->{'datelastseen'} = slashifyDate($item->{'datelastseen'});
!     if ($item->{'date_due'} = 'Available'){
! 	$item->{'issue'}="<b>Currently on issue to:</b><br>";
!     } else {
! 	$item->{'issue'}="<b>Currently on issue to:</b> <a href=/cgi-bin/koha/moremember.pl?bornum=$item->{'borrower0'}>$item->{'card'}</a><br>";
!     }
! 	  
! }
! 
! $template->param(includesdir => $includes);
! $template->param(BIBITEM_DATA => \@results);
! $template->param(ITEM_DATA => \@items);
! print "Content-Type: text/html\n\n", $template->output;
  

Index: moremember.pl
===================================================================
RCS file: /cvsroot/koha/koha/moremember.pl,v
retrieving revision 1.11.2.2
retrieving revision 1.11.2.3
diff -C2 -r1.11.2.2 -r1.11.2.3
*** moremember.pl	27 Jun 2002 21:06:34 -0000	1.11.2.2
--- moremember.pl	11 Jul 2002 18:05:28 -0000	1.11.2.3
***************
*** 128,131 ****
--- 128,134 ----
  
  <INPUT TYPE="image" name="delete"  VALUE="delete" height=42  WIDTH=93 BORDER=0 src="/images/delete-mem.gif"> 
+ 
+ <p>
+ <INPUT TYPE="image" name="password"  VALUE="password" height=42  WIDTH=154 BORDER=0 src="/images/password-mem.gif"> 
  </p>
  

Index: search.pl
===================================================================
RCS file: /cvsroot/koha/koha/search.pl,v
retrieving revision 1.6.2.8
retrieving revision 1.6.2.9
diff -C2 -r1.6.2.8 -r1.6.2.9
*** search.pl	30 Jun 2002 17:40:43 -0000	1.6.2.8
--- search.pl	11 Jul 2002 18:05:28 -0000	1.6.2.9
***************
*** 1,359 ****
  #!/usr/bin/perl
! #script to provide intranet (librarian) advanced search facility
! 
  use strict;
! use C4::Search;
  use CGI;
! use C4::Output;
! use C4::Acquisitions;
! 
! my $env;
! my $input = new CGI;
! print $input->header;
! #print $input->dump;
! 
! #whether it is called from the opac or the intranet
! my $type=$input->param('type');if ($type eq ''){
!   $type = 'intra';
  }
  
! my $ttype=$input->param('ttype');
  
! #setup colours                 
! my $main;
! my $secondary;
  
! if ($type eq 'opac'){
!   $main='#99cccc';    
!   $secondary='#efe5ef';
! } else {
!   $main='#cccc99';
!   $secondary='#ffffcc';
! }       
  
! #print $input->Dump;
! my $blah;
  my %search;
! 
! #build hash of users input
! my $title=validate($input->param('title'));
! $search{'title'}=$title;
! 
! my $keyword=validate($input->param('keyword'));
  $search{'keyword'}=$keyword;
  
- $search{'front'}=validate($input->param('front'));
- 
- my $author=validate($input->param('author'));
- $search{'author'}=$author;
- 
- my $illustrator=validate($input->param('illustrator'));
- $search{'illustrator'}=$illustrator;
- 
- my $subject=validate($input->param('subject'));
  $search{'subject'}=$subject;
! 
! my $itemnumber=validate($input->param('item'));
! $search{'item'}=$itemnumber;
! 
! my $isbn=validate($input->param('isbn'));
  $search{'isbn'}=$isbn;
! 
! my $datebefore=validate($input->param('date-before'));
  $search{'date-before'}=$datebefore;
! 
! my $class=$input->param('class');
  $search{'class'}=$class;
  
  $search{'ttype'}=$ttype;
  
! my $dewey=validate($input->param('dewey'));
! $search{'dewey'}=$dewey;
! 
! my $branch=validate($input->param('branch'));
! $search{'branch'}=$branch;
  
  my @results;
- my $offset=$input->param('offset');
- if ($offset eq ''){
-   $offset=0;
- }
- my $num=$input->param('num');
- if ($num eq ''){
-   $num=10;
- }
- print startpage();
- print startmenu($type);
- #print $type;
- #print $search{'ttype'};
- if ($type eq 'intra'){
-   print mkheadr(1,'Catalogue Search Results');
- } elsif ($type eq 'catmain'){
-   print mkheadr(1,'Catalogue Maintenance');
- } else {
-   print mkheadr(1,'Opac Search Results');
- }
- print center();
  my $count;
! if ($itemnumber ne '' || $isbn ne ''){
!     ($count, at results)=&CatSearch(\$blah,'precise',\%search,$num,$offset);
  } else {
!   if ($subject ne ''){
!     ($count, at results)=&CatSearch(\$blah,'subject',\%search,$num,$offset);
!   } else {
!     if ($keyword ne ''){
!       ($count, at results)=&KeywordSearch(\$blah,'intra',\%search,$num,$offset);
!     }elsif ($title ne '' || $author ne '' || $illustrator ne '' || $dewey ne '' || $class ne '') {
!       ($count, at results)=&CatSearch(\$blah,'loose',\%search,$num,$offset);
!     }
!   }
  }
- print "You searched on ";
- while ( my ($key, $value) = each %search) {                                 
-   if ($value ne '' && $key ne 'ttype'){
-     $value=~ s/\\//g;
-     print bold("$key $value,");
-   }                          
- }
- print " $count results found";
- my $offset2=$num+$offset;
- my $dispnum=$offset+1;
- print "<br> Results $dispnum to $offset2 displayed";
- print mktablehdr;
- if ($type ne 'opac'){
-   if ($subject ne ''){
-    print mktablerow(1,$main,'<b>SUBJECT</b>','/images/background-mem.gif');
-   } elsif ($illustrator ne '') {
-    print mktablerow(7,$main,'<b>TITLE</b>','<b>AUTHOR</b>', '<b>ILLUSTRATOR<b>', bold('&copy;'),'<b>COUNT</b>',bold('LOCATION'),'','/images/background-mem.gif');
-   } else {
-    print mktablerow(6,$main,'<b>TITLE</b>','<b>AUTHOR</b>',bold('&copy;'),'<b>COUNT</b>',bold('LOCATION'),'','/images/background-mem.gif');
-   }
- } else {
-   if ($subject ne ''){
-    print mktablerow(6,$main,'<b>SUBJECT</b>',' &nbsp; ',' &nbsp; ');
-   } elsif ($illustrator ne '') {
-    print mktablerow(7,$main,'<b>TITLE</b>','<b>AUTHOR</b>','<b>ILLUSTRATOR</b>', bold('&copy;'),'<b>COUNT</b>',bold('LOCATION'),'');
-   } else {
-    print mktablerow(6,$main,'<b>TITLE</b>','<b>AUTHOR</b>',bold('&copy;'),'<b>COUNT</b>',bold('LOCATION'),'');
-   }
- }
- my $count2=@results;
- if ($keyword ne '' && $offset > 0){
-   $count2=$count-$offset;
-   if ($count2 > 10){
-     $count2=10;
-   }
- }
- #print $count2;
- my $i=0;
- my $colour=1;
- while ($i < $count2){
- #    print $results[$i]."\n";
-     my @stuff=split('\t',$results[$i]);
-     $stuff[1]=~ s/\`/\\\'/g;
-     my $title2=$stuff[1];
-     $title2=~ s/ /%20/g;
-     if ($subject eq ''){
- #      print $stuff[0];
-       $stuff[1]=mklink("/cgi-bin/koha/detail.pl?type=$type&bib=$stuff[2]&title=$title2",$stuff[1]);
-       my $word=$stuff[0];
- #      print $word;
-       $word=~ s/([a-z]) +([a-z])/$1%20$2/ig;
-       $word=~ s/  //g;
-       $word=~ s/ /%20/g;
-       $word=~ s/\,/\,%20/g;
-       $word=~ s/\n//g;
-       my $url="/cgi-bin/koha/search.pl?author=$word&type=$type";
-       $stuff[7]=$stuff[5];
-       $stuff[5]='';
-       $stuff[0]=mklink($url,$stuff[0]);
-       my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit,$ocount,$branchcount)=itemcount($env,$stuff[2],$type);
-       $stuff[4]=$count;
-       if ($nacount > 0){
-         $stuff[5]=$stuff[5]."On Loan";
- 	if ($nacount >1 ){                                                                                                         
- 	  $stuff[5]=$stuff[5]." ($nacount)";                                                                                            
-          }                                                                                                                         
- 	 $stuff[5].=" ";
-       }
-       if ($lcount > 0){
-          $stuff[5]=$stuff[5]."Levin";
-          if ($lcount >1 ){                                                                                                         
- 	  $stuff[5]=$stuff[5]." ($lcount)";                                                                                            
-          }                                                                                                                         
- 	 $stuff[5].=" ";
-       }
-       if ($fcount > 0){
-         $stuff[5]=$stuff[5]."Foxton";
-          if ($fcount >1 ){                                                                                                         
- 	  $stuff[5]=$stuff[5]." ($fcount)";                                                                                            
-          }                                                                                                                         
- 	 $stuff[5].=" ";	
-       }
-       if ($scount > 0){
-         $stuff[5]=$stuff[5]."Shannon";
-          if ($scount >1 ){                                                                                                         
- 	  $stuff[5]=$stuff[5]." ($scount)";                                                                                            
-          }                                                                                                                         
- 	 $stuff[5].=" ";	
-       }
-       $stuff[5]='';
-       my ($numbranches, @branches) = branches();
-       my $branchinfo;
-       foreach (@branches) {
- 	      my $branchcode=$_->{'branchcode'};
- 	      my $branchname=$_->{'branchname'};
- 	      $branchinfo->{$branchcode}=$branchname;
-       }
-       if ($numbranches>1) {
- 	      foreach my $branchcode (sort keys %$branchcount) {
- 		  my $c=$branchcount->{$branchcode};
- 		  $stuff[5].=$branchinfo->{$branchcode};
- 		  if ($c>1) {
- 		      $stuff[5].=" ($c)";
- 		  }
- 		  $stuff[5].=" ";
- 	      }
-       } else {
- 	      my $shelfcount=$count-$nacount-$lostcount-$mending-$transit;
- 	      if ($nacount) {
- 		      $stuff[5]="On Loan ";
- 		      if ($count>1) {
- 			      $stuff[5].="($nacount) ";
- 		      }
- 	      }
- 	      if ($shelfcount) {
- 		      $stuff[5].="Shelf ";
- 		      if ($count>1) {
- 			      $stuff[5].="($shelfcount) ";
- 		      }
- 	      }
-       }
-       if ($lostcount > 0) {
-         $stuff[5]=$stuff[5]."Lost";
-          if ($count >1 ){                                                                                                         
- 	  $stuff[5]=$stuff[5]." ($lostcount)";                                                                                            
-          }                                                                                                                         
- 	 $stuff[5].=" ";	
-       }
-       if ($mending > 0){
-         $stuff[5]=$stuff[5]."Mending";
-          if ($count >1 ){                                                                                                         
- 	  $stuff[5]=$stuff[5]." ($mending)";                                                                                            
-          }                                                                                                                         
- 	 $stuff[5].=" ";	
-       }
-       if ($transit > 0){
-         $stuff[5]=$stuff[5]."In Transit";
-          if ($count >1 ){                                                                                                         
- 	  $stuff[5]=$stuff[5]." ($transit)";                                                                                            
-          }                                                                                                                         
- 	 $stuff[5].=" ";	
-       }
-       if ($ocount > 0){
-         $stuff[5]=$stuff[5]."On Order";
-          if ($ocount >1 ){                                                                                                         
- 	  $stuff[5]=$stuff[5]." ($ocount)";                                                                                            
-          }                                                                                                                         
- 	 $stuff[5].=" ";	
-       }
-       
-       if ($type ne 'opac'){
-         $stuff[6]=mklink("/cgi-bin/koha/request.pl?bib=$stuff[2]","Request");
-       }
-     } else {
-       my $word=$stuff[1];
-       $word=~ s/ /%20/g;
-       
-         $stuff[1]=mklink("/cgi-bin/koha/subjectsearch.pl?subject=$word&type=$type",$stuff[1]);
  
!     }
  
!     if ($colour == 1){
!       if ($illustrator) {
! 	  print mktablerow(7,$secondary,$stuff[1],$stuff[0],$stuff[7],$stuff[3],$stuff[4],$stuff[5],$stuff[6]);
!       } else {
! 	  print mktablerow(6,$secondary,$stuff[1],$stuff[0],$stuff[3],$stuff[4],$stuff[5],$stuff[6]);
!       }
!       $colour=0;
!     } else {
!       if ($illustrator) {
! 	  print mktablerow(7,'white',$stuff[1],$stuff[0],$stuff[7],$stuff[3],$stuff[4],$stuff[5],$stuff[6]);
!       } else {
! 	  print mktablerow(6,'white',$stuff[1],$stuff[0],$stuff[3],$stuff[4],$stuff[5],$stuff[6]);
!       }
!       $colour=1;
!     }
!     $i++;
! }
! $offset=$num+$offset;
! if ($type ne 'opac'){
!     if ($illustrator) {
! 	 print mktablerow(7,$main,' &nbsp; ',' &nbsp; ',' &nbsp;',' &nbsp;','','','','/images/background-mem.gif');
!     } else {
! 	 print mktablerow(6,$main,' &nbsp; ',' &nbsp; ',' &nbsp;',' &nbsp;','','','/images/background-mem.gif');
      }
- } else {
-  if ($illustrator) {
-      print mktablerow(7,$main,' &nbsp; ',' &nbsp; ',' &nbsp;',' &nbsp; ','', '','');
-  } else {
-      print mktablerow(6,$main,' &nbsp; ',' &nbsp; ',' &nbsp;',' &nbsp; ','','');
-  }
  }
- print mktableft();
- my $search;
  
!     $search="num=$num&offset=$offset&type=$type";
!     if ($subject ne ''){
!       $subject=~ s/ /%20/g;
!       $search=$search."&subject=$subject";
!     }
!     if ($title ne ''){
!       $title=~ s/ /%20/g;
!       $search=$search."&title=$title";
!     }
!     if ($author ne ''){
!       $author=~ s/ /%20/g;
!       $search=$search."&author=$author";
!     }
!     if ($keyword ne ''){
!       $keyword=~ s/ /%20/g;
!       $search=$search."&keyword=$keyword";
!     }
!     if ($class ne ''){
!       $keyword=~ s/ /%20/g;
!       $search=$search."&class=$class";
!     }
!     if ($dewey ne ''){
!       $search=$search."&dewey=$dewey";
!     }
!     $search.="&ttype=$ttype";    
! if ($offset < $count){    
!     my $stuff=mklink("/cgi-bin/koha/search.pl?$search",'Next');
!     print $stuff;
! }
! print "<br>";
! my $pages=$count/10;
! $pages++;
! for (my $i=1;$i<$pages;$i++){
!   my $temp=$i*10;
!   $temp=$temp-10;
!   $search=~ s/offset=[0-9]+/offset=$temp/;
!   my $stuff=mklink("/cgi-bin/koha/search.pl?$search",$i);
!   print "$stuff ";
! }
!   
! print endcenter();
! print endmenu($type);
! print endpage();
  
  
! sub validate {
!   my ($input)=@_;
!   $input=~ s/\<[a-z]+\>//gi;
!   $input=~ s/\<\/[a-z]+\>//gi;
!   $input=~ s/\<//g;
!   $input=~ s/\>//g;
!   $input=~ s/^%//g;
!   return($input);
! }
--- 1,203 ----
  #!/usr/bin/perl
! use HTML::Template;
  use strict;
! require Exporter;
! use C4::Database;
  use CGI;
! use C4::Search;
! use C4::Auth;
! use C4::Output; # no contains picktemplate
!   
! my $query=new CGI;
! my $type=$query->param('type');
! my ($loggedinuser, $cookie, $sessionID) = checkauth($query, ($type eq 'opac') ? (1) : (0));
! 
! 
! my $language='french';
! 
! 
! my %configfile;
! open (KC, "/etc/koha.conf");
! while (<KC>) {
!  chomp;
!  (next) if (/^\s*#/);
!  if (/(.*)\s*=\s*(.*)/) {
!    my $variable=$1;
!    my $value=$2;
!    # Clean up white space at beginning and end
!    $variable=~s/^\s*//g;
!    $variable=~s/\s*$//g;
!    $value=~s/^\s*//g;
!    $value=~s/\s*$//g;
!    $configfile{$variable}=$value;
!  }
  }
+ #print $query->header;
  
! my $includes=$configfile{'includes'};
! ($includes) || ($includes="/usr/local/www/hdl/htdocs/includes");
! my $templatebase="catalogue/searchresults.tmpl";
! my $startfrom=$query->param('startfrom');
! ($startfrom) || ($startfrom=0);
! my $theme=picktemplate($includes, $templatebase);
! 
! my $subject=$query->param('subject');
! # if its a subject we need to use the subject.tmpl
! if ($subject) {
!     $templatebase=~ s/searchresults\.tmpl/subject\.tmpl/;
!     $theme=picktemplate($includes, $templatebase);
! }
  
! my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]);
  
! my $env;
! $env->{itemcount}=1;
  
! # get all the search variables
! # we assume that C4::Search will validate these values for us
  my %search;
! my $keyword=$query->param('keyword');
  $search{'keyword'}=$keyword;
  
  $search{'subject'}=$subject;
! my $author=$query->param('author');
! $search{'author'}=$author;
! $search{'authoresc'}=$author;
! #$search{'authorhtmlescaped'}=~s/ /%20/g;
! my $illustrator=$query->param('illustrator');
! $search{'param'}=$illustrator;
! my $itemnumber=$query->param('itemnumber');
! $search{'itemnumber'}=$itemnumber;
! my $isbn=$query->param('isbn');
  $search{'isbn'}=$isbn;
! my $datebefore=$query->param('date-before');
  $search{'date-before'}=$datebefore;
! my $class=$query->param('class');
  $search{'class'}=$class;
+ my $dewey=$query->param('dewey');
+ $search{'dewey'};
+ my $branch=$query->param('branch');
+ $search{'branch'}=$branch;
+ my $title=$query->param('title');
+ $search{'title'}=$title;
+ my $abstract=$query->param('abstract');
+ $search{'abstract'}=$abstract;
+ my $publisher=$query->param('publisher');
+ $search{'publisher'}=$publisher;
  
+ my $ttype=$query->param('ttype');
  $search{'ttype'}=$ttype;
  
! my $forminputs;
! ($keyword) && (push @$forminputs, { line => "keyword=$keyword"});
! ($subject) && (push @$forminputs, { line => "subject=$subject"});
! ($author) && (push @$forminputs, { line => "author=$author"});
! ($illustrator) && (push @$forminputs, { line => "illustrator=$illustrator"});
! ($itemnumber) && (push @$forminputs, { line => "itemnumber=$itemnumber"});
! ($isbn) && (push @$forminputs, { line => "isbn=$isbn"});
! ($datebefore) && (push @$forminputs, { line => "date-before=$datebefore"});
! ($class) && (push @$forminputs, { line => "class=$class"});
! ($dewey) && (push @$forminputs, { line => "dewey=$dewey"});
! ($branch) && (push @$forminputs, { line => "branch=$branch"});
! ($title) && (push @$forminputs, { line => "title=$title"});
! ($ttype) && (push @$forminputs, { line => "ttype=$ttype"});
! ($abstract) && (push @$forminputs, { line => "abstract=$abstract"});
! ($publisher) && (push @$forminputs, { line => "publisher=$publisher"});
! ($forminputs) || (@$forminputs=());
! $template->param(FORMINPUTS => $forminputs);
! # whats this for?
! # I think it is (or was) a search from the "front" page...   [st]
! $search{'front'}=$query->param('front');
  
+ my $num=10;
  my @results;
  my $count;
! if (my $subject=$query->param('subjectitems')) {
!     my $blah;
!     @results=subsearch(\$blah,$subject);
!     $count=$#results+1;
  } else {
!     ($count, at results)=catalogsearch($env,'',\%search,$num,$startfrom);
  }
  
! #my $resultsarray=\@results;
! my $resultsarray;
  
! foreach my $result (@results) {
!     $result->{'authorhtmlescaped'}=$result->{'author'};
!     $result->{'authorhtmlescaped'}=~s/ /%20/g;
!     ($result->{'copyrightdate'}==0) && ($result->{'copyrightdate'}='');
!     ($type eq 'opac') ? ($result->{'opac'}=1) : ($result->{'opac'}=0);
!     push (@$resultsarray, $result);
! }
! ($resultsarray) || (@$resultsarray=());
! my $search="num=20";
! my $searchdesc='';
! if ($keyword){
!     $search=$search."&keyword=$keyword";
!     $searchdesc.="keyword $keyword, ";
! }
! if (my $subjectitems=$query->param('subjectitems')){
!     $search=$search."&subjectitems=$subjectitems";
!     $searchdesc.="subject $subjectitems, ";
! }
! if ($subject){
!     $search=$search."&subject=$subject";
!     $searchdesc.="subject $subject, ";
! }
! if ($author){
!     $search=$search."&author=$author";
!     $searchdesc.="author $author, ";
! }
! if ($class){
!     $search=$search."&class=$class";
!     $searchdesc.="class $class, ";
! }
! if ($title){
!     $search=$search."&title=$title";
!     $searchdesc.="title $title, ";
! }
! if ($dewey){
!     $search=$search."&dewey=$dewey";
!     $searchdesc.="dewey $dewey, ";
! }
! $search.="&ttype=$ttype";
! 
! $search=~ s/ /%20/g;
! $template->param(startfrom => $startfrom+1);
! ($startfrom+$num<=$count) ? ($template->param(endat => $startfrom+$num)) : ($template->param(endat => $count));
! $template->param(numrecords => $count);
! my $nextstartfrom=($startfrom+$num<$count) ? ($startfrom+$num) : (-1);
! my $prevstartfrom=($startfrom-$num>=0) ? ($startfrom-$num) : (-1);
! $template->param(nextstartfrom => $nextstartfrom);
! my $displaynext=1;
! my $displayprev=0;
! ($nextstartfrom==-1) ? ($displaynext=0) : ($displaynext=1);
! ($prevstartfrom==-1) ? ($displayprev=0) : ($displayprev=1);
! $template->param(displaynext => $displaynext);
! $template->param(displayprev => $displayprev);
! ($type eq 'opac') ? ($template->param(opac => 1)) : ($template->param(opac => 0));
! $template->param(prevstartfrom => $prevstartfrom);
! $template->param(search => $search);
! $template->param(searchdesc => $searchdesc);
! $template->param(SEARCH_RESULTS => $resultsarray);
! $template->param(includesdir => $includes);
! $template->param(loggedinuser => $loggedinuser);
! 
! my $numbers;
! @$numbers=();
! if ($count>10) {
!     for (my $i=1; $i<$count/10+1; $i++) {
!     ($title) && (push @$forminputs, { line => "title=$title"});
! 	my $highlight=0;
! 	($startfrom==($i-1)*10) && ($highlight=1);
! 	push @$numbers, { number => $i, highlight => $highlight , FORMINPUTS => $forminputs, startfrom => ($i-1)*10, opac => ($type eq 'opac') ? (1) : (0)};
      }
  }
  
! $template->param(numbers => $numbers);
  
  
! 
! print $query->header(-cookie => $cookie), $template->output;
! 

Index: shelves.pl
===================================================================
RCS file: /cvsroot/koha/koha/shelves.pl,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -C2 -r1.2.2.1 -r1.2.2.2
*** shelves.pl	26 Jun 2002 20:28:15 -0000	1.2.2.1
--- shelves.pl	11 Jul 2002 18:05:28 -0000	1.2.2.2
***************
*** 11,18 ****
  use C4::BookShelves;
  use C4::Circulation::Circ2;
  
  my $env;
  my $query = new CGI;
! print $query->header;
  my $headerbackgroundcolor='#663266';
  my $circbackgroundcolor='#555555';
--- 11,20 ----
  use C4::BookShelves;
  use C4::Circulation::Circ2;
+ use C4::Auth;
  
  my $env;
  my $query = new CGI;
! my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
! print $query->header(-cookie => $cookie);
  my $headerbackgroundcolor='#663266';
  my $circbackgroundcolor='#555555';
***************
*** 25,28 ****
--- 27,31 ----
  
  
+ print "<p align=left>Logged in as: $loggedinuser [<a href=/cgi-bin/koha/logout.pl>Log Out</a>]</p>\n";
  
  
***************
*** 158,162 ****
      <input type=hidden name=modifyshelfcontents value=1>
      <input type=hidden name=viewshelf value=$shelfnumber>
!     <input type=submit value="Modify Shelf List">
      </form>
  EOF
--- 161,165 ----
      <input type=hidden name=modifyshelfcontents value=1>
      <input type=hidden name=viewshelf value=$shelfnumber>
!     <input type=submit value="Remove Selected Items">
      </form>
  EOF
***************
*** 167,170 ****
--- 170,182 ----
  #
  # $Log$
+ # Revision 1.2.2.2  2002/07/11 18:05:28  tonnesen
+ # Committing changes to add authentication and opac templating to rel-1-2 branch
+ #
+ # Revision 1.5  2002/07/04 19:42:48  tonnesen
+ # Minor changes
+ #
+ # Revision 1.4  2002/07/04 19:21:29  tonnesen
+ # Beginning of authentication api.  Applied to shelves.pl for now as a test case.
+ #
  # Revision 1.2.2.1  2002/06/26 20:28:15  tonnesen
  # Some udpates that I made here locally a while ago.  Still won't be useful, but





More information about the Koha-cvs mailing list