From dbd97cd37adb183f83e4e20b5a5eb951378fd7cc Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 9 Mar 2016 12:31:55 +0000 Subject: [PATCH] Mobile theme: - Eliminates some actions from contextmenu only on mobile --- addressbook/inc/class.addressbook_ui.inc.php | 13 ++++++-- calendar/inc/class.calendar_uilist.inc.php | 3 +- infolog/inc/class.infolog_ui.inc.php | 4 +++ mail/inc/class.mail_ui.inc.php | 35 +++++++++++--------- resources/inc/class.resources_ui.inc.php | 1 + 5 files changed, 37 insertions(+), 19 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 55e4b388b9..3024f9f258 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -372,7 +372,8 @@ class addressbook_ui extends addressbook_bo 'disableClass' => 'contact_organisation', 'hideOnDisabled' => true, // Children added below - 'children' => array() + 'children' => array(), + 'hideOnMobile' => true ), 'open' => array( 'caption' => 'Open', @@ -404,6 +405,7 @@ class addressbook_ui extends addressbook_bo 'icon' => 'copy', ), ), + 'hideOnMobile' => true ), ); // CRM view options @@ -548,6 +550,7 @@ class addressbook_ui extends addressbook_bo 'prefix' => 'move_to_', 'group' => $group, 'disableClass' => 'rowNoDelete', + 'hideOnMobile' => true ); } $actions['merge'] = array( @@ -556,6 +559,7 @@ class addressbook_ui extends addressbook_bo 'hint' => 'Merge into first or account, deletes all other!', 'allowOnMultiple' => 'only', 'group' => $group, + 'hideOnMobile' => true ); ++$group; // integration with other apps: infolog, calendar, filemanager @@ -580,7 +584,8 @@ class addressbook_ui extends addressbook_bo 'popup' => egw_link::get_registry('infolog', 'add_popup'), 'onExecute' => 'javaScript:app.addressbook.add_task', // call server for org-view only ), - ) + ), + 'hideOnMobile' => true ); } if ($GLOBALS['egw_info']['user']['apps']['calendar']) @@ -604,6 +609,7 @@ class addressbook_ui extends addressbook_bo 'onExecute' => 'javaScript:app.addressbook.add_cal', ), ), + 'hideOnMobile' => true ); } //Send to email @@ -664,6 +670,7 @@ class addressbook_ui extends addressbook_bo 'group' => $group, // disable for for org-views, as it needs contact-ids 'disableClass' => 'contact_organisation', + 'hideOnMobile' => true ); } // check if user is an admin or the export is not generally turned off (contact_export_limit is non-numerical, eg. no) @@ -687,6 +694,7 @@ class addressbook_ui extends addressbook_bo 'icon' => egw_vfs::mime_icon('text/vcard'), ), ), + 'hideOnMobile' => true ); } @@ -703,6 +711,7 @@ class addressbook_ui extends addressbook_bo 'onExecute' => 'javaScript:app.addressbook.adb_mail_vcard', 'disableClass' => 'contact_organisation', 'hideOnDisabled' => true, + 'hideOnMobile' => true ); } ++$group; diff --git a/calendar/inc/class.calendar_uilist.inc.php b/calendar/inc/class.calendar_uilist.inc.php index 683bbd8848..7346a5b3bd 100644 --- a/calendar/inc/class.calendar_uilist.inc.php +++ b/calendar/inc/class.calendar_uilist.inc.php @@ -868,7 +868,8 @@ class calendar_uilist extends calendar_ui $actions = array( 'add' => array( 'caption' => 'Add', - 'egw_open' => 'add-calendar' + 'egw_open' => 'add-calendar', + 'hideOnMobile' => true ), 'open' => array( 'caption' => 'Open', diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index cfd189045b..e560563903 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -1089,6 +1089,7 @@ class infolog_ui 'enabled' => 'javaScript:app.infolog.has_parent', 'onExecute' => 'javaScript:app.infolog.view_parent', 'group' => $group, + 'hideOnMobile' => true ), 'add' => array( 'caption' => 'Add', @@ -1115,6 +1116,7 @@ class infolog_ui 'icon' => 'copy', ), ), + 'hideOnMobile' => true ), 'no_notifications' => array( 'caption' => 'Do not notify', @@ -1165,6 +1167,7 @@ class infolog_ui 'nm_action' => 'open_popup', ), ), + 'hideOnMobile' => true ), 'close' => array( 'caption' => 'Close', @@ -1245,6 +1248,7 @@ class infolog_ui 'postSubmit' => true, // download needs post submit to work 'group' => $group, 'allowOnMultiple' => true, + 'hideOnMobile' => true ); $actions['delete'] = array( diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 67eaecbf2b..1f78e1b39d 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -438,7 +438,7 @@ class mail_ui 'actions' => self::get_actions(), 'row_id' => 'row_id', // is a concatenation of trim($GLOBALS['egw_info']['user']['account_id']):profileID:base64_encode(FOLDERNAME):uid 'placeholder_actions' => array('composeasnew'), - + ); } if (html::$ua_mobile) $content[self::$nm_index]['header_row'] = 'mail.index.header_right'; @@ -609,7 +609,7 @@ class mail_ui 'sieve' => array( 'caption' => 'Mail filter', 'onExecute' => 'javaScript:app.mail.edit_sieve', - + 'enabled' => 'javaScript:app.mail.sieve_enabled', 'icon' => 'etemplate/fav_filter', // funnel 'hideOnMobile' => true @@ -677,7 +677,7 @@ class mail_ui ); break; } - + $junkFolder = $this->mail_bo->getJunkFolder(); //error_log(__METHOD__.__LINE__.$junkFolder); if ($junkFolder && !empty($junkFolder)) @@ -691,9 +691,9 @@ class mail_ui ); } $tree_actions['sieve']['group'] = $tree_actions['vacation']['group'] = ++$group; // new group for filter - $tree_actions['edit_account']['group'] = $tree_actions['edit_acl']['group'] = ++$group; - - + $tree_actions['edit_account']['group'] = $tree_actions['edit_acl']['group'] = ++$group; + + // enforce global (group-specific) ACL if (!mail_hooks::access('aclmanagement')) { @@ -721,10 +721,10 @@ class mail_ui // sending preview toolbar actions if ($content['mailSplitter']) $etpl->setElementAttribute('mailPreview[toolbar]', 'actions', $this->get_toolbar_actions()); - + // We need to send toolbar actions to client-side because view template needs them if (html::$ua_mobile) $sel_options['toolbar'] = $this->get_toolbar_actions(); - + //we use the category "filter" option as specifier where we want to search (quick, subject, from, to, etc. ....) if (empty($content[self::$nm_index]['cat_id']) || empty($content[self::$nm_index]['search'])) $content[self::$nm_index]['cat_id']=(emailadmin_imapbase::$supportsORinQuery[$this->mail_bo->profileID]?'quick':'subject'); $readonlys = $preserv = array(); @@ -955,6 +955,7 @@ class mail_ui 'onExecute' => 'javaScript:app.mail.mail_compose', ), ), + 'hideOnMobile' => true ), 'composeasnew' => array( 'caption' => 'Compose', @@ -1063,6 +1064,7 @@ class mail_ui 'allowOnMultiple' => false, ), ), + 'hideOnMobile' => true ), 'view' => array( 'caption' => 'View', @@ -1102,6 +1104,7 @@ class mail_ui 'allowOnMultiple' => false, ), ), + 'hideOnMobile' => true ), 'mark' => array( 'caption' => 'Set / Remove Flags', @@ -1976,7 +1979,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2); ); $actions['tracker']['toolbarDefault'] = true; $actions['forward']['toolbarDefault'] = true; - + $compose = $actions['composeasnew']; unset($actions['composeasnew']); $actions = array_reverse($actions,true); @@ -2527,7 +2530,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2); function vfsSaveAttachment($ids,$path) { //error_log(__METHOD__.__LINE__.'("'.array2string($ids).'","'.$path."\")');"); - + if (is_array($ids) && !egw_vfs::is_writable($path) || !is_array($ids) && !egw_vfs::is_writable(dirname($path))) { return 'alert("'.addslashes(lang('%1 is NOT writable by you!',$path)).'"); egw(window).close();'; @@ -2535,7 +2538,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2); $err=null; $dupe_count = array(); $rememberServerID = $this->mail_bo->profileID; - + /** * Extract all parameteres from the given id * @param int $id message id ('::' delimited mailbox::uid::part-id::is_winmail::name) @@ -2556,7 +2559,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2); 'icServer' => $hA['profileID'] ); }; - + //Examine the first attachment to see if attachment //is winmail.dat embedded attachments. $isMultipleDownload=is_array($ids); @@ -3757,7 +3760,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2); $response->call('app.mail.mail_reloadNode',$refreshData); } - + /** * ResolveWinmail fetches the encoded attachments * from winmail.dat and will response expected structure back @@ -3773,11 +3776,11 @@ $filter['before']= date("d-M-Y", $cutoffdate2); function ajax_resolveWinmail ($_rowid) { $response = egw_json_response::get(); - + $idParts = self::splitRowID($_rowid); $uid = $idParts['msgUID']; $mbox = $idParts['folder']; - + $attachments = $this->mail_bo->getMessageAttachments($uid, null, null, false,true,true,$mbox); if (is_array($attachments)) { @@ -3789,7 +3792,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2); $response->call('egw.message', lang('Can not resolve the winmail.dat attachment!')); } } - + /** * move folder * diff --git a/resources/inc/class.resources_ui.inc.php b/resources/inc/class.resources_ui.inc.php index 1871fa56d2..2ff71f231b 100755 --- a/resources/inc/class.resources_ui.inc.php +++ b/resources/inc/class.resources_ui.inc.php @@ -195,6 +195,7 @@ class resources_ui 'url' => 'menuaction=resources.resources_ui.edit&accessory_of=-1', 'popup' => egw_link::get_registry('resources', 'add_popup'), 'group' => $group, + 'hideOnMobile' => true ), 'view-acc' => array( 'caption' => 'View accessories',