<!--#include file="uploads_Fun.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="<%=sitepath%>css/bootstrap.min.css" rel="stylesheet">
<link href="<%=sitepath%>css/font-awesome.min.css" rel="stylesheet">
<link href="<%=sitepath%>css/animate.min.css" rel="stylesheet">
<link href="<%=sitepath%>css/style.min.css" rel="stylesheet">
<link href="<%=sitepath%>plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link href="<%=sitepath&adminPath%>css/adminstyle.css" rel="stylesheet">
<script src="<%=sitepath%>js/jquery.min.js"></script>
<!--[if lte IE 9]>
<script src="<%=sitepath%>js/respond.min.js"></script>
<script src="<%=sitepath%>js/html5.js"></script>
<![endif]-->
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
  <div class="row">
    <div class="col-sm-3">

<div class="panel">
								<div class="panel-heading">
									<h3 class="panel-title">文件目录</h3>
									<div class="panel-aj">
										<button type="button" class="btn-toggle-collapse"><i class="fa fa-chevron-down"></i></button>
										<button type="button" class="btn-remove"><i class="fa fa-times"></i></button>
									</div>
								</div>
<div class="panel-body">
<div class="panel-body no-padding">		
<div class="ibox float-e-margins">
        <div class="ibox-content">
          <div class="file-manager">
            <h5><a href="?<%=sitePath&uploadpath%>"><%=sitePath&uploadpath%></a></h5>
            <ul class="folder-list" style="padding: 0">
              <%call folder_list(pctempath,0)%>
            </ul>
          </div>
        </div>        
      </div>
</div>
</div>
    </div>

	</div>
	
    <div class="col-sm-9">

<div class="panel">
								<div class="panel-heading">
									<h3 class="panel-title">当前文件夹</h3>
									<div class="panel-aj">
										<button type="button" class="btn-toggle-collapse"><i class="fa fa-chevron-down"></i></button>
										<button type="button" class="btn-remove"><i class="fa fa-times"></i></button>
									</div>
								</div>
<div class="panel-body">
<div class="panel-body no-padding">		
<div class="ibox float-e-margins">
        <div class="ibox-content">
          <h5>当前文件夹：<%=parentPath%></h5>       
    <button class="btn  btn-primary" type="button" onClick="location.href='template_add.asp?parentPath=<%=parentPath%>'"><i class="fa fa-plus"></i>　当前目录添加</button>
    <button class="btn btn-danger" type="button" onClick="clearall()"><i class="fa fa-trash">　</i>清理冗余文件</button>
    <button id="remove" class="btn btn-danger" type="button" disabled><i class="fa fa-trash">　</i>删除</button>
	<button  class="btn"  id="divAddFiles"></button>	
         <button onClick="location.reload()" class="btn btn-primary1" type="button"><i class="fa fa-refresh"></i>刷新</button>
         <div id="moswf"></div>
            <table id="table"
           data-toggle="table"
           data-pagination="true"  
           data-id-field="state"       
           data-id-table="advancedTable"
           data-page-size="20"
           data-page-list="[20,100,200]">
            <thead>
              <tr> 
              	<th class="tableid" data-field="state" data-checkbox="true"></th>
                <th class="tableturl" data-field="name" data-sortable="true">文件名</th>  
                <th class="tabletype"  data-sortable="true">查看</th>
                <th class="tabletype" data-sortable="true">大小</th>
                <th class="tabletype" data-sortable="true">时间</th>
                <th class="tabletype" >冗余</th>
                <th  class="tablename" data-field="edit">操作</th>
              </tr>
            </thead>
              <%	
	    		dim objFolder,objSubFolders,objSubFolder
				if isnul(parentPath) then
				   echo "<tr><td colspan='6'>未选择目录</td></tr>"	
				else  
				  call file_List(parentPath)
				  set objFolder=fso.GetFolder(setfolder(parentPath))
				  set objSubFolders=objFolder.Subfolders
				  for each objSubFolder in objSubFolders
					With objSubFolder
					  call file_List(parentPath&.name&"/")
					 End With
					next 			  
				  if not instr(fileListArray(0),",")>0 then
					  echo "<tr bgcolor=""#FFFFFF"" align=""center""><td></td><td>空文件夹,<a href=""javascript:history.go(-1)"" class=""txt_C1"">返回</a></td></tr>"
				  end if	
				end if
				%>           
          </table>
        </div>
      </div>
</div>
</div>
      
    </div>

    </div>
</div>
</div>
<script src="<%=sitepath%>js/klorofil-common.js"></script>
<script src="<%=sitepath%>js/bootstrap.min.js"></script> 
<script src="<%=sitepath%>plugins/bootstrap-table/bootstrap-table.min.js"></script> 
<script src="<%=sitepath%>plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script> 
<script src="<%=sitepath%>plugins/layer/layer.min.js"></script> 
<script src="<%=sitepath%>plugins/fancybox/jquery.fancybox.js"></script>
<link href="<%=sitepath%>plugins/fancybox/jquery.fancybox.css " rel="stylesheet">
<link href="<%=sitepath&adminpath%>inc/swfupload/js/swfupload.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<%=sitepath&adminpath%>inc/swfupload/js/swfupload.min.js"></script>
<script type="text/javascript" src="<%=sitepath&adminpath%>inc/swfupload/js/swfupload.handler.min.js"></script>
<script type="text/javascript" src="<%=sitepath&adminpath%>inc/swfupload/js/swfupload.callback.min.js"></script>
<script type="text/javascript">
var path="<%=parentPath%>";
var Setting={
	debug:false,upload_url: "<%=sitepath&adminpath%>inc/swfupload/upload.asp?path=" + encodeURIComponent(path),file_post_name : "filedata",button_width: 71,button_height: 28,button_image_url:"/images/upload.png",charset: "utf-8",auto:true,button_append : "divAddFiles",
	file_types :'*.html;*.jpg;*.png;*.gif;*.js;*.css;*.xml',
	file_types_description : "选择文件",
	file_size_limit : "5mb",
	file_upload_limit :50
};
function DEBUG(msg){alert(msg);}
//所有上传文件成功后的回调，全局变量Files（文件信息数组）包含所有上传成功的文件信息
function FinishedCallBack(result){	
if(typeof window.parent.CallBack=="function")window.parent.CallBack.apply(Files,[result]);location.reload();}
window.onload=init;
</script>
<script src="<%=sitepath&adminPath%>js/content.min.js"></script> 
<script>
 var $table = $('#table')
 var $remove = $('#remove')
 $(function () {
        $table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {
            $remove.prop('disabled', !$table.bootstrapTable('getSelections').length);
        });
		$remove.click(function () {
		  parent.layer.confirm('确定删除吗？', function(){
           $.map($table.bootstrapTable('getSelections'), function (row) {
			   $.post("uploads_Fun.asp?act=del&filepath="+row.name)
            });	
			 parent.layer.msg("删除成功,请稍后刷新",{icon: 1});
			//location.reload()			
       	  });			 
		});		
});
$(function(){$(".fancybox").fancybox()});
function rename(path,name){
	parent.layer.prompt({title: '输入新文件名',value:name}, function(newname){
   	// alert(path+"\n "+name+"\n "+newname);
   $.post("uploads_Fun.asp?act=rename&filepath="+path+"&filename="+name+"&newname="+newname, function(data) {parent.layer.msg(data,{icon: 1});location.reload()})
	});	
}
function creatfolder(path){
	parent.layer.prompt({title: '输入新文件夹名'}, function(newname){
   	// alert(path+"\n"+newname);  
  $.post("uploads_Fun.asp?act=Crefolder&parentPath="+path+"&newname="+newname, function(data) {parent.layer.msg(data,{icon: 1});location.reload()})
	});	
}
function delfolder(path){
	parent.layer.confirm('确定删除此文件夹吗？', function(newname){
   	// alert(path+"\n"+newname);  
  $.post("uploads_Fun.asp?act=delfolder&parentPath="+path+"&newname="+newname, function(data) {parent.layer.msg(data,{icon: 1});location.reload()})
	});	
}
function clearall(){
	parent.layer.confirm('您确定要清理全部冗余文件？</br>1.仅能匹配数据库默认数据字段的图片；</br>2.模板和其他位置使用的图片不能识别；<br/>3.不能识别自定义字段使用的图片；<br/>4.冗余文件将移动到upload/backups/;</br>5.发现问题可手动恢复，或全部删除。', function(){
	parent.layer.closeAll();
 	location.href="cms_Content/uploads/uploads_Fun.asp?act=clearall";
	});	
}
function delfile(path){parent.layer.confirm('确定删除吗？', function(){$.post("uploads_Fun.asp?act=del&filepath="+path,function(data){parent.layer.msg(data,{icon: 1});location.reload()});});}
 </script>
</BODY>
</HTML>