* chang the ping method, use js settimeout to trigger the ping action after five minutes.

This commit is contained in:
wangchunsheng
2009-12-19 03:05:00 +00:00
parent 82ad7803c8
commit 748e1dc392
3 changed files with 26 additions and 15 deletions

View File

@@ -1,9 +1,5 @@
<!--[if lte IE 6]><br /><![endif]-->
<div class='yui-d0' id='hiddenbar'>
<iframe frameborder='0' name='hiddenwin' id='hiddenwin'
class='<?php $config->debug ? print("debugwin") : print('hiddenwin')?>'
src='<?php echo $this->createLink('index', 'ping');?>'>
</iframe>
<iframe frameborder='0' name='hiddenwin' id='hiddenwin' class='<?php $config->debug ? print("debugwin") : print('hiddenwin')?>'></iframe>
</div>
<div id='footer' class='yui-d0 yui-t7'>
<div class='yui-g'>

View File

@@ -34,11 +34,12 @@ $themeRoot = $webRoot . "theme/";
if(isset($header['desc'])) echo "<meta name='description' content='$header[desc]'>\n";
?>
<?php echo js::exportConfigVars();?>
<script language='Javascript'>var needPing=false</script>
<script src="<?php echo $jsRoot;?>jquery/lib.js" type="text/javascript"></script>
<script src="<?php echo $jsRoot;?>my.js" type="text/javascript"></script>
<link rel='stylesheet' href='<?php echo $clientTheme . 'yui.css';?>' type='text/css' media='screen' />
<link rel='stylesheet' href='<?php echo $clientTheme . 'style.css';?>' type='text/css' media='screen' />
<script type="text/javascript">loadFixedCSS();</script>
<script language='Javascript'>loadFixedCSS();</script>
<body onload="document.getElementById('account').focus();">
<div class='yui-d0'>
<form method='post' style='margin-top:100px'>

View File

@@ -21,25 +21,31 @@ function createLink(moduleName, methodName, vars, viewType)
{
link = webRoot;
if(!viewType) viewType = defaultView;
vars = vars.split('&');
for(i = 0; i < vars.length; i ++) vars[i] = vars[i].split('=');
if(vars)
{
vars = vars.split('&');
for(i = 0; i < vars.length; i ++) vars[i] = vars[i].split('=');
}
if(requestType == 'PATH_INFO')
{
link += moduleName + requestFix + methodName;
if(pathType == "full")
if(vars)
{
for(i = 0; i < vars.length; i ++) link += requestFix + vars[i][0] + requestFix + vars[i][1];
}
else
{
for(i = 0; i < vars.length; i ++) link += requestFix + vars[i][1];
if(pathType == "full")
{
for(i = 0; i < vars.length; i ++) link += requestFix + vars[i][0] + requestFix + vars[i][1];
}
else
{
for(i = 0; i < vars.length; i ++) link += requestFix + vars[i][1];
}
}
link += '.' + viewType;
}
else
{
link += '?' + moduleVar + '=' + moduleName + '&' + methodVar + '=' + methodName + '&' + viewVar + '=' + viewType;
for(i = 0; i < vars.length; i ++) link += '&' + vars[i][0] + '=' + vars[i][1];
if(vars) for(i = 0; i < vars.length; i ++) link += '&' + vars[i][0] + '=' + vars[i][1];
}
return link;
}
@@ -92,9 +98,17 @@ function switchAccount(account)
location.href=link;
}
function setPing()
{
$('#hiddenwin').attr('src', createLink('index', 'ping'));
}
/* 需要不需要ping已保证session不过期。 */
needPing = true;
/* 自动执行的代码。*/
$(document).ready(function()
{
setNowrapObjTitle();
if(needPing) setTimeout('setPing()', 1000 * 60 * 5); // 5分钟之后开始ping。
});