Apache2-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
$r->print("</HTML>");
}
# .. overload the methods ..
=head1 DESCRIPTION
The Apache2::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.
Apache2::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
Apache2::FileManager.
FileManager.pm view on Meta::CPAN
}
###############################################################################
# ----- Views --------------------------------------------------------------- #
###############################################################################
#after upload files - view
sub view_post_upload {
r->print(q{
<SCRIPT>
window.opener.document.FileManager.submit();
window.opener.focus();
window.close();
</SCRIPT>
});
return undef;
}
FileManager.pm view on Meta::CPAN
}
}
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 want to upload a directory, archive it first into a \"+
\"<I>zip</I> file or a tarball. You will then be able to extract \"+
\"it on the server. You can upload up to 10 files at a time. \"+
\"After selecting the files you want to upload, click the \"+
\"<I>upload</I> button to transfer the files from your machine to \"+
\"the server.<BR><BR>\"+
\"<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?\"+
FileManager.pm view on Meta::CPAN
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_curr_dir')."'>\");
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;
sel_files = window.document.FileManager.FILEMANAGER_sel_files;
// no files
FileManager.pm view on Meta::CPAN
f.submit();
} else if (rv == '') {
window.alert('can not create blank directory names');
}
return false;\"
><FONT COLOR=WHITE><B>new directory</B></FONT></A>",
#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',
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 not defined $up;
#my $in_fh = $up->fh;
#next if !defined $in_fh;
my $path = $$o{DR}."/".r->param('FILEMANAGER_curr_dir')."/".$filename;
$up->link($path);
#my $arg = "> ".$$o{DR}."/".r->param('FILEMANAGER_curr_dir')."/".$filename;
#my $out_fh;
FileManager.pm view on Meta::CPAN
# or die "ERROR: cannot open '$arg'";
#next if not defined $out_fh;
#while (<$in_fh>) {
# print $out_fh $_;
#}
#close($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);
FileManager.pm view on Meta::CPAN
'delete' => 1,
'stats' => 1
} );
$obj->exec( { src => r->document_root(),
dest => $$o{'RSYNC_TO'} } )
or warn "rsync 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.226 second using v1.01-cache-2.11-cpan-b16cb0d3907 )