OSSP CVS Repository

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

ossp-pkg/tabea/tabea.cgi 1.15 -> 1.16

--- tabea.cgi    2002/05/14 14:06:21     1.15
+++ tabea.cgi    2002/05/14 15:34:02     1.16
@@ -42,6 +42,7 @@
 my $configsdir = "./tabea.d";
 #my $tabeauser = "tabea";
 
+
 # establish my configuration
 my $MY = {};
 $MY->{PROGNAME} = ($0 =~ m|^.*?([^/]+?)(?:\.[^/.]+)?$|)[0];
@@ -247,6 +248,17 @@
     #   enter View form
     $page .= &view($cgi->param('templatelist'));
 }
+elsif ($dialog eq 'New') {
+    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
+    $page .= &new($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username);
+    $page .= $cgi->endform;
+}
+elsif ($dialog eq 'New_file') {
+    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
+    $page .= &newfile($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username, $cgi->param('newfile'), $cgi->param('new_rights'));
+    $page .= $cgi->endform;
+}
+
 else {
     die "invalid dialog \"$dialog\"";
 }
@@ -351,6 +363,92 @@
     return $text;
 }
 ########################################################################################
+
+
+#########################################################################################
+sub new {
+########################################################################################
+    my ( $dirname, $user ) = @_;
+    my $text;
+
+    $text= "<font size=+2>" .
+    "New File:<br><br>\n" .
+    "</font>" .
+
+    "<table spacing=0 cellpadding=0>" .
+    "  <tr>" .
+    "    <td>New Filename: $dirname " . "/" . "$user" . "/" . "</td>" .
+    "   <td>" .
+    $cgi->textfield(
+        -name => 'newfile',
+        -default => '',
+        -size => 20,
+        -maxlength => 30
+    ) .
+    " </td>" .
+    " </tr>" .
+    " <tr>" .
+    "<tr><td><br></td></tr>" .
+    "<td></td>" .
+    " <td align=left>" .
+#    $cgi->checkbox_group(
+#       -name => 'new_rights',
+#       -values => ['private', 'protected', 'public'],
+#       -defaults => 'private',
+#       -linebreak => 'true'
+#    ) .
+    $cgi->scrolling_list(
+       -name => 'new_rights',
+       -value => ['private', 'protected', 'public'],
+       -size => 1
+    ) .
+    " </td>" .
+    " </tr>" .
+    "<tr><td><br></td></tr>" .
+    "  <tr>" . 
+    "<td></td>" .
+    "    <td colspan=2 align=left>" .
+    $cgi->submit(-name => 'dialog', -value => 'Back') .
+    $cgi->submit(-name => 'dialog', -value => 'New_file') .
+    "    </td>" .
+    "  </tr>" . 
+    "</table>"; 
+
+    return $text;
+}
+########################################################################################
+sub newfile {
+########################################################################################
+    my ( $dirname, $user, $newfilename, $newrights ) = @_;
+    my $text;
+    my $newpath = $dirname . "/" . $user . "/" . $newfilename;
+    my $filerights = '';
+
+    $text= "<font size=+2>" .
+    "Creating New File:<br><br>" .
+    "</font><br><br><br>" ;
+    system("touch $newpath") && die "Cannot create new file";
+    if ($newrights eq "private" ) {
+        $filerights = '';
+    } elsif ($newrights eq "protected" ) {
+        $filerights = "r";
+    } elsif ($newrights eq "public" ) {
+        $filerights = "rw";
+    } else {
+        die "Unknown file rights";   
+    }
+    $text .= "Creating the new file $newpath<br><br>";
+    system("touch $newpath") && die "Cannot create new file";
+    $text .= "Setting new file rights for $newpath<br><br>";
+    system("chmod u=rw $newpath") && die "Cannot set new file rights";
+    system("chmod o=$filerights $newpath") && die "Cannot set new file rights";
+    # Checking that file dont exist: TODO
+    $text .= "<br><br><br>" .
+    $cgi->submit(-name => 'dialog', -value => 'Back');
+
+    return $text;
+}
+########################################################################################
 
 
 ########################################################################################

CVSTrac 2.0.1