From 5dc063ebfce6e78b69fa41bb4a2475fd726ee728 Mon Sep 17 00:00:00 2001 From: pcanterino <> Date: Sun, 14 Mar 2004 09:41:57 +0000 Subject: [PATCH] Added an "About" dialogue, which shows some (more or less useful) information about Dev-Editor. Additionally, the $VERSION variable in devedit.pl is back again. --- devedit.dat | 1 + devedit.pl | 13 ++++-- modules/Command.pm | 83 ++++++++++++++++++++++++++++++++++-- templates/about.htm | 91 ++++++++++++++++++++++++++++++++++++++++ templates/copyfile.htm | 6 +++ templates/dirlist.htm | 1 + templates/renamefile.htm | 8 +++- templates/upload.htm | 1 + templates/viewfile.htm | 2 + 9 files changed, 198 insertions(+), 8 deletions(-) create mode 100644 templates/about.htm diff --git a/devedit.dat b/devedit.dat index f180cae..79ad3db 100644 --- a/devedit.dat +++ b/devedit.dat @@ -32,6 +32,7 @@ tpl_dirlist_file = templates/dirlist_file.htm tpl_dirlist_dir = templates/dirlist_dir.htm tpl_dirlist_up = templates/dirlist_up.htm tpl_error = templates/error.htm +tpl_about = templates/about.htm # Error messages diff --git a/devedit.pl b/devedit.pl index b2261ad..543d220 100644 --- a/devedit.pl +++ b/devedit.pl @@ -1,17 +1,18 @@ #!C:/Programme/Perl/bin/perl.exe -w # -# Dev-Editor 1.2 +# Dev-Editor 2.0 (CVS) # # Dev-Editor's main program # # Author: Patrick Canterino -# Last modified: 2004-02-23 +# Last modified: 2004-03-06 # use strict; use CGI::Carp qw(fatalsToBrowser); +use vars qw($VERSION); use lib 'modules'; use CGI; @@ -22,6 +23,8 @@ use Command; use Output; use Tool; +$VERSION = '2.0 (CVS)'; + use constant CONFIGFILE => 'devedit.dat'; # Read the configuration file @@ -90,14 +93,16 @@ if(-e clean_path($config->{'fileroot'}."/".$file)) $uselist->load; # Create a hash with data submitted by user - # (the CGI and the File::UseList object will also be included) + # (some other necessary information will also be included) my %data = (physical => $physical, virtual => $virtual, new_physical => $new_physical, new_virtual => $new_virtual, uselist => $uselist, - cgi => $cgi); + cgi => $cgi, + version => $VERSION, + configfile => CONFIGFILE); my $output = exec_command($command,\%data,$config); # Execute the command... diff --git a/modules/Command.pm b/modules/Command.pm index 8e899d3..9f6b970 100644 --- a/modules/Command.pm +++ b/modules/Command.pm @@ -6,7 +6,7 @@ package Command; # Execute Dev-Editor's commands # # Author: Patrick Canterino -# Last modified: 2004-03-04 +# Last modified: 2004-03-09 # use strict; @@ -37,7 +37,8 @@ my %dispatch = ('show' => \&exec_show, 'copy' => \&exec_copy, 'rename' => \&exec_rename, 'remove' => \&exec_remove, - 'unlock' => \&exec_unlock + 'unlock' => \&exec_unlock, + 'about' => \&exec_about ); ### Export ### @@ -314,7 +315,7 @@ sub exec_endedit($$) # Check if someone else is editing the new file - return error_in_use($virtual) if($uselist->in_use($virtual)); + return error($config->{'err_in_use'},upper_path($virtual),{FILE => $virtual}) if($uselist->in_use($virtual)); } return error($config->{'err_editdir'},upper_path($virtual)) if(-d $physical); @@ -487,6 +488,7 @@ sub exec_copy($$) $tpl->fillin("NEW_FILENAME",file_name($new_virtual)); $tpl->fillin("NEW_DIR",$dir); $tpl->fillin("DIR",upper_path($virtual)); + $tpl->fillin("COMMAND","copy"); $tpl->fillin("URL",equal_url($config->{'httproot'},$virtual)); $tpl->fillin("SCRIPT",$script); @@ -560,6 +562,7 @@ sub exec_rename($$) $tpl->fillin("NEW_FILENAME",file_name($new_virtual)); $tpl->fillin("NEW_DIR",$dir); $tpl->fillin("DIR",upper_path($virtual)); + $tpl->fillin("COMMAND","rename"); $tpl->fillin("URL",equal_url($config->{'httproot'},$virtual)); $tpl->fillin("SCRIPT",$script); @@ -697,6 +700,80 @@ sub exec_unlock($$) } } +# exec_about() +# +# Display some information about Dev-Editor +# +# Params: 1. Reference to user input hash +# 2. Reference to config hash +# +# Return: Output of the command (Scalar Reference) + +sub exec_about($$) +{ + my ($data,$config) = @_; + + my $tpl = new Template; + $tpl->read_file($config->{'tpl_about'}); + + $tpl->fillin("SCRIPT",$script); + + # Dev-Editor's version number + + $tpl->fillin("VERSION",$data->{'version'}); + + # Some path information + + $tpl->fillin("SCRIPT_PHYS",$ENV{'SCRIPT_FILENAME'}); + $tpl->fillin("CONFIG_PATH",$data->{'configfile'}); + $tpl->fillin("FILE_ROOT",$config->{'fileroot'}); + $tpl->fillin("HTTP_ROOT",$config->{'httproot'}); + + # Perl + + $tpl->fillin("PERL_PROG",$^X); + $tpl->fillin("PERL_VER",sprintf("%vd",$^V)); + + # Information about the server + + $tpl->fillin("HTTPD",$ENV{'SERVER_SOFTWARE'}); + $tpl->fillin("OS",$^O); + $tpl->fillin("TIME",strftime($config->{'timeformat'},localtime)); + + # Process information + + $tpl->fillin("PID",$$); + + # Check if the functions getpwuid() and getgrgid() are available + + if(eval("getpwuid(0)") && eval("getgrgid(0)")) + { + # Dev-Editor is running on a system which allows users and groups + # So we display the user and the group of our process + + $tpl->parse_if_block("users",1); + + # ID's of user and group + + $tpl->fillin("UID",$<); + $tpl->fillin("GID",$(); + + # Names of user and group + + $tpl->fillin("USER",getpwuid($<)); + $tpl->fillin("GROUP",getgrgid($()); + } + else + { + $tpl->parse_if_block("users",0); + } + + my $output = header(-type => "text/html"); + $output .= $tpl->get_template; + + return \$output; +} + # it's true, baby ;-) 1; diff --git a/templates/about.htm b/templates/about.htm new file mode 100644 index 0000000..7b5d36a --- /dev/null +++ b/templates/about.htm @@ -0,0 +1,91 @@ + + + + +About Dev-Editor + + + + +

About Dev-Editor

+ +

Dev-Editor {VERSION}

+ +

© 1999-2000 Roland Blüthgen, Frank Schönmann
+© 2003-2004 Patrick Canterino

+ +

View license (needs an active internet connection)

+ +

http://devedit.sourceforge.net/

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{IF users} + + + + + + + + + +{ENDIF} +
Physical script path:{SCRIPT_PHYS}
Path to configuration file:{CONFIG_PATH}
Physical root directory:{FILE_ROOT}
HTTP root:{HTTP_ROOT}
Perl executable:{PERL_PROG}
Perl version:{PERL_VER}
HTTP server software:{HTTPD}
Server operating system:{OS}
Server time:{TIME}
Process ID:{PID}
User:{USER} (UID: {UID})
Group:{GROUP} (GID: {GID})
+ +
+ + + \ No newline at end of file diff --git a/templates/copyfile.htm b/templates/copyfile.htm index 9733ed2..fa7ce7c 100644 --- a/templates/copyfile.htm +++ b/templates/copyfile.htm @@ -14,6 +14,8 @@

Back to {DIR}

+
+
@@ -23,5 +25,9 @@

+ +
+ +

About Dev-Editor

\ No newline at end of file diff --git a/templates/dirlist.htm b/templates/dirlist.htm index 3ababde..6f83465 100644 --- a/templates/dirlist.htm +++ b/templates/dirlist.htm @@ -45,5 +45,6 @@
+

About Dev-Editor

\ No newline at end of file diff --git a/templates/renamefile.htm b/templates/renamefile.htm index 0d59a07..bdfb04b 100644 --- a/templates/renamefile.htm +++ b/templates/renamefile.htm @@ -14,6 +14,8 @@

Back to {DIR}

+
+
@@ -21,7 +23,11 @@

Move/Rename file '{FILE}' to:
{DIR}

-

+

+ +
+ +

About Dev-Editor

\ No newline at end of file diff --git a/templates/upload.htm b/templates/upload.htm index 552bb57..276bc6b 100644 --- a/templates/upload.htm +++ b/templates/upload.htm @@ -44,5 +44,6 @@
+

About Dev-Editor

\ No newline at end of file diff --git a/templates/viewfile.htm b/templates/viewfile.htm index 556e017..0de0bc6 100644 --- a/templates/viewfile.htm +++ b/templates/viewfile.htm @@ -19,5 +19,7 @@ {CONTENT} + +

About Dev-Editor

\ No newline at end of file -- 2.34.1