From: Jagadedes Date: Tue, 21 Oct 2014 10:28:53 +0000 (+0530) Subject: #29759 template take from db if override checked. updated template X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=851c37a82aeb80547face220edfd633078252458;p=com.zyxware.civiwci.git #29759 template take from db if override checked. updated template --- diff --git a/CRM/Wci/BAO/Widget.php b/CRM/Wci/BAO/Widget.php index 1d35044..4f6f0f4 100644 --- a/CRM/Wci/BAO/Widget.php +++ b/CRM/Wci/BAO/Widget.php @@ -154,8 +154,10 @@ class CRM_Wci_BAO_Widget extends CRM_Wci_DAO_Widget { $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); + $data["custom_template"] = $dao->custom_template; + $data["widgetId"] = $widgetId; + $data["override"] = $dao->override; } - return $data; } } diff --git a/CRM/Wci/Form/CreateWidget.php b/CRM/Wci/Form/CreateWidget.php index 0b8273a..4315bd5 100644 --- a/CRM/Wci/Form/CreateWidget.php +++ b/CRM/Wci/Form/CreateWidget.php @@ -228,7 +228,7 @@ where w.id=" . $this->_id; } else { /** Keep template in civicrm-wci/templates folder*/ - $output = file_get_contents('templates/CRM/Wci/Page/Widget.tpl',FILE_USE_INCLUDE_PATH); + $output = file_get_contents('templates/CRM/Wci/Page/wciwidget.tpl',FILE_USE_INCLUDE_PATH); $elem = $this->getElement('custom_template'); $elem->setValue($output); } diff --git a/extern/wciwidget.php b/extern/wciwidget.php index a44ea71..bf5500e 100644 --- a/extern/wciwidget.php +++ b/extern/wciwidget.php @@ -58,11 +58,17 @@ if (isset($embed) && (true == $embed)) { } else { $data = CRM_Wci_BAO_Widget::getWidgetData($widgetId); + $template->assign('wciform', $data); $template->assign('cpageId', $data['button_link_to']); - $template->template_dir[] = getWciWidgetTemplatePath(); - $wcidata = $template->fetch('wciwidget.tpl'); + if ($data["override"] == '0') { + $template->template_dir[] = getWciWidgetTemplatePath(); + $wcidata = $template->fetch('wciwidget.tpl'); + } else { + + $wcidata = $template->fetch('string:' . base64_decode($data['custom_template'])); + } $output = 'var wciwidgetcode = ' . json_encode($wcidata) . ';'; echo $output; diff --git a/templates/CRM/Wci/Form/CreateWidget.tpl b/templates/CRM/Wci/Form/CreateWidget.tpl index 52db603..943e826 100644 --- a/templates/CRM/Wci/Form/CreateWidget.tpl +++ b/templates/CRM/Wci/Form/CreateWidget.tpl @@ -21,8 +21,13 @@ $data = CRM_Wci_BAO_Widget::getWidgetData($wid_id); $template = CRM_Core_Smarty::singleton(); $template->assign('wciform', $data); - $template->template_dir[] = getWciWidgetTemplatePath(); - $wcidata = $template->fetch('wciwidget.tpl'); + if($data["override"] == 0) { + $template->template_dir[] = getWciWidgetTemplatePath(); + $wcidata = $template->fetch('wciwidget.tpl'); + } else { + echo "hi"; + $wcidata = $template->fetch('string:' . base64_decode($wid_page[$dao->id]['custom_template'])); + } $widget_controller_path = getWciWidgetControllerPath(); } {/php} @@ -50,7 +55,17 @@
- {include file="CRM/Wci/Page/wciwidget.tpl"} + {* {include file="CRM/Wci/Page/wciwidget.tpl"} *} + + + + +
+
{/if} diff --git a/templates/CRM/Wci/Page/wciwidget.tpl b/templates/CRM/Wci/Page/wciwidget.tpl index 84e63c6..7c3afeb 100644 --- a/templates/CRM/Wci/Page/wciwidget.tpl +++ b/templates/CRM/Wci/Page/wciwidget.tpl @@ -9,6 +9,9 @@ -khtml-border-radius: 4px; border-radius: 4px; border:1px solid #96C0E7; + background-color: {/literal}{$wciform.color_widget_bg}{literal}; /* background color */ + border-color:{/literal}{$wciform.color_border}{literal}; /* border color */ + background: {/literal}{if $wciform.image}url('{$wciform.image}'){/if}{literal}; /* background image */ } .crm-wci-widget.thin { @@ -32,7 +35,9 @@ -webkit-border-radius: 4px; -khtml-border-radius: 4px; border-radius: 4px; - } + color: {/literal}{$wciform.color_title}{literal}; + background-color: {/literal}{$wciform.color_title_bg}{literal}; + } /* title */ .crm-wci-widget .crm-amounts { height:1em; @@ -49,7 +54,7 @@ margin:0px 30%; text-align:center; } - .crm-wci-widget .crm-amount-bar { + .crm-wci-widget .crm-amount-bar { /* progress bar */ background-color:#FFF; width:100%; display:block; @@ -60,6 +65,9 @@ border-radius: 4px; margin-bottom:.8em; text-align:left; + + background-color:{/literal}{$wciform.color_bar}{literal}; + border-color:#CECECE; } .crm-wci-widget .crm-amount-fill { background-color:#2786C2; @@ -77,6 +85,7 @@ } .crm-wci-widget .crm-amount-raised { font-weight:bold; + color:#000; } .crm-wci-widget .crm-logo { @@ -88,6 +97,7 @@ .crm-wci-widget .crm-campaign { font-size:11px; margin-bottom:.8em; + color:{/literal}{$wciform.color_description}{literal} /* other color*/ } .crm-wci-widget .crm-wci-button { @@ -108,28 +118,9 @@ .crm-wci-widget .crm-home-url { text-decoration:none; border:0px; + color:{/literal}{$wciform.color_homepage_link}{literal} /* home page link color*/ } - - + {/literal} -
-
+
+
{if $wciform.logo_image}
-
-
-
+
+
+
-
+
-
+
-
+
{$wciform.description}
-