<?php
/**
 * @package iCMS
 * @copyright 2007-2010, iDreamSoft
 * @license http://www.idreamsoft.cn iDreamSoft
 * @author coolmoo <idreamsoft@qq.com>
 */
!defined('iPATH') && exit('What are you doing?'); 
$do!='dialog' && iCMS_admincp_head();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>iCMS文件管理</title>
<link rel="stylesheet" href="admin/images/style.css?v=3.1.3" type="text/css" media="all" />
<script type="text/javascript" src="javascript/jquery.js"></script>
<script type="text/javascript" src="admin/js/jquery.function.js"></script>
<script type="text/javascript" src="admin/js/admin.js"></script>
<style type="text/css">
body, td, th {
	font-size: 12px;
	color: #333;
}
body {
	background-color: #FFF;
	margin-left: 0px;
	margin-top: 0px;
}
#explorer {
	border-collapse:collapse;
	word-break:break-all;
	border:solid 1px #ECE9D8;
	border-bottom:solid 1px #959385;
	background-color:#ECE9D8;
}
#explorer #m {
	background-color:#ECE9D8;
	width:5px;
}
#explorer #tdfile {
	background-color: #FFF;
	width:600px;
	border-left:solid 1px #7F9DB9;
	border-top:solid 1px #7F9DB9;
}
#explorer #tddir {
	background-color: #FFF;
	width:220px;
	height:350px;
	border-right:solid 1px #7F9DB9;
	border-top:solid 1px #ACA899;
}
.dirlist {
	width:220px;
	height:350px;
	overflow-x:auto;
	overflow-y:scroll;
	clear: both;
	list-style:none;
	margin: 0px;
	display: block;
	padding: 0px 0px 0px 4px;
}
.dirlist li {
	clear: both;
	height: 16px;
	margin-top: 1px;
	text-align: left;
}
.dirlist li span {
	margin-left:36px;
	display: block;
}
.dirlist ul {
	clear: both;
	list-style:none;
	margin: 0px;
	display: block;
	padding: 0px 0px 0px 16px;
}
/*缩略图*/
#filelist {
	width:100%;
	height:375px;
	overflow-y:scroll;
	clear: both;
	list-style:none;
	margin: 0px 0px;
	padding: 0px;
	display: block;
	margin-top: 4px;
}
#filelist li {
	float:left;
	width:96px;
	height:96px;
	border:solid 1px #ECE9D8;
	margin-left:8px;
}
/*缩略图 end*/
.filelist {
	width:100%;
	height:350px;
	clear: both;
	list-style:none;
	margin: 0px 0px 0px 1px;
	padding: 0px;
	display: block;
	overflow-y: scroll;
	overflow-x: visible;
}
.filelist li {
	float:left;
	padding-top: 3px;
	height: 16px;
	padding-left: 8px;
	overflow:hidden;
}
.fileheader {
	background: url(admin/images/header-bg.gif) repeat-x;
	height: 22px;
	overflow: visible;
}
.fileheader li {
	background: url(admin/images/header-li-left.gif) no-repeat right top;
}
#tdfile .name {
	width:160px;
	text-align: left;
}
#tdfile .bg {
	background-color: #F7F7F7;
}
#tdfile .size {
	width: 72px;
	text-align: right;
	padding-right: 6px;
}
#tdfile .author {
	width: 72px;
	text-align: left;
}
#tdfile .date {
	text-align: left;
	width: 120px;
}
#tdfile .manage {
	text-align: left;
	width: auto;
	<?php if($do=='dialog'){?>display:none;<?php }?>	
}
.opendir {
	background: url(admin/images/file/opendir.gif) no-repeat left top;
	height: 14px;
}
span.on {
	border:dotted 1px #000;
	background-color:#316AC5;
	color:#FFF;
}
.closedir {
	background: url(admin/images/file/closedir.gif) no-repeat left top;
	height: 14px;
}
.closedir span {
}
</style>
<script type="text/javascript">
<?php if($do!='dialog'){?>
admincpnav('首页&nbsp;&raquo;&nbsp;文件管理&nbsp;&raquo;&nbsp;<select name="filemethod" onchange="parent.main.location.href=\'<?=__SELF__?>?do=file&operation=manage&method=\'+this.value"><option value="database"<?php if($method=="database") echo ' selected="selected"'?>>数据库模式</option><option value="file"<?php if($method=="file") echo ' selected="selected"'?>>文件浏览器</option></select>');
<?php }?>
var iFM = iFM||{};
iFM.dir = function(j,t){
	var a=$(j);
	if(t=='p') a=$(j).parent();
	var d=a.attr("folder"),c=a.attr("class");
	$(".dirlist span").removeClass("on");
	a.find("span").addClass("on");
	$('input[name=savedir]').val(d+'/');
	var sid="#"+d.replace(/\//g,'-');
	if(t=='p'||(t!='p'&& c=='closedir')){
		a.attr("class","opendir");
		$("#fList").html('<img src="admin/images/ajax_loader.gif" /> 加载中...');
		$.getJSON("<?=__SELF__?>?do=file&opt=<?=$operation?>&click=<?=$click?>&from=<?=$from?>&in=<?=$in?>&operation=filejosn&jsoncallback=?&dir="+d,
			function(i){
				$(sid).remove();
				a.after(i.dir);
				$("#fList").html(i.file);
				<?php if($operation!='template'){?>$(".icon").snap("href",180,200,10,10);<?php }?>
		});
	}
	if(t!='p'&& c=='opendir'){
		a.attr("class","closedir");
		$(sid).remove();
	}
}
$(function(){
window.focus();
<?php if($operation!='template'){?>
	$(".icon").snap("href",180,200,10,10);
<?php }?>
});
</script>
</head>
<body>
<table border="0" align="left" cellpadding="0" cellspacing="0" id="explorer">
  <tr>
    <td height="22" colspan="2" align="left" style="padding-left:4px;">文件夹 <?=$Folder?></td>
    <td rowspan="2" valign="top" id="tdfile"><ul class="filelist fileheader">
        <li class="name">名称</li>
        <li class="size">大小</li>
        <li class="author">上传者</li>
        <li class="date">修改日期</li>
      </ul>
      <ul class="filelist" id="fList">
        <?php 
	$_FL=$L['FileList'];
	$_fCount=count($_FL);
	for($i=0;$i<$_fCount;$i++){
	$href=$operation=='template'?$iCMS->config['url'].'/templates/'.$_FL[$i]['path']:uploadpath($_FL[$i]['path']);
	$filepath=$from=='editor'?$href:$_FL[$i]['path'];
		?>
        <li class="name bg" title="<?=$_FL[$i]['name']?>"><a href="<?=$href?>" class="icon" target="_blank" title="点击查看"><?=$_FL[$i]['icon']?></a> <?php if($click=='file'){?><a href="javascript:void(0)" onclick="insert('<?=$filepath?>','<?=$in?>');"><?=$_FL[$i]['name']?></a><?php }else{?><?=$_FL[$i]['name']?><?php }?></li>
        <li class="size"><?=$_FL[$i]['size']?></li>
        <li class="author">上传者</li>
        <li class="date"><?=$_FL[$i]['time']?></li>
        <?php } ?>
      </ul></td>
  </tr>
  <tr>
    <td id="tddir"><ul class="dirlist">
        <?php
    		$_dir=$L['folder'];
			$_count=count($_dir);
    		for($i=0;$i<$_count;$i++){?>
        <li class="closedir" folder="<?=$_dir[$i]['path']?>" onclick="iFM.dir(this);"><span onclick="iFM.dir(this,'p');"><?=$_dir[$i]['dir']?></span></li>
        <?php } ?>
      </ul></td>
    <td id ='m'></td>
  </tr>
  <tr>
    <td colspan="3" style="padding:1px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td align="left"><form action="/test/icms/admincp.php?do=dialog&operation=post" method="post" enctype="multipart/form-data" name="uploadfile" target="post" id="uploadfile">
              <input name="file" type="file" class="uploadbtn" id="pic" />
              <input name="savedir" type="hidden" value="" />
              <input name="action" type="hidden" value="uploadfile" />
              <input type="submit" value="上传" style="border:1px solid #999999;"/>
            </form></td>
          <td align="left"><form action="/test/icms/admincp.php?do=dialog&operation=post" method="post" name="createdir" target="post" id="createdir">
              <input type='text' name='dirname' value='创建新目录' style='width:180px;border:1px solid #999999;' onclick="if(this.value=='创建新目录')this.value=''" >
              <input name="savedir" type="hidden" value="" />
              <input name="action" type="hidden" value="createdir" />
              <input type="submit" value="创建" style="border:1px solid #999999;"/>
          </form></td>
        </tr>
      </table></td>
  </tr>
</table>
<iframe width="100%" height="100" style="display:none" id="post" name="post"></iframe>
</body>
</html>