<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="page_list.aspx.cs" Inherits="JumboUCMS.WebFile.Admin._page_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   name="robots" content="noindex, nofollow" />
<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/jcmsU1.js"></script>
<link type="text/css" rel="stylesheet" href="../_data/jcmsU1.css" />
<link type="text/css" rel="stylesheet" href="css/common.css" />
<script type="text/javascript" src="scripts/common.js"></script>

<script type="text/javascript">
var sid = joinValue('sid');
function ajaxTopNav()
{
	$.ajax({
		type:		"get",
		dataType:	"json",
		data:		"time="+(new Date().getTime()),
		url:		"modules_ajax.aspx?oper=ajaxGetList&enabled=1",
        	error:		function(XmlHttpRequest,textStatus, errorThrown) { alert(XmlHttpRequest.responseText);},
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				JumboUCMS.Alert(d.returnval, "0", "top.window.location='login.aspx';");
				break;
			case '0':
				JumboUCMS.Alert(d.returnval, "0");
				break;
			case '1':
				$("#ajaxTopNav").setTemplateElement("tplTopNav", null, {filter_data: true});
				$("#ajaxTopNav").processTemplate(d);
				break;
			}
		}
	});
}
var pagesize=15;
var page=thispage();
$(document).ready(function(){
	ajaxTopNav();
	ajaxList(page);
});
function ajaxList(currentpage)
{
	if(currentpage!=null) page=currentpage;
	JumboUCMS.Loading.show("正在加载数据,请等待...");
	$.ajax({
		type:		"get",
		dataType:	"json",
		data:		"page="+currentpage+"&pagesize="+pagesize+"&time="+(new Date().getTime()) + sid,
		url:		"page_ajax.aspx?oper=ajaxGetList",
		error:		function(XmlHttpRequest,textStatus, errorThrown){JumboUCMS.Loading.hide();alert(XmlHttpRequest.responseText); },
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				JumboUCMS.Alert(d.returnval, "0", "top.window.location='login.aspx';");
				break;
			case '0':
				JumboUCMS.Alert(d.returnval, "0");
				break;
			case '1':
				JumboUCMS.Loading.hide();
				$("#ajaxList").setTemplateElement("tplList", null, {filter_data: true});
				$("#ajaxList").processTemplate(d);
				$("#ajaxPageBar").html(d.pagerbar);
				break;
			}
		}
	});
}
function ConfirmDel(id){
	JumboUCMS.Confirm("确定要删除吗?", "ajaxDel("+id+")");
}
function ajaxDel(id){
	$.ajax({
		type:		"post",
		dataType:	"json",
		data:		"id="+id,
		url:		"page_ajax.aspx?oper=ajaxDel&time="+(new Date().getTime()),
		error:		function(XmlHttpRequest,textStatus, errorThrown){JumboUCMS.Loading.hide();alert(XmlHttpRequest.responseText); },
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				JumboUCMS.Alert(d.returnval, "0", "top.window.location='login.aspx';");
				break;
			case '0':
				JumboUCMS.Alert(d.returnval, "0");
				break;
			case '1':
				ajaxList(page);
				break;
			}
		}
	});
}
function ajaxCreatePage(id){
	JumboUCMS.Loading.show("正在生成...");
	$.ajax({
		type:		"post",
		dataType:	"json",
		data:		"id="+id,
		url:		"page_ajax.aspx?oper=ajaxCreatePage&time="+(new Date().getTime()),
		error:		function(XmlHttpRequest,textStatus, errorThrown){JumboUCMS.Loading.hide();alert(XmlHttpRequest.responseText); },
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				JumboUCMS.Alert(d.returnval, "0", "top.window.location='login.aspx';");
				break;
			case '0':
				JumboUCMS.Alert(d.returnval, "0");
				break;
			case '1':
				JumboUCMS.Message(d.returnval, "1");
				break;
			}
		}
	});
}
    </script>

</head>
<body>
<textarea id="tplTopNav" style="display:none">
<div class="topnav"> <span class="preload1"></span><span class="preload2"></span>
	<ul id="topnavbar">
		<li class="topmenu"><a href="javascript:void(0);" id="pageadd" class="top_link" onclick="JumboUCMS.Popup.show('page_edit.aspx?id=0'+sid,500,280,false)"><span>增加单页</span></a></li>
	</ul>
	<script>
	topnavbarStuHover();
    </script>
</div>
</textarea>
<div id="ajaxTopNav"></div>
<textarea id="tplList" style="display:none">
<table class="listtable" cellspacing="0" cellpadding="0" border="0" style="width:100%;border-collapse:collapse;">
	<tr>
		<th scope="col" style="width:40px;">ID</th>
		<th scope="col" style="width:120px;">单页名称</th>
		<th scope="col" width="*">单页文件名</th>
		<th scope="col" style="width:200px;">操作</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="center"><a>{$T.record.title}</a></td>
		<td align="left"><a>{$T.record.source}</a></td>
		<td align="center">
			<a href="javascript:void(0);" onclick="JumboUCMS.Popup.show('page_edit.aspx?id={$T.record.id}'+ sid,500,280,false)">属性设置</a>
			<a href="javascript:void(0);" onclick="JumboUCMS.Popup.show('page_edittemplate.aspx?id={$T.record.id}'+ sid,560,420,true)">模板编辑</a>
			<a href="javascript:void(0);" onclick="ajaxCreatePage({$T.record.id})">静态生成</a>
			<a href="javascript:void(0);" onclick="ConfirmDel({$T.record.id})">删除</a>
		</td>
	</tr>
	{#/for}
</table>
</textarea>
<div id="ajaxList"></div>
<div id="ajaxPageBar" class="pages"> </div>
</body>
</html>
