Index: ossp-pkg/tabea/tabea.cgi RCS File: /v/ossp/cvs/ossp-pkg/tabea/tabea.cgi,v rcsdiff -q -kk '-r1.37' '-r1.38' -u '/v/ossp/cvs/ossp-pkg/tabea/tabea.cgi,v' 2>/dev/null --- tabea.cgi 2002/07/16 14:49:09 1.37 +++ tabea.cgi 2002/07/26 14:54:19 1.38 @@ -263,9 +263,13 @@ my $text = ''; $text .= - "" . - " " . - " " . + "
" . + "
Username:
" . + "". + "". + "" . + " " . + " " . " " . " " . " " . - " " . + " " . " " . " " . " " . - " " . + " " . " " . - "
Login
 
Username:" . $cgi->textfield( -name => 'username', @@ -276,7 +280,7 @@ "
Password:Password:" . $cgi->password_field( -name => 'password', @@ -287,12 +291,15 @@ "
" . + " " . $cgi->reset() . + " " . $cgi->submit(-name => 'dialog_mainw', -value => 'login') . "
" ; + "" . + "" . &logging("Starting Tabea"); @@ -332,21 +339,46 @@ $text .= # Begin with templates part + "
" . "

" . - "" . - "" . + + "
" . + "" . + + "" . - "" . + + "" . + + "" . + "" . + "" . "
" . + "
" . + + "" . "" . - "Active User: $username

\n" . + "Active User:". "
" . "
" . + + "". + "$username

\n" . + "
" . + "" . + "" . + "". + "". + "
". $cgi->submit(-name => 'dialog_logout', -value => 'Logout') . + "
". "
". - "" . - "
Templates
" . + + "

" . + "" . + "". + "
Templates
" . $cgi->scrolling_list( -name => 'templatelist', -value => [@templatesarray], @@ -374,9 +406,9 @@ "
" . # Now the configuration part "

" . - "" . - "
Configuration
" . - " " . + "" . + "". + " " . " " . - "
Configuration
" . $cgi->scrolling_list( -name => 'configslist', -value => [@configsarray], @@ -384,7 +416,7 @@ ) . " " . - " " . + "
" . " " . @@ -408,8 +440,8 @@ " " . "
" . $cgi->submit(-name => 'dialog_new', -value => 'New') . "
" . "
" . - "
" ; + "
" . + ""; return $text; } @@ -489,8 +521,10 @@ $cgi->hidden(-name => 'editfile', -default => $filename ); &logging("Edit file $filename"); } else { - $text .= "Missing filename

\n" . - $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); + $text .= "



" . + "
Missing filename


\n" . + $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . + "
"; &logging("Missing filename"); } @@ -515,14 +549,14 @@ if (defined $fileout) { print $fileout $edittext; $fileout->close; - $form = 'mainw'; - if($cgi->param("editfile") =~ $cfghash{'BaseDir'} . "tabea.cfg" ) { + if($cgi->param("editfile") =~ ($cfghash{'BaseDir'} . "tabea.cfg") ) { $password = ""; } &logging("Saving $file"); + $form = 'mainw'; goto NEXTFORM; } else { $text .= "Cannot save file

\n"; @@ -547,8 +581,11 @@ my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $cgi->param('templatelist'); $text .= &editconfig($filename, 'r', $username); } else { - $text .= "Missing filename

\n" . - $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); + $text .= "



" . + "
" . + "Missing filename


\n" . + $cgi->submit(-name => 'dialog_mainw', -value => 'Back'). + "
" ; } return $text; } @@ -561,9 +598,13 @@ my ($dirname, $user) = @_; my $text = ''; - $text= "" . - "New File:

\n" . + $text= "
" . + "" . + "New File

\n" . "
" . + "
" . + "

" . + "
" . "" . " " . " " . @@ -589,13 +630,15 @@ " " . "" . " " . - "" . - " " . + "" . + "" . " " . - "
New Filename: $dirname " . "/" . "$user" . "/" . "

" . + " " . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . + "" . $cgi->submit(-name => 'dialog_newf', -value => 'Create') . - "
"; + "
" . + "
" ; return $text; } @@ -642,11 +685,16 @@ $text .= "


"; $form = 'mainw'; goto NEXTFORM; + $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); } else { - $text .= "Cannot write file. File exists

\n"; + $text .= "



" . + "
" . + "Cannot write file. File exists


\n". + $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . + "
" ; + &logging("Cannot write $newpath. File exists"); } - $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); return $text; } @@ -672,12 +720,17 @@ $defaultright = "private"; } - $text .= "" . - "Changing rights of file:

"; + $text .= "
" . + "" . + "Changing Rights of File


\n" . + "
" . + "
" ; $namefile =~ m{^([a-zA-Z0-9!"£\$%^&*()-_=+#~]+)/(.+)}sg; if ($1 eq $username) { - $text .= "" . + $text .= "



" . + "
" . + "
" . "" . " " . "" . - "
" . "$namefile
" . @@ -691,10 +744,21 @@ ) . "
" . - "

" . + + "" . + "" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . - $cgi->submit(-name => 'dialog_changer', -value => 'Set_rights'); + "" . + "" . + $cgi->submit(-name => 'dialog_changer', -value => 'Set_rights'). + "" . + "" . + + "" . + "" . + "
" ; + + $confname = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $namefile; $text .= $cgi->hidden(-name => 'filename', -default => $namefile ) ; } @@ -705,8 +769,11 @@ } } else { - $text .= "Missing filename

\n" . - $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); + $text .= "



" . + "
" . + "Missing filename


\n" . + $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . + "
" ; &logging("Cannot change rights of empty filename"); } @@ -722,10 +789,13 @@ my $text = ''; my $filerights = ''; - $text = "" . + $text = "
" . + "" . "Changing rights of file:
" . "
" . - "
$filename to $newrights
"; + "
$filename to $newrights
" . + "
" ; + if ($newrights eq "private") { $filerights = ''; } @@ -758,20 +828,20 @@ if ($filename) { my $srcfile = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $filename; $text .= $cgi->hidden(-name => 'srcfile', -default => $srcfile ) . + "
" . "" . - "Copying File:
" . + "Copying File
" . "
" . - "

" . - "Active user: $username
" . - "
" . - "" . - " " . + "". + "


" . + "
" . + "
" . " " . - " " . + " " . " " . " " . - " " . - " " . + " " . - " " . - "
Sourcefile :Destinationfile$srcfile
$srcfile" . + " Destinationfile:" . " " . " " . " " . @@ -786,23 +856,24 @@ " " . "
" . $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $username . "/
" . "
" . - "

" . - "" . - " " . + " " . " " . - " " . - "
" . - " " . + "
" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back'). " " . $cgi->submit(-name => 'dialog_copy', -value => 'Copy'). "
" ; + "" . + " " . + "" . + "
" ; } else { - $text .= "Missing filename

\n" . - $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ; + $text .= "



" . + "
" . + "Missing filename


\n" . + $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . + "
" ; } return $text; @@ -828,18 +899,22 @@ &logging("Deleting $fpath"); $form = 'mainw'; goto NEXTFORM; + $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); } else { $text .= "You can only delete file in your own directory

\n"; - &loggong("Just delete your own files not $fpath"); + &logging("Just delete your own files not $fpath"); } } else { - $text .= "Missing filename

\n"; - &loggin("Missing filename"); - } + $text .= "



" . + "
" . + "Missing filename


\n" . + $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . + "
"; - $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); + &logging("Missing filename"); + } return $text; } @@ -858,9 +933,12 @@ my $outputtext = ''; if ($runfile eq '') { - $text .= "No configuration selected

\n" ; + $text .= "



" . + "
" . + "No configuration selected


\n" . + $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . + "
" ; &logging("Cannot run configuration without configuration"); - $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); return $text; } $rcommand =~ s|%{profile}%|$rpath|s; @@ -869,10 +947,11 @@ system("/bin/rm $output"); } - $text .= "" . - "Running Configuration: $rpath

\n" . + $text .= "
" . + "" . + "Running Configuration

\n" . "
" . - "

" ; + "
" ; system("$rcommand > $output 2>&1"); &logging("Running command $rcommand"); @@ -891,13 +970,36 @@ -columns => 80 }; $outputhash->{readonly} = ""; - $text .= $cgi->textarea($outputhash) . "
"; + + $text .= "
" ."
". + "" . + "" . + "" . + "
" . + "Configuration filename:" . + "" . + $rpath . + "
" . + "

" . + $cgi->textarea($outputhash) . + "

" . + "" . + "" . + "" . + "" . + "
" . + $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . + "
" . + "
" ; } else { - $text .= "Run command not working

\n"; + $text .= "
" . + "Run command not working

\n" . + $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . + "
" ; + &logging("Run command $rcommand not working"); } - $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); return $text; } @@ -913,9 +1015,17 @@ my @userlistarray = split(/\s/, $userlist); $akt_user = $username; - &logging("Using admin section"); - $text .= "" . - "
". + + $text .= "
" . + "" . + "Administration

\n" . + "
" . + "
" ; + + $text .= "


" . + "
" . + "" . + "" . - "" . - "
". # $cgi->popup_menu( @@ -936,17 +1046,16 @@ $text .= "" . "" . + "" . "" . - "" . - "" . "" . "" . - "" . "" . @@ -956,12 +1065,13 @@ "" . "
" . + "" . $cgi->submit(-name => 'dialog_nuser', -value => 'New User'). "
" . + "" . $cgi->submit(-name => 'dialog_duser', -value => 'Del User'). "
" . - "

" . - "" . - "" . + "" . + "" . + "" . + "
" . + "


" . + "" . + + "" . - "" . @@ -969,7 +1079,8 @@ "

" . - $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ; + $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . + "" ; @@ -983,12 +1094,30 @@ ######################################################################################## my ($user) = @_; my $ctext; + my $texttitle; + + if ($user =~ $cfghash{'TabeaUser'}) { + $texttitle = "Administration: Change Password"; + } else { + $texttitle = "Change Password"; + } - $ctext .= "
Changing the password of $user

"; - $ctext .= "
" . $cgi->submit(-name => 'dialog_cfgedit', -value => 'Edit Configuration') . "" . + "" . $cgi->submit(-name => 'dialog_chpwd', -value => 'Change Password') . "
" ; + + $ctext .= "
" . + "" . + $texttitle . "

\n" . + "
" . + "
" ; + + $ctext .= "
" . + "
" ; if ( (($username eq $cfghash{'TabeaUser'}) && ($user eq $cfghash{'TabeaUser'}) ) || ($username ne $cfghash{'TabeaUser'}) ) { - $ctext .= " " . + $ctext .= "" . + "" . + "" . + + "" . " " . " " . " " ; - } - + } $ctext .= " " . " " . @@ -1025,19 +1153,22 @@ ) . " " . " " . - " " . - " " . + " " . - " " . - "
Changing the password of $user
Old Password:" . $cgi->password_field( @@ -999,8 +1128,7 @@ ) . "
New Password:
" . - $cgi->reset() ; + "
" ; if ( $cgi->param('username') eq $cfghash{'TabeaUser'}) { $ctext .= $cgi->submit(-name => 'dialog_admin', -value => 'Back'); } else { $ctext .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); } - - $ctext .= $cgi->submit(-name => 'dialog_changepwd', -value => 'Change') . - "
" ; + $ctext .= "
" . + $cgi->reset() . + $cgi->submit(-name => 'dialog_changepwd', -value => 'Change') . + "
" . + "" ; return $ctext; @@ -1066,13 +1197,15 @@ $valid = 1; } if ( !$valid ) { - $cptext .= "The password is incorrect.

\n"; + $cptext .= "
" . + "The password is incorrect.

\n"; &logging("Password is incorrect"); if ( $cgi->param('username') eq $cfghash{'TabeaUser'}) { $cptext .= $cgi->submit(-name => 'dialog_admin', -value => 'Back'); } else { $cptext .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); } + $cptext .= "
"; } else { if ($new1_password eq $new2_password) { $pwdfp = IO::File->new("<$pwdfile"); @@ -1093,9 +1226,11 @@ $form = 'mainw'; goto NEXTFORM; } else { - $cptext .= "The password you typed do not match. Type the same password. ". - "in both boxes

\n". - $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); + $cptext .= "
" . + "The password you typed do not match. Type the same password. ". + "in both boxes

\n". + $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . + "
" ; &logging("The password in the two boxes are not the same"); } } @@ -1111,12 +1246,18 @@ ######################################################################################## my $text; - $text .= - "Akt User: $akt_user" . - "" . - " " . - " " . - " " . + "
New User:" . + $text .= "
" . + "" . + "Administration: New User

\n" . + "
" . + "
" . + + "


" . + "
" . + "" . + "" . + "" . + "" . " " . - "
New User:" . $cgi->textfield( -name => 'akt_user', -default => "", @@ -1126,20 +1267,17 @@ ) . "
" . - - "

" . - - "" . - "" . + "" . "" . - - "
" . + "
" . $cgi->submit(-name => 'dialog_admin', -value => 'Back'). "" . - $cgi->submit(-name => 'dialog_newuser', -value => 'Write User'). + $cgi->submit(-name => 'dialog_newuser', -value => 'Create User'). "
" ; + "
" . + "" ; return $text; @@ -1165,11 +1303,19 @@ $nuser = ""; } + $ntext .= "
" . + "" . + "Administration: New User

\n" . + "
" . + "
" ; + if ( $nuser eq "" ) { - $ntext .= "" . + $ntext .= "
". + "" . "
Username wrong

" . "
" . - $cgi->submit(-name => 'dialog_admin', -value => 'Back'); + $cgi->submit(-name => 'dialog_admin', -value => 'Back') . + "
" ; &logging("Username is wrong"); } else { $pwdin = IO::File->new("<$pwdfile"); @@ -1207,17 +1353,21 @@ } - $ntext .= "" . + $ntext .= "". + "" . "User $nuser created

" . - $cgi->submit(-name => 'dialog_admin', -value => 'Back'); + $cgi->submit(-name => 'dialog_admin', -value => 'Back'). + "" ; &logging("New use $nuser created"); } else { - $ntext .= "" . + $ntext .= "
" . + "" . "
User exists

" . "
" . - $cgi->submit(-name => 'dialog_admin', -value => 'Back'); + $cgi->submit(-name => 'dialog_admin', -value => 'Back') . + "
"; &logging("Cannot create user $nuser. The user exists.") } } @@ -1239,24 +1389,24 @@ } if (! $derror ) { - $text .= - - "" . + $text .= "
" . + "" . + "Administration: Delete User

\n" . + "
" . + "
" . + "


" . + "
" . + "
" . "". - "" . - - "
" . - "" . "User to delete :" . - "" . "" . + "" . "$duser" . + "" . "
" . - "

" . - # $cgi->checkbox(-name=>'del_u_files', # -value=>'del_files', # -checked=>'', @@ -1264,20 +1414,16 @@ # -checked=> # ) . "Delete files of user" . - - "


" . - - "" . - - "
" . + "

" . + "" . + "" . "" . - - "
" . $cgi->submit(-name => 'dialog_admin', -value => 'Back'). "" . $cgi->submit(-name => 'dialog_d2user', -value => 'Del User'). "
" ; - + "
" . + "" ; } else { $text .= "" . @@ -1301,17 +1447,23 @@ my ($duser) = @_; my $dtext; - $dtext .= - + $dtext .= "
" . + "" . + "Administration: Delete User

\n" . + "
" . + "
" . + "


" . + + "
" . "" . "". "" . "
" . - "" . "User to delete :" . - "" . "" . + "" . "$duser" . + "" . "
" ; @@ -1333,7 +1485,8 @@ $cgi->submit(-name => 'dialog_d3user', -value => 'Really delete user'). "
" ; + "
" . + "
" ; return $dtext; @@ -1355,17 +1508,24 @@ my $uname; - $d3text .= - + $d3text .= "
" . + "" . + "Administration: Delete User

\n" . + "
" . + "
" . + "


" . + + "
" . "" . "". "" . "
" . - "" . - "User to delete :" . - "" . + "Deleting user:" . "" . + + "" . "$duser" . + "" . "
" . @@ -1401,7 +1561,8 @@ $d3text .= "
" . - $cgi->submit(-name => 'dialog_admin', -value => 'Back'); + $cgi->submit(-name => 'dialog_admin', -value => 'Back') . + "
" ; return $d3text; @@ -1430,10 +1591,15 @@ my ($srcf, $dstf) = @_; my $text = ''; - $text .= "" . + $text .= "
" . + "" . "Copying File:
" . - "


" . - "Copying from $srcf to $dstf

"; + "
" . + "
" . + "

" . + "
" . + "Copying from $srcf to $dstf

". + "
" ; system("cp $srcf $dstf") && die "Cannot copy file"; system("chmod o= $dstf") && die "Cannot change file rights"; @@ -1601,27 +1767,43 @@ if ($mode eq 'r') { $textahash->{readonly}=""; } - $texte .= "" . - $titletext . ":

\n" . - "
" . - "" . - "File: $file

\n" . + $texte .= "
" . + "" . + $titletext . "

\n" . "
" . + "
" . + "
" . + "
" . + "" . + "" . + "". + "\n" . + "" . + "
". + "
". + "File:" . + "". + "$file". + "
" . + "
" . $cgi->textarea($textahash). "

\n" . - "" . + "
" . " "; if ($mode eq 'w') { - $texte .= " "; } $texte .= " " . - "
" . - " " . + " " . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . " " . + $texte .= " " . $cgi->submit(-name => 'dialog_save', -value => 'Save') . " " . "
"; + "" . + "" . + "" . + "
" ; return $texte; } ########################################################################################