From 94686b361f578b4f6c08ae9dd274fce36196e328 Mon Sep 17 00:00:00 2001 From: Manoj K Date: Mon, 15 Sep 2014 11:26:04 +0530 Subject: [PATCH] #29521 - Modified widget creation page url. Replaced textarea with WYSIWYG for field custom template. --- CRM/Wci/Form/CreateWidget.php | 30 ++++++++++++++++++++++++++---- xml/Menu/wci.xml | 10 ++-------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/CRM/Wci/Form/CreateWidget.php b/CRM/Wci/Form/CreateWidget.php index aa79a6f..351446b 100644 --- a/CRM/Wci/Form/CreateWidget.php +++ b/CRM/Wci/Form/CreateWidget.php @@ -9,9 +9,21 @@ require_once 'CRM/Core/Form.php'; */ class CRM_Wci_Form_CreateWidget extends CRM_Core_Form { + /** + * the widget id saved to the session for an update + * + * @var int + * @access protected + */ + protected $_id; + function preProcess() { parent::preProcess(); + $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', + $this, FALSE, NULL, 'REQUEST' + ); + $this->_colorFields = array('color_title' => array(ts('Title Text Color'), 'text', FALSE, @@ -60,6 +72,17 @@ class CRM_Wci_Form_CreateWidget extends CRM_Core_Form { ); } + function setDefaultValues() { + $defaults = array(); + + $defaults['size_variant'] = 'normal'; + foreach ($this->_colorFields as $name => $val) { + $defaults[$name] = $val[3]; + } + + return $defaults; + } + function buildQuickForm() { // add form elements @@ -69,7 +92,7 @@ class CRM_Wci_Form_CreateWidget extends CRM_Core_Form { $this->add('select', 'button_link_to', ts('Contribution button'), $this->getContributionPageOptions()); $this->add('text', 'button_title', ts('Contribution button title')); $this->add('select', 'progress_bar', ts('Progress bar'), array('' => '- select -')); - $this->add('textarea', 'description', ts('Description')); + $this->addWysiwyg('description', ts('Description'), ''); $this->add('select', 'email_signup_group_id', ts('Newsletter signup'), $this->getGroupOptions()); $this->add('select', 'size_variant', ts('Size variant'), $this->getSizeOptions()); foreach ($this->_colorFields as $name => $val) { @@ -82,7 +105,7 @@ class CRM_Wci_Form_CreateWidget extends CRM_Core_Form { } $this->add('textarea', 'style_rules', ts('Additional Style Rules')); $this->add('checkbox', 'override', ts('Override default template')); - $this->add('textarea', 'custom_template', ts('Custom template')); + $this->addWysiwyg('custom_template', ts('Custom template'), ''); $this->addButtons(array( array( 'type' => 'submit', @@ -107,7 +130,7 @@ class CRM_Wci_Form_CreateWidget extends CRM_Core_Form { '' => ts('- select -'), ); - $result = civicrm_api3('contribution_page', 'get'); + $result = civicrm_api3('contribution_page', 'get'); foreach ($result['values'] as $contribution_page) { $options[$contribution_page['id']] = $contribution_page['title']; } @@ -130,7 +153,6 @@ class CRM_Wci_Form_CreateWidget extends CRM_Core_Form { function getSizeOptions() { $options = array( - '' => ts('- select -'), 'thin' => ts('Thin'), 'normal' => ts('Normal'), 'wide' => ts('Wide'), diff --git a/xml/Menu/wci.xml b/xml/Menu/wci.xml index fe7787a..e1c7def 100644 --- a/xml/Menu/wci.xml +++ b/xml/Menu/wci.xml @@ -1,15 +1,9 @@ - civicrm/wci - CRM_Wci_Page_WCIDashboard - WCIDashboard - access CiviCRM - - - civicrm/wci/create-widget + civicrm/wci/widget/add CRM_Wci_Form_CreateWidget - CreateWidget + Create Widget access CiviCRM -- 2.25.1