From dfc4c3775ee3a82b58f44c2dab9d4ef06cf0ee97 Mon Sep 17 00:00:00 2001 From: mDeflotte Date: Thu, 9 Feb 2012 17:02:07 +0000 Subject: [PATCH] [-] BO : Fix Bug #PSTEST-694 - Replace save button by a "return to dashboard" button --- controllers/admin/AdminEmailsController.php | 44 ++++++++++++++++----- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/controllers/admin/AdminEmailsController.php b/controllers/admin/AdminEmailsController.php index 500fe95cd..b4ec70b03 100644 --- a/controllers/admin/AdminEmailsController.php +++ b/controllers/admin/AdminEmailsController.php @@ -37,7 +37,7 @@ class AdminEmailsControllerCore extends AdminController foreach (Contact::getContacts($this->context->language->id) as $contact) $arr[] = array('email_message' => $contact['id_contact'], 'name' => $contact['name']); - $this->options = array( + $this->options = array( 'email' => array( 'title' => $this->l('E-mail'), 'icon' => 'email', @@ -47,23 +47,23 @@ class AdminEmailsControllerCore extends AdminController 'PS_MAIL_TYPE' => array('title' => '', 'validation' => 'isGenericName', 'type' => 'radio', 'required' => true, 'choices' => array(1 => $this->l('Send e-mail as HTML'), 2 => $this->l('Send e-mail as Text'), 3 => $this->l('Both'))), ), 'submit' => array() - ), - 'smtp' => array( + ), + 'smtp' => array( 'title' => $this->l('E-mail'), 'icon' => 'email', - 'top' => '
', + 'top' => '
', 'bottom' => '
', - 'fields' => array( + 'fields' => array( 'PS_MAIL_DOMAIN' => array('title' => $this->l('Mail domain:'), 'desc' => $this->l('Fully qualified domain name (keep it empty if you do not know)'), 'empty' => true, 'validation' => 'isUrl', 'size' => 30, 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL), 'PS_MAIL_SERVER' => array('title' => $this->l('SMTP server:'), 'desc' => $this->l('IP or server name (e.g., smtp.mydomain.com)'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL), 'PS_MAIL_USER' => array('title' => $this->l('SMTP user:'), 'desc' => $this->l('Leave blank if not applicable'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL), 'PS_MAIL_PASSWD' => array('title' => $this->l('SMTP password:'), 'desc' => $this->l('Leave blank if not applicable'), 'validation' => 'isAnything', 'size' => 30, 'type' => 'password', 'visibility' => Shop::CONTEXT_ALL, 'autocomplete' => false), 'PS_MAIL_SMTP_ENCRYPTION' => array('title' => $this->l('Encryption:'), 'desc' => $this->l('Use an encrypt protocol'), 'type' => 'select', 'cast' => 'strval', 'identifier' => 'mode', 'list' => array(array('mode' => 'off', 'name' => $this->l('None')), array('mode' => 'tls', 'name' => $this->l('TLS')), array('mode' => 'ssl', 'name' => $this->l('SSL'))), 'visibility' => Shop::CONTEXT_ALL), 'PS_MAIL_SMTP_PORT' => array('title' => $this->l('Port:'), 'desc' => $this->l('Number of port to use'), 'validation' => 'isInt', 'size' => 5, 'type' => 'text', 'cast' => 'intval', 'visibility' => Shop::CONTEXT_ALL), - ), - 'submit' => array() - ), - 'test' => array( + ), + 'submit' => array() + ), + 'test' => array( 'title' => $this->l('Test your e-mail configuration'), 'icon' => 'email', 'fields' => array( @@ -72,7 +72,31 @@ class AdminEmailsControllerCore extends AdminController 'bottom' => '

', ) - ); + ); + } + + /** + * AdminController::initContent() override + * @see AdminController::initContent() + */ + public function initContent() + { + $this->initToolbar(); + unset($this->toolbar_btn['save']); + + $back = $this->context->link->getAdminLink('AdminHome'); + + $this->toolbar_btn['back'] = array( + 'href' => $back, + 'desc' => $this->l('Back to dashboard') + ); + + $this->content .= $this->renderOptions(); + + $this->context->smarty->assign(array( + 'content' => $this->content, + 'url_post' => self::$currentIndex.'&token='.$this->token, + )); } public function beforeUpdateOptions()