<%@ Page Inherits="Dvbbs.bbs.UI.Admin.topreset" %>
<%@ Register tagPrefix="Dvbbs" namespace="Dvbbs.Controls" assembly="Dvbbs.Web"%>
<%@ Register tagPrefix="bbs" tagName="AdminHeader" src="controls/admin_header.ascx"%>
<%@ Register tagPrefix="bbs" tagName="AdminFooter" src="controls/admin_footer.ascx"%>
<script type="text/JavaScript">
<!--
function MM_showHideLayers(th1,th2, th3) { //v6.0
	if(arguments.length == 3) 
	{
		document.getElementById(th2).style.visibility = 'hidden';
		document.getElementById(th3).style.visibility = 'hidden';
		return;
	}
	document.getElementById(th2).style.visibility = 'hidden';
	var usePass = document.getElementById(th1); 
	var isShow = usePass.style.visibility;
		isShow = isShow == 'hidden'?'visible':'hidden';
		usePass.style.visibility = isShow;
	return;
}
//-->
</script>
<bbs:AdminHeader title="已授予勋章" runat="server" ID="Adminheader1" NAME="Adminheader1" />
<br />
<%if(null == __HtmlAction__ || string.Empty == __HtmlAction__){%>
<form runat="server" ID="Form1">
	<table width="100%" class="maintable" cellpadding="0" cellspacing="1" border="0" ID="Table2">
		<tr>
			<td colspan="4" class="title">贴子搜索引擎优化</td>
		</tr>
		<tr>
			<td colspan="4">点关键名称进行编辑，如果要删除关键字，请选中要删除的项再提交即可完成操作。</td>
		</tr>
		<tr>
			<td width="1%" nowrap="nowrap">删除?</td>
			<td width="10%" nowrap="nowrap">编号</td>
			<td width="10%" nowrap="nowrap">版面编号</td>
			<td>关键字名称</td>
		</tr>
		<asp:Repeater id="list" runat="server">
			<ItemTemplate>
				<tr onMouseOver="this.bgColor='#ffffff'" onMouseOut="this.bgColor=''">
					<td width="1%"><Dvbbs:Span id="ID" runat="server" /></td>
					<td width="10%"><Dvbbs:Span id="ID2" runat="server" /></td>
					<td><Dvbbs:Span id="boardid" runat="server" /></td>
					<td><Dvbbs:Anchor id="keyword" runat="server" /></td>
				</tr>
			</ItemTemplate>
		</asp:Repeater>
		<tr>
			<td class="title" colspan="4"><%=pager.ToString()%></td>
		</tr>
		<tr>
			<td align="center" colspan="4">
				<input type="submit" class="button" onFocus="IEvent('focus',this);" onBlur="IEvent('blur',this)"
					onMouseOver="IEvent('mouseover',this)" onMouseOut="IEvent('mouseout',this)" value="提 交" />&nbsp;
				<input type="button" class="button" onFocus="IEvent('focus',this);" onBlur="IEvent('blur',this)"
					onMouseOver="IEvent('mouseover',this)" onMouseOut="IEvent('mouseout',this)" value="新 增"
					onclick="window.location.href='topreset.aspx?__HtmlAction__=AddNew'" />
			</td>
		</tr>
		<tr>
			<td colspan="3" align="left">
				<input type="button" class="button" onFocus="IEvent('focus',this);" onBlur="IEvent('blur',this)"
					onMouseOver="IEvent('mouseover',this)" onMouseOut="IEvent('mouseout',this)" value="更新所有贴子关键字"
					id="StartUpdate" name="StartUpdate" onclick="UpdateTopicKeys();this.disabled=true;" />
				<br />
			</td>
			<td align="left">
				<div style="border:1px solid #CC6600;">
					<div style="border:1px solid #ddd; background-color:#CC9933;height:20px;width:auto;text-align:center"
						id="SetBar" name="SetBar">&nbsp;已完成/总记录数</div>
				</div>
			</td>
		</tr>
		<tr>
			<td colspan="4" align="left">此处将更新所有贴子中的关键字信息为当前系统关键字设置，更新所需时间较长，并且将会更新原贴子所指定的关键字信息，建议为系统第一次开启时使用，请慎重。
			</td>
		</tr>
	</table>
</form>
<%}else{%>
<form runat="server" ID="Form2">
	<table width="100%" class="maintable" cellpadding="0" cellspacing="1" border="0">
		<tr>
			<td colspan="3" class="title">添加关键字</td>
		</tr>
		<tr>
			<td class="left" width="30%">选择版面</td>
			<td class="right" colspan="3" width="70%"><asp:dropdownlist id="parentboard" onmousewheel="return false" runat="server" Width="180"></asp:dropdownlist></td>
		</tr>
		<tr>
			<td class="left">关健字</td>
			<td class="right"><input type="text" name="keyword"  onFocus="IEvent('focus',this);" onBlur="IEvent('blur',this)" onMouseOver="IEvent('mouseover',this)" onMouseOut="IEvent('mouseout',this)" value="<%=_keyword_%>" /></td>
			<td><p>说明：论坛贴子搜索引擎优化，可以将系统中设定好的关键字在指定条件下随机置于贴子标题的末端，建议设置为和本论坛讨论内容相关的关键字，避免大量重复和无关的关键字；您可以在论坛总设置中设置是否开启此项功能以及在帖子标题末端随机的关键字个数；用户发贴过程系统将根据此处设置随机指定关键字到帖子末端，关键字指定后为固定的不能更改，除非使用“更新所有贴子关键字”功能。</p>
			</td>
		</tr>
		<tr>
			<td colspan="3" align="center" class="bottom">
				<input name="submit" onFocus="IEvent('focus',this);" onBlur="IEvent('blur',this)" onMouseOver="IEvent('mouseover',this)"
					onMouseOut="IEvent('mouseout',this)" class="button" type="submit" value="提 交" />&nbsp;
				<input type="button" onFocus="IEvent('focus',this);" onBlur="IEvent('blur',this)" onMouseOver="IEvent('mouseover',this)"
					onMouseOut="IEvent('mouseout',this)" class="button" value="返 回" onclick="window.location.href='topreset.aspx'" />
			</td>
		</tr>
	</table>
</form>
<%}%>
<br />
<br />
<bbs:AdminFooter runat="server" ID="Adminfooter1" NAME="Adminfooter1" />
<script>
var Request = new Object();
Request.send = function(url, method, callback, data) {
	var req;
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	req.onreadystatechange = function() {
		
		if (req.readyState == 4) {
			if (req.status < 400) {
				(method=="POST") ? callback(req) : callback(req,data);
			} else {				
			}
		}
	}

	if (method=="POST") {
		req.open("POST", url, true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.send(data);
	} else {		
		req.open("GET", url, true);
		req.send(null);
	}
	return req;
}

Request.sendPOST = function(url, data, callback) {
	Request.send(url, "POST", callback, data);
}
Request.sendGET = function(url, callback, args) {	
	return Request.send(url, "GET", callback, args);
}

function CallUpdateTopicKeys(response,data){
	var _data_ = response.responseText;
	_data_ = _data_.split(',');
	if(_data_[0] == 'OK'){
		document.getElementById('SetBar').innerHTML='更新完成。';
		eval(_data_[1]);
		return;
	}if(_data_[0] == 'ERR'){
		eval(_data_[1]);
		document.getElementById('StartUpdate').disabled = false;
		return;
	}else{
		document.getElementById('SetBar').innerHTML= _data_[0];
		Request.sendGET("topreset.aspx?Next="+ _data_[1]+"&Total="+ _data_[2] +"&__HtmlAction__=UpdateCache&nocache="+Math.random(), CallUpdateTopicKeys,'');
	}
	
}
function UpdateTopicKeys(){
	Request.sendGET("topreset.aspx?__HtmlAction__=UpdateCache&nocache="+Math.random(), CallUpdateTopicKeys,'');
}

</script>
