Apache2-FileManager

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


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
  - added error message for rename and edit operation when selected filed != 1
  - fixed bad error after canceling a rename file dialog then refreshing
  - print error dialog when trying to create blank directory name
  - added time to date stamp

0.19 Philip Collins
  - prevented file edit screen from opening when cancel is clicked when creating new filenames
  - fixed up documentation

FileManager.pm  view on Meta::CPAN

      return UTCstring;
    }

    function getcookie(cookiename) {
      var cookiestring=''+document.cookie;
      var index1=cookiestring.indexOf(cookiename);
      if (index1==-1 || cookiename=='') return '';
      var index2=cookiestring.indexOf(';',index1);
      if (index2==-1) index2=cookiestring.length;
      escsubstring = cookiestring.substring(index1+cookiename.length+1, index2)
      return unescape(escsubstring);
    }

    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',

FileManager.pm  view on Meta::CPAN

      var sel_ar = get_sel_ckbox_array();

      //make sure there is 1 and only 1 selected file
      if (sel_ar.length != 1) {
        window.alert('Please select ONE file to edit by clicking on a '+
                     'check box with the mouse.');
      }

      else {
        var f= window.document.FileManager;
        var cd = escape(f.FILEMANAGER_curr_dir.value);
        var editfile = escape(sel_ar[0].value);
        var w = window.open('".r->uri."?FILEMANAGER_cmd=editfile".
                                      "&FILEMANAGER_curr_dir='+cd+'".
                                      "&FILEMANAGER_editfile='+editfile,
                            'FileManagerEditFile',
                            'scrollbars,resizable');
        sel_ar[0].checked = false;
        w.focus();
      }
    }

FileManager.pm  view on Meta::CPAN

    #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>",

FileManager.pm  view on Meta::CPAN


    #if directory?
    if (-d $file) {
      $last_modified = "--";
      $size = "<TD ALIGN=CENTER>--</TD>";
      $type = "/"; # "/" designates "directory"
      $link = "<A HREF=#
                onclick=\"
                  var f=window.document.FileManager;
                  f.FILEMANAGER_curr_dir.value='"
                      .Apache2::Util::escape_path($curr_dir.$file, r->pool)."';
                  f.submit();
                  return false;\">
                <FONT COLOR=#006699>$file$type</FONT></A>";
    }

    #must be a file
    elsif (-f $file) {

      #get file size
      my $stat = stat($file);

FileManager.pm  view on Meta::CPAN

      my $fake_doc_root = $$o{DR};
      $fake_doc_root =~ s/^$true_doc_root//;
      $fake_doc_root =~ s/^\///; $fake_doc_root =~ s/\/$//;

      my $href = $curr_dir;
      $href = $fake_doc_root."/".$href if $fake_doc_root;

      $link = "
          <A HREF=\"/$href"."$file?nossi=1\"
             TARGET=_blank><FONT COLOR=BLACK>"
             .Apache2::Util::escape_path($file.$type, r->pool).
            "</FONT>
          </A>";
    }

    $acum .= "
        <TR BGCOLOR=#$bgcolor>
        <TD><INPUT TYPE=CHECKBOX NAME=FILEMANAGER_sel_files
                   VALUE='$curr_dir"."$file'></TD>
        <TD>$link</TD>
        <TD ALIGN=CENTER NOWRAP>$last_modified</TD>

FileManager.pm  view on Meta::CPAN

}


sub get_selected_files {
  my @sel_files = r->param('FILEMANAGER_sel_files');
  return \@sel_files;
}


sub filename_esc {
  #escape spaces in filename
  my $o = shift;
  my $f = shift;
  $f =~ s/\ /\\\ /g;
  return $f;
}


sub formated_date {
  my $o = shift;
  my $date = shift || time;



( run in 0.367 second using v1.01-cache-2.11-cpan-c21f80fb71c )