Apache-FileManager

 view release on metacpan or  search on metacpan

FileManager.pm  view on Meta::CPAN

    return sel_ar.length;
  }

  //function to edit file
  function edit_file () {
    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();  
    }
  }

  // make cookie for checked filenames
  function save_names (type) {
    var cb = get_sel_ckbox_array();
    var ac = '';
    for (var i=0; i < cb.length; i++) {
      ac = ac + cb[i].value + '|';
      cb[i].checked = false;
    }
    if (ac == '') {
      window.alert('Please select file(s) by clicking on the check boxes with the mouse.');
    } else {
      ac = ac + type;
      window.setcookie(cookie_name,ac,1);
    }
  }

  //test if browser cookies are enabled
  if (! window.document.cookie ) {
    window.setcookie(cookie_name,'test',1);
    if (! window.document.cookie) document.write('<H1><FONT COLOR=#990000>please enable cookies</FONT></H1>');
    window.setcookie(cookie_name,'',-1);
  }

  $$o{JS}

  -->
  </SCRIPT> "; #end return literal

}
 ### end sub html_javascript

sub html_style_sheet {
  my $o = shift;

  return ("
  <STYLE TYPE='text/css'>
    <!-- 
BODY {
background-color: white;
font-family: serif;
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
padding-top: 0;
padding-bottom: 0;
padding-right: 1;
padding-left: 1;
border-top: 0;
border-bottom: 0;
border-right: 0;
border-left: 0;
border-style: 0;
}

A:link {
color: #990000;
text-decoration: none;
}

A:visited {
color: #990000;
text-decoration: none;
}

A:hover {
color: #990000;
text-decoration: underline;
}
    -->
  </STYLE>")
}




sub html_hidden_fields {
  my $o = shift;
  return "
<INPUT TYPE=HIDDEN NAME=FILEMANAGER_curr_dir VALUE='".r->param('FILEMANAGER_curr_dir')."'>
<INPUT TYPE=HIDDEN NAME=FILEMANAGER_cmd VALUE=''>
<INPUT TYPE=HIDDEN NAME=FILEMANAGER_arg VALUE=''>
<INPUT TYPE=HIDDEN NAME=FILEMANAGER_last_select_all VALUE='".r->param('FILEMANAGER_last_select_all')."'>
";
}

sub html_location_toolbar {
  my $o = shift;

  my @loc = split /\//, r->param('FILEMANAGER_curr_dir');

  #already in base directory?
  return "<B>location: / </B>" if ($#loc == -1);

  #for all elements in the loc except the last one
  my @ac;
  my $up_a_href = "<A HREF=# onclick=\"var f=window.document.FileManager; f.FILEMANAGER_curr_dir.value=''; f.submit(); return false;\"><FONT COLOR=#006699 SIZE=+1><B>..</B></FONT></A>&nbsp;";
  for (my $i = 0; $i < $#loc; $i++) {
    push @ac, $loc[$i];



( run in 2.524 seconds using v1.01-cache-2.11-cpan-0d23b851a93 )