Apache2-FileManager

 view release on metacpan or  search on metacpan

FileManager.pm  view on Meta::CPAN

    #Refresh
    "<A HREF=# onclick=\"
        var f=window.document.FileManager;
        f.submit();
        return false;\"
        ><FONT COLOR=WHITE><B>refresh</B></FONT></A>",

    #Edit
    "<A HREF=# onclick=\"
        window.edit_file(); return false;\"
        ><FONT COLOR=WHITE><B>edit</B></FONT></A>",

    #Cut
    "<A HREF=# onclick=\"
        window.save_names('cut'); return false;\"
        ><FONT COLOR=WHITE><B>cut</B></FONT></A>",

    #Copy
    "<A HREF=# onclick=\"
        window.save_names('copy'); return false;\"
        ><FONT COLOR=WHITE><B>copy</B></FONT></A>",

    #Paste
    "<A HREF=# onclick=\"
        if (window.getcookie(cookie_name) != '') {
          var f=window.document.FileManager;
          f.FILEMANAGER_cmd.value='paste'; f.submit();
        } else {
          window.alert('Please select file(s) to paste by checking '+
                       'the file(s) first and clicking copy or cut.');
        }
        return false;\"
        ><FONT COLOR=WHITE><B>paste</B></FONT></A>",

    #Delete
    "<A HREF=# onclick=\"
      var f=window.document.FileManager;
      if (get_num_checked() == 0) {
        window.alert('Please select a file to delete by clicking'+
                     ' on a check box with the mouse.');
        } else {
          var msg = '\\n                 Are you sure?\\n' +
                    '\\n' + 'Click OK to delete selected ' +
                    'files & directories\\n' +
                    '   ***including*** files in those directories';

          if (window.confirm(msg)) {
            f.FILEMANAGER_cmd.value='delete'; f.submit();
          }
        }
        return false; \"
        ><FONT COLOR=WHITE><B>delete</B></FONT></A>",

    #Rename
    "<A HREF=# onclick=\"
        var f=window.document.FileManager;
        if (get_num_checked() != 1) {
          window.alert('Please select ONE file to rename by clicking on a '+
                       'check box with the mouse.');
        } else {
          var rv=window.prompt('enter new name','');
          if ((rv != null) && (rv != '')) {
            f.FILEMANAGER_cmd.value='rename';
            f.FILEMANAGER_arg.value=rv;
            f.submit();
          }
        }
        return false;\"
        ><FONT COLOR=WHITE><B>rename</B></FONT></A>",

    #Extract
    "<A HREF=# onclick=\"
        var f=window.document.FileManager;
        if (get_num_checked() == 0) {
          window.alert('Please select a file to extract by clicking on a '+
                       'check box with the mouse.');
        } else {
          f.FILEMANAGER_cmd.value='extract';
          f.submit();
        }
        return false;\"
        ><FONT COLOR=WHITE><B>extract</B></FONT></A>",

    #New File
    "<A HREF=# onclick=\"
        var f=window.document.FileManager;
        var rv = window.prompt('new file name','');
        var cd = f.FILEMANAGER_curr_dir.value;
        if (cd != '') {
          rv = cd+'/'+rv;
        }
        if ((rv != null) && (rv != '')) {
          var w = window.open('".r->uri."?FILEMANAGER_cmd=editfile".
                                        "&FILEMANAGER_curr_dir='+escape(cd)+'".
                                        "&FILEMANAGER_editfile='+escape(rv),
                              'FileManagerEditFile',
                              'scrollbars,resizable');
          w.focus();

        } 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 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',
                              'scrollbars=yes,resizables=yes,width=400,height=500');
            w.focus();
            var d=w.document.open();
            d.write('<HTML><BODY><BR><BR><BR>".
                    "<CENTER>Please wait synchronizing production server.".
                    "<BR>This could take several minutes.".
                    "</CENTER></BODY></HTML>');
            d.close();
            w.location.replace('".r->uri."?FILEMANAGER_cmd=rsync',
                               'RSYNC',
                               'scrollbars=yes,resizables=yes,width=400,height=500');
          } return false;\"
          ><FONT COLOR=WHITE><B>synchronize</B></FONT></A>";
  }

  return "
    <!-- Actions Tool bar -->
    <TABLE CELLPADDING=0 CELLSPACING=0
           BORDER=0>
      <TR ALIGN=CENTER>
        <TD ALIGN=CENTER>"
    .join("</TD><TD>&nbsp;<B><FONT COLOR=#bcbcbc SIZE=+2>|</FONT>&nbsp;</B>"
         ."</TD><TD>",
         @cmds)
    ."</TD></TR></TABLE>";
}


sub html_file_list {
  my $o = shift;
  my $up_a_href = shift || "";

  my $bgcolor = "efefef";



( run in 1.816 second using v1.01-cache-2.11-cpan-6aa56a78535 )