<form action="channel.manage.php" id="form_del" name="form_del" method="post">
	<input type="hidden" name="action" id="action" />
<table border="0" cellpadding="0" cellspacing="0" class="from_table2_one">
	  <thead>
		  <tr class="area_ajax_list_title">
		    <th width="15%" align="left" class="pd-left"><tpl> $langChannelSelect </tpl></th>	
			  <th width="150" align="left"><tpl> $langChannelName </tpl></th>
		    <th width="10%" align="left"><tpl> $langCSort </tpl></th>
		    <th width="150" align="left"><tpl> $langChannelEstate </tpl></th>
		    <th width="200" align="left"><tpl> $langCOperation </tpl></th>
		  </tr>
	  </thead>
	  <tpl> if $channel_array[0].channel_id neq "" </tpl>
		  <tpl> section name=i loop=$channel_array </tpl>
			  <tr>
				<td  width="15%" align="left" class="pd-left"><input name="channel_id[]" type="checkbox" value="<tpl> $channel_array[i].channel_id </tpl>"/></td>
				<td width="150" align="left"><tpl> $channel_array[i].channel_name </tpl></td>
				<td width="10%" align="left"><tpl> $channel_array[i].channel_sort </tpl></td>
				<td width="150" align="left">
					<tpl> if $channel_array[i].channel_state eq "0" </tpl><tpl> $langCOpen </tpl><tpl> /if </tpl>
					<tpl> if $channel_array[i].channel_state eq "1" </tpl><tpl> $langCClose </tpl><tpl> /if </tpl>
				</td>
				<td width="200" align="left">
					<a href="javascript:;" onclick="hideMessage();;ajax_modi('<tpl> $channel_array[i].channel_id </tpl>');"title="<tpl> $langCedit </tpl>" class="edit_a_pic"></a>
				  	<tpl> if $config_channel_html eq '1' </tpl><!-- 开启静态 -->
					<a href="javascript:;" onclick="hideMessage();;ajax_html('<tpl> $channel_array[i].channel_id </tpl>');" class="static_a_pic" title="<tpl> $langChannelCreateHomePage </tpl>"></a>
					<tpl> /if </tpl>
					<tpl> if $channel_array[i].channel_state eq "0" </tpl>
						<tpl> if $config_channel_html eq '1' </tpl><!-- 开启静态 -->
							<a href="<tpl> $site_url </tpl>/html/<tpl> $channel_array[i].channel_sign </tpl>" target="_blank" title="<tpl> $langChannelPreview </tpl>" class="view_a_pic"></a>
						<tpl> else </tpl>
							<a href="<tpl> $site_url </tpl>/home/channel.php?id=<tpl> $channel_array[i].channel_id </tpl>" target="_blank" class="view_a_pic" title="<tpl> $langChannelPreview </tpl>"></a>
						<tpl> /if </tpl>
					<tpl> /if </tpl>
					<tpl> if $channel_array[i].channel_state eq "1" </tpl>
						<a href="<tpl> $site_url </tpl>/html/<tpl> $channel_array[i].channel_sign </tpl>/lock_index.html" target="_blank" class="view_a_pic" title="<tpl> $langChannelPreview </tpl>"></a>
					<tpl> /if </tpl>
				</td>
			  </tr>
		  <tpl> /section </tpl>
		 
	  <tpl> else </tpl>
	  	  <tr>
			<td colspan="6"><tpl> $langChannelNotInfo </tpl></td>
		  </tr>
	  <tpl> /if </tpl>
  </table>
  <tpl> if $channel_array[0].channel_id neq "" </tpl>
  <div class="table-5-bottom">
  <div style="float:left; padding-left:20px">
				<span class="btn_left">
				<input name="selectall" type="button" id="selectall" value="<tpl> $langChannelAllSelect </tpl>" class="btn_submit"/></span>
					<span class="btn_left">
				<input name="negative" type="button" id="negative" value="<tpl> $langChannelContrarySelect </tpl>" class="btn_submit"/></span>
					<span class="btn_left">
				<input id="delbutton" name="delbutton" value="<tpl> $langChannelDelSelect </tpl>" class="btn_submit" type="button"/></span>
					<span class="btn_left">
				<input id="closebutton" name="closebutton" value="<tpl> $langChannelCloseSelect </tpl>" class="btn_submit" type="button"/></span>
					<span class="btn_left">
				<input id="openbutton" name="openbutton" value="<tpl> $langChannelOpenSelect </tpl>" class="btn_submit" type="button"/></span>
				
			</div>
			<div style="float:right; padding-right:20px">
				<tpl> $page_list </tpl>		
			</div>
			</div>
			<tpl> /if </tpl>
</form>
<div id="question" style="display:none; cursor: default; padding:10px"> 
        <b style=" font-size:14px; margin-top:10px; line-height:50px; height:50px;padding-top:10px; padding-bottom:10px"><tpl> $langChannelConfirmDelete </tpl></b> <br />
        <input type="button" id="yes" value="<tpl> $langCYes </tpl>"  style=" border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/> 
        <input type="button" id="no" value="<tpl> $langCNo </tpl>"  style="border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/>
</div> 


<script>
$(document).ready(function() {	
	$('#negative').click(
		function(){
			$('#form_del input[@type=checkbox]').each(function(){
				$(this).attr('checked',!$(this).attr('checked'))
			})
		}
	);
	$('#selectall').click(
		function(){
			$('#form_del input[@type=checkbox]').each(function(){
				$(this).attr('checked',true)
			})
		}
	);
	//删除操作
	var options_del = {
		beforeSubmit:  function(){showLoading(showText);},
		success:       function(msg){
						hideLoading();
						showMessage(msg.message,msg.type);
						if(msg.type == '1'){
							ShowDiv = "result_content";
							getPageContent("channel.manage.php?action=ajax_list");
						}
					},
		type:      'post',
		dataType:  'json'
	};
	
	var question = $('#question')[0];
	$("#delbutton").click(function(){//删除按钮
		$('#action').val('del');
		$.blockUI(question, { width: '275px' });
	});
	$("#openbutton").click(function(){//开启按钮
		$('#action').val('open');
		$('#form_del').ajaxSubmit(options_del);	
	});
	$("#closebutton").click(function(){//关闭按钮
		$('#action').val('close');
		$('#form_del').ajaxSubmit(options_del);	
	});
	$('#yes').click(function() {
			$.unblockUI();
			$('#form_del').ajaxSubmit(options_del);	
			return false;
		});
	$('#no').click($.unblockUI);
});	

//编辑
function ajax_modi(id){
	//载入页面
	ShowDiv = "result_content";
	getPageContent("channel.manage.php?action=modi&id="+id);
}

//生成静态
function ajax_html(id){
	$.ajax({
		url: "html.manage.php",
		data: "action=one_channel&id="+id,
		type:'post',
		dataType:"json",
		beforeSubmit:  showLoading(showText),// 提交之前执行的方法
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
		}
	});
	return false;
}

</script>