Apache-FileManager
view release on metacpan or search on metacpan
- made javacript control cut / copy buffer so module user does not
need to call the constructor before sending the header anymore.
- added rsync functionality
- checked for null filenames with javascript in rename and mkdir actions
- updated documentation
0.03 Fri Jun 21 11:00:11 2002 Philip Collins
- added prerequisite modules to 'PREREQ_PM' in Makefile.PL.
0.04 Fri Jun 21 04:30:00 2002 Philip Collins
- let user upload filenames with dashes in them.
- show javascript not enabled warning message
- show cookies not enabled warning message
- alert user when trying to copy, or cut 0 selected files.
- got rid of stringify & destringify functions as well as
MIME::Base64 and Storable libs since they aren't used anymore.
- added confirm dialog to 'go live!' button.
- bold faced path location to make it more noticable.
0.05 Tues Jun 25 08:00:00 2002 Philip Collins
- fixed javascript checkbox array bug occuring when only 0 or 1 files
- Updated delete confirm box message.
- added go to previous directory (..) control
0.13 Thur July 11 14:32:21 Philip Collins
- updated the documentation
0.14 Thur July 11 17:15:10 Philip Collins
- updated look of application
- added the beginnings of the help section
- used CSS tags to to hovering underline
- enlarged the file upload path boxes to 40 (Hardy)
0.15 Friday July 12 20:50:02 Philip Collins
- changed `go live!` to `synchronize`
- email File::NCopy author to fix empty directory copy
- fixed cut count so it can be > 1
- Added Help Section
0.16 Philip Collins
- Added close button to upload window
- cleaned up the documentation a bit
0.17 Philip Collins
- added return declined stmt if we see nossi param
0.18 Tue Nov 19 15:00 Philip Collins
- fixed extract to report error when trying to extract invalid archives
- Apache::Util::escape_html on all files names
- added ability to mass select and deselect shown files
- added ability to edit and preview edited files
FileManager.pm view on Meta::CPAN
print "</HTML>";
}
# .. overload the methods ..
=head1 DESCRIPTION
The Apache::FileManager module is a simple HTML file manager. It provides
file manipulations such as cut, copy, paste, delete, rename, extract archive,
create directory, create file, edit file, and upload files.
Apache::FileManager also has the ability to rsync the server htdocs tree to
another server. With the click of a button.
=head1 PREREQUISITES
The following (non-core) perl modules must be installed before installing
Apache::FileManager.
Apache::Request => 1.00
FileManager.pm view on Meta::CPAN
###############################################################################
# ----- Views --------------------------------------------------------------- #
###############################################################################
#after upload files - view
sub view_post_upload {
my $o = shift;
r->print("<SCRIPT>window.opener.document.FileManager.submit(); window.opener.focus(); window.close();</SCRIPT>");
return undef;
}
#after rsync transacation - view
sub view_post_rsync {
my $o = shift;
r->print("<CENTER><TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0><TR><TD>$$o{MESSAGE}</TD></TR><TR><FORM><TD ALIGN=RIGHT><INPUT TYPE=BUTTON VALUE='close' onclick=\"window.close();\"></TD></FORM></TR></TABLE></CENTER>");
FileManager.pm view on Meta::CPAN
for (var i=0; i < ar.length; i++) {
ar[i].checked = ck_stat;
}
}
function display_help () {
var w=window.open('','help','resizable=yes,scrollbars=yes,width=650,height=650');
var d = w.document.open();
d.write(\"<HTML> <UL><B><U><FONT SIZE=+1>Help</FONT></U></B><BR><BR>\"+
\"<LI><A NAME=upload><B>How do I upload files?</B></A><BR>\"+
\"Click on the upload menu item. After the <I>Upload Files</I> window opens, click the <I>Browse</I> button. This will pop open another window showing files on your computer. Select a file you want to upload. You can not upload directories. If you wa...
\"<LI><A NAME=move><B>How do I copy or move files?</B></A><BR>\"+
\"First click the check boxes next to the file names that you would like to copy or paste. Next click the <I>copy</I> or <I>paste</I> button. Then go to the directory you would like them pasted in. Finally, click <I>paste</I>.<BR><BR>\"+
\"<LI><A NAME=move><B>Why does the file manager seem broken in certain directories or when copying or pasting certain files?</B></A><BR>\"+
\"This occurs when the file manager does not have permission to access these files. To fix the problem, contact your system administrator and ask them to grant the webserver READ, WRITE, and EXECUTE access to your files.<BR><BR>\"+
\"</UL><CENTER><FORM><INPUT TYPE=BUTTON VALUE='close' onclick='window.close();'></FORM> </CENTER> </HTML>\");
d.close();
w.focus();
FileManager.pm view on Meta::CPAN
return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}
function setcookie(name,value,duration){
cookiestring=name+'='+escape(value)+';EXPIRES='+getexpirydate(duration);
document.cookie=cookiestring;
if(!getcookie(name)){ return false; }
else{ return true; }
}
function print_upload () {
var w = window.open('','FileManagerUpload','scrollbars=yes,resizable=yes,width=500,height=440');
var d = w.document.open();
d.write(\"<HTML><BODY><CENTER><H1>Upload Files</H1><FORM NAME=UploadForm ACTION='".r->uri."' METHOD=POST onsubmit='window.opener.focus();' ENCTYPE=multipart/form-data><INPUT TYPE=HIDDEN NAME=FILEMANAGER_curr_dir VALUE='".r->param('FILEMANAGER_cur...
for (var i=1; i <= 10; i++) {
d.write(\"<INPUT TYPE=FILE SIZE=40 NAME=FILEMANAGER_file\"+i+\"><BR>\");
}
d.write(\"<INPUT TYPE=BUTTON VALUE='cancel' onclick='window.close();'> <INPUT TYPE=SUBMIT NAME=FILEMANAGER_cmd VALUE=upload></CENTER></BODY></HTML>\");
d.close();
w.focus();
}
// make input check box form elements into an array ALL the time
function get_ckbox_array() {
var ar;
// no files
if (window.document.FileManager.FILEMANAGER_sel_files == null) {
FileManager.pm view on Meta::CPAN
} else if (rv == '') {
window.alert('can not create blank file names');
}
return false;
\"><FONT COLOR=WHITE><B>new file</B></FONT></A>",
#New Directory
"<A HREF=# onclick=\"var f=window.document.FileManager; var rv=window.prompt('new directory name',''); if ((rv != null)&&(rv != '')) { f.FILEMANAGER_arg.value=rv; f.FILEMANAGER_cmd.value='mkdir'; f.submit(); } else if (rv == '') { window.alert('can...
#Upload
"<A HREF=# onclick=\"window.print_upload(); return false;\"><FONT COLOR=WHITE><B>upload<B></FONT></A>"
);
#Rsync
my $rsync = "";
if ($$o{'RSYNC_TO'}) {
push @cmds, "<TD><A HREF=# onclick=\"if (window.confirm('Are you sure you want to synchronize with the production server?')) {var w=window.open('','RSYNC','scrollbars=yes,resizables=yes,width=400,height=500'); w.focus(); var d=w.document.open(); ...
}
return "
<!-- Actions Tool bar -->
FileManager.pm view on Meta::CPAN
foreach my $f (@{ $sel_files }) {
my $esc = $o->filename_esc($$o{DR}."/".$f);
my $archive = Archive::Any->new($esc);
$archive->extract if defined $archive;
$$o{MESSAGE} = "Files extracted.";
}
return undef;
}
sub cmd_upload {
my $o = shift;
my $arg1 = shift;
my $count = 0;
foreach my $i (1 .. 10) {
my @ar = split /\/|\\/, r->param("FILEMANAGER_file$i");
next if ($#ar == -1);
my $filename = pop @ar;
$filename =~ s/[^\w\ \d\.\-]//g;
next if ($filename eq "");
$count++;
my $up = r->upload("FILEMANAGER_file$i"); next if ! defined $up;
my $in_fh = $up->fh; next if ! defined $in_fh;
my $arg = "> ".$$o{DR}."/".r->param('FILEMANAGER_curr_dir')."/".$filename;
my $out_fh = Apache::File->new($arg);
next if ! defined $out_fh;
while (<$in_fh>) {
print $out_fh $_;
}
}
#$$o{MESSAGE} = "$count file(s) uploaded.";
$$o{'view'} = "post_upload";
return undef;
}
sub cmd_rename {
my $o = shift;
my $arg1 = shift;
my $sel_files = $o->get_selected_files();
my $file = $$o{DR}."/".$sel_files->[0];
my $bool = move($file, $arg1);
if ($bool) {
FileManager.pm view on Meta::CPAN
'delete' => 1,
'stats' => 1
} );
$obj->exec( { src => r->document_root,
dest => $$o{'RSYNC_TO'} } )
or warn "rsyn failed\n";
$$o{MESSAGE} = join ("<BR>", @{ $obj->out }) if ($obj->out);
$$o{MESSAGE} = join ("<BR>", @{ $obj->err }) if ($obj->err);
}
$$o{'view'} = "post_upload";
return undef;
}
sub cmd_mkdir {
my $o = shift;
my $arg1 = shift;
my $bool = mkdir $arg1;
if ($bool) {
$$o{MESSAGE} = "New directory added.";
( run in 1.400 second using v1.01-cache-2.11-cpan-b16cb0d3907 )