do NOT store actions in session or eT2 request, nor send for mobile devices skiped actions

This commit is contained in:
Ralf Becker 2017-04-04 16:52:25 +02:00
parent f2a27d73c4
commit 48fa3a9949
7 changed files with 27 additions and 14 deletions

View File

@ -1385,7 +1385,7 @@ window.egw_LAB.wait(function() {
{ {
$store_query = $query; $store_query = $query;
// Do not store these // Do not store these
foreach(array('options-cat_id','actions') as $key) foreach(array('options-cat_id','actions','action_links','placeholder_actions') as $key)
{ {
unset($store_query[$key]); unset($store_query[$key]);
} }

View File

@ -272,16 +272,21 @@ class Request
*/ */
protected function cleanup() protected function cleanup()
{ {
if (isset($this->data['content']['nm']) && is_array($this->data['content']['nm']['rows'])) if (isset($this->data['content']['nm']))
{ {
foreach(array_keys($this->data['content']['nm']['rows']) as $n) if (is_array($this->data['content']['nm']['rows']))
{ {
if (is_int($n)) foreach(array_keys($this->data['content']['nm']['rows']) as $n)
{ {
unset($this->data['content']['nm']['rows'][$n]); if (is_int($n))
{
unset($this->data['content']['nm']['rows'][$n]);
}
} }
//error_log(__METHOD__."() content[nm][rows]=".array2string($this->data['content']['nm']['rows']));
} }
//error_log(__METHOD__."() content[nm][rows]=".array2string($this->data['content']['nm']['rows'])); // do not store actions
unset($this->data['content']['nm']['actions'], $this->data['content']['nm']['action_links']);
} }
} }

View File

@ -808,6 +808,10 @@ class Nextmatch extends Etemplate\Widget
foreach((array)$actions as $id => $action) foreach((array)$actions as $id => $action)
{ {
if (!empty($action['hideOnMobile']) && Api\Header\UserAgent::mobile())
{
continue; // no need to send this action to client, specially document actions can be huge
}
// in case it's only selectbox id => label pairs // in case it's only selectbox id => label pairs
if (!is_array($action)) $action = array('caption' => $action); if (!is_array($action)) $action = array('caption' => $action);
if ($default_attrs) $action += $default_attrs; if ($default_attrs) $action += $default_attrs;

View File

@ -274,8 +274,12 @@ class calendar_uilist extends calendar_ui
$this->filter = $params['filter']; $this->filter = $params['filter'];
} }
} }
if (!$params['csv_export']) Api\Cache::setSession('calendar', 'calendar_list', $params);
if (!$params['csv_export'])
{
Api\Cache::setSession('calendar', 'calendar_list',
array_diff_key ($params, array_flip('rows', 'actions', 'action_links', 'placeholder_actions')));
}
// do we need to query custom fields and which // do we need to query custom fields and which
// Check stored preference if selectcols isn't available (ie: first call) // Check stored preference if selectcols isn't available (ie: first call)
$select_cols = $params['selectcols'] ? $params['selectcols'] : $GLOBALS['egw_info']['user']['preferences']['calendar']['nextmatch-calendar.list.rows']; $select_cols = $params['selectcols'] ? $params['selectcols'] : $GLOBALS['egw_info']['user']['preferences']['calendar']['nextmatch-calendar.list.rows'];

View File

@ -330,7 +330,6 @@ class filemanager_ui
'default_cols' => '!comment,ctime', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns 'default_cols' => '!comment,ctime', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns
'csv_fields' => false, // I false=disable csv export, true or unset=enable it with auto-detected fieldnames, 'csv_fields' => false, // I false=disable csv export, true or unset=enable it with auto-detected fieldnames,
//or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type) //or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type)
'actions' => static::get_actions(),
'row_id' => 'path', 'row_id' => 'path',
'row_modified' => 'mtime', 'row_modified' => 'mtime',
'parent_id' => 'dir', 'parent_id' => 'dir',
@ -340,6 +339,7 @@ class filemanager_ui
); );
$content['nm']['path'] = static::get_home_dir(); $content['nm']['path'] = static::get_home_dir();
} }
$content['nm']['actions'] = static::get_actions();
$content['nm']['home_dir'] = static::get_home_dir(); $content['nm']['home_dir'] = static::get_home_dir();
$content['nm']['view'] = $GLOBALS['egw_info']['user']['preferences']['filemanager']['nm_view']; $content['nm']['view'] = $GLOBALS['egw_info']['user']['preferences']['filemanager']['nm_view'];
@ -813,7 +813,8 @@ class filemanager_ui
// do NOT store query, if hierarchical data / children are requested // do NOT store query, if hierarchical data / children are requested
if (!$query['csv_export']) if (!$query['csv_export'])
{ {
Api\Cache::setSession('filemanager', 'index',$query); Api\Cache::setSession('filemanager', 'index',
array_diff_key ($query, array_flip('rows','actions','action_links','placeholder_actions')));
} }
if(!$query['path']) $query['path'] = static::get_home_dir(); if(!$query['path']) $query['path'] = static::get_home_dir();

View File

@ -316,8 +316,8 @@ class infolog_ui
unset($query['col_filter']['parent_id']); unset($query['col_filter']['parent_id']);
if(!$query['action']) if(!$query['action'])
{ {
unset($query['rows']); Api\Cache::setSession('infolog', $query['session_for'].'session_data',
Api\Cache::setSession('infolog', $query['session_for'].'session_data', $query); array_diff_key ($query, array_flip('rows','actions','action_links','placeholder_actions')));
} }
$query['actions'] = $this->get_actions($query); $query['actions'] = $this->get_actions($query);
$query['row_id'] = 'info_id'; $query['row_id'] = 'info_id';

View File

@ -327,7 +327,7 @@ class timesheet_ui extends timesheet_bo
'view' => $view, 'view' => $view,
'tabs' => $content['tabs'], 'tabs' => $content['tabs'],
'link_to' => array( 'link_to' => array(
'to_id' => $this->data['ts_id'] ? $this->data['ts_id'] : 'to_id' => $this->data['ts_id'] ? $this->data['ts_id'] :
($this->data['link_to']['to_id'] ? $this->data['link_to']['to_id'] : $content['link_to']['to_id']), ($this->data['link_to']['to_id'] ? $this->data['link_to']['to_id'] : $content['link_to']['to_id']),
'to_app' => TIMESHEET_APP, 'to_app' => TIMESHEET_APP,
), ),
@ -934,7 +934,6 @@ class timesheet_ui extends timesheet_bo
'placeholder_actions' => array('add') 'placeholder_actions' => array('add')
); );
} }
$content['nm']['actions'] = $this->get_actions($content['nm']);
if($_GET['search']) if($_GET['search'])
{ {
@ -1322,7 +1321,7 @@ class timesheet_ui extends timesheet_bo
{ {
$original_id = $this->data['ts_id']; $original_id = $this->data['ts_id'];
unset($this->data['ts_id']); unset($this->data['ts_id']);
$this->data['ts_title'] = lang('Copy of:') . ' ' .$this->data['ts_title']; $this->data['ts_title'] = lang('Copy of:') . ' ' .$this->data['ts_title'];
unset($this->data['ts_modified']); unset($this->data['ts_modified']);
unset($this->data['ts_modifier']); unset($this->data['ts_modifier']);