<!--{template 'head'}-->
<!--{if $action=='manage'}-->
<script type="text/javascript" src="{AW_P}images/js/jscharts.js"></script>
<script type="text/javascript">
function keywordAdd(fid){
	qmeCms.dialogView.get("关键词汇", "system.php?sys=comment_filter&action=add&fid="+fid.toString());
	return false;
}
function loadKeyword(){
	qmeCms.dialogView.get("批量导入关键词汇", "system.php?sys=comment_filter&action=load");
	return false;
}
function loadCount(){
	qmeCms.dialogView.get("垃圾评论拦截统计", "system.php?sys=comment_filter&action=count", {width:640});
	return false;
}
</script>
<script type="text/javascript">
setSubject("系统设置");
</script>
<table cellpadding="2" cellspacing="1" border="0" align=center class="tableborder" >
<tr>
	<td class="tablerow">管理操作：<a href="system.php?sys=comment_filter&action=manage">管理词汇</a> | <a href="###" onclick="return keywordAdd(0);">添加词汇</a> | <a href="###" onclick="return loadKeyword();">批量添加</a> | <a href="###" onclick="return loadCount();">拦截统计</a></td>
</tr>
</table>
<form action="system.php?sys=comment_filter&action=delete" method="post">
<table cellpadding="0" cellspacing="0" border="0" align=center class="tableborder" id="mytable" >
	<tr>
		<td class="tablerowhighlight" width="40"></td>
		<td class="tablerowhighlight" width="60">ID</td>
		<td class="tablerowhighlight" >关键词</td>
		<td class="tablerowhighlight" width="100">类型</td>
		<td class="tablerowhighlight" width="120">操作类型</td>
		<td class="tablerowhighlight" width="120">管理</td>
	</tr>
	<!--{if $data}-->
		<!--{loop $data $val}-->
			<tr class="item" id="item-{$val['fid']}">
				<td class="tablerowl"><input type="checkbox" name="ids[]" id="ids_{$val[fid]}"  value="{$val[fid]}" onclick="try{event.cancelBubble=true;}catch(e){event.stopPropagation();}" /></td>
				<td align="center">{$val['fid']}</td>
				<td style="padding-left:12px;">{$val['keyword']}</td>
				<td align="center"><!--{if $val['type']}-->正则表达式<!--{else}-->普通词汇<!--{/if}--></td>
				<td align="center"><!--{if $val['act']}-->禁止提交<!--{else}-->需要审核<!--{/if}--></td>
				<td align="center">
					<a href="###" onclick="return keywordAdd({$val['fid']});">修改</a>
					<a href="system.php?sys=comment_filter&action=delete&fid={$val['fid']}" onclick="return makeSure();">删除</a>
				</td>
			</tr>
		<!--{/loop}-->
			<tr class="item">
				<td class="tablerowl"><input name='chkall' type='checkbox' id='chkall' onclick='checkall(this.form)' value='checkbox' /></td>
				<td class="tablerow" colspan="5">
					<input type="submit" value=" 批量删除 " class="f-button" />
				</td>
			</tr>
	<!--{else}-->
			<tr class="item">
				<td class="tablerow"><p style="padding:25px;text-align:center">还没有相关数据</p></td>
			</tr>
	<!--{/if}-->
</table>
</form>
<!--{elseif $action == 'add'}-->
<form name="ajaxForm" id="ajaxForm" action="system.php?sys=comment_filter&action=add&fid={$fid}" method="post">
	<p class="padding"><label class="f-label">关键词：</label><input size="30" name="keyword" value="{$_output['keyword']}" id="filter_keyword" type="text" class="f-text" autocomplete="off" /></p>
	<p class="padding"><label class="f-label">类型：</label><select name="type"><option value="0"<!--{if $_output['type'] == 0}--> selected<!--{/if}-->>普通词汇</option><option value="1"<!--{if $_output['type'] == 1}--> selected<!--{/if}-->>正则表达式</option></select></p>
	<p class="padding"><label class="f-label">操作：</label><select name="act"><option value="0"<!--{if $_output['act'] == 0}--> selected<!--{/if}-->>需要审核</option><option value="1"<!--{if $_output['act'] == 1}--> selected<!--{/if}-->>禁止提交</option></select></p>
</form>
<script type="text/javascript" reload="1">
(function(){
	$('ajaxForm').onsubmit = function(){
		if($('filter_keyword').value.trim().length == 0){
			alert("需要输入关键词汇");
			$('filter_keyword').focus();
			return false;
		}
		qmeCms.dialogView.setSubmit(true, '提交中...', function(){});
		Form.send('ajaxForm', function(resp){
			qmeCms.dialogView.setMessage(resp);
			qmeCms.dialogView.setSubmit(true, '完成', function(){});
		});
		return false;
	};
	qmeCms.dialogView.setSubmit(true, "提交", function(){
		$('ajaxForm').onsubmit();
	});
})();
</script>
<!--{elseif $action == 'load'}-->
<form name="ajaxForm" id="ajaxForm" action="system.php?sys=comment_filter&action=load" method="post">
	<p class="padding"><label class="f-label">关键词：</label><textarea name="keyword"  id="filter_keyword"  class="f-text" style="width:300px;height:120px;"></textarea></p>
	<p class="padding" style="padding-left:130px;color:blue">一行一个关键词</p>
	<p class="padding"><label class="f-label">类型：</label><select name="type"><option value="0">普通词汇</option><option value="1">正则表达式</option></select></p>
	<p class="padding"><label class="f-label">操作：</label><select name="act"><option value="0">需要审核</option><option value="1">禁止提交</option></select></p>
</form>
<script type="text/javascript" reload="1">
(function(){
	$('ajaxForm').onsubmit = function(){
		if($('filter_keyword').value.trim().length == 0){
			alert("需要输入关键词汇");
			$('filter_keyword').focus();
			return false;
		}
		qmeCms.dialogView.setSubmit(true, '提交中...', function(){});
		Form.send('ajaxForm', function(resp){
			qmeCms.dialogView.setMessage(resp);
			qmeCms.dialogView.setSubmit(true, '完成', function(){});
		});
		return false;
	};
	qmeCms.dialogView.setSubmit(true, "提交", function(){
		$('ajaxForm').onsubmit();
	});
})();
</script>
<!--{elseif $action == 'count'}-->
	<!--{if count($temp) > 1}-->
	<div id="graph">Loading graph...</div>
	<script type="text/javascript" reload="1">
		var myChart = new JSChart('graph', 'line');
		myChart.setTitle('Comment spams in last 14 days');
		var json = [];
		json[0] = {$data_json[0]};
		json[1] = {$data_json[1]};
		myChart.setDataArray(json[0], 'green');
		myChart.setDataArray(json[1], 'red');
		myChart.setAxisPaddingBottom(40);
		myChart.setTextPaddingBottom(10);
		myChart.setAxisValuesNumberY(10);
		myChart.setIntervalStartY(0);
		myChart.setIntervalEndY({$max});
		myChart.setAxisValuesNumberX(14);
		myChart.setShowXValues(false);
		myChart.setTitleColor('#454545');
		myChart.setAxisValuesColor('#454545');
		myChart.setLineColor('#A4D314', 'green');
		myChart.setLineColor('#FF6600', 'red');
		myChart.setFlagColor('#9D16FC');
		myChart.setFlagRadius(4);
		for(var i=0;i<json[0].length;i++){
			myChart.setTooltip([i]);
		}
		myChart.setBackgroundImage('{AW_P}images/chart_bg.jpg');
		myChart.setSize(616, 321);
		myChart.draw();
	</script>
	<!--{/if}-->
<p style="padding-top:6px;"><font color="#A4D314">绿色</font>：表示被禁止提交的，<font color="#FF6600">红色</font>：表示需要审核的</p>
<p style="padding-top:6px;">历史上系统一共拦截{echo ($count['a'] + $count['b'])}次，其中<font color="#A4D314">{$count['a']}</font>次禁止提交，<font color="#FF6600">{$count['b']}</font>次等待审核</p>
<!--{/if}-->
<!--{template 'foot'}-->