<!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 name="robots" content="noindex,nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link  href="img/style.css" rel="stylesheet" type="text/css" />
<title>影片管理</title>
<script src="js/common.js" type="text/javascript"></script>
<script src="js/main.js" type="text/javascript"></script>
</head>
<body>
<!--当前导航-->
<script type="text/JavaScript">if(parent.$('admincpnav')) parent.$('admincpnav').innerHTML='后台首页&nbsp;&raquo;&nbsp;广告&nbsp;&raquo;&nbsp;广告管理 ';</script>
<div class="container" id="cpcontainer">
<?php
if($action=="viewads"){
?>
<form method="post" >
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tb_style">
<tr class="thead"><th colspan="2">预览广告</th></tr>
<tr><td class="td_border" style="text-align:center">
<table  style="border:#BBDDFF solid 2px;"><tr><td>
<?php
	$row = $dsql->GetOne("Select * From `sea_myad` where aid='$id'");
	echo ("<script>");
	echo str_replace("+sitePath+","+'".$cfg_cmspath."'+",$row['adsbody']);
	echo ("</script>");
?>
</td></tr></table>
</td></tr>
<tr><td class="td_border"><input type="button" value="返   回"  class="rb1" onClick="javascript:history.go(-1)" /></td></tr></table>
</form>
<?php
}else{
$numPerPage=30;
$page = isset($page) ? intval($page) : 1;
if($page==0) $page=1;
$csqlStr="select count(*) as dd from `sea_myad`";
$row = $dsql->GetOne($csqlStr);
if(is_array($row)){
$TotalResult = $row['dd'];
}else{
$TotalResult = 0;
}
$TotalPage = ceil($TotalResult/$numPerPage);
if ($page>$TotalPage) $page=$TotalPage;
$limitstart = ($page-1) * $numPerPage;
if($limitstart<0) $limitstart=0;
$sqlStr="select aid,adname,adenname,timeset,intro,adsbody from `sea_myad` order by aid desc limit $limitstart,$numPerPage";
?>	
<form action="?action=delall" method="post">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tb_style">
    <tr class="thead"><td colspan="15" class="td_title">广告管理</td></tr>
    <TR>
      <TD width="10%" align="left" height="30" class="td_btop3">ID</TD>
      <TD width="30%" align="left" height="30" class="td_btop3">名称</TD>
       <TD width="15%" align="left" height="30" class="td_btop3">标识(文件名)</TD>
       <TD width="10%" align="center" height="30" class="td_btop3">描述</TD>
       <TD width="8%" align="center" height="30" class="td_btop3">文件存在?</TD>
       <TD width="7%" align="center" height="30" class="td_btop3">添加时间</TD>
      <TD width="20%" align="center" height="30" class="td_btop3">操作</TD>
    </TR>
<?php
$dsql->SetQuery($sqlStr);
$dsql->Execute('mytag_list');
while($row=$dsql->GetObject('mytag_list'))
{
$aid=$row->aid;
?>
	<tr id="adtr<?php echo $aid;?>" name="adtr" <?php if($id==$aid) echo " class=\"editlast\"";?> bgcolor="#FFF" style="background-color:#FFF" onmouseover="style.backgroundColor='#E6F2FB'" onmouseout="style.backgroundColor='#FFF'" >
      <td height="30" class="td_border" align="left"><input type="checkbox" value="<?php echo $aid;?>" name="e_id[]" class="checkbox" /><?php echo $aid;?></TD>
      <td height="30" class="td_border" align="left"><?php echo $row->adname;?></TD>
      <td height="30" class="td_border" align="left"><?php echo $row->adenname;?></TD>
      <td height="30" class="td_border" align="center"><?php echo $row->intro;?>&nbsp;</TD>
      <td height="30" class="td_border" align="center"><?php isAdsFileExist($row->adenname,$aid);?></TD>
      <td height="30" class="td_border" align="center"><?php echo isCurrentDay($row->timeset);?></TD>
      <td height="30" class="td_border" align="center"><a href="?action=viewads&id=<?php echo $aid;?>">预览</a>&nbsp;&nbsp;<a href="javascript:" onClick="viewCurrentAdTr('<?php echo $aid;?>');openAdWin('callad','../js/{seacms:adfolder}/<?php echo $row->adenname;?>.js','/{seacms:sitepath}')">调用广告</a>&nbsp;&nbsp;<a href="?action=edit&page=<?php echo $page;?>&id=<?php echo $aid;?>">编辑</a>&nbsp;&nbsp;<a  href="?action=del&id=<?php echo $aid;?>" onclick="if(confirm('确定要删除吗')){return true;}else{return false;}">删除</a></TD>
    </tr>
<?php
}
?>
    <tr>
    <td colspan="7" height="30" class="td_border"><div class="cuspages"><div class="pages">全选<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(this.checked,'input','e_id[]')" />反选<input type="checkbox" name="chkothers" id="chkothers" class="checkbox" onclick="checkOthers('input','e_id[]')" /><input type="submit" value="批量删除" onclick="if(confirm('确定要批量删除吗')){return true}else{return false}" class="rb1"  />&nbsp;&nbsp; 页次<?php echo $page;?>/<?php echo $TotalPage;?> 每页<?php echo $numPerPage;?> 总收录数据<?php echo $TotalResult;?>条 <a href="?page=1">首页</a> <a href="?page=1">首页</a> <a href="?page=<?php echo ($page-1);?>">上一页</a> <span><?php echo makePageNumber($page, 10, $TotalPage, "adslist");?></span><a href="?page=<?php echo ($page+1);?>">下一页</a> <a href="?page=<?php echo $TotalPage;?>">尾页</a></div></div></td></tr>
</TABLE>
</form> 
<?php
}
?>
	</div>

<?php 
if($action!="viewads"){
?>
<div id="callad" style="top:100px; display:none;" class="popdiv">
	<div class="poptitie"><img src="img/btn_close.gif" alt="关闭" onClick="$('callad').style.display='none'" />广告调用路径 </div>
    <div class="popbody"><div>
        <table>
        <tr>
          <td width="60" valign="top">调用代码</td>
          <td class="td_border"><textarea cols="71" rows="4" id="adpath" onfocus="this.select();" ></textarea></td>
        </tr>
       <tr><td align="center" colspan="2"><font color="red">请手动复制以上文本框中的广告调用代码，粘贴到模板文件相应位置即可</font></td></tr>
        </table>
    </div></div>
</div>
<script type="text/javascript" src="js/drag.js"></script>
<?php
}
viewFoot();
?>