#!/usr/bin/perl
use strict;
use CGI;
my $r=CGI::new();
my $from=$r->referer;
my $frame=$r->param('frame');
   $from.="?frame=$frame" if $frame && !$from=~m:[?&]frame=:o;
print $r->header,qq~<HTML><HEAD><TITLE>Apache::OpenIndex Help Page</TITLE></HEAD>\n~;
print qq~<BODY>\n~ unless $frame;
print $r->h1({-align=>'CENTER'},"The Official Apache::OpenIndex Help Page"),
  $r->p("Your Version=",$r->param('version')),
  $from?$r->a({-href=>$from},"Back to OpenIndex"):'',
  $r->hr;
if($r->param('version') lt '1.04b') {
print <<NEWVERSION;
A newer version is available at http://www.xorgate.com/Apache/OpenIndex
If you have any problems send email to:
perler\@xorgate.com or modperl\@apache.org
along with a description and such.  (Thanks:-)
<HR>
NEWVERSION
}
print <<INTRO;
OpenIndex provides a web site file manager using a web browser.  The
server is running Apache with mod_perl.  OpenIndex is a mod_perl Apache 
module integrated into the Apache web server.
INTRO
print $r->p;
if($r->param('mark')) {
print <<HAVEMARK;
You have the MARK mode enabled.  OpenIndex may either managing the
files in the MARK fake directory (normally .XFM/.MARK) or it may
be pointed to any designated directory on the server.  The options
are part of the configuration of the web server.  You will need to
contact the web service provider (WSP),if you have any questions.
HAVEMARK
} else {
print <<NOMARK;
OpenIndex provides a ROOT directory tree and commands that allow you to
manage your web site. The ROOT tree is the location where the web-server 
provides web pages to your web-browsers.
NOMARK
}
print $r->p;
print <<SELECTING;
Before you can execute most command you must first select a file 
or directory.  You select an item by placing a check in the
select check box just to the left of the files and directory
items listed the Directory index.
SELECTING
print <<DESTINATION;
Most of the commands (except for the "Browse", "Upload", "Delete", and 
"Help") require both a "select item" and a "destination" argument.
DESTINATION

print $r->h2("Browse");
print <<BROWSE;
The Browse command activates a local pop-up dialog window which allows
you to select a file on your computer to be uploaded.  An "Upload"
command is required to perform the actual file transfer to the server.
BROWSE

print $r->h2("Upload");
print <<UPLOAD;
The Uplaod command takes the selected local "Browse" file and 
transferes it the destination directory on the web server.
UPLOAD

print "The maximum file size which can be uploaded has been set to ",
  $r->param('postmax'), " bytes by the web master.";

print $r->h2("Delete");
print <<DELETE;
The Delete command deletes the "select items".  If an item is a 
directory it will delete all the files and sub-directories contained 
there in. (Be careful!)
DELETE

print $r->h2("MkDir");
print <<MKDIR;
The Mkdir command creates a new directory with the name specified in the
text "Destination" field.  For example, to create a directory named "test",
just type "test" into the "Destination" field and then click on the "Mkdir"
button.
MKDIR

print $r->h2("MkFile");
print <<MKFILE;
The Mkdir command creates a new file and activates the file editor.
This allow you to create a new text file.  You must specify the
new file name in the "Destination" text field.
MKFILE

print $r->h2("Unzip");
print <<UNZIP;
The Unzip command takes the selected zip file and expands it to 
the "destination" directory.  This is a convienant way to populate
your web site by, first locally create a zip file containing your 
site files, upload it, and then Unzipping it into the web server's 
ROOT directory.
UNZIP

print $r->h2("Copy");
print <<COPY;
The Copy command copies the "select item" to the destination. The 
selected item may either be a file or a directory.  For example, if a file 
is selected and the "Copy" button is clicked, the file will be copied to the 
destination directory.
COPY

print $r->h2("Move");
print <<MOVE;
The Move command moves the "select item" to the destination. The selected
item may either be a file or a directory.  For example, if a file is selected
and the "Copy" button is clicked, the file will be copied to the destination
directory.  If the destination already exists, it will be over written. 
(Be careful!)
MOVE

print $r->h2("Edit");
print <<EDIT;
The Edit command allows you to edit a text file such as a HTML file.
You can only edit one file at a time, so only select one item at a
time.  If you need to create a new file use the "MkFile" command.
EDIT

print $r->h2("Rename");
print <<RENAME;
The Rename allows you to change the name of a file or directory.
You must first select an item, then enter new name into the
"Destination" field, and then click the Rename button.
RENAME

if($r->param('perms')) {
print $r->hr, $r->h2("Permissions");
print <<PERMISSIONS;
File permissions are controled by checking your assigned access ID
against the ID assigned to each of the file and directory you 
try to process.  When you logged on to the web site, you had an access
ID assinged.  This ID is displayed at the top of the display.  Each 
file and directory you create has this same ID assigned.  Before each 
commands is executed, the ID of each item selected and any destination are 
checked to make sure that you are allowed to process the selection.
If you can not access a file or directory that you think you should
have access, you will need to contact your web service provider (WSP)
web-master in order to resolve your problem.
PERMISSIONS
}
if($r->param('admin')) {
print $r->hr, $r->h2("SetGID");
print <<SETGID;
You are obviously powerful. You have "admin" rights.  You only see
the "SetGID" command when your login access matches the admin GID.
To change the GID of any file or directory, simply select it, enter 
the GID name or number in the text field provide next to the SetGID 
button, and then click the "SetGID" button.  Notice that your display
also lists the Owner and Group of each file and directory.  If you
need to know about other group IDs (GIDs) that are available, you must 
contact the web master of your web service provider (WSP).
SETGID
print $r->hr, $r->h2("Revoke");
print <<REVOKE;
The "Revoke" command takes you to another form, which allows you (the
admin user) to enter either a user or group (GID) name that will have
their permissions "Enabled" or "Disabled".  This allows you to control
from your remote browser the access that others have to your site.
This option is normally turned off, but can be enabled by your web
service provider (WSP).  If the option is turned off (the default)
you will not see the "Revoke" command.
REVOKE
}
print $r->hr, $r->a({-href=>$from},"Back to OpenIndex") if $from;
print qq~</BODY>\n~ unless $frame;
print qq~</HTML>\n~;
