<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title><!--{$UUDEV_PAGE_TITLE}--></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--{include file=elements/header.css.html}-->
<!--{include file=elements/header.js.html type=common}-->
<!--{include file=elements/header.js.html type=date}-->
<!--{include file=elements/header.js.html type=popbox}-->
</head>
<body>
<div id="outside">
	<!--{include file=frame/top.html}-->
	<div id="mainareaContent">
		<!--{include file=frame/left.html}-->
		<div id="rightContent">
			<div id="topContent">
				<div class="sitmap">
					<span class="r"><!--{include file="elements/uuadvad.html"}--></span>模块管理&nbsp;&gt;&nbsp;文章模块&nbsp;&gt;&nbsp;内容管理
				</div>
			</div>
			<div class="tabcontent">
				<a href="index.php?r=Article.index" class="nolink">内管管理</a>
				<a href="index.php?r=SiteSet.articleset" class="link">属性设置</a>
				<a href="index.php?r=Article.articleListLayout" class="link">列表页布局</a>
					<a href="index.php?r=Article.articlePageLayout" class="link">内容页布局</a>
			</div>
			<div id="secrightContent">
				<div class="tableContent3">
					<table class="tbl_leftnav" width="100%"><tr>
						<td class="td_channel"><div class="leftnav">
							<span class="ontitle">文章资源库</span>
							<span class="sectitle">频道分类</span>
							<!--{foreach from=$channel item=item name=channellist}-->
								<a href="index.php?r=Article.category&channel_id=<!--{$item.id}-->">[<!--{$item.id}-->]<!--{$item.channel_text}--></a>
							<!--{/foreach}-->
						</div></td>
						<td>
							<form name="searchForm" action="index.php" method="get" onSubmit="setDisabled('button', window.document);">
								<input type="hidden" name="r" value="Article.index"/>
								<input type="hidden" id="comment_flag" name="comment_flag" value="<!--{$comment_flag}-->"/>
								<input type="hidden" id="publish_status" name="publish_status" value="<!--{$publish_status}-->"/>
								<input type="hidden" id="orderby" name="orderby" value="<!--{$orderby}-->"/>
								<div class="searchbar">文章标题&nbsp;<input type="text" class="text" name="title" value="<!--{$title}-->"/>&nbsp;<button type="submit" class="but2font">查询</button></div>
							</form>
							<div class="operation">
								<button type="button" class="but2font" onClick="window.location.href='index.php?r=Article.add&returnParams=<!--{$returnParams}-->'">新增</button>
								<button type="button" class="but2font" onClick="publish('<!--{$returnParams}-->')">发布</button>
								<button type="button" class="but2font" onClick="batchOperate('index.php?r=Article.offline&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定下线？')">下线</button>
								<button type="button" class="but2font" onClick="batchOperate('index.php?r=Article.delete&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定删除？')">删除</button>
								<button type="button" class="but5font" onClick="deletemore('<!--{$returnParams}-->')">按时间删除</button>
							</div>
							<table class="tbl_list" width="100%" cellpadding="0" cellspacing="0" border="0">
								<tr class="thead">
									<td width="5%"><input type="checkbox" class="checkall"/></td>
									<td width="5%">ID</td>
									<td width="15%">文章标题</td>
									<td width="15%">发布频道</td>
									<td width="10%"><select onChange="$('#publish_status').val(this.value);document.forms['searchForm'].submit();">
										<option value="">状态</option>
										<option value="1" <!--{if $publish_status eq 1}-->selected<!--{/if}-->>已发布</option>
										<option value="2" <!--{if $publish_status eq 2}-->selected<!--{/if}-->>未发布</option>
									</select></td>
									<td width="10%"><select onChange="$('#comment_flag').val(this.value);document.forms['searchForm'].submit();">
										<option value="">评论</option>
										<option value="1" <!--{if $comment_flag eq 1}-->selected<!--{/if}-->>开启</option>
										<option value="0" <!--{if $comment_flag eq '0'}-->selected<!--{/if}-->>关闭</option>
									</select></td>
									<td width="10%">来源</td>
									<td width="9%">
										<!--{if $orderby eq click_count0}-->
										<a class="link" onClick="$('#orderby').val('click_count1');document.forms['searchForm'].submit();">人气↑</a>
										<!--{elseif $orderby eq click_count1}-->
										<a class="link" onClick="$('#orderby').val('click_count0');document.forms['searchForm'].submit();">人气↓</a>
										<!--{else}-->
										<a class="link" onClick="$('#orderby').val('click_count0');document.forms['searchForm'].submit();">人气</a><!--{/if}-->
									</td>
									<td width="12%">
										<!--{if $orderby eq create_date0}-->
										<a class="link" onClick="$('#orderby').val('create_date1');document.forms['searchForm'].submit();">创建时间↑</a>
										<!--{elseif $orderby eq create_date1}-->
										<a class="link" onClick="$('#orderby').val('create_date0');document.forms['searchForm'].submit();">创建时间↓</a>
										<!--{else}-->
										<a class="link" onClick="$('#orderby').val('create_date0');document.forms['searchForm'].submit();">创建时间</a><!--{/if}-->
									</td>
									<td width="9%">操作<!--{$data.channels}--></td>
								</tr>
								<!--{foreach from=$article item=data}-->
								<tr onMouseOver="chgTrColor(this)" onMouseOut="chgTrColor(this)">
									<td><input type="checkbox" name="recordId" value="<!--{$data.id}-->"/></td>
									<td><!--{$data.id}--></td>
									<td><a href="index.php?r=Article.edit&id=<!--{$data.id}-->&returnParams=<!--{$returnParams}-->"><!--{$data.title}--></a></td>
									<td><!--{$data.channels}--></td>
									<td><!--{if $data.publish_status eq 1}-->已发布<!--{elseif $data.publish_status eq 2}-->未发布<!--{/if}--></td>
									<td><!--{if $data.comment_flag eq 1}-->开启<!--{elseif $data.comment_flag eq 0}-->关闭<!--{/if}--></td>
									<td><!--{$data.source}--></td>
									<td><!--{$data.click_count}--></td>
									<td><!--{$data.create_date|date_format:"%Y-%m-%d"}--></td>
									<td><a href="index.php?r=Article.edit&id=<!--{$data.id}-->&returnParams=<!--{$returnParams}-->">修改</a></td>
								</tr>
								<!--{foreachelse}-->
								<tr><td colspan="10">没有对应数据</td></tr>
								<!--{/foreach}-->
							</table>
							<div class="operation">
								<button type="button" class="but2font" onClick="window.location.href='index.php?r=Article.add&returnParams=<!--{$returnParams}-->'">新增</button>
								<button type="button" class="but2font" onClick="publish('<!--{$returnParams}-->')">发布</button>
								<button type="button" class="but2font" onClick="batchOperate('index.php?r=Article.offline&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定下线？')">下线</button>
								<button type="button" class="but2font" onClick="batchOperate('index.php?r=Article.delete&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定删除？')">删除</button>
								<button type="button" class="but5font" onClick="deletemore('<!--{$returnParams}-->')">按时间删除</button>
							</div>
							<div class="page"><!--{$pager}--></div>
						</td>
					</tr></table>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
<script>
function publish(returnParams){
	var item = $("[name=recordId]");
	var id = "";
	if (item.size() > 0) {
		item.each(function(){
			if ($(this).attr("checked") == true) {
				id += $(this).val();
				id += ",";
			}
		});
	}
	id = id.substr(0, id.lastIndexOf(","));
	if (id == "") {
		alert("请选择记录");
		return false;
	} else {
		$.popbox({title:"文章发布", content:popstr_search});
		$.ajax({
			type: "get",
			url: "index.php?r=Article.publish&id="+id+"&returnParams="+returnParams,
			cache: false,
			success: function(data){
				$.popbox.setcontent({title:"文章发布", content:data});
			}
		});
	}
}
function deletemore(returnParams){
	$.popbox({title:"文章删除", content:popstr_search});
	$.ajax({
		type: "get",
		url: "index.php?r=Article.delete_more&returnParams="+returnParams,
		cache: false,
		success: function(data){
			$.popbox.setcontent({title:"文章删除", content:data});
		}
	});
}
function delete1(){
	var month = $("#slc_month").val();
	if (confirm("你确定要删除"+$("#slc_month").find("option:selected").text()+"的文章吗？")) {
		$.get("index.php?r=Article.delete_more",{type:"months",months:month},function(data){
			var dataObj=eval("("+data+")");
			if (dataObj.status == 1) {
				alert("删除数据成功！");
				window.location.reload();
			}
			if(dataObj.status == 2){
				alert("删除失败，在该时间区间内未查询到任何数据！");
			}
			if(dataObj.status == 0) {
				alert("删除数据失败！");
			}
		});
	}
}
function delete2(){
	var timefrom = $("#begin_date").val();
		var timeto = $("#end_date").val();
		if(timefrom =="" &&　timeto == ""){
			alert("请选择要删除的日期范围！");
			return false;
		}
		var cfm = "你确定要删除"+timefrom+"到"+timeto+"的文章吗？";
		if(timefrom == ""){
			cfm = "你确定要删除"+timeto+"以前的文章吗？";
		}
		
		if(confirm(cfm)){
			$.get("index.php?r=Article.delete_more",{type:"date",from:timefrom,to:timeto},function(data){
				var dataObj=eval("("+data+")");
				if (dataObj.status == 1) {
					alert("删除数据成功！");
					window.location.reload();
				}
				if(dataObj.status == 2){
					alert("删除失败，在该时间区间内未查询到任何数据！");
				}
				if(dataObj.status == 0) {
					alert("删除数据失败！");
				}
			});
		}
}
</script>
</html>