<!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>
<title>刀客建站系统   管理中心  - 频道管理 </title>
<%{include file="header.html"}%>
</head>
<body>

<h1>
<span class="action-span"><a href="index.php?act=channel.addchannel">添加自定义频道</a></span>
<span class="action-span1"><a href="index.php?act=index.default">刀客建站系统   管理中心 </a>  - 频道管理</span>
<span style='float:right;margin-right:10px;'><img src='images/top_help.gif'><a href="http://sitepub.cn/help"> 帮助 </a></span>
<span style='float:right;margin-right:10px;'><img src='images/top_forum.gif'><a href="http://bbs.sitepub.cn"> 论坛 </a></span>
<div style="clear:both"></div>
</h1>
<form method="post" action="" name="listForm">
<!-- start brand list -->
<div class="list-div" id="listDiv">

  <table >

    <tr>
      <th>频道名称</th>
      <th>频道链接</th>
      <th>排序</th>
      <th>是否显示</th>
      <th>类型</th>
      <th>操作</th>
    </tr>
	<%{foreach item=v key=k from=$out.channel_arr}%>
	 <tr align="center" style='background-color:#FFF;' onmouseover='this.style.backgroundColor="";' onmouseout='this.style.backgroundColor="#FFF";'>
      <td class="first-cell"  >
        <span ><%{$v.channel_name|escape:html}%></span>
      </td>
      <td><a href="<%{$out.glo_domain_directory}%><%{$v.go_to_link}%>" target="_brank"><%{$out.glo_domain_directory}%><%{$v.go_to_link}%></a></td>
      <td align="right"><span ><%{$v.sort_order}%></span></td>
      <td align="center"><img style='cursor:pointer' onclick='channel_is_open(<%{$v.channel_id}%>,this)' src="images/<%{if $v.is_open}%>yes<%{else}%>no<%{/if}%>.gif"  /></td>
      <td align="center"><span ><%{if $v.type=='system'}%>系统频道<%{elseif $v.type=='custom'}%>自定义频道<%{/if}%></span></td>
      <td align="center">
        <a href="index.php?act=channel.updatechannel&channel_id=<%{$v.channel_id}%>" title="编辑">编辑</a> |
        <a href="javascript:void(0);" <%{if $v.type=='custom'}%>onclick="if(window.confirm('确定删除该频道?')){channel_remove(<%{$v.channel_id}%>,this);}" <%{else}%> onclick='alert("系统频道无法删除");'<%{/if}%> title="删除">删除</a> 
      </td>
    </tr>
	<%{/foreach}%>
   </table>

<!-- end brand list -->
</div>
</form>
<script>
function channel_remove(channel_id,obj)
{
	$.ajax({
			url			:	"index.php?act=channel.del_channel_ajax&channel_id="+channel_id,	
			type			:	'GET',
			'dataType'	:	'json',
			success		:	function(json){
				if(json=='ok'){
					alert('成功删除频道');
					$(obj).parent().parent().remove();
				}	
			}
	});
}
function channel_is_open(channel_id,obj)
{
	if(obj.src.match('yes')){
		is_open=0;
	}else{
		is_open=1;
	}
	$.ajax({
			url			:	"index.php?act=channel.handle_is_open&channel_id="+channel_id+"&is_open="+is_open,	
			type			:	'GET',
			'dataType'	:	'json',
			success		:	function(json){
				if(json=='ok'){
					if(is_open){
						obj.src='images/yes.gif';		
					}else{
						obj.src='images/no.gif';
					}
				}		
			}
	});	


}

</script>

</body>
</html>

