From d6f51b170ac05576009bdd18ecb28c8729fe32de Mon Sep 17 00:00:00 2001 From: Jagadedes Date: Fri, 14 Nov 2014 15:41:17 +0530 Subject: [PATCH] Beta2 bug fixes. 31240, 31239, 31238, 31236, 31235, 31228 --- CRM/Wci/BAO/ProgressBar.php | 31 +++++++++------ CRM/Wci/BAO/Widget.php | 9 ++++- CRM/Wci/Form/CreateWidget.php | 7 ++-- CRM/Wci/Form/NewEmbedCode.php | 4 +- CRM/Wci/Page/ManageEmbedCode.php | 2 +- extern/embed.php | 5 +-- info.xml | 2 +- templates/CRM/Wci/Form/WCISettings.tpl | 1 + templates/CRM/Wci/Page/wciwidget.tpl | 53 +++++++++++++++++--------- 9 files changed, 70 insertions(+), 44 deletions(-) diff --git a/CRM/Wci/BAO/ProgressBar.php b/CRM/Wci/BAO/ProgressBar.php index 932ccd1..1177bd7 100644 --- a/CRM/Wci/BAO/ProgressBar.php +++ b/CRM/Wci/BAO/ProgressBar.php @@ -159,6 +159,7 @@ class CRM_Wci_BAO_ProgressBar extends CRM_Wci_DAO_ProgressBar { */ public static function getProgressbarPercentage($idPB) { $bp = 0; + $ga = 0; $query = "SELECT * FROM civicrm_wci_progress_bar where id=" . $idPB; $params = array(); $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_ProgressBar'); @@ -197,20 +198,26 @@ class CRM_Wci_BAO_ProgressBar extends CRM_Wci_DAO_ProgressBar { if (100 < $perc){ $perc = 100; } - return $perc; + return round($perc); } - public static function getProgressbarData($pbId) { - - $query = "SELECT * FROM civicrm_wci_progress_bar where id=".$pbId; - $params = array(); - - $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_Widget'); - - $pbData = array(); - while ($dao->fetch()) { - $pbData["starting_amount"] = $dao->starting_amount; - $pbData["goal_amount"] = $dao->goal_amount; + public static function getProgressbarData($pbId, &$pbData) { + if(0 != $pbId) { + $query = "SELECT * FROM civicrm_wci_progress_bar where id=".$pbId; + $params = array(); + + $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_Widget'); + + //$pbData = array(); + while ($dao->fetch()) { + $pbData["starting_amount"] = $dao->starting_amount; + $pbData["goal_amount"] = $dao->goal_amount; + } + $pbData["pb_percentage"] = CRM_Wci_BAO_ProgressBar::getProgressbarPercentage($pbId); + $pbData["no_pb"] = False; + } else { + $pbData["no_pb"] = True; } + return $pbData; } } diff --git a/CRM/Wci/BAO/Widget.php b/CRM/Wci/BAO/Widget.php index 06aada5..a0faff4 100644 --- a/CRM/Wci/BAO/Widget.php +++ b/CRM/Wci/BAO/Widget.php @@ -138,7 +138,12 @@ class CRM_Wci_BAO_Widget extends CRM_Wci_DAO_Widget { $data["title"] = $dao->title; $data["logo_image"] = $dao->logo_image; $data["image"] = $dao->image; - $data["button_title"] = $dao->button_title; + + (empty($dao->button_title)) ? $contrin_title = "Donate" : + $contrin_title = $dao->button_title; + + $data["button_title"] = $contrin_title; + $data["button_link_to"] = $dao->button_link_to; $data["progress_bar_id"] = $dao->progress_bar_id; $data["description"] = $dao->description; @@ -153,7 +158,7 @@ class CRM_Wci_BAO_Widget extends CRM_Wci_DAO_Widget { $data["color_button"] = $dao->color_button; $data["color_button_bg"] = $dao->color_button_bg; $data['style_rules'] = $dao->style_rules; - $data["pb_percentage"] = CRM_Wci_BAO_ProgressBar::getProgressbarPercentage($dao->progress_bar_id); + CRM_Wci_BAO_ProgressBar::getProgressbarData($dao->progress_bar_id, $data); $data["custom_template"] = $dao->custom_template; $data["widgetId"] = $widgetId; $data["override"] = $dao->override; diff --git a/CRM/Wci/Form/CreateWidget.php b/CRM/Wci/Form/CreateWidget.php index f1689a3..276d105 100644 --- a/CRM/Wci/Form/CreateWidget.php +++ b/CRM/Wci/Form/CreateWidget.php @@ -101,7 +101,7 @@ class CRM_Wci_Form_CreateWidget extends CRM_Core_Form { function buildQuickForm() { // add form elements - $this->add('text', 'title', ts('Title'),true)->setSize(45); + $this->add('text', 'title', ts('Title'),true, true)->setSize(45); $this->add('text', 'logo_image', ts('Logo image'))->setSize(45); $this->add('text', 'image', ts('Image'))->setSize(45); $this->add('select', 'button_link_to', ts('Contribution button'), getContributionPageOptions()); @@ -267,7 +267,7 @@ where w.id=" . $this->_id;*/ if (isset($this->_id)) { $sql = "UPDATE civicrm_wci_widget SET title = '". $title . "', logo_image = '" . $values['logo_image'] . "', image = '" - . $values['image'] . "', button_title = '" . $values['button_title'] + . $values['image'] . "', button_title = '" . $values['button_title'] . "', button_link_to = '" . $values['button_link_to'] . "', progress_bar_id = '" . $values['progress_bar'] . "', description = '" . str_replace("'", "''", $values['description']) @@ -353,6 +353,7 @@ where w.id=" . $this->_id;*/ return $options; } +/* function getContributionPageOptions() { $options = array( '' => ts('- select -'), @@ -365,7 +366,7 @@ where w.id=" . $this->_id;*/ return $options; } - +*/ function getGroupOptions() { $options = array( '' => ts('- select -'), diff --git a/CRM/Wci/Form/NewEmbedCode.php b/CRM/Wci/Form/NewEmbedCode.php index 793123f..c39820d 100644 --- a/CRM/Wci/Form/NewEmbedCode.php +++ b/CRM/Wci/Form/NewEmbedCode.php @@ -18,14 +18,14 @@ class CRM_Wci_Form_NewEmbedCode extends CRM_Core_Form { } function buildQuickForm() { - $this->add('text', 'title', ts('Title'),true)->setSize(45); + $this->add('text', 'title', ts('Title'),true, true)->setSize(45); // add form elements $this->add( 'select', // field type 'widget', // field name 'Widget', // field label $this->getWidgets(), // list of options - false // is required + true // is required ); $this->addButtons(array( array( diff --git a/CRM/Wci/Page/ManageEmbedCode.php b/CRM/Wci/Page/ManageEmbedCode.php index 67d7a38..af78d03 100644 --- a/CRM/Wci/Page/ManageEmbedCode.php +++ b/CRM/Wci/Page/ManageEmbedCode.php @@ -76,7 +76,7 @@ class CRM_Wci_Page_ManageEmbedCode extends CRM_Core_Page { self::$_actionLinks = array( CRM_Core_Action::UPDATE => array( - 'name' => ts('Edit'), + 'name' => ts('View and Edit'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'action=update&reset=1&id=%%id%%', 'title' => ts('Update'), diff --git a/extern/embed.php b/extern/embed.php index 0260f4d..8455adb 100644 --- a/extern/embed.php +++ b/extern/embed.php @@ -100,10 +100,7 @@ $preview = CRM_Utils_Request::retrieve('preview', 'Positive', CRM_Core_DAO::$_nu if (isset($format)) { $jsonvar .= $cpageId; } else { - $widData = CRM_Wci_BAO_Widget::getWidgetData($widgetId); - $pbData = CRM_Wci_BAO_ProgressBar::getProgressbarData($widData["progress_bar_id"]); - $data = array_merge($widData, $pbData); - + $data = CRM_Wci_BAO_Widget::getWidgetData($widgetId); $template->assign('wciform', $data); $template->assign('cpageId', $data['button_link_to']); $template->assign('preview', $preview); diff --git a/info.xml b/info.xml index 7086a8b..25b7e44 100644 --- a/info.xml +++ b/info.xml @@ -9,7 +9,7 @@ manoj.k@zyxware.com, jagadees.pillai@zyxware.com 2014-11-13 - 1.0-beta3 + 1.0-beta2 beta 4.2 diff --git a/templates/CRM/Wci/Form/WCISettings.tpl b/templates/CRM/Wci/Form/WCISettings.tpl index c87735a..09a74e0 100644 --- a/templates/CRM/Wci/Form/WCISettings.tpl +++ b/templates/CRM/Wci/Form/WCISettings.tpl @@ -10,6 +10,7 @@
{$form.$elementName.label}
{$form.$elementName.html}
+
This profile id will be used for newsletter signup. User's mail id will be added to this group when they click subscribe button.'
{/foreach} diff --git a/templates/CRM/Wci/Page/wciwidget.tpl b/templates/CRM/Wci/Page/wciwidget.tpl index e176a36..8fe8958 100644 --- a/templates/CRM/Wci/Page/wciwidget.tpl +++ b/templates/CRM/Wci/Page/wciwidget.tpl @@ -32,7 +32,7 @@ width: 250px; } - .crm-wci-widget h5 { + .crm-wci-widget-title { font-size:14px; padding:3px; margin: 0px; @@ -47,7 +47,10 @@ .crm-amounts { height:1em; - margin:.8em 0px; + /*margin:.8em 0px;*/ + margin-left: auto; + margin-right: auto; + width:98%; font-size:13px; } .crm-amount-low { @@ -62,16 +65,18 @@ } .crm-amount-bar { /* progress bar */ background-color:#FFF; - width:100%; + width:98%; display:block; border:1px solid #CECECE; -moz-border-radius: 4px; -webkit-border-radius: 4px; -khtml-border-radius: 4px; border-radius: 4px; + margin-top:.8em; margin-bottom:.8em; - text-align:left; - + /*text-align:left;*/ + margin-left: auto; + margin-right: auto; background-color: #FFFFFF; border-color:#CECECE; } @@ -176,29 +181,38 @@ {/if} {if $wciform.title } -
- {if $wciform.logo_image} - - {/if} {if (false == $wciform.hide_title)} +
+ {if $wciform.logo_image} + + {/if} {$wciform.title} +
+ {else} + {if $wciform.logo_image} +
+ +
+ {/if} {/if} -
{/if} - {if $wciform.image} -
- -
- {/if} - {if (false == $wciform.hide_pbcap)} + {if $wciform.image} +
+ +
+ {/if} + {if false == $wciform.no_pb} + {if (false == $wciform.hide_pbcap)}
${$wciform.goal_amount}
${$wciform.starting_amount}
{$wciform.pb_percentage}%
- {/if} + {/if}
@@ -207,6 +221,7 @@
{$wciform.description}
+ {/if}
{if $wciform.button_title && $cpageId} -- 2.25.1