From 48fa3a9949dd89ec036bb0d1c7fe337c312fd574 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 4 Apr 2017 16:52:25 +0200 Subject: [PATCH] do NOT store actions in session or eT2 request, nor send for mobile devices skiped actions --- addressbook/inc/class.addressbook_ui.inc.php | 2 +- api/src/Etemplate/Request.php | 15 ++++++++++----- api/src/Etemplate/Widget/Nextmatch.php | 4 ++++ calendar/inc/class.calendar_uilist.inc.php | 6 +++++- filemanager/inc/class.filemanager_ui.inc.php | 5 +++-- infolog/inc/class.infolog_ui.inc.php | 4 ++-- timesheet/inc/class.timesheet_ui.inc.php | 5 ++--- 7 files changed, 27 insertions(+), 14 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index af31dbf5c0..735d0643d8 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -1385,7 +1385,7 @@ window.egw_LAB.wait(function() { { $store_query = $query; // 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]); } diff --git a/api/src/Etemplate/Request.php b/api/src/Etemplate/Request.php index 854b22c039..b5c87bfdd2 100644 --- a/api/src/Etemplate/Request.php +++ b/api/src/Etemplate/Request.php @@ -272,16 +272,21 @@ class Request */ 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']); } } diff --git a/api/src/Etemplate/Widget/Nextmatch.php b/api/src/Etemplate/Widget/Nextmatch.php index 4d6cb18f75..a9429f3430 100644 --- a/api/src/Etemplate/Widget/Nextmatch.php +++ b/api/src/Etemplate/Widget/Nextmatch.php @@ -808,6 +808,10 @@ class Nextmatch extends Etemplate\Widget 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 if (!is_array($action)) $action = array('caption' => $action); if ($default_attrs) $action += $default_attrs; diff --git a/calendar/inc/class.calendar_uilist.inc.php b/calendar/inc/class.calendar_uilist.inc.php index a7a3bcabeb..fff4274d7d 100644 --- a/calendar/inc/class.calendar_uilist.inc.php +++ b/calendar/inc/class.calendar_uilist.inc.php @@ -274,8 +274,12 @@ class calendar_uilist extends calendar_ui $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 // 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']; diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index c53ea8a659..5db9641b27 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -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 '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) - 'actions' => static::get_actions(), 'row_id' => 'path', 'row_modified' => 'mtime', 'parent_id' => 'dir', @@ -340,6 +339,7 @@ class filemanager_ui ); $content['nm']['path'] = static::get_home_dir(); } + $content['nm']['actions'] = static::get_actions(); $content['nm']['home_dir'] = static::get_home_dir(); $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 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(); diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index eb4ce1d0a0..e99cbc6818 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -316,8 +316,8 @@ class infolog_ui unset($query['col_filter']['parent_id']); if(!$query['action']) { - unset($query['rows']); - Api\Cache::setSession('infolog', $query['session_for'].'session_data', $query); + Api\Cache::setSession('infolog', $query['session_for'].'session_data', + array_diff_key ($query, array_flip('rows','actions','action_links','placeholder_actions'))); } $query['actions'] = $this->get_actions($query); $query['row_id'] = 'info_id'; diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php index 240938f2d2..a9cc4f2490 100644 --- a/timesheet/inc/class.timesheet_ui.inc.php +++ b/timesheet/inc/class.timesheet_ui.inc.php @@ -327,7 +327,7 @@ class timesheet_ui extends timesheet_bo 'view' => $view, 'tabs' => $content['tabs'], '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']), 'to_app' => TIMESHEET_APP, ), @@ -934,7 +934,6 @@ class timesheet_ui extends timesheet_bo 'placeholder_actions' => array('add') ); } - $content['nm']['actions'] = $this->get_actions($content['nm']); if($_GET['search']) { @@ -1322,7 +1321,7 @@ class timesheet_ui extends timesheet_bo { $original_id = $this->data['ts_id']; unset($this->data['ts_id']); - + $this->data['ts_title'] = lang('Copy of:') . ' ' .$this->data['ts_title']; unset($this->data['ts_modified']); unset($this->data['ts_modifier']);