koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/admin branches.pl,1.5,1.6


From: David Strainchamps
Subject: [Koha-cvs] CVS: koha/admin branches.pl,1.5,1.6
Date: Tue, 15 Oct 2002 13:27:22 -0700

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

Modified Files:
        branches.pl 
Log Message:
Modified File
        branches.pl
to use HTML::Template


Index: branches.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/branches.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** branches.pl 13 Oct 2002 09:36:27 -0000      1.5
--- branches.pl 15 Oct 2002 20:27:18 -0000      1.6
***************
*** 26,29 ****
--- 26,30 ----
  use C4::Context;
  use C4::Output;
+ use HTML::Template;
  
  # Fixed variables
***************
*** 31,35 ****
  my $linecolor2='white';
  my $backgroundimage="/images/background-mem.gif";
! my $script_name="/cgi-bin/koha/admin/branches.pl";
  my $pagesize=20;
  
--- 32,36 ----
  my $linecolor2='white';
  my $backgroundimage="/images/background-mem.gif";
! my $script_name="/cgi-bin/koha/admin/newbranches.pl";
  my $pagesize=20;
  
***************
*** 42,61 ****
  my $op = $input->param('op');
  
! # header
! print $input->header;
! 
! # start the page and read in includes
! print startpage();
! print startmenu('admin');
  
  if ($op eq 'add') {
! # If the user has pressed the "add new branch" button.
!     print heading("Branches: Add Branch");
!     print editbranchform();
! 
  } elsif ($op eq 'edit') {
  # if the user has pressed the "edit branch settings" button.
!     print heading("Branches: Edit Branch");
!     print editbranchform($branchcode);
  
  } elsif ($op eq 'add_validate') {
--- 43,65 ----
  my $op = $input->param('op');
  
! my $template = gettemplate("parameters/branches.tmpl",0);
! if ($op) {
! $template->param(script_name => $script_name,
!                                               $op              => 1); # we 
show only the TMPL_VAR names $op
! } else {
! $template->param(script_name => $script_name,
!                                               else              => 1); # we 
show only the TMPL_VAR names $op
! }
! $template->param(action => $script_name);
  
  if ($op eq 'add') {
! # If the user has pressed the "add new branch" button. 
!     heading("Branches: Add Branch");
!     editbranchform();
  } elsif ($op eq 'edit') {
  # if the user has pressed the "edit branch settings" button.
!     heading("Branches: Edit Branch");
!     $template->param(add => 1);
!     editbranchform($branchcode);
  
  } elsif ($op eq 'add_validate') {
***************
*** 66,69 ****
--- 70,74 ----
      } else {
        setbranchinfo($params);
+       $template->param(else => 1);
        default ("Branch record changed for branch: $params->{'branchname'}");
      }
***************
*** 73,79 ****
      my $message = checkdatabasefor($branchcode);
      if ($message) {
        default($message);
      } else {
!       print deleteconfirm($branchcode);
      }
  
--- 78,87 ----
      my $message = checkdatabasefor($branchcode);
      if ($message) {
+       $template->param(else => 1);
        default($message);
      } else {
!       deleteconfirm($branchcode);
!         $template->param(delete_confirm => 1);
!       $template->param(branchcode => $branchcode);
      }
  
***************
*** 81,84 ****
--- 89,93 ----
  # actually delete branch and return to the main screen....
      deletebranch($branchcode);
+     $template->param(else => 1);
      default("The branch with code $branchcode has been deleted.");
  
***************
*** 89,94 ****
  
  
- print endmenu('admin');
- print endpage();
  
  
######################################################################################################
--- 98,101 ----
***************
*** 98,111 ****
  sub default {
      my ($message) = @_;
!     print heading("Branches");
!     print "<font color='red'>$message</font>";
!     print "<form action='$script_name' method=post><input type='hidden' 
name='op' value='add'><input type=submit value='Add New Branch'></form>";
!     print branchinfotable();
!     print branchcategoriestable();
  }
  
  sub heading {
      my ($head) = @_;
!     return "<FONT SIZE=6><em>$head</em></FONT><br>";
  }
  
--- 105,119 ----
  sub default {
      my ($message) = @_;
!     heading("Branches");
!     $template->param(message => $message);
!     $template->param(action => $script_name);
!     branchinfotable();
!     
!     
  }
  
  sub heading {
      my ($head) = @_;
!     $template->param(head => $head);
  }
  
***************
*** 117,120 ****
--- 125,136 ----
        $data = getbranchinfo($branchcode);
        $data = $data->[0];
+       $template->param(branchcode => $data->{'branchcode'});
+         $template->param(branchname => $data->{'branchname'});
+         $template->param(branchaddress1 => $data->{'branchaddress1'});
+         $template->param(branchaddress2 => $data->{'branchaddress2'});
+         $template->param(branchaddress3 => $data->{'branchaddress3'});
+         $template->param(branchphone => $data->{'branchphone'});
+         $template->param(branchfax => $data->{'branchfax'});
+         $template->param(branchemail => $data->{'branchemail'});
      }
  # make the checkboxs.....
***************
*** 126,129 ****
--- 142,153 ----
        if (grep {/^$tmp$/} @{$data->{'categories'}}) {
            $checked = "CHECKED";
+ <<<<<<< branches.pl
+               }
+     $template->param(categoryname => $cat->{'categoryname'});
+     $template->param(categorycode => $cat->{'categorycode'});
+     $template->param(codedescription => $checked>$cat->{'codedescription'});  
  
+     }
+    
+ =======
        }
        $catcheckbox .= <<EOF;
***************
*** 150,153 ****
--- 174,178 ----
  EOF
      return $form;
+ >>>>>>> 1.5
  }
  
***************
*** 155,158 ****
--- 180,185 ----
  # message to print if the
      my ($branchcode) = @_;
+ <<<<<<< branches.pl
+ =======
      my $output = <<EOF;
  Confirm delete:
***************
*** 164,167 ****
--- 191,195 ----
  EOF
      return $output;
+ >>>>>>> 1.5
  }
  
***************
*** 177,180 ****
--- 205,210 ----
        $branchinfo = getbranchinfo();
      }
+ <<<<<<< branches.pl
+ =======
      my $table = <<EOF;
  <table border='1' cellpadding='5' cellspacing='0' width='550'>
***************
*** 190,193 ****
--- 220,224 ----
  EOF
  
+ >>>>>>> 1.5
      my $color;
      foreach my $branch (@$branchinfo) {
***************
*** 207,210 ****
--- 238,249 ----
        }
        $categories = '(no categories set)' unless ($categories);
+ <<<<<<< branches.pl
+ $template->param(color => $color);
+ $template->param(branch_name => $branch->{'branchname'});
+ $template->param(adress => $address);
+ $template->param(categories => $categories);
+ $template->param(branch_code => $branch->{'branchcode'});
+ $template->param(value => $branch->{'branchcode'});
+ =======
        $table .= <<EOF;
  <tr bgcolor='$color'>
***************
*** 225,231 ****
  </tr>
  EOF
      }
!     $table .= "</table><br>";
!     return $table;
  }
  
--- 264,270 ----
  </tr>
  EOF
+ >>>>>>> 1.5
      }
! 
  }
  
***************
*** 234,237 ****
--- 273,278 ----
  
      my $categoryinfo = getcategoryinfo();
+ <<<<<<< branches.pl
+ =======
      my $table = <<EOF;
  <table border='1' cellpadding='5' cellspacing='0'>
***************
*** 244,260 ****
  </tr>
  EOF
  my $color;
      foreach my $cat (@$categoryinfo) {
        ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
!       $table .= <<EOF;
! <tr bgcolor='$color'>
!     <td align='left' valign='top'>$cat->{'categoryname'}</td>
!     <td align='left' valign='top'>$cat->{'categorycode'}</td>
!     <td align='left' valign='top'>$cat->{'codedescription'}</td>
! </tr>
! EOF
      }
-     $table .= "</table>";
-     return $table;
  }
  
--- 285,297 ----
  </tr>
  EOF
+ >>>>>>> 1.5
  my $color;
      foreach my $cat (@$categoryinfo) {
        ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
! $template->param(color => $color);
! $template->param(categoryname => $cat->{'categoryname'});
! $template->param(categorycode => $cat->{'categorycode'});
! $template->param(codedescription => $cat->{'codedescription'});
      }
  }
  
***************
*** 398,400 ****
  }
  
! 
--- 435,437 ----
  }
  
! print "Content-Type: text/html\n\n", $template->output;




reply via email to

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