From b7ec2a9b919ca66bebf3cba5f2240f289916cce2 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 23 Apr 2020 17:31:33 +0200 Subject: [PATCH] Add phone call actions --- .../inc/class.addressbook_hooks.inc.php | 47 +++++++++++++++++++ addressbook/js/app.js | 8 ---- addressbook/js/app.ts | 11 ----- addressbook/setup/setup.inc.php | 1 + 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/addressbook/inc/class.addressbook_hooks.inc.php b/addressbook/inc/class.addressbook_hooks.inc.php index a32a6401fd..cf8b116949 100644 --- a/addressbook/inc/class.addressbook_hooks.inc.php +++ b/addressbook/inc/class.addressbook_hooks.inc.php @@ -576,4 +576,51 @@ class addressbook_hooks if (empty($config['geolocation_url'])) $ret ['geolocation_url'] = $geoLocation[0]['value']; return $ret; } + + + /** + * get actions + * + * @return array return an array of actions + */ + public static function status_get_actions() + { + $config = Api\Config::read('stylite'); + + return [ + 'addressbook_phonecall' => [ + 'caption' => 'Phone Call', + 'icon' => 'call', + 'group' => 2, + 'enabled' => !empty($config['pbx_type']) && !empty($config['pbx_api_key']), + 'disableIfNoEPL' => !$GLOBALS['egw_info']['apps']['stylite'], + 'children' => [ + 'addressbook_tel_work' => [ + 'caption' => lang('Business phone'), + 'icon' => 'phone', + 'onExecute' => 'javaScript:app.status.phoneCall', + 'enabled' => 'javaScript:app.status.phoneIsAvailable' + ], + 'addressbook_tel_cell' => [ + 'caption' => lang('Mobile phone'), + 'icon' => 'personal', + 'onExecute' => 'javaScript:app.status.phoneCall', + 'enabled' => 'javaScript:app.status.phoneIsAvailable' + ], + 'addressbook_tel_home' => [ + 'caption' => lang('Home phone'), + 'icon' => 'home', + 'onExecute' => 'javaScript:app.status.phoneCall', + 'enabled' => 'javaScript:app.status.phoneIsAvailable' + ], + 'addressbook_tel_prefer' => [ + 'caption' => lang('Favorite phone'), + 'icon' => 'fav_filter', + 'onExecute' => 'javaScript:app.status.phoneCall', + 'enabled' => 'javaScript:app.status.phoneIsAvailable' + ] + ] + ] + ]; + } } diff --git a/addressbook/js/app.js b/addressbook/js/app.js index 293bb713db..c4b50d7d70 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -1121,14 +1121,6 @@ var AddressbookApp = /** @class */ (function (_super) { } app.status.makeCall(data); }; - /** - * - * @param _action - * @param _selected - * @todo - */ - AddressbookApp.prototype.videoconference_scheduleCall = function (_action, _selected) { - }; return AddressbookApp; }(egw_app_1.EgwApp)); app.classes.addressbook = AddressbookApp; diff --git a/addressbook/js/app.ts b/addressbook/js/app.ts index 164c7e60e9..e6110f7139 100644 --- a/addressbook/js/app.ts +++ b/addressbook/js/app.ts @@ -1363,17 +1363,6 @@ class AddressbookApp extends EgwApp app.status.makeCall(data); } - /** - * - * @param _action - * @param _selected - * @todo - */ - private videoconference_scheduleCall(_action, _selected) - { - - } - } app.classes.addressbook = AddressbookApp; diff --git a/addressbook/setup/setup.inc.php b/addressbook/setup/setup.inc.php index c82cfd9ae8..014ef7e8dc 100755 --- a/addressbook/setup/setup.inc.php +++ b/addressbook/setup/setup.inc.php @@ -47,6 +47,7 @@ $setup_info['addressbook']['hooks']['export_limit'] = 'addressbook_hooks::getApp $setup_info['addressbook']['hooks']['acl_rights'] = 'addressbook_hooks::acl_rights'; $setup_info['addressbook']['hooks']['categories'] = 'addressbook_hooks::categories'; $setup_info['addressbook']['hooks']['groupdav_root_props'] = 'addressbook_groupdav::groupdav_root_props'; +$setup_info['addressbook']['hooks']['status-get_actions'] = 'addressbook_hooks::status_get_actions'; /* Dependencies for this app to work */ $setup_info['addressbook']['depends'][] = array(