[Koha-cvs] CVS: koha/maint catmaintain.pl,1.5,1.6

Ambrose C. LI acli at users.sourceforge.net
Sun Mar 7 06:47:34 CET 2004


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

Modified Files:
	catmaintain.pl 
Log Message:
Various updates/fixes from rel_2_0
Fixes for bugs 721 (templating), 727, and 734


Index: catmaintain.pl
===================================================================
RCS file: /cvsroot/koha/koha/maint/catmaintain.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** catmaintain.pl	5 Oct 2002 10:05:52 -0000	1.5
--- catmaintain.pl	7 Mar 2004 05:47:32 -0000	1.6
***************
*** 25,36 ****
  use strict;
  use CGI;
  use C4::Output;
  use C4::Maintainance;
  
  my $input = new CGI;
! print $input->header;
  my $type=$input->param('type');
- print startpage();
- print startmenu('catalog');
  my $blah;
  my $num=0;
--- 25,48 ----
  use strict;
  use CGI;
+ use C4::Auth;
  use C4::Output;
+ use C4::Interface::CGI::Output;
  use C4::Maintainance;
+ use HTML::Template;
  
  my $input = new CGI;
! my ($template, $loggedinuser, $cookie)
!     = get_template_and_user({template_name   => 'maint/catmaintain.tmpl',
!                              query           => $input,
!                              type            => 'intranet',
!                              authnotrequired => 0,
!                              flagsrequired   => {catalogue => 1},
!                              debug           => 1,
!                              });
! 
! my %params = ();
! 
! 
  my $type=$input->param('type');
  my $blah;
  my $num=0;
***************
*** 39,117 ****
    my $sub=$input->param('sub');
    my ($count,$results)=listsubjects($sub,$num,$offset);
    for (my $i=0;$i<$count;$i++){
      my $sub2=$results->[$i]->{'subject'};
!     $sub2=~ s/ /%20/g;
!       $sub2=~ s/\'/%27/g;
!     print "\"<a href=\"/cgi-bin/koha/maint/catmaintain.pl?type=allsub&sub=$sub\" onclick=\'messenger(\"/cgi-bin/koha/maint/catmaintain.pl?type=modsub&sub=$sub2\");window1.focus()\'>$results->[$i]->{'subject'}\"</a><br>\n";
    }
  } elsif ($type eq 'modsub'){
!   my $sub=$input->param('sub');
!   print "<form action=/cgi-bin/koha/maint/catmaintain.pl>";
!   print "Subject:<input type=text value=\"$sub\" name=sub size=40><br>\n";
!   print "<input type=hidden name=type value=upsub>";
!   print "<input type=hidden name=oldsub value=\"$sub\">";
!   print "<input type=submit value=modify>";
! #  print "<a href=\"nowhere\" onclick=\"document.forms[0].submit();\">Modify</a>";
!   print "</form>";
!   print "<p> This will change the subject headings on all the biblios this subject is applied to"
  } elsif ($type eq 'upsub'){
    my $sub=$input->param('sub');
    my $oldsub=$input->param('oldsub');
    updatesub($sub,$oldsub);
!   print "Successfully modified $oldsub is now $sub";
!   print "<p><a href=/cgi-bin/koha/maint/catmaintain.pl target=window0 onclick=\"window0.focus()\">Back to catalogue maintenance</a><br>";
!   print "<a href=nowhere onclick=\"self.close()\">Close this window</a>";
  } elsif ($type eq 'undel'){
    my $title=$input->param('title');
    my ($count,$results)=deletedbib($title);
!   print "<table border=0>";
!   print "<tr><td><b>Title</b></td><td><b>Author</b></td><td><b>Undelete</b></td></tr>";
    for (my $i=0;$i<$count;$i++){
!     print "<tr><td>$results->[$i]->{'title'}</td><td>$results->[$i]->{'author'}</td><td><a href=/cgi-bin/koha/maint/catmaintain.pl?type=finun&bib=$results->[$i]->{'biblionumber'}>Undelete</a></td>\n";
    }
!   print "</table>";
  } elsif ($type eq 'finun'){
    my $bib=$input->param('bib');
    undeletebib($bib);
!   print "Succesfully undeleted";
!   print "<p><a href=/cgi-bin/koha/maint/catmaintain.pl>Back to Catalogue Maintenance</a>";
  } elsif ($type eq 'fixitemtype'){
    my $bi=$input->param('bi');
    my $item=$input->param('item');
!   print "<form method=post action=/cgi-bin/koha/maint/catmaintain.pl>";
!   print "<input type=hidden name=bi value=$bi>";
!   print "<input type=hidden name=type value=updatetype>";
!   print "Itemtype:<input type=text name=itemtype value=$item><br>\n";
!   print "<input type=submit value=Change>";
!   print "</form>";
  } elsif ($type eq 'updatetype'){
    my $bi=$input->param('bi');
    my $itemtype=$input->param('itemtype');
    updatetype($bi,$itemtype);
!   print "Updated successfully";
!   print "<p><a href=/cgi-bin/koha/maint/catmaintain.pl>Back to Catalogue Maintenance</a>";
  } else {
!   print "<B>Subject Maintenance</b><br>";
!   print "<form action=/cgi-bin/koha/maint/catmaintain.pl method=post>";
!   print "<input type=hidden name=type value=allsub>";
!   print "Show all subjects beginning with <input type=text name=sub><br>";
!   print "<input type=submit value=Show>";
!   print "</form>";
!   print "<p>";
!   print "<B>Group Maintenance</b></br>";
!   print "<form action=/cgi-bin/koha/search.pl method=post>";
!   print "<input type=hidden name=type value=catmain>";
!   print "Show all Titles beginning with <input type=text name=title><br>";
!   print "Item Number <INPUT TYPE=\"text\"  SIZE=\"25\"   NAME=\"item\"><br>";
!   print "<input type=submit value=Show>";
!   print "</form>";
!   print "<p>";
!   print "<B>Undelete Biblio</b></br>";
!   print "<form action=/cgi-bin/koha/maint/catmaintain.pl method=post>";
!   print "<input type=hidden name=type value=undel>";
!   print "Show all Titles beginning with <input type=text name=title><br>";
!   print "<input type=submit value=Show>";
!   print "</form>";
  }
! print endmenu('catalog');
! print endpage();
--- 51,105 ----
    my $sub=$input->param('sub');
    my ($count,$results)=listsubjects($sub,$num,$offset);
+   my @it = ();
    for (my $i=0;$i<$count;$i++){
      my $sub2=$results->[$i]->{'subject'};
!     push @it, {'sub2' => $sub2, 'subject' => $results->[$i]->{'subject'}};
    }
+   %params = ('sub' => $sub, 'loop' => \@it);
+ 
  } elsif ($type eq 'modsub'){
!   %params = ('sub' => $input->param('sub'));
! 
  } elsif ($type eq 'upsub'){
    my $sub=$input->param('sub');
    my $oldsub=$input->param('oldsub');
    updatesub($sub,$oldsub);
!   %params = ('sub' => $sub, 'oldsub' => $oldsub);
! 
  } elsif ($type eq 'undel'){
    my $title=$input->param('title');
    my ($count,$results)=deletedbib($title);
!   my @it = ();
    for (my $i=0;$i<$count;$i++){
!     push @it, {
! 	'title'    => $results->[$i]->{'title'},
! 	'author'   => $results->[$i]->{'author'},
! 	'undelete' => "type=finun&bib=$results->[$i]->{'biblionumber'}",
!       };
    }
!   %params = ('loop' => \@it);
! 
  } elsif ($type eq 'finun'){
    my $bib=$input->param('bib');
    undeletebib($bib);
! 
  } elsif ($type eq 'fixitemtype'){
    my $bi=$input->param('bi');
    my $item=$input->param('item');
!   %params = ('bi' => $bi, 'item' => $item);
! 
  } elsif ($type eq 'updatetype'){
    my $bi=$input->param('bi');
    my $itemtype=$input->param('itemtype');
    updatetype($bi,$itemtype);
! 
  } else {
!   $type = 'mainmenu'; # NOTE
! 
  }
! 
! $template->param(type => 'intranet',
!                 "$type-p" => 1,
!                  %params);
! 
! output_html_with_http_headers $input, $cookie, $template->output;





More information about the Koha-cvs mailing list