OSSP CVS Repository

ossp - Difference in ossp-pkg/tabea/tabea.cgi versions 1.13 and 1.14
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/tabea/tabea.cgi 1.13 -> 1.14

--- tabea.cgi    2002/05/13 13:05:56     1.13
+++ tabea.cgi    2002/05/13 16:28:28     1.14
@@ -150,15 +150,14 @@
      $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) .
         $cgi->hidden(-name => 'form', -default => ['']) .
 # Begin with templates part         
-        "<br> Active User: $username<br>\n" .
-        "Templates:   <br><br>\n" . 
-        "<table width=70%>" .
+        "<br> Active User: $username<br><br>\n" .
+#        "Templates:   <br><br>\n" . 
         "  <td>" . 
         "    <td>" .
         $cgi->scrolling_list(
             -name => 'templatelist',
             -value => [@templatesarray],
-            -size => 2
+            -size => 3
         ) .
         "   </td>" .
         "  <td>" .
@@ -182,14 +181,13 @@
         "</table>" .
 
 # Now the configuration part         
-        $page .= "Configuration:   <br><br>\n". 
-        "<table width=70%>" .
-        "  <tr>" . 
+        $page .=  "<table> <caption>Configuration</caption>" .
+        "<td>" .
         "    <td>" .
         $cgi->scrolling_list(
             -name => 'configslist',
             -value => [@configsarray],
-            -size => 5
+            -size => 10
         ) .
         "   </td>" .
         "   <td>" .
@@ -221,8 +219,7 @@
 
         "    </table>" .
         "  </td>" .
-
-        " </tr>" .
+        "<td>" .
         "</table>" ;
 
 
@@ -231,31 +228,11 @@
 }
 elsif ($dialog eq 'Edit') {
     #   enter Edit form
-#    &validpassword($username, $password, $pwdfile) || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html");
-    if ($cgi->param('configslist')) {
-    my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $username . "/" . $cgi->param('configslist');
-    &editconfig($filename, 'w', $username);
-    } else {
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) .
-    "<font color=red>Missing filename<br><br>\n" .
-    $cgi->submit(-name => 'dialog', -value => 'Back') .
-    $cgi->endform;
-    }
-    
+        $page .= &edit($cgi->param('configslist'));
 } 
 elsif ($dialog eq 'View') {
     #   enter View form
-#    &validpassword($username, $password, $pwdfile) || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html");
-    if ($cgi->param('templatelist')) {
-    my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $cfghash{'TabeaUser'} . "/" . $cgi->param('templatelist');
-    &editconfig($filename, 'r', $username);
-    } else {
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) .
-    "<font color=red>Missing filename<br><br>\n" .
-    $cgi->submit(-name => 'dialog', -value => 'Back') .
-    $cgi->endform;
-    }
-    
+    $page .= &view($cgi->param('templatelist'));
 } else {
     die "invalid dialog \"$dialog\"";
 }
@@ -272,6 +249,48 @@
 
 exit (0);
 
+
+########################################################################################
+sub edit {
+########################################################################################
+    my ($file) = @_;
+    my $text;
+    #   enter Edit form
+    if($file) {
+    my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $username . "/" . $file;
+    &editconfig($filename, 'w', $username);
+    } else {
+    $text = $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) .
+    "<font color=red>Missing filename<br><br>\n" .
+    $cgi->submit(-name => 'dialog', -value => 'Back') .
+    $cgi->endform;
+    }
+    return $text;
+}
+########################################################################################
+
+
+########################################################################################
+sub view {
+########################################################################################
+    my ($file) = @_; 
+    my $text;
+    #   enter View form
+    if ($file) {
+    my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $cfghash{'TabeaUser'} . "/" . $cgi->param('templatelist');
+    &editconfig($filename, 'r', $username);
+    } else {
+    $text .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) .
+    "<font color=red>Missing filename<br><br>\n" .
+    $cgi->submit(-name => 'dialog', -value => 'Back') .
+    $cgi->endform;
+    }
+    return $text;
+}
+########################################################################################
+
+
+
 ########################################################################################
 sub read_config {
 ########################################################################################
@@ -368,23 +387,37 @@
     my ($file, $mode, $user) = @_;
     my $text = '';
     my $filein ;
-     
+    my $readonly ;
+    my $titletext ;
 
     $filein = IO::File->new("<$file");
     while(<$filein>) { $text .= $_; }
     $filein->close; 
+
+
+    if ($mode eq 'w') {
+        $titletext = "Edit window";
+    } elsif ($mode eq 'r') {
+       $titletext = "View window";
+    }
+
+    my $textahash ={ -name => 'editwindow',
+          -default => $text,
+          -rows    => 40,
+          -columns => 80
+    };
+    if ($mode eq 'r') {
+        $textahash->{readonly}="";
+    }
     $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) .
-    "Edit window:   <br><br>\n" ;
-    $page .= "Username: $username<br><br>\n" .
+    "<font size=+2>" .
+    $titletext . ":   <br><br>\n" .
+    "</font>" .
+    "Username: $username<br><br>\n" .
     "File: $file<br><br>\n" .
     "Mode: $mode<br><br>\n" .
-    $cgi->textarea(
-        -name => 'editwindow',
-        -default => $text,
-        -rows    => 40,
-        -columns => 80
-    );
-    $page .= " <br><br>\n" .
+    $cgi->textarea($textahash).
+    "<br><br>\n" .
     "<table>" .
     "  <td>" .
     "    <td>" .
@@ -401,7 +434,5 @@
 
 
     $cgi->endform;
-
-
 }
 ########################################################################################

CVSTrac 2.0.1