<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<title>附件数据管理</title>
<link href='base.css' rel='stylesheet' type='text/css'>
<style>
.napisdiv {left:10;top:0;width:150;height:100;position:absolute;z-index:3}
</style>
<script>
function $(eid){ return document.getElementById(eid); }
function ChangeImage(surl){ $('picview').src = surl; }
	//获得选中文件的文件名
function getCheckboxItem(){
	 var allSel="";
	 if(document.form1.aids.value) return document.form1.aids.value;
	 for(i=0;i<document.form1.aids.length;i++)
	 {
		 if(document.form1.aids[i].checked){
			 if(allSel=="")
				 allSel=document.form1.aids[i].value;
			 else
				 allSel=allSel+","+document.form1.aids[i].value;
		 }
	 }
	 return allSel;	
}

function nullLink(){
	return;
}

function ReAddon(resrc)
{
	window.opener.document.<?=$f?>.value=resrc;
	if(window.opener.document.getElementById('<?=$v?>') 
	  && (resrc.indexOf('.jpg')>0 || resrc.indexOf('.gif')>0 || resrc.indexOf('.png')>0)
	){
		window.opener.document.getElementById('<?=$v?>').src = resrc;
	}
	if(document.all) window.opener=true;
  window.close();
}

function AllSel(){
	for(i=0;i<document.form1.aids.length;i++){
		document.form1.aids[i].checked = true;
	}
}

function NoneSel(){
	for(i=0;i<document.form1.aids.length;i++){
		document.form1.aids[i].checked = false;
	}
}

</script>
</head>
<body background='img/allbg.gif' leftmargin='0' topmargin='0'>
<div id="floater" class="napisdiv">
<a href="javascript:;" onClick="ChangeImage('../dialog/img/picviewnone.gif');">
	<img src='../dialog/img/picviewnone.gif' id='picview' name='picview' border='0' alt='单击关闭预览' style='z-index:10000'>
</a>
</div>
<SCRIPT language=JavaScript src="float.js"></SCRIPT>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#98CAEF">
  <tr> 
    <td height="19" colspan="7" background="img/tbg.gif">
    	<table width='96%' cellpadding='0' cellspacing='0'>
    		<tr>
    		<td width='30%'><b>附件数据管理</b></td>
        <td align='right'>
    	  [<a href="#uploadnew"><u>上传新文件</u></a>]
        </td>
      </tr>
     </table>
    </td>
  </tr>
  <tr bgcolor="#F2FAE2" height="24"> 
    <td colspan="7">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
        <form name='forms' action=''>
        <input name='f' type='hidden' value='<?php echo $f; ?>'>
        <tr> 
          <td width="10">&nbsp;</td>
          <td width="70" align="center">关键字：</td>
          <td width="100"><input name="keyword" type="text" id="keyword" style="width:100" value="<?php echo $keyword?>"></td>
          <td width="100" align="center">
		      <select name='mediatype' style='width:80'>
            <option value='0'>文件类型</option>
            <option value='1'<?php if($mediatype==1) echo " selected"?>>图片</option>
            <option value='2'<?php if($mediatype==2) echo " selected"?>>FLASH</option>
            <option value='3'<?php if($mediatype==3) echo " selected"?>>视频/音频</option>
            <option value='4'<?php if($mediatype==4) echo " selected"?>>其它附件</option>
          </select>
          </td>
          <td><input class="np" name="imageField" type="image" src="img/button_search.gif" width="60" height="22" border="0" style="height:22px"></td>
        </tr>
      </form>
      </table>
    </td>
  </tr>
  <tr bgcolor="#F8FBFB" height="24" align="center"> 
    <td width="8%">选择</td>
    <td width="32%">文件标题</td>
    <td width="10%">文件大小</td>
    <td width="18%">上传时间</td>
    <td width="12%">文件类型</td>
    <td width="8%">管理</td>
  </tr>
   <form name='form1'>
  <?php 
$mylist = $dlist->GetDataList();
while($row = $mylist->GetArray('dm'))
{
?>
  <tr align="center" bgcolor="#FFFFFF" height="24" onMouseMove="javascript:this.bgColor='#EFEFEF';" onMouseOut="javascript:this.bgColor='#FFFFFF';"> 
    <td>
    	<input type='checkbox' onClick="ReAddon('<?php echo $row['url']; ?>');" name='aids' id='aids<?php echo $row['aid']?>' value='<?php echo $row['aid']?>' class='np'/>
    </td>
    <td>
    	<a href="javascript:ReAddon('<?php echo $row['url']; ?>');">
      <?php 
      if(eregi("\.(jpg|gif|png)$",$row['url'])){
      	echo "<img src='".$row['url']."' width='100' border='0'><br/>";
      }
      ?>
      <u><?php echo $row['title']?></u>
    	</a>
    </td>
    <td><?php echo GetFileSize($row['filesize'])?></td> 
    <td><?php echo strftime("%y-%m-%d %H:%M",$row['uptime'])?></td>
    <td><?php echo MediaType($row['mediatype'],$row['url'])?></td>
    <td>
    	<a href="javascript:ReAddon('<?php echo $row['url']; ?>');">选择</a> 
    </td>
     </tr>
		<?php 
	}
		?>
  <tr bgcolor="#F8FBFB" height="24"> 
   <td colspan="6">
    &nbsp; <input type="button" name="b4" value="全选" class="nbt" style="width:40" onClick="AllSel();"> 
    &nbsp; <input type="button" name="b5" value="取消" class="nbt" style="width:40" onClick="NoneSel();"> 
   </td>
  </tr>
  <tr bgcolor="#EEFAC9" height="24"> 
    <td colspan="6" align="center">
    	<?php echo $dlist->GetPageList(7);?>
    </td>
  </tr>
</form>
</table>
</td>
</tr>
</table>

<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#98CAEF" style="margin-top:6px;">
  <tr>
    <td bgcolor="#FFFFFF">
     <a name='uploadnew'></a>
    	<table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="24" align="center">
		      <form name="form2" enctype="multipart/form-data" method="post" action="medias_upload.php" style="padding:0px;margin:0px;">
		        标题： 
		        <input type="text" name="title" size="width:80px">
		        文件：
            <input type="file" name="uploadfile" size="width:150px">
            <input type="submit" name="Submit" value="上传">
          </form>
          </td>
        </tr>
        <tr>
          <td height="24" bgcolor="#EBF3D6" style="word-break:break-all;padding:5px">
          	支持的文件类型：
          	<?php echo $cfg_mb_mediatype; ?>
          </td>
        </tr>
      </table></td>
  </tr>
</table>

</body>
</html>