<!--{template 'head'}-->
<style>
table.tableborder td.tablerowl{padding:8px 5px;text-align:right;padding-right:15px;}
</style>
<script type="text/javascript">
function seoStart(){
	var ids = [];
	var o = $('channellist').getElementsByTagName('input');
	for(var i=0;i<o.length;i++){
		if(o[i].checked == true) ids.push(o[i].value);
	};
	if(ids.length == 0){
		alert("请选择频道");
		return;
	};
	var limit = parseInt($('num').value.trim());
	if(isNaN(limit)){
		alert("请输入每轮生成内容条数");
		$('num').focus();
		return;
	}
	var type = 0;
	var page = 1;
	var domain = $('domain').value.trim();
	var cid = ids.shift();
	var index = 1;
	var map = config.url + "attachment/sitemap/google-open.xml";
	(function(){
		qmeCms.dialogView.form("Sitemap", "<p class='loading'>Sitemap "+index+" 生成中，请等待...</p>", {width:400,type:'fixed'});
		var url = "plugin.php?plugin=seo&action=manage&domain="+domain+"&cid="+cid+"&type="+type.toString()+"&limit="+limit.toString()+"&page="+page.toString();
		var parameters = "myFormAc=update";
		var A = arguments;
		type = 1;
		Ajax.request(url,{method:'post',parameters:parameters,onComplete: function(resp){
			index++;
			qmeCms.dialogView.form("Sitemap", "<p class='loading'>Sitemap "+index+" 生成中，请等待...</p>", {width:400,type:'fixed'});
			var json = evaljson(resp);
			if(json['status'] == 200){
				if(json.num < limit){
					if(ids.length == 0){
						qmeCms.dialogView.form("Sitemap", "<p>Sitemap生成完毕,</p><p><a href='"+map+"' target='_blank'>"+map+"</a></p>", {width:400,type:'fixed'});
						return;
					}else{
						cid = ids.shift();
						page = 1;
						A.callee();
					}
				}else{
					page++;
					A.callee();
				}
			}else{
				alert('出错了，请重试');
			}
			return true;
		}});
	})();
}
</script>
<table cellpadding="2" cellspacing="1" border="0" align=center class="tableborder" width="100%">
	<tr>
		<td class="submenu" align=center width=100% height=26 colspan="2"> 百度，谷歌地图生成 </td>
	</tr>
	<tr>
		<td class="tablerowl" width="30%" >生成类型</td>
		<td class="tablerow">
			<select id="domain">
				<option value="g">谷歌</option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tablerowl">选择频道</td>
		<td class="tablerow" id="channellist">
			<!--{loop $channel $val}-->
			<!--{if !$val['domain']}-->
			<input type="checkbox" value="{$val['channelid']}" id="channel-{$val['channelid']}"  /> <label for="channel-{$val['channelid']}">{$val['channelname']}</label>
			<!--{/if}-->
			<!--{/loop}-->
			<p style="color:blue">绑定了二级域名的，将不能生成google sitemap</p>
		</td>
	</tr>
	<tr>
		<td class="tablerowl">每轮生成内容条数</td>
		<td class="tablerow" id="channellist">
			<input type="text" class="f-text" size="6" id="num" value="200"  /> 
			<span style="color:blue">请根据服务器性能而定，一般情况下200条就可以</span>
		</td>
	</tr>
	<tr>
		<td class="tablerowl"></td>
		<td class="tablerow">
			<input type="button" value=" 开始生成 " class="f-button" onclick="seoStart();" />
		</td>
	</tr>
</table>

<!--{template 'foot'}-->
