<?php
echo ahead("上传文件管理");
?>
<link rel="stylesheet" href="css/xstyle.css" type="text/css" media="screen" />
<style type="text/css">
<!--
.style11 {color: #0066CC;
	font-weight: bold;
}
#labcontent .altCheckboxOn {
	display: inline;
	padding: 20px 2px; /* NS 6 problem */
	padding-left: 70px;
	color: #000;
	line-height: 60px;
	font-family: "Courier New", Courier, mono;
	font-size: 1.2em;
	font-weight: bold;
	background-image: url(alt_checkbox_on.gif);
	background-repeat: no-repeat;
	background-position: 0% 50%;
	border: 0px;
}
-->
</style>
<script type="text/javascript" src="inc/js.js"></script>
</head>
<body onload="initLightbox()">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
  <tr>
    <th height="25">上传文件管理</th>
  </tr>
  <tr>
    <td height=25 class="pl20"><b>管理选项：</b><a href="files_imgfiles.php">管理首页</a> |  当前目录：<?php echo $files_path;?></td>
  </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableBorder">
<form name="form" action="files_imgfiles.php" method="post">
<tr align="center"> 
    <td height="221"><div style="width:100%; height:auto;min-height:360px; background-color:#FFFFFF; ">
<?php
foreach($dirs as $k=>$v){
?><ul style="float:left; color:#000000; width:50px; margin:6px; padding:4px; text-align:center;" ondblclick="window.location='?do=next&dir=<?php echo $dir.'/'.$v['dirname'];?>';" title="双击打开文件夹"><li style="float:left; width:50px;"><img src='images/TheSuperFolder.gif' border="0" align='absmiddle' /></li>
<li style="float:left; width:50px; height:20px; overflow:hidden"><a href="?do=next&dir=<?php echo $dir.'/'.$v['dirname'];?>" title="<?php echo $v['dirname'];?>"><?php echo $v['dirname'];?></a></li>
</ul>
<?php
}
foreach($imgfiles as $k=>$v){
?><ul style="float:left; color:#000000; width:50px; margin:6px; padding:4px; text-align:center;">
<li style="float:left; width:50px;"><a href="<?php echo $files_path.$v['filename'];?>" rel="lightbox[plants]" title="<?php echo $v['filename'];?>"><img src='images/<?php echo $v['fileext'];?>.gif' border="0" align='absmiddle' /></a></li>
<li style="float:left; width:50px; height:20px; overflow:hidden"><a href="<?php echo $files_path.$v['filename'];?>" rel="lightbox[plants]" title="<?php echo $v['filename'];?>"><?php echo $v['filename'];?></a></li>
<li style="float:left; width:50px;"><input name="filesname" type="checkbox" class="checkbox" value="<?php echo $v['filename'];?>"></li>
</ul>
<?php }?>
</div>
<div style="width:100%; height:20px; background-color:#FFFFFF; ">
<ul style="float:right; color:#000000; width:98%; margin:0; padding:4px; text-align:center;"><li style="float:right;"><input type="hidden" name="dir" value="<?php echo $dir;?>" /><input type="hidden" name="filesnames" value="" /><input name="checkSelect" type="checkbox" class="checkbox" onClick="javascript: checkAll(this)" value="checkbox">
  全选  
      <input name="button" type="button" class="inputs" onclick="confirmX(1);" value="删   除" />
</li></ul>
</div></td>
  </tr>
 </form>
</table>
<?php
echo acopy();
?>
<script language="javascript">
function confirmX(num)
{
	var ids = document.getElementsByName("filesname");
	var check=false;
	var allSel="";
	if (ids != null) {
		
		for (i=0; i<ids.length; i++) 
		{
			var obj = ids[i];
			if (obj.checked==true)
			{
				if(allSel==""){
				allSel=obj.value;
				}else{
				allSel=allSel+","+obj.value;
				}
				form.filesnames.value = allSel;
				check=true;
				
			}
		}
		if(check==false){alert("请选择操作对象！");return false;}
	}
	if(num==1)
	{
		if(confirm("警告:此操作将会删除所选的文件、文件夹，以及文件夹下的所有文件!\n是否继续操作下去?"))	
		{
			document.form.action="files_imgfiles.php?do=del";
			document.form.submit();		
		}
	}
	return false;	
}
function checkAll(box1) {
    var ids = document.getElementsByName("filesname");
	if (ids != null) {
		for (i=0; i<ids.length; i++) {
			var obj = ids[i];
			obj.checked = box1.checked;
		}
	}
}
</script>