From: Nick J. <nje...@us...> - 2002-01-25 07:41:59
|
Update of /cvsroot/sandweb/sandweb/bin In directory usw-pr-cvs1:/tmp/cvs-serv13852/bin Modified Files: sandweb.cgi Log Message: * updated view_file template * changed some vars and added content to sandweb.cgi Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.121 retrieving revision 1.122 diff -U2 -r1.121 -r1.122 --- sandweb.cgi 2002/01/21 00:23:18 1.121 +++ sandweb.cgi 2002/01/25 07:41:56 1.122 @@ -413,6 +413,6 @@ my $save = CGI::param('save'); my $username = $auth->get_userinfo('username'); - my $template_dir = $config->{'paths'}->{'template_dir'}; - my $users_dir = $config->{'paths'}->{'users_dir'}; + my $template_dir = $config->{'paths'}->{'template_dir'}; + my $users_dir = $config->{'paths'}->{'users_dir'}; my $server = $userprefs->{'repository'}->{'server'}; my $vcs_username = $userprefs->{'repository'}->{'username'}; @@ -423,4 +423,5 @@ my $vcsroot; + # Remove a file ?? XXX if ( $file_command eq 'remove' ) { unless (@filename) { @@ -462,4 +463,5 @@ } + # XXX if ( $repo_type eq 'CVS' ) { $log->debug("repo type is CVS, setting up CVSROOT"); @@ -469,11 +471,13 @@ $vcsroot = ":$connection:$vcs_username\@$server:$root"; } - } + } - my $group; - my $permissions; - my $file_type; - my $file; + # comments on what these vars mean? XXX + my $group; # XXX + my $permissions; # XXX + my $file_type; # XXX + my $file; # XXX + # XXX if ($filename) { $log->debug("creating file object"); @@ -481,20 +485,21 @@ 'config_obj' => $config, 'log_obj' => $log, - 'filename' => $filename, - 'location' => "$users_dir/$username$location", + 'filename' => $filename, + 'location' => "$users_dir/$username$location", ); } + # XXX if ( $file_command eq 'view' ) { $log->debug("viewing file : $filename"); - my $data = $file->file_read(); + my $file_content = $file->file_read(); # make output browser-friendly # Special Characters; RFC 1866 - $data =~ s/&/&/g; - $data =~ s/\"/"/g; - $data =~ s/</</g; - $data =~ s/>/>/g; + $file_content =~ s/&/&/g; + $file_content =~ s/\"/"/g; + $file_content =~ s/</</g; + $file_content =~ s/>/>/g; my $edit = ""; @@ -503,5 +508,5 @@ $log->debug("User wants to view non-text file : $filename"); set_error("This does not appear to be a text file."); - $data = ""; + $file_content = ""; } else { $edit = '<input type="submit" name="file_command" value="edit" />'; @@ -514,5 +519,8 @@ LOCATION => "$location", EDIT => "$edit", - DATA => "$data", + FILE_CONTENT => "$file_content", + FILE_SIZE => $file->get_size(), + FILE_TYPE => $file->get_file_type(), + FILE_AGE => $file->get_age(), ); @@ -531,5 +539,5 @@ $log->debug("editing file : $filename"); if ($save) { - my $data = CGI::param('data'), + my $file_content = CGI::param('data'), my $filename = $file->get_filename(); $log->debug("saving edited file : $filename"); @@ -539,5 +547,5 @@ 'location' => "$location", 'filename' => "$filename", - 'contents' => $data, + 'contents' => $file_content, ); @@ -545,9 +553,9 @@ file( - cookie => $cookie, - file_command => "view", - filename => \@filename, - location => $location, - ); + cookie => $cookie, + file_command => "view", + filename => \@filename, + location => $location, + ); } if ( $file->get_file_type() ne "Text" ) { @@ -555,9 +563,9 @@ set_error("This does not appear to be a text file."); file( - cookie => $cookie, - file_command => "view", - filename => $filename, - location => $location, - ); + cookie => $cookie, + file_command => "view", + filename => $filename, + location => $location, + ); } $log->debug("reading $users_dir/$username/$location/$filename"); @@ -733,6 +741,6 @@ my $message = CGI::param('message'); my $username = $auth->get_userinfo('username'); - my $template_dir = $config->{'paths'}->{'template_dir'}; - my $users_dir = $config->{'paths'}->{'users_dir'}; + my $template_dir = $config->{'paths'}->{'template_dir'}; + my $users_dir = $config->{'paths'}->{'users_dir'}; my %return; my $server = $userprefs->{'repository'}->{'server'}; @@ -747,10 +755,10 @@ if ( $repo_type eq 'CVS' ) { - if ( $connection eq 'local' ) { - $vcsroot = "$root"; - } else { - $vcsroot = ":$connection:$vcs_username\@$server:$root"; - } - } + if ( $connection eq 'local' ) { + $vcsroot = "$root"; + } else { + $vcsroot = ":$connection:$vcs_username\@$server:$root"; + } + } my $repository = SandWeb::Repository->new( @@ -774,19 +782,19 @@ my $content = $ui->get_menu( MENU => 'vcs_output', - LOCATION => $location, - PROGNAME => $progname, - FULLPATH => "$users_dir/$username/$location", + LOCATION => $location, + PROGNAME => $progname, + FULLPATH => "$users_dir/$username/$location", VCS_OUTPUT => "@vcs_output", VCS_ERROR => "@vcs_error", - ); - print CGI::header( -cookie => $cookie ); - $ui->print_screen( - TITLE=> "SandWeb : VCS $vcs_command", - MENU_TITLE => 'SandWeb', - SUBMENU_TITLE => "VCS $vcs_command", - FOOTER => '', - CONTENT => $content, - ERROR => $error, - ); + ); + print CGI::header( -cookie => $cookie ); + $ui->print_screen( + TITLE=> "SandWeb : VCS $vcs_command", + MENU_TITLE => 'SandWeb', + SUBMENU_TITLE => "VCS $vcs_command", + FOOTER => '', + CONTENT => $content, + ERROR => $error, + ); exit 0; } @@ -890,5 +898,5 @@ my $vcs_username = $userprefs->{'repository'}->{'username'}; my $root = $userprefs->{'repository'}->{'root'}; - my $users_dir = $config->{'paths'}->{'users_dir'}; + my $users_dir = $config->{'paths'}->{'users_dir'}; my $repo_type = $userprefs->{'repository'}->{'repo_type'}; my $connection = $userprefs->{'repository'}->{'connection'}; |