<!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={$_SET['def_charset']}">
<title>顶部管理导航菜单</title>
<link href="{AW_P}images/skin.css" rel="stylesheet" type="text/css">
<style type="text/css">
.admin_topbg a{color:#fff;}
</style>
<script  type='text/javascript'>
var config = {charset:'{$_SET['def_charset']}',channelid : '',channeldir : '',url : "{W_P}",web_path : "{$_SET['webpath']}"};
</script>
<script type="text/javascript">
var web_path="{$_SET[webpath]}";
var channeltitle = '{$channeltitle}';
var mod = '{$mod}';
var channel = <!--{eval echo qbase::jsonencode($channel);}-->;
</script>
<script type="text/javascript" src="{WW_P}images/js/qmecms.js"></script>
<base target='main'>
<script language='JavaScript' type='text/JavaScript'>
function preloadImg(src) 
{
	var img=new Image();
	img.src=src
}

var displayBar=true;
function switchBar(obj) 
{
	if (displayBar) 
	{
			parent.document.getElementById('frame').cols='0,*';
			displayBar=false;
			obj.title='打开左边管理导航菜单';
	} else {
			parent.document.getElementById('frame').cols='200,*';
			displayBar=true;
			obj.title='关闭左边管理导航菜单';
	}
}
function reloadFlush(){
	parent.document.getElementById('main').contentWindow.location.href = getCurrentLocation();
	document.body.focus();
	return false;
}

function getCurrentLocation(){
	var u = parent.document.getElementById('main').contentWindow.location;
	return u.href.split('#')[0];
}

function flushCache(obj){
	obj.href = "system.php?sys=html&action=common&location=" + encodeURIComponent(getCurrentLocation());
	return true;
}

var dateOffset = {$_SERVER['REQUEST_TIME']} - parseInt((new Date()).getTime() / 1000);
function runCron(){
	Ajax.request('system.php?sys=cron&action=run',{method:'get',onComplete: function(resp){
		if(resp.trim().length > 2){
			var json = evaljson(resp);
			if(json['status'] == 404){
				return;
			}else{
				if(json['m'] <= 30){
					setTimeout(function(){
						runCollect(json);
					},1000);
				}
			}
		}
		setTimeout(runCron, 300*1000);
	}});
};

var map = [];
function runCollect(json){
	if(map.inArray(json['h'])) return;
	map.push(json['h']);
	Ajax.get("system.php?sys=collect&work=run_cron&channelid=1", function(resp){
		var data = evaljson(resp);
		if(data == null) return;
		var linkMap = [];
		(function(){
			var A = arguments;
			var item = data.shift();
			linkMap.push(item);
			Ajax.get("system.php?sys=collect&work=link_work&channelid="+item.channelid+"&rules="+item.id+"&pageno=1&threadGet=1", function(resp){
				if(data.length > 0) A.callee();
				else runCollectLink(linkMap);
			});
		})();
	});
}

function runCollectLink(linkMap){
	var contentMap = [];
	(function(){
		var A = arguments;
		var item = linkMap.shift();
		Ajax.get("system.php?sys=collect&work=geturl&channelid="+item.channelid+"&rules="+item.id, function(resp){
			var info = evaljson(resp);
			if(info != null && typeof info['data'] != 'undefined' && info['status'] == 200){
				if(info['data'].length > 0){
					for(var i=0;i<info['data'].length;i++){
						contentMap.push({'channelid':item.channelid, 'rules':item.id, 'id':info['data'][i]});
					}
				}
			}
			if(linkMap.length > 0) A.callee();
			else runCollectContent(contentMap);
		});
	})();
}

function runCollectContent(contentMap){
	(function(){
		var A = arguments;
		var item = contentMap.shift();
		Ajax.get("system.php?sys=collect&work=content&rules="+item['rules']+"&channelid="+item['channelid']+"&id="+item['id'], function(){
			A.callee();
		});
	})();
}

setTimeout(runCron, 10*1000);
setTimeout(function(){
	window.location.reload(0);
},3600 * 1000 * 6);
</script>
</head>
<body>
<table width="100%" height="64" border="0" cellpadding="0" cellspacing="0" class="admin_topbg">
	<tr>
		<td width="270" height="64"><img onclick="switchBar(this);" style="cursor:pointer" title="关闭左边管理导航菜单" src="{AW_P}images/skin/logo.gif" width="262" height="64"></td>
		<td valign="top" align="right">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td height="27" > </td>
					<td width=92 style="background:url({AW_P}images/skin/button.gif)" align=center><a href='system.php?sys=html&action=common' onclick="return flushCache(this);" target='main'>更新缓存</a></td>
					<td width=92 style="background:url({AW_P}images/skin/button.gif)" align=center><a href='system.php?sys=html&action=all&dir=index' target='main'>更新首页</a></td>
					<td width=92 style="background:url({AW_P}images/skin/button.gif)" align=center><a href='system.php?sys=html&action=all&dir=channel' target='main'>更新频道</a></td>
					<td width=92 style="background:url({AW_P}images/skin/button.gif)" align=center><a href='system.php?sys=member&file=admin&action=password' target="main">修改密码</a></td>
					<td width=92 style="background:url({AW_P}images/skin/button.gif)" align=center><a href='###' onclick="return reloadFlush()" target="_self">刷新页面</a></td>
					<td width=92 style="background:url({AW_P}images/skin/button.gif)" align=center><a href='login.php?action=logout' target="_top">退出登录</a></td>
					<td width=92 style="background:url({AW_P}images/skin/button.gif)" align=center><a href='../' target=_blank>网站首页</a></td>
				</tr>
				<tr>
					<td height="19" colspan="8">
						<script type="text/javascript">
						document.write('<object id="save2local_objid" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"  style="width:1px;height:1px;">');
						document.write('<param name="movie" value="../images/save2local.swf">');
						document.write('<param name="quality" value="high">');
						document.write('<param name=wmode value=Opaque>');
						document.write('<param name="AllowScriptAccess" value="always">');
						document.write('<embed name="save2local_objid" wmode="opaque" AllowScriptAccess="always" src="../images/save2local.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" style="width:1px;height:1px;"></embed>');
						document.write('</object>');
						</script>					
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<script type="text/javascript">
var swfSave = {
	objid:'save2local_objid',
	getObj:function(){
		var id = this.objid;
		return (navigator.appName.indexOf("Microsoft") != -1) ? window[id] : document[id];
	},
	set:function(key, dat) {
		var f = this.getObj();
		if (f && f.saveData) try{
			f.saveData(key, dat);
		}catch(e){};
	},
	del:function(key, call){
		var f = this.getObj();
		if (f && f.saveData) try{
			f.saveData(key, null);
		}catch(e){};
	},
	get:function(key){
		var f = this.getObj();
		if (f && f.loadData) try{
			return f.loadData(key);
		}catch(e){
		};
	},
	ready:function(){
		var s = ((typeof this.getObj() == 'function' || typeof this.getObj() == 'object') && typeof this.getObj().loadData == 'function' && typeof this.getObj().saveData == 'function') ? true : false;
		return s;
	}
};
</script>
</body>
</html>
