<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>文件管理器</title>
<script language="javascript" src="<?=BASEURL?>public/share/jquery.js"></script>
<script language="javascript" src="<?=BASEURL?>public/admin/js/common.js"></script>
<link href="<?=BASEURL?>public/admin/css/main.css" rel="stylesheet" type="text/css" />
<script language="javascript">
//使用附件
function useFile(){
	var n			=	window.opener.$("#paths").find('tr').length-1
	if($("input:checked").length>0){
		$("input:checked").each(function(){
			var	path	=	$(this).attr('value');
			if(window.opener.$("#paths").html().indexOf(path)<=0&&path!='all'){
				window.opener.selectuse(path);
				n++;
			}
		});
		window.close();
	}
	else{
		alert('请选择需要操作的文件');
	}
	return false;
}
//选择使用
function selectuse(path){
	window.opener.selectuse(path);
}
</script>
</head>
<body>
<form action="<?=@$formAction?>" id="file_manager" method="post" name="adminform">
<table class="adminlist" cellpadding="0" cellspacing="0" id="filebrowse">
  <thead>
    <tr>
      <th width="5%"><input type="checkbox" id="toggle" value="all"></th>
      <th width="5%">序号</th>
      <th width="25%">文件名称</th>
      <th width="15%">路径</th>
      <th width="5%">类型</th>
      <th width="15%">上传时间</th>
      <th width="5%">大小</th>
      <th width="15%">操作</th>
    </tr>
  </thead>
  <tbody>
  <tr>
    <td class="list" id="filelist" valign="top" style="background:#FFFFFF;padding:0px;" colspan="9">
    <div id="list">
          <input type="hidden" name="boxchecked" value="0">
          <input type="hidden" name="current-path" value="<?=@$targPath?>">
          <table class="filelist" cellpadding="0" cellspacing="0" width="100%">
            <tbody>
              <tr>
                <td width="5%">&nbsp;</td>
                <td colspan="8"><?=html::anchor(BASEURI."file_manager/index/".base64_encode(dirname($targPath)),"上级目录");?></td>
              </tr>
              <?php $a=1;?>
              <?php foreach($paths as $tmp){?>
              <?php 	if($tmp['type']=="dir"){?>
              <tr class="row0">
                <td width="5%">&nbsp;</td>
                <td width="5%"><?=$a++?></td>
                <td width="25%"><?=html::anchor(BASEURI."file_manager/index/".base64_encode($tmp['path']),$tmp['file_name']);?></td>
                <td width="15%"><?=dirname($tmp['path'])?></td>
                <td width="5%">目录</td>
                <td width="15%">&nbsp;</td>
                <td width="5%">&nbsp;</td>
                <td width="15%"><?=html::anchor(BASEURI.'','重命名')?>
                  <?=html::anchor(BASEURI.'file_manager/delete/'.base64_encode($tmp['path'])."/".base64_encode($targPath),'删除',array("onclick"=>"return confirm('是否要删除目录')"))?>
                </td>
              </tr>
              <?php }?>
              <?php }?>
              <?php foreach($paths as $tmp){if(!@$a){$a=1;}else{$a++;}?>
              <?php 	if($tmp['type']=="file"){?>
              <tr>
                <td width="5%"><input type="checkbox" name="select[]" id="cb<?=$a?>" value="<?=$tmp['path']?>" class="filepath"></td>
                <td width="5%"><?=$a++?></td>
                <td width="25%"><?=$tmp['file_name']?></td>
                <td width="15%"><?=dirname($tmp['path'])?></td>
                <td width="5%"><?=$tmp['ext']?></td>
                <td width="15%"><?=$tmp['filemtime']?></td>
                <td style="text-align:right;" width="10%"><?=$tmp['file_size']?>
                  KB</td>
                <td width="15%">
				  <?=html::anchor(BASEURI.'','编辑')?>
                  <?=html::anchor(BASEURI.'file_manager/delete/'.base64_encode($tmp['path'])."/".base64_encode($targPath),'删除',array("onclick"=>"return confirm('是否要删除文件')"))?>
                  <?php if($tmp['is_image']){?>&nbsp;&nbsp;[<a thumb="<?=BASEURL.path::getThumb($tmp['path'])?>"  href="<?=BASEURL.$tmp['path']?>" target="_blank" class="preview">图片</a>]<?php }?>
                </td>
              </tr>
              <?php }?>
              <?php }?>
            </tbody>
          </table>
      </div></td>
  </tr>
  </tbody>
  <tfoot>
    <tr>
      <td colspan="2">显示模式</td>
      <td colspan="2">
      	<span class="file_show_list" title="列表">&nbsp;</span>
      	<span class="file_show_thumb" title="缩略图">&nbsp;</span>
      	<span class="file_show_thumblist" title="缩略图列表">&nbsp;</span>
      </td>
      <td colspan="5" style="text-align:right">
        <?=html::anchor('#','批量删除',array("onclick"=>"select_control('".BASEURI."file_manager/delete','你是否要删除已选中的文件')"))?>
        &nbsp;&nbsp;&nbsp;&nbsp;
      </td>
    </tr>
  </tfoot>
</table>
</form>
<div class="file_comment">
1,勾选复选框，点击使用“使用附件”，即可加入到附件列表
</div>
</body>
</html>
