<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ezine_list.aspx.cs" Inherits="JumbotCms.WebFile.Admin._ezine_list" %>
<!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=EmulateIE7" />
<title></title>
<script type="text/javascript" src="../_libs/jquery.tools.pack.js"></script>
<script type="text/javascript" src="../_data/jcmsV4.x.js"></script>
<link type="text/css" rel="stylesheet" href="../_data/jcmsV4.x.css" />
<link type="text/css" rel="stylesheet" href="css/common.css" />
<script type="text/javascript" src="scripts/common.js"></script>

<script type="text/javascript" src="scripts/admin.js"></script>
<script language="javascript">
var pagesize=10;
var page=thispage();
$(document).ready(function(){
	ajaxList(page);
});
function ajaxList(currentpage)
{
	if(currentpage!=null) page=currentpage;
	top.JumbotCms.Loading.show("正在加载数据,请等待...",260,80);
	$.ajax({
		type:		"get",
		dataType:	"json",
		data:		"page="+currentpage+"&pagesize="+pagesize+"&time="+(new Date().getTime()),
		url:		"ezine_ajax.aspx?oper=ajaxGetList",
		error:		function(XmlHttpRequest,textStatus, errorThrown){top.JumbotCms.Loading.hide();alert(XmlHttpRequest.responseText); },
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				top.JumbotCms.Alert(d.returnval, "0", "top.window.location='login.aspx';");
				break;
			case '0':
				top.JumbotCms.Alert(d.returnval, "0");
				break;
			case '1':
				top.JumbotCms.Loading.hide();
				$("#ajaxList").setTemplateElement("tplList", null, {filter_data: true});
				$("#ajaxList").processTemplate(d);
				$("#ajaxPageBar").html(d.pagerbar);
				break;
			}
		}
	});
}
function ConfirmDel(id){
	top.JumbotCms.Confirm("删除电子报同时会删除其内容,确定吗?", "IframeOper.ajaxDel("+id+")");
}
function ajaxDel(id){
	$.ajax({
		type:		"post",
		dataType:	"json",
		data:		"id="+id,
		url:		"ezine_ajax.aspx?oper=ajaxDel&time="+(new Date().getTime()),
		error:		function(XmlHttpRequest,textStatus, errorThrown){alert(XmlHttpRequest.responseText); },
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				top.JumbotCms.Alert(d.returnval, "0", "top.window.location='login.aspx';");
				break;
			case '0':
				top.JumbotCms.Alert(d.returnval, "0");
				break;
			case '1':
				top.JumbotCms.Message(d.returnval, "1");
				ajaxList(page);
				break;
			}
		}
	});
}
function ConfirmDef(id){
	top.JumbotCms.Confirm("设为当前刊后的电子报才能发送,此操作还会取消其他电子刊的自动发信计划，确定吗?", "IframeOper.ajaxDef("+id+")");
}
function ajaxDef(id){
	$.ajax({
		type:		"post",
		dataType:	"json",
		data:		"id="+id,
		url:		"ezine_ajax.aspx?oper=ajaxDef&time="+(new Date().getTime()),
		error:		function(XmlHttpRequest,textStatus, errorThrown){alert(XmlHttpRequest.responseText); },
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				top.JumbotCms.Alert(d.returnval, "0", "top.window.location='login.aspx';");
				break;
			case '0':
				top.JumbotCms.Alert(d.returnval, "0");
				break;
			case '1':
				top.JumbotCms.Message(d.returnval, "1");
				ajaxList(page);
				break;
			}
		}
	});
}
function ajaxCreateEzine(id){
	top.JumbotCms.Loading.show("正在生成...",260,80);
	$.ajax({
		type:		"post",
		dataType:	"json",
		data:		"id="+id,
		url:		"ezine_ajax.aspx?oper=ajaxCreateEzine&time="+(new Date().getTime()),
		error:		function(XmlHttpRequest,textStatus, errorThrown){top.JumbotCms.Loading.hide();alert(XmlHttpRequest.responseText); },
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				top.JumbotCms.Alert(d.returnval, "0", "top.window.location='login.aspx';");
				break;
			case '0':
				top.JumbotCms.Alert(d.returnval, "0");
				break;
			case '1':
				top.JumbotCms.Message(d.returnval, "1");
				break;
			}
		}
	});
}
</script>
</head>
<body>
<div id="temporarydiv" style="display:none;"></div>
<div class="topnav"> <span class="preload1"></span><span class="preload2"></span>
	<ul id="topnavbar">
		<li class="topmenu"><a href="javascript:void(0);" onclick="top.JumbotCms.Popup.show('ezine_edit.aspx?id=0',600,280,true)" class="top_link"><span>添加电子报</span></a> </li>
		<li class="topmenu"><a href="javascript:void(0);" onclick="top.JumbotCms.Popup.show('ezinesort_list.aspx',-1,-1,true)" class="top_link"><span>栏目管理</span></a></li>
	</ul>
	<script>
	topnavbarStuHover();
        </script>
</div>
<table class="helptable">
        <tr>
            <td>
                <ul>
                    <li>为避免混乱，只有“当前刊”才能发信；“当前刊”不能进行其他操作。</li>
                    <li>为避免冲突，在“发信计划”有效期内无权进行人工发信。</li>
                </ul>
            </td>
        </tr>
</table>
<textarea id="tplList" style="display:none">
<table class="listtable" cellspacing="0" cellpadding="0" border="0" id="gvList" style="width:100%;border-collapse:collapse;">
	<tr>
		<th scope="col" style="width:40px;">ID</th>
		<th scope="col" width="*">电子报标题</th>
		<th scope="col" style="width:220px;">电子报路径</th>
		<th scope="col" style="width:380px;">操作</th>
	</tr>
	{#foreach $T.table as record}
	<tr onMouseOver="this.style.backgroundColor='F3F7FF'" onMouseOut="this.style.backgroundColor='FFFFFF'">
		<td align="center">{$T.record.id}</td>
		<td align="left">{$T.record.title}</td>
		<td align="left"><a target="_blank" href="../ezine/{$T.record.source}">../ezine/{$T.record.source}</a></td>
		<td align="center">
			{#if $T.record.isdefault == "1"}
			<font color='#cccccc'>编辑</font>
			<font color='#cccccc'>内容管理</font>
			<font color='#cccccc'>生成电子报</font>
			<a href="javascript:void(0);" onclick="top.JumbotCms.Popup.show('ezine_autotask.aspx?id={$T.record.id}',500,280,true)">发信计划</a>
			<a href="javascript:void(0);" onclick="top.JumbotCms.Popup.show('ezine_sendmail.aspx?id={$T.record.id}',-1,-1,true,null,'#grouplist')">人工发信</a>
			<font color='#cccccc'>设为当前刊</font>
			<font color='#cccccc'>删除</font>
			{#else}
			<a href="javascript:void(0);" onclick="top.JumbotCms.Popup.show('ezine_edit.aspx?id={$T.record.id}',600,280,true)">编辑</a>
			<a href="javascript:void(0);" onclick="top.JumbotCms.Popup.show('ezinecontent_list.aspx?eid={$T.record.id}',-1,-1,true)">内容管理</a>
			<a href="javascript:void(0);" onclick="ajaxCreateEzine({$T.record.id})">生成电子报</a>
			<font color='#cccccc'>发信计划</font>
			<font color='#cccccc'>人工发信</font>
			<a href="javascript:void(0);" onclick="ConfirmDef({$T.record.id})">设为当前刊</a>
			<a href="javascript:void(0);" onclick="ConfirmDel({$T.record.id})">删除</a>
			{#/if}
		</td>
	</tr>
	{#/for}
</table>
</textarea>
<div id="ajaxList"> </div>
<div id="ajaxPageBar" class="pages"> </div>
</body>
</html>
