From e125b27e528dd0916e829b073a9010ff0b732917 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 3 Nov 2013 10:24:09 +0000 Subject: [PATCH] mail_wizard extending emailadmin_wizard, to allow regular users to use it --- mail/inc/class.mail_hooks.inc.php | 6 +++++ mail/inc/class.mail_ui.inc.php | 8 ++++++- mail/inc/class.mail_wizard.inc.php | 37 ++++++++++++++++++++++++++++++ mail/js/app.js | 13 ++++++++++- 4 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 mail/inc/class.mail_wizard.inc.php diff --git a/mail/inc/class.mail_hooks.inc.php b/mail/inc/class.mail_hooks.inc.php index e60341ef88..75bbbce6be 100644 --- a/mail/inc/class.mail_hooks.inc.php +++ b/mail/inc/class.mail_hooks.inc.php @@ -808,6 +808,12 @@ class mail_hooks $menu_title = lang('Preferences'); // ToDo: remove Preferences sub-menu from sidebox $file = array(); + // create account wizard + $file += array( + 'create new account' => "javascript:egw_openWindowCentered2('" . + egw::link('/index.php', array('menuaction' => 'mail.mail_wizard.add'), ''). + "','_blank',640,480,'yes')", + ); if($preferences->userDefinedAccounts || $preferences->userDefinedIdentities) { $linkData = array ( 'menuaction' => 'mail.mail_uipreferences.index', diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index e5f42bab93..4c283249bd 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -307,7 +307,13 @@ class mail_ui 'delete' => array( 'caption' => 'Delete Folder', 'onExecute' => 'javaScript:app.mail.mail_DeleteFolder' - ) + ), + 'edit_account' => array( + 'caption' => 'Edit account', + 'icon' => 'configure', + 'onExecute' => 'javaScript:app.mail.edit_account', + //'enableId' => '^\\d+$', // only show action on account itself + ), )); //error_log(__METHOD__.__LINE__.array2string($content)); if (empty($content[self::$nm_index]['filter2']) || empty($content[self::$nm_index]['search'])) $content[self::$nm_index]['filter2']='quick'; diff --git a/mail/inc/class.mail_wizard.inc.php b/mail/inc/class.mail_wizard.inc.php new file mode 100644 index 0000000000..880f4bdb45 --- /dev/null +++ b/mail/inc/class.mail_wizard.inc.php @@ -0,0 +1,37 @@ + + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +/** + * Wizard to create mail accounts + * + * Extends emailadmin_wizard to allow non-admins to use it. + */ +class mail_wizard extends emailadmin_wizard +{ + /** + * Prefix for callback names + */ + const APP_CLASS = 'mail.mail_wizard.'; + + /** + * Constructor + */ + public function __construct() + { + parent::__construct(); + + // need emailadmin's app.css file + egw_framework::includeCSS('emailadmin','app'); + + // and translations + translation::add_app('emailadmin'); + } +} \ No newline at end of file diff --git a/mail/js/app.js b/mail/js/app.js index 9fa20239a2..e2b16db9f5 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -1168,7 +1168,7 @@ app.mail = AppJS.extend( }, /** - * + * */ displayAttachment: function(tag_info, widget) { @@ -1946,4 +1946,15 @@ app.mail = AppJS.extend( request.sendRequest(); }, + /** + * Edit a mail account + * + * @param _action + * @param _senders - the representation of the tree leaf to be manipulated + */ + edit_account: function(_action, _senders) + { + var acc_id = parseInt(_senders[0].id); + this.egw.open_link('mail.mail_wizard.edit&acc_id='+acc_id, '_blank', '640x480'); + } });