fixed statistic submit to show, but ignore, tree

This commit is contained in:
Ralf Becker 2014-07-17 14:02:31 +00:00
parent 4c2567c1ff
commit daa0ce25f3
4 changed files with 24 additions and 18 deletions

View File

@ -33,10 +33,6 @@ class admin_hooks
{
unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
if (!isset($_GET['menuaction']) && substr($_SERVER['PHP_SELF'],-16) == '/admin/index.php')
{
admin_statistics::check();
}
$appname = 'admin';
$location = is_array($args) ? $args['location'] : $args;

View File

@ -52,7 +52,7 @@ class admin_statistics
config::save_value(self::CONFIG_POSTPONE_SUBMIT,time()+$content['postpone'],self::CONFIG_APP);
$what = 'postpone';
}
elseif(!$content['canceled'])
elseif(!$content['cancel'])
{
config::save_value(self::CONFIG_LAST_SUBMIT,time(),self::CONFIG_APP);
config::save_value(self::CONFIG_SUBMIT_ID,empty($content['submit_id']) ? '***none***' : $content['submit_id'],self::CONFIG_APP);
@ -280,21 +280,25 @@ class admin_statistics
/**
* Check if next submission is due, in which case we call submit and NOT return to the admin hook
*
* @param boolean $redirect should we redirect or return true
* @return boolean true if statistic submission is due
*/
public static function check()
public static function check($redirect=true)
{
if (isset($_GET['statistics']))
{
return;
}
$config = config::read(self::CONFIG_APP);
if (isset($config[self::CONFIG_POSTPONE_SUBMIT]) && $config[self::CONFIG_POSTPONE_SUBMIT] > time() ||
isset($config[self::CONFIG_LAST_SUBMIT ]) && $config[self::CONFIG_LAST_SUBMIT ] > time()-self::SUBMISION_RATE)
{
return;
return false;
}
if (!$redirect) return true;
//die('Due for new statistics submission: last_submit='.$config[self::CONFIG_LAST_SUBMIT ].', postpone='.$config[self::CONFIG_POSTPONE_SUBMIT].', '.function_backtrace());
egw::redirect_link('/index.php',array('menuaction'=>'admin.admin_statistics.submit'));
egw::redirect_link('/index.php',array(
'menuaction' => 'admin.admin_ui.index',
'ajax' => 'true',
'load' => 'admin.admin_statistics.submit',
));
}
}

View File

@ -37,8 +37,10 @@ class admin_ui
*/
public function index(array $content=null)
{
admin_statistics::check();
if (admin_statistics::check(false))
{
$_GET['load'] = 'admin.admin_statistics.submit';
}
$tpl = new etemplate_new('admin.index');
$content = array();

View File

@ -113,6 +113,10 @@ app.classes.admin = AppJS.extend(
*/
load: function(_url)
{
if (this.iframe && this.iframe.getDOMNode().contentDocument.location.href.match(/menuaction=admin.admin_statistics.submit/))
{
return; // do not allow to leave statistics submit
}
if (_url)
{
this.iframe.set_src(_url);
@ -172,7 +176,7 @@ app.classes.admin = AppJS.extend(
var nm = this.et2.getWidgetById('nm');
nm.applyFilters(activeFilters);
}
}
var refreshTree = this.et2.getWidgetById('tree');
if (refreshTree) refreshTree.refreshItem('/groups');
@ -768,10 +772,10 @@ app.classes.admin = AppJS.extend(
return true;
},
/**
* Delete confirmation dialog
*
*
* @param {egw action} _action
*/
delete_category: function (_action)
@ -801,7 +805,7 @@ app.classes.admin = AppJS.extend(
action.id = 'delete_sub';
nm_action(action);
}
}
}
}
else
{