<script language = "javascript">

var ie = (document.all)? true : false;
function js_action() {      
    var bottom_form = top.bottomfrm.document.frm_footer;
    var status = 0;

    <%if cmd_do eq 'cmd_tar' or $cmd_do eq 'cmd_uncompress'%>
        top.js_cmd_tar(<%if reload eq '2'%>1<%endif%>);
    <%else%>
      if (typeof(bottom_form) == 'undefined') {
        <%if reload%>top.loadStatus("<%status%>");<%endif%>
        return;
      }
      
      var cmd_current = bottom_form.cmd_do.value;
      <%if reload and $cmd_do%>
        if (cmd_current == 'cmd_search' || cmd_current == 'cmd_replace' || cmd_current == 'cmd_passwd')
          top.loadStatus("<%status%>");
        else
          eval("top.js_" + cmd_current + "(<%if reload eq '2'%>1<%endif%>)");
      <%endif%>

      <%ifnot status%>
        if (cmd_current == 'cmd_search' || cmd_current == 'cmd_replace')
            bottom_form.scope.options[0].text = "All of <%if work_path%><%work_path%><%else%>Root<%endif%>";
      <%endif%>
    <%endif%>
}
</script>
<link rel="stylesheet" href="<%html_url%>/<%scheme%>.css">
<body class="bg_main" onload="js_action()" leftmargin=5 topmargin=4>
<form name='frm_main' action='<%http_ref%>' method=post>
<%if readme%><%if position eq 'Y'%><p><%font%><%readme%></font><%endif%><%endif%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <%if search%>
    <%if cmd_do eq "cmd_search" or cmd_do eq "cmd_replace"%>
  <tr><td><%font%>
      <a href="<%http_ref%>?fdo=cmd_main_display&work_path=<%work_path%>&<%url_opts%>"><img src='<%html_url%>/icons/back.gif' border=0></a>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%status%></font></td></tr>
    <%endif%>
  <%endif%>
  <tr class="bg_main2">
    <td class="bg_main2">
      <table border="0" cellpadding="1" cellspacing="1" width="100%" id="tabMain" >
        <tr>
          <td width="1%" align=center class="header_format">
            <%if num_objects > 1%><input name="allbox" type="checkbox" value="Check All" onClick="top.CheckAll();"><%else%>&nbsp;<%endif%>
          </td>
          <td width="3%" class="header_format"><%font%><%sview%></td>
          <td width="36%" class="header_format"><%font%><%sname%></td>
          <td width="10%" class="header_format"><%font%><%ssize%></td>
          <td width="12%" class="header_format"><%font%><%stype%></td>
          <td width="16%" class="header_format"><%font%><%sdate%></td>
          <td width="10%" class="header_format"><%font%><%suser%></td>
          <td width="12%" class="header_format"><%font%><%sperm%></td>
        </tr>
       <%loop results%>
        <tr <%ifnot even%>class="background"<%else%>class="bg_main"<%endif%>>
          <td width="1%" align=center>
            <%if type%>
                <%if disabled%>
                 <input type="checkbox" name="c_edit" value="<%name%>" onClick="top.CheckCheckAll(this);">
                <%else%>
                 <input type="checkbox" name="c_edit"  value="<%name%>" onClick="top.CheckCheckAll(this);">
                <%endif%>
            <%else%>
                &nbsp;
                <input name="dparent" type=hidden value="1">
            <%endif%>
            <input type="hidden" name="size<%row_num%>" value="<%if nsize%><%nsize%><%endif%>">
          </td>
          <td align=center valign=middle>
          <%if disabled%>
             <%icon%>
          <%else%>
            <%if isdir%>
                <a href="<%http_ref%>?fdo=cmd_main_display;work_path=<%work_path%><%if work_path%>/<%endif%><%name%><%if url_opts%>;<%url_opts%><%endif%>">
              <%else%>
                <a href="<%http_ref%>?cmd_do=cmd_view&work_path=<%work_path%>&c_edit=<%name%><%if url_opts%>;<%url_opts%><%endif%>">
              <%endif%><%icon%></a>
          <%endif%>
          </td>
          <td><%font%>
          <%if disabled%>
              <%name%>
          <%else%>
              <%if isdir%>
                <a href="<%http_ref%>?fdo=cmd_main_display&work_path=<%work_path%><%if work_path%>/<%endif%><%name%><%if url_opts%>&<%url_opts%><%endif%>"><%name%></a>
              <%else%>
                <%if show_all%>
                    <a href="<%http_ref%>?cmd_do=cmd_edit&work_path=<%work_path%>&c_edit=<%name%>&<%url_opts%>"><%name%></a>
                <%else%>
                    <%ifnot cmd_edit%>
                        <%name%>
                    <%else%>
                        <a href="<%http_ref%>?cmd_do=cmd_edit&work_path=<%work_path%>&c_edit=<%name%>&<%url_opts%>"><%name%></a>
                    <%endif%>
                 <%endif%>
              <%endif%>
          <%endif%></font>
          </td>
          <td><%font%><%if size%><%size%><%else%>&nbsp;<%endif%></font></td>
          <td><%font%><%if type%><%type%><%else%>&nbsp;<%endif%></font></td>
          <td><%font%><%date%></font></td>
          <td><%font%><%user%></font></td>
          <td><%font%>
            <%if show_all%>
                <%if type%><a href="javascript:top.show_chmod('<%name%>','<%perm%>')" target=bottomfrm><%perm%></a><%endif%>
            <%else%>
                <%ifnot cmd_chmod%>
                    <%perm%>
                <%else%>
                   <%if type%><a href="javascript:top.show_chmod('<%name%>','<%perm%>')" target=bottomfrm><%perm%></a><%endif%>
                <%endif%>
            <%endif%>
             &nbsp;
            </font>
            </td>
          </tr>
        <%endloop%>
      </table>
    </td>
  </tr>
<%if speed_bar%>
  <tr>
      <td colspan="8"><%font%><b>Page:</b> &nbsp;<%speed_bar%></font> </td>
  </tr>
<%endif%>
</table>
<%ifnot position%>
<%set position="N"%>
<%endif%>
<%if readme%><%if position eq 'N'%><p><%font%><%readme%></font><%endif%><%endif%>
<input type=hidden name='work_path' value='<%work_path%>'>
<input type=hidden name='txt_input' value=''>
<input type=hidden name="cmd_do" value=''>
<input type=hidden name="page" value=''>
<input type=hidden name="search" value="<%if search%><%search%><%endif%>">
<input type=hidden name="status" value="<%if status%><%escape_html status%><%endif%>">
<input type=hidden name="main_screen">
<input type=hidden name="opt_gz">
<input type=hidden name="chmode">
<input type=hidden name="retime">
<!--Search options-->
<input type=hidden name="c_regex">
<input type=hidden name="c_case">
<input type=hidden name="c_word">
<input type=hidden name="c_content">
<input type=hidden name="c_bak">
<input type=hidden name="scope">
<input type=hidden name="txt_with">
<input type=hidden name=do value='fileman'>
<input type=hidden name="print_all" value=''>
<input type=hidden name=have_gzip value='<%have_gzip%>'>

<!--informations-->
<input type=hidden name="num_objects" value="<%if num_objects%><%num_objects%><%endif%>">
<input type=hidden name="total_space" value="<%if total_space%><%total_space%><%endif%>">

<!--multi users-->
<input type=hidden name='session_id' value="<%if session_id%><%session_id%><%endif%>">
<input type=hidden name='root_selected' value="<%if root_selected%><%root_selected%><%endif%>">
<%if re_scheme%>
<input name="re_scheme" type=hidden value="<%re_scheme%>">
<%endif%>
</form>
<%if allowed_space and usage > 0%>
  <table cellpadding=0 cellspacing=0 width="250" border=0 >
    <tr>
      <td><%font%><small>You are using <b><%usage%>%</b> of your <b><%allowed_space%></b> limit.</small></font></td>
    </tr>
    <%if usage > 0 and usage < 100%>
    <tr>
      <td align=right>
        <table cellpadding=1 cellspacing=0 width="100%" border=0 bgcolor=black>
          <tr><td>
            <table cellpadding=0 cellspacing=0 border=0 width="100%">
              <tr>
                <td bgcolor="<%if usage >=80%>red<%else%>#ffe349<%endif%>" width="<%usage%>%" style="border:0"><img src="<%html_url%>/icons/1pixel.gif" width="1" height="10"></td>
                <td bgcolor="white" height=5 style="border:0"><img src="<%html_url%>/icons/1pixel.gif" width="1" height="10"></td>
              </tr>
            </table>
          </td></tr>
        </table>
      </td>
    </tr>
    <%endif%>
  </table>
<%endif%>
<script>
function show_msg(space_selected, objects_selected) {
    if (top.bottomfrm.document.getElementById('d_msg')) {
        top.bottomfrm.document.getElementById('d_msg').innerHTML = "<font size=1><b>"+ space_selected +"</b> of <b>"+top.print_filesize(<%total_space%>)+"</b> in <b>"+ objects_selected +"</b> of <b><%num_objects%></b> files selected&nbsp;</b></font>";
    }
}

function refresh() {
    if (typeof(window.top.mainfrm) == 'undefined') return;
    var main_form = window.top.mainfrm.document.frm_main;

    if (!top.isMainForm(false)) return;
    if (main_form.re_scheme.value != "") {
        main_form.re_scheme.value = "";
        window.top.location = window.location.protocol + '//' + window.location.host + window.location.pathname + '?<%if url_opts%><%url_opts%><%endif%>';
    }
}

/* Display protect form */
<%if show_passwd%>
  var html = "<form name=frm_footer action='<%http_ref%>' method=post target='mainfrm' style='margin:0px'>\n" +
    '<input type="hidden" name="do" value="fileman">\n' +
    '<input type="hidden" name="work_path" value="<%work_path%>">\n' +    
    '<input type="hidden" name="cmd_do" value="cmd_passwd">\n' +
    '<%ifnot user_sessions%><input type="hidden" name="session_id" value="<%if session_id%><%session_id%><%endif%>"><%endif%>\n' +
    '<%if root_selected%><input type="hidden" name="root_selected" value="<%root_selected%>"><%endif%>\n' +
    '<table border="0" cellpadding="2" cellspacing="0">\n';
  <%ifnot delete_list%>
    html += "<tr><td><%font%>Status:</font></td><td height=25><%font%><span id='d_status'>\n" +
      "<%if pass_path%>Password directory is <b><%pass_path%></b><%else%>Protect <b><span id='span_path'><%if work_path%>/<%work_path%><%else%>Root<%endif%></span></b> directory.<%endif%></span></font></td></tr>";
  <%else%>
    html += "<tr><td><%font%>Users:</font></td><td><%font%><%delete_list%>\n" +
      "<input type=submit name=remove value='Remove'  class='submit'>&nbsp;\n" +
      "<input type=submit name=remove_all value='Remove all'  class='submit'>\n" +
      "<%if pass_path%>Password directory is <b><%pass_path%></b><%else%>Protect <b><span if='span_path'><%if work_path%>/<%work_path%><%else%>Root<%endif%></span></b> directory.<%endif%></font></td></tr>\n";
  <%endif%>
  html += "<tr><td width='30'><nobr><%font%>Username:</td><td><input type=text name=p_username size='15'  class='object'></font>\n" +
    "&nbsp; <%font%>Password:</font> <input type=password name=p_password size='15'  class='object'>\n" +
    " <input type=submit name=add value='Add User'  class='submit'></td></tr>\n" +
    "</table></form>";
  top.js_cmd_protect(html);
  <%if msg%>alert("<%msg%>")<%endif%>
<%endif%>

function reloadPath() {
/* reload the current path i status */
  var span_path    = window.top.bottomfrm.document.getElementById('span_path');
  var current_path = window.top.topfrm.document.getElementById('current_path');
  if (span_path)
    span_path.innerHTML = "<%if work_path%>/<%work_path%><%else%>Root<%endif%>";
  if (current_path)
    current_path.innerHTML = "<%if string%><%string%><%endif%>";

  if (typeof(window.top.topfrm.document.frm_top) != 'undefined') {
    window.top.topfrm.document.frm_top.work_path.value = "<%work_path%>";
    window.top.topfrm.document.frm_top.txt_input.value = '';
  }
}

show_msg(0,0)
reloadPath();

<%if re_scheme%>
setInterval("refresh()", 100);
<%endif%>
</script>
</body>
</html>
