From c1a7ee1fb9858d215b31f5ec25b5f2b3f7cd8fed Mon Sep 17 00:00:00 2001 From: Jagadedes Date: Fri, 7 Nov 2014 17:32:27 +0530 Subject: [PATCH] Beta I Bug fixes: #31066(Newsletter signup ability to change the button color and the text), #31069(2,3), #31064 --- CRM/Wci/BAO/Widget.php | 4 ++ CRM/Wci/DAO/Widget.php | 58 ++++++++++++++++++++++++++++ CRM/Wci/Form/CreateWidget.php | 46 ++++++++++++++++++++-- CRM/Wci/Form/ProgressBar.php | 2 +- addmore.js | 4 +- sql/install.sql | 5 +++ templates/CRM/Wci/Page/wciwidget.tpl | 14 +++++-- 7 files changed, 122 insertions(+), 11 deletions(-) diff --git a/CRM/Wci/BAO/Widget.php b/CRM/Wci/BAO/Widget.php index e881e0f..a21cdf9 100644 --- a/CRM/Wci/BAO/Widget.php +++ b/CRM/Wci/BAO/Widget.php @@ -163,6 +163,10 @@ class CRM_Wci_BAO_Widget extends CRM_Wci_DAO_Widget { $data["color_bar"] = $dao->color_progress_bar; $defProf = civicrm_api3('setting', 'getValue', array('group' => 'Wci Preference', 'name' => 'default_wci_profile')); $data["emailSignupGroupFormURL"] = CRM_Utils_System::baseCMSURL() . '/civicrm/profile/create?reset=1&gid=' . $defProf; + $data["color_btn_newsletter"] = $dao->color_btn_newsletter; + $data["color_btn_newsletter_bg"] = $dao->color_btn_newsletter_bg; + $data["newsletter_text"] = $dao->newsletter_text; + $data["color_newsletter_text"] = $dao->color_newsletter_text; } return $data; } diff --git a/CRM/Wci/DAO/Widget.php b/CRM/Wci/DAO/Widget.php index b00b42a..1f1f586 100644 --- a/CRM/Wci/DAO/Widget.php +++ b/CRM/Wci/DAO/Widget.php @@ -227,6 +227,35 @@ class CRM_Wci_DAO_Widget extends CRM_Core_DAO * @var string */ public $custom_template; + + /** + * Newsletter Button text color + * + * @var string + */ + public $color_btn_newsletter; + + /** + * Newsletter Button color + * + * @var string + */ + public $color_btn_newsletter_bg; + + /** + * Newsletter text + * + * @var string + */ + public $newsletter_text; + + /** + * Newsletter msg text color + * + * @var string + */ + public $color_newsletter_text; + function __construct() { $this->__table = 'civicrm_wci_widget'; @@ -417,6 +446,35 @@ class CRM_Wci_DAO_Widget extends CRM_Core_DAO 'title' => ts('Widget custom template', array('domain' => 'org.civicrm.wci')) , 'required' => false, ) , + + 'color_btn_newsletter' => array( + 'name' => 'color_btn_newsletter', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Newsletter Button text color', array('domain' => 'org.civicrm.wci')) , + 'required' => true, + 'maxlength' => 10, + ) , + 'color_btn_newsletter_bg' => array( + 'name' => 'color_btn_newsletter_bg', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Newsletter Button color', array('domain' => 'org.civicrm.wci')) , + 'required' => true, + 'maxlength' => 10, + ) , + 'newsletter_text' => array( + 'name' => 'newsletter_text', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Newsletter text', array('domain' => 'org.civicrm.wci')) , + 'required' => true, + 'maxlength' => 64, + ) , + 'color_newsletter_text' => array( + 'name' => 'color_newsletter_text', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Newsletter text color', array('domain' => 'org.civicrm.wci')) , + 'required' => true, + 'maxlength' => 10, + ) , ); } return self::$_fields; diff --git a/CRM/Wci/Form/CreateWidget.php b/CRM/Wci/Form/CreateWidget.php index 2e64992..585a149 100644 --- a/CRM/Wci/Form/CreateWidget.php +++ b/CRM/Wci/Form/CreateWidget.php @@ -58,13 +58,33 @@ class CRM_Wci_Form_CreateWidget extends CRM_Core_Form { 'color_button' => array(ts('Button text color'), 'text', FALSE, - '#000000', + '#FFFFFF', ), 'color_button_bg' => array(ts('Button background color'), 'text', FALSE, '#BF0F0F', ), + 'color_btn_newsletter' => array(ts('Newsletter Button text color'), + 'text', + FALSE, + '#FFFFFF', + ), + 'color_btn_newsletter_bg' => array(ts('Newsletter Button color'), + 'text', + FALSE, + '#BF0F0F', + ), + 'newsletter_text' => array(ts('Newsletter text'), + 'text', + FALSE, + 'Get the monthly newsletter', + ), + 'color_newsletter_text' => array(ts('Newsletter text color'), + 'text', + FALSE, + '#BF0F0F', + ), ); } @@ -184,6 +204,16 @@ where w.id=" . $this->_id;*/ 'hide_border' => $wid_page[$dao->id]['hide_border'])); $this->setDefaults(array( 'hide_pbcap' => $wid_page[$dao->id]['hide_pbcap'])); + + $this->setDefaults(array( + 'color_btn_newsletter' => $wid_page[$dao->id]['color_btn_newsletter'])); + $this->setDefaults(array( + 'color_btn_newsletter_bg' => $wid_page[$dao->id]['color_btn_newsletter_bg'])); + $this->setDefaults(array( + 'newsletter_text' => $wid_page[$dao->id]['newsletter_text'])); + $this->setDefaults(array( + 'color_newsletter_text' => $wid_page[$dao->id]['color_newsletter_text'])); + if(true == $wid_page[$dao->id]['override']) { $cust_templ = html_entity_decode($wid_page[$dao->id]['custom_template']); $this->setDefaults(array( @@ -260,6 +290,10 @@ where w.id=" . $this->_id;*/ . "', hide_title = '" . $hide_title . "', hide_border = '" . $hide_border . "', hide_pbcap = '" . $hide_pbcap + . "', color_btn_newsletter = '" . $values['color_btn_newsletter'] + . "', color_btn_newsletter_bg = '" . $values['color_btn_newsletter_bg'] + . "', newsletter_text = '" . $values['newsletter_text'] + . "', color_newsletter_text = '" . $values['color_newsletter_text'] . "', style_rules = '" . str_replace("'", "''", $values['style_rules']) . "', override = '" . $override . $quote . $coma . $cust_tmpl_col . $equals . $quote . $cust_tmpl . "' where id =" . $this->_id ; } @@ -268,7 +302,9 @@ where w.id=" . $this->_id;*/ button_title, button_link_to, progress_bar_id, description, email_signup_group_id, size_variant, color_title, color_title_bg, color_progress_bar, color_widget_bg, color_description, color_border, - color_button, color_button_bg, hide_title, hide_border, hide_pbcap, style_rules, override" . $coma . $cust_tmpl_col ." ) + color_button, color_button_bg, hide_title, hide_border, hide_pbcap, + color_btn_newsletter, color_btn_newsletter_bg, newsletter_text, color_newsletter_text, + style_rules, override" . $coma . $cust_tmpl_col ." ) VALUES ('" . $title . "','" . $values['logo_image'] . "','" . $values['image'] . "','" . $values['button_title'] . "','" . $values['button_link_to'] . "','" . $values['progress_bar'] . "','" . @@ -279,8 +315,10 @@ where w.id=" . $this->_id;*/ $values['color_widget_bg'] . "','" . $values['color_description'] . "','" . $values['color_border'] . "','" . $values['color_button'] . "','" . $values['color_button_bg'] . "','" . $hide_title . "','" . - $hide_border . "','" . $hide_pbcap . "','" - . str_replace("'", "''", $values['style_rules']) . "','" . + $hide_border . "','" . $hide_pbcap . "','" . + $values['color_btn_newsletter'] . "','" . $values['color_btn_newsletter_bg'] . "','" . + $values['newsletter_text'] . "','" . $values['color_newsletter_text'] . "','" . + str_replace("'", "''", $values['style_rules']) . "','" . $override . $quote . $coma . $quote . $cust_tmpl . "')"; } diff --git a/CRM/Wci/Form/ProgressBar.php b/CRM/Wci/Form/ProgressBar.php index ed38046..d6f58e1 100644 --- a/CRM/Wci/Form/ProgressBar.php +++ b/CRM/Wci/Form/ProgressBar.php @@ -116,7 +116,7 @@ class CRM_Wci_Form_ProgressBar extends CRM_Core_Form { $this->fillData(); - $this->addElement('link', 'addmore_link',' ', 'addmore', 'Add more'); + $this->addElement('link', 'addmore_link',' ', 'addmore', 'Add another contribution page'); $this->addButtons(array( array( diff --git a/addmore.js b/addmore.js index c6ce92e..0875b01 100644 --- a/addmore.js +++ b/addmore.js @@ -43,14 +43,14 @@ cj(function ( $ ) { c_page_sel.attr("name", "contribution_page_" + count); var id_section = "crm-section-con-" + count; - var sect_tag = "
"; + var sect_tag = "

"; $('#addmore_link').parent().parent().before(sect_tag); var id_content = "content_con-" + count; $('#' + id_section).append("
"); $('#' + id_content).append(c_page_sel); $('#' + id_content).append(' Remove'); - $('#' + id_section).append(""); id_section = "crm-section-per-" + count; sect_tag = "
"; diff --git a/sql/install.sql b/sql/install.sql index e921af8..86a0cd8 100644 --- a/sql/install.sql +++ b/sql/install.sql @@ -44,6 +44,11 @@ CREATE TABLE IF NOT EXISTS civicrm_wci_widget ( hide_title tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Hide title, if 1.', hide_border tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Hide widget border, if 1.', hide_pbcap tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Hide pb caption, if 1.', + color_btn_newsletter varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Newsletter Button text color', + color_btn_newsletter_bg varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Newsletter Button color', + newsletter_text varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Newsletter text', + color_newsletter_text varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Newsletter text color', + PRIMARY KEY (`id`), UNIQUE KEY `unique_wci_title` (`title`), CONSTRAINT FK_civicrm_wci_widget_progress_bar_id FOREIGN KEY (`progress_bar_id`) REFERENCES `civicrm_wci_progress_bar`(`id`) ON DELETE SET NULL diff --git a/templates/CRM/Wci/Page/wciwidget.tpl b/templates/CRM/Wci/Page/wciwidget.tpl index c68cc93..9bb909d 100644 --- a/templates/CRM/Wci/Page/wciwidget.tpl +++ b/templates/CRM/Wci/Page/wciwidget.tpl @@ -14,7 +14,6 @@ border: None; {/literal}{/if}{literal} background-color: {/literal}{$wciform.color_widget_bg}{literal}; /* background color */ - box-shadow: 3px 3px 6px; } .crm-wci-widget.thin { @@ -150,6 +149,13 @@ text-align: center; margin: 0 auto; } + input.btnNL, button.btnNL { + color:{/literal}{$wciform.color_btn_newsletter}{literal}; + background:{/literal}{$wciform.color_btn_newsletter_bg}{literal}; + } + #newsletter_msg { + color:{/literal}{$wciform.color_newsletter_text}{literal}; + }