<?php 


/** 
***************************************************
*欢迎使用免费版SiteTeam企业建站软件！
*这是一个专业为搜索引擎营销而设计的，极稳定、极易维护的建站软件！
*官方客服：help@php.net.cn
*官方下载网址：http://www.SiteTeam.cn 
***************************************************
**/



 if(!defined('IN_SITETEAM')) {exit('Access Denied');}?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SiteTeam Administrator's Control Panel</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<link rel="stylesheet" href="admin/images/admincp.css" type="text/css" media="all" />
<link rel="stylesheet" href="admin/images/form.css" type="text/css" media="all" />
<script src="admin/js/common.js" type="text/javascript"></script>
<script src="skin/common.js" type="text/javascript"></script>
</head>
<body>
<script type="text/JavaScript">if(parent.$('admincpnav')) parent.$('admincpnav').innerHTML='开始&nbsp;&raquo;&nbsp;关键词工具&nbsp;&raquo;&nbsp;更新全站内链索引';</script>
<div class="container" id="cpcontainer">
  <div class="itemtitle">
    <h3>更新进度列表</h3>
	<ul class="tab1">
      <li><a href="javascript:start_task()"><span>点击启动更新</span></a></li>
	  <li><a href="javascript:stop_task()"><span>停止本次任务</span></a></li>
    </ul>
  </div>
	<table width="700" class="tb tb2 ">
	  <tr>
	    <td><h4>标题</h4></td>
	    <td width="100"><h4>状态</h4></td>
	  </tr>
	  <?php if (is_array($article_list) && count($article_list) > 0) foreach ($article_list as $k => $v) {?>
	  <tr>
	    <td><?=$v['body_name']?></td>
	    <td><div id="msg_<?=$v['key']?>">loading</div></td>
	  </tr>
	  <?php  }?>
	  <?php if (is_array($product_list) && count($product_list) > 0) foreach ($product_list as $k => $v) {?>
	  <tr>
	    <td><?=$v['name']?></td>
	    <td><div id="msg_<?=$v['key']?>">loading</div></td>
	  </tr>
	  <?php  }?>
  </table>
</div>

<script language="javascript" type="text/javascript">
<?php $i = 0;$article_list=array_reverse($article_list);$product_list=array_reverse($product_list);?>
var task = new Array();
<?php if (is_array($product_list) && count($product_list) > 0) foreach ($product_list as $k => $v) {?>
task['<?=++$i?>'] = 'key=<?=$v['key']?>&type=product&category=<?=$v['category']?>';	
<?php  }?>
<?php if (is_array($article_list) && count($article_list) > 0) foreach ($article_list as $k => $v) {?>
task['<?=++$i?>'] = 'key=<?=$v['key']?>&type=article&category=<?=$v['category']?>';	
<?php  }?>
var task_status = 1;
function run_task() {
	var arr = task.pop();
	if (typeof(arr) == 'undefined') {
		return false;
	}
	
	var str = arr.split("&");
	for (var i in str) {
		var temp = str[i];
		var tmp = temp.split("=");
		if (tmp[0] == 'key') var key = tmp[1];
		if (tmp[0] == 'type') var type = tmp[1];
		if (tmp[0] == 'category') var category = tmp[1];
	}
	showContent('msg_' + key, "admin.php?action=keywords&operation=interna_update&" + arr);
	if (task_status == 4) return false;
	window.setTimeout("run_task()",50);
	
}
//开始任务
function start_task() {
	if (confirm('此操作需要几分钟或更长时间，确定要进行吗？')){
		task_status = 1;
		window.setTimeout("run_task()",100);
	}
}
//结束任务
function stop_task() {
	task_status = 4;
}
</script>
</body>
</html>
