<!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" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link  href="skin/css/style.css" rel="stylesheet" type="text/css" />
<title>广告管理</title>
<script src="skin/js/common.js" type="text/javascript"></script>
<script src="skin/js/main.js" type="text/javascript"></script>
</head>
<body>
<div class="container" id="cpcontainer">
<?php
if($action=="viewads"){
?>

<?php
}else{
$numPerPage=30;
$page = isset($page) ? intval($page) : 1;
if($page==0) $page=1;
$csqlStr="select count(*) as dd from `duomi_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 `duomi_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">广告管理</td></tr>
    <TR>
      <TD width="5%" align="center" height="30" class="td_btop3">ID</TD>
      <TD width="20%" align="center" height="30" class="td_btop3">名称</TD>
       <TD width="15%" align="center" height="30" class="td_btop3">标识(文件名)</TD>
       <TD width="25%" 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\"";?> >
      <td height="30" class="td_border" align="center"><input type="checkbox" value="<?php echo $aid;?>" name="e_id[]" class="checkbox" /><?php echo $aid;?></TD>
      <td height="30" class="td_border" align="center"><?php echo $row->adname;?></TD>
      <td height="30" class="td_border" align="center"><?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="javascript:" onClick="viewCurrentAdTr('<?php echo $aid;?>');openAdWin('callad','../interface/{duomicms:adfolder}/<?php echo $row->adenname;?>.js','/{duomicms:webpath}')">调用广告</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="skin/images/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="skin/js/drag.js"></script>
<?php
}
viewFoot();
?>