<?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?'); 
iCMS_admincp_head();
?>
<script type="text/javascript">
admincpnav('首页&nbsp;&raquo;&nbsp;TAG管理&nbsp;&raquo;&nbsp;TAG[<?=$tagName?>]关联管理');
$(function(){
<?php if(isset($_GET['at'])){?>
$("#at").val("<?=$_GET['at']?>");
<?php } if($_GET['cid']){?>
$("#cid").val("<?=$_GET['cid']?>");
<?php } if($_GET['st']){?>
$("#st").val("<?=$_GET['st']?>");
<?php } if($_GET['sub']=="on"){?>
$("#sub").attr("checked",true);
<?php } if($_GET['nopic']=="on"){?>
$("#nopic").attr("checked",true);
<?php }?>
});
function doaction(obj){
	switch(obj.value){ 
		case "delist":
			if(confirm("确定要删除！！！")){
				return true;
			}else{
				obj.value="";
				return false;
			}
		break;
	}
}
</script>
<div id="append_parent"></div>
<script type="text/javascript" src="admin/js/calendar.js"></script>
<div class="container" id="cpcontainer">
  <h3>TAG[<?=$tagName?>]关联管理</h3>
  <table class="tb tb2 nobdb" id="tips">
    <tr>
      <th colspan="15" class="partition">技巧提示</th>
    </tr>
    <tr>
      <td class="tipsblock"><ul id="tipslis">
          <li>点击ID可查看该文章</li>
          <li>删除关联只删除TAG相关数据，不会删除文章</li>
        </ul></td>
    </tr>
  </table>
  <form action="<?=__SELF__?>" method="get">
    <input type="hidden" name="do" value="tag" />
    <input type="hidden" name="operation" value="list" />
    <input type="hidden" name="id" value="<?=$_GET['id']?>" />
    <table class="tb tb2 ">
      <tr>
        <td class="tipsblock"><select name="at" id="at">
            <option value="-1"> == 文章属性 == </option>
            <option value="0">普通文章[type='0']</option>
            <?=contentype("article")?>
          </select>
          　<select name="cid" id="cid">
          	<option value="0"> == 按栏目 == </option>
            <?=$catalog->select(0,0,1,"channel&list")?>
          </select>
        <input type="checkbox" name="sub" class="checkbox" id="sub"/>子栏目
        <input type="checkbox" name="nopic" class="checkbox" id="nopic"/>无缩略图
        </td>
      </tr>
     <tr>
        <td class="tipsblock">开始时间：<input type="text" class="txt" name="starttime" value="<?=$_GET['starttime']?>" onClick="showcalendar(event, this)" style="width:80px">-结束时间：<input type="text" class="txt" name="endtime" value="<?=$_GET['endtime']?>" onClick="showcalendar(event, this)" style="width:80px">  关键字：
          <input type="text" name="keywords" class="txt" id="keywords" value="<?=$_GET['keywords']?>" size="30" />
          每页显示<input type="text" name="perpage" class="txt" id="perpage" value="<?=$_GET['perpage']?$_GET['perpage']:20?>" style="width:30px;" />
          <input type="submit" class="btn" value="搜索"/>
        </td>
      </tr>
    </table>
  </form>
  <form action="<?=__SELF__?>?do=tag&operation=post" method="post">
    <table class="tbL tb tb2 ">
      <tr>
        <th width="4%" height="22">选择</th>
        <th width="4%">ID</th>
        <th width="4%">排序</th>
        <th>标 题</th>
        <th width="120">发布时间</th>
        <th width="10%">栏目</th>
        <th width="7%">点/评</th>
        <th width="4%">状态</th>
        <th width="120">操作</th>
      </tr>
      <tbody id="alist">
      <?php for($i=0;$i<$_count;$i++){
      	$ourl=$rs[$i]['url'];
      	$C=$catalog->catalog[$rs[$i]['cid']];
      	$iurlArray=array('id'=>$rs[$i]['id'],'link'=>$rs[$i]['clink'],'url'=>$rs[$i]['url'],'dir'=>$C['dir'],'cid'=>$rs[$i]['cid'],'domain'=>$C['domain'],'pubdate'=>$rs[$i]['pubdate'],'htmlext'=>$C['htmlext']);
		$iurl=$iCMS->iurl('show',$iurlArray);
		empty($ourl) && $htmlurl=$iurl->path;
		$rs[$i]['url']=$iurl->href;
	?>
      <tr onmouseover="this.style.backgroundColor='#F2F9FD'" onmouseout="this.style.backgroundColor='#FFFFFF'">
        <td><input type="checkbox" class="checkbox" name="id[]" value="<?=$rs[$i]['id']?>" /></td>
        <td><a href="<?=$rs[$i]['url']?>" target="_blank"><?=$rs[$i]['id']?></a></td>
        <td><input type="text" name="order[<?=$rs[$i]['id']?>]" value="<?=$rs[$i]['order']?>" style="width:20px;border:1px #F6F6F6 solid;"/></td>
        <td><div style="height:22px;width:100%;overflow:hidden;"><?php if($rs[$i]['status']=="0"){echo empty($rs[$i]['postype'])?'[未审核]':'[草稿]';}?> <?php if($rs[$i]['isPic'])echo '<img src="admin/images/image.gif" align="absmiddle">'?> <?=$rs[$i]['title']?></div></td>
        <td><?=get_date($rs[$i]['pubdate'],'Y-m-d H:i');?></a></td>
        <td><a href="<?=__SELF__?>?do=tag&operation=list&id=<?=$rs[$i]['id']?>&cid=<?=$rs[$i]['cid']?><?=$uri?>"><?=$C['name']?></a></td>
        <td><?=$rs[$i]['hits']?>/<a href="comment.php?aid=<?=$rs[$i]['id']?>" target="_blank"><?=$rs[$i]['comments']?></a></td>
        <td>
        	<?php if($ourl){?><img src="admin/images/olink.gif" align="absmiddle" alt="外部链接"><?php }?>
        	<?php if($cid && $cid!=$rs[$i]['cid']){?>虚<?php }?>
        </td>
        <td><?php if($cid&&$cid!=$rs[$i]['cid']){?>
        	<a href="<?=__SELF__?>?do=article&operation=delvlink&id=<?=$rs[$i]['id']?>&cid=<?=$cid?>" onclick="return confirm('删除<?=$rs[$i]['title']?>此栏目的虚链接?');">删除</a>
        	<?php }else{ ?>
        		<?php if ($iCMS->config['ishtm'] && $rs[$i]['status']=="1" && empty($ourl)){?>
        			<a href="<?=__SELF__?>?do=article&operation=updateHTML&id=<?=$rs[$i]['id']?>"><?=file_exists($htmlurl)?"更新":"待发布"?></a> | 
        		<?php }?>
        			<a href="<?=__SELF__?>?do=article&operation=add&id=<?=$rs[$i]['id']?>">编辑</a> | <a href="<?=__SELF__?>?do=tag&operation=delist&aid=<?=$rs[$i]['id']?>&id=<?=$id?>" onclick="return confirm('确定要删除<?=HTML2JS($rs[$i]['title'])?>与标签[<?=$tagName?>]的关联？');">删除</a>
        	<?php }?></td>
      </tr>
      <?php }?>
      </tbody>
      <tr>
        <td colspan="9" align="right"><?=$pagenav?></td>
      </tr>
      <tr class="nobg">
        <td class="td23"><input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll('prefix', this.form, 'id')" />
          <label for="chkall">全选</label></td>
        <td colspan="8"><div class="fixsel"><select name="action" id="action" onChange="doaction(this);">
              <option value="">========批 量 操 作=======</option>
              <option value="delist">删除</option>
            </select><input type="submit" class="btn" name="forumlinksubmit" value="提交"  /></div></td>
      </tr>
    </table>
  </form>
</div>
</body></html>