From: Rob H. <for...@us...> - 2001-11-21 19:48:46
|
Update of /cvsroot/sandweb/sandweb/bin In directory usw-pr-cvs1:/tmp/cvs-serv19766/bin Modified Files: sandweb.cgi Log Message: implemented simple versions of view and edit also, clicking on a file now runs "$repo->status" on that file, which is the first step to having an info page Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.63 retrieving revision 1.64 diff -U2 -r1.63 -r1.64 --- sandweb.cgi 2001/11/15 19:46:20 1.63 +++ sandweb.cgi 2001/11/21 19:48:43 1.64 @@ -132,4 +132,5 @@ cookie => $cookie, filename => param('filename'), + command => param('command'), ); } @@ -295,4 +296,5 @@ + my $command = $args{'command'}; my $username = $auth->get_userinfo('username'); my $template_dir = $config->{'paths'}->{'template_dir'}; @@ -300,6 +302,13 @@ my $repo_type = $userprefs->{'repository'}->{'VCS'}; my $root = $userprefs->{'repository'}->{'root'}; - my $sandbox = $userprefs->{'paths'}->{'users_dir'}; +# my $sandbox = $userprefs->{'paths'}->{'users_dir'}; + my $sandbox='/usr/local/apache/cgi-bin/sandweb/bin'; + my $repository = SandWeb::Repository->new( + root => $root, + repo_type => $repo_type, + sandbox => $sandbox, + ); + my $location = "$users_dir/$username"; @@ -321,5 +330,27 @@ 'location' => $location, ); -# if ( $command eq 'view' ) { + if ( $command eq 'info' ) { + print header; + print '<pre>'; + my %return = $repository->status( file => "$location/$filename" ); + print $return{'output'}; + print '</pre>'; + exit 1; + } + elsif ( $command eq 'view' ) { + unless ( $file->get_file_type() eq "Text" ) { + print header; + print "This does not appear to be a text file.\n"; + exit 1; + } + print header; + open (FILE, "$location/$filename"); + print "<pre>"; + foreach my $line (<FILE>) { + print "$line"; + } + print "</pre>"; + } + elsif ( $command eq 'edit' ) { unless ( $file->get_file_type() eq "Text" ) { print header; @@ -330,9 +361,18 @@ open (FILE, "$location/$filename"); print "<pre>"; + print "<textarea name=\"$filename\" rows=\"50\" cols=\"160\">"; foreach my $line (<FILE>) { print "$line"; } + print '</textarea>'; print "</pre>"; -# } + print "<input type=\"button\" value=\"Save\" />"; + exit 1; + } + else { + print header; + print "hello\n"; + exit 1; + } } |