--- /dev/null
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.4 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2013 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+*/
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2013
+ *
+ */
+
+class CRM_Wci_BAO_WidgetCache extends CRM_Wci_DAO_WidgetCache {
+
+ /**
+ * class constructor
+ */
+ function __construct() {
+ parent::__construct();
+ }
+
+ /**
+ * Function to create widget cache
+ * takes an associative array
+ *
+ * This function is invoked from within the web form layer and also from the api layer
+ *
+ * @param array $params (reference ) an assoc array of name/value pairs
+ *
+ * @return object CRM_Wci_BAO_WidgetCache object
+ * @access public
+ * @static
+ */
+ static function create(array $params) {
+
+ // check required params
+ if (!self::dataExists($params)) {
+ CRM_Core_Error::fatal('Not enough data to create a progress bar formula entry.');
+ }
+
+ $widget_cache = new CRM_Wci_BAO_WidgetCache();
+ $widget_cache->copyValues($params);
+
+ $widget_cache->save();
+
+ return $widget_cache;
+ }
+
+ /**
+ * Get a list of Widgets matching the params, where params keys are column
+ * names of civicrm_wci_widget.
+ *
+ * @param array $params
+ * @return array of CRM_Wci_BAO_ProgressBarFormula objects
+ */
+ static function retrieve(array $params) {
+ $result = array();
+
+ $widget_cache = new CRM_Wci_BAO_WidgetCache();
+ $widget_cache->copyValues($params);
+ $widget_cache->find();
+
+ while ($widget_cache->fetch()) {
+ $result[(int) $widget_cache->id] = clone $widget_cache;
+ }
+
+ $widget_cache->free();
+
+ return $result;
+ }
+
+ /**
+ * Wrapper method for retrieve
+ *
+ * @param mixed $id Int or int-like string representing widget ID
+ * @return CRM_Wci_BAO_ProgressBarFormula
+ */
+ static function retrieveByID($id) {
+ if (!is_int($id) && !ctype_digit($id)) {
+ CRM_Core_Error::fatal(__CLASS__ . '::' . __FUNCTION__ . ' expects an integer.');
+ }
+ $id = (int) $id;
+
+ $widget_cache = self::retrieve(array('id' => $id));
+
+ if (!array_key_exists($id, $widget_cache)) {
+ CRM_Core_Error::fatal("No formula entry with ID $id exists.");
+ }
+
+ return $widget_cache[$id];
+ }
+
+ public static function setWidgetCache($widgetId, $code) {
+ $query = "DELETE from civicrm_wci_widget_cache WHERE widget_id = %1";
+ CRM_Core_DAO::executeQuery($query, array(1=>array($widgetId, 'Integer')),
+ TRUE, 'CRM_Wci_DAO_WidgetCache');
+
+ $query = "INSERT into civicrm_wci_widget_cache (widget_id, widget_code) VALUES (%1, %2)";
+ $params = array(1=>array($widgetId, 'Integer'),
+ 2=>array($code, 'String'),);
+ CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_WidgetCache');
+ }
+ public static function getCurrentTsDiff($widgetId) {
+ $tsDiff = 0;
+ $query = "SELECT TIMESTAMPDIFF(MINUTE, `ts`, NOW()) as tsDiff FROM
+ civicrm_wci_widget_cache where widget_id = %1";
+ $dao = CRM_Core_DAO::executeQuery($query, array(1=>array($widgetId, 'Integer')),
+ TRUE, 'CRM_Wci_DAO_WidgetCache');
+ if ($dao->fetch()) {
+ $tsDiff = $dao->tsDiff;
+ } else {
+ $tsDiff = PHP_INT_MAX;
+ }
+ return $tsDiff;
+ }
+
+ public static function getWidgetCache($widgetId) {
+ $code = "";
+ $query = "SELECT widget_code FROM civicrm_wci_widget_cache where widget_id = %1";
+ $dao = CRM_Core_DAO::executeQuery($query, array(1=>array($widgetId, 'Integer')),
+ TRUE, 'CRM_Wci_DAO_WidgetCache');
+ if ($dao->fetch()) {
+ $code = $dao->widget_code;
+ }
+ return $code;
+ }
+}
--- /dev/null
+<?php
+/*
++--------------------------------------------------------------------+
+| CiviCRM version 4.4 |
++--------------------------------------------------------------------+
+| Copyright CiviCRM LLC (c) 2004-2013 |
++--------------------------------------------------------------------+
+| This file is a part of CiviCRM. |
+| |
+| CiviCRM is free software; you can copy, modify, and distribute it |
+| under the terms of the GNU Affero General Public License |
+| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+| |
+| CiviCRM is distributed in the hope that it will be useful, but |
+| WITHOUT ANY WARRANTY; without even the implied warranty of |
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+| See the GNU Affero General Public License for more details. |
+| |
+| You should have received a copy of the GNU Affero General Public |
+| License and the CiviCRM Licensing Exception along |
+| with this program; if not, contact CiviCRM LLC |
+| at info[AT]civicrm[DOT]org. If you have questions about the |
+| GNU Affero General Public License or the licensing of CiviCRM, |
+| see the CiviCRM license FAQ at http://civicrm.org/licensing |
++--------------------------------------------------------------------+
+*/
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2013
+ */
+class CRM_Wci_DAO_WidgetCache extends CRM_Core_DAO
+{
+ /**
+ * static instance to hold the table name
+ *
+ * @var string
+ * @static
+ */
+ static $_tableName = 'civicrm_wci_widget_cache';
+ /**
+ * static instance to hold the field values
+ *
+ * @var array
+ * @static
+ */
+ static $_fields = null;
+ /**
+ * static instance to hold the keys used in $_fields for each field.
+ *
+ * @var array
+ * @static
+ */
+ static $_fieldKeys = null;
+ /**
+ * static instance to hold the FK relationships
+ *
+ * @var string
+ * @static
+ */
+ static $_links = null;
+ /**
+ * static instance to hold the values that can
+ * be imported
+ *
+ * @var array
+ * @static
+ */
+ static $_import = null;
+ /**
+ * static instance to hold the values that can
+ * be exported
+ *
+ * @var array
+ * @static
+ */
+ static $_export = null;
+ /**
+ * static value to see if we should log any modifications to
+ * this table in the civicrm_log table
+ *
+ * @var boolean
+ * @static
+ */
+ static $_log = true;
+ /**
+ * cache id
+ *
+ * @var int unsigned
+ */
+ public $id;
+ /**
+ * widget code
+ *
+ * @var string
+ */
+ public $widget_code;
+ /**
+ * widget id
+ *
+ * @var float
+ */
+ public $widget_id;
+ /**
+ * time stamp
+ *
+ * @var float
+ */
+ public $ts;
+
+ function __construct()
+ {
+ $this->__table = 'civicrm_wci_widget_cache';
+ parent::__construct();
+ }
+ /**
+ * return foreign keys and entity references
+ *
+ * @static
+ * @access public
+ * @return array of CRM_Core_EntityReference
+ */
+ static function getReferenceColumns()
+ {
+ return self::$_links;
+ }
+ /**
+ * returns all the column names of this table
+ *
+ * @access public
+ * @return array
+ */
+ static function &fields()
+ {
+ if (!(self::$_fields)) {
+ self::$_fields = array(
+ 'widget_cache_id' => array(
+ 'name' => 'id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'title' => ts('cahce Id', array('domain' => 'org.civicrm.wci')) ,
+ 'required' => true,
+ ) ,
+ 'widget_id' => array(
+ 'name' => 'widget_id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'required' => false,
+ ) ,
+ 'widget_code' => array(
+ 'name' => 'widget_code',
+ 'type' => CRM_Utils_Type::T_TEXT,
+ 'title' => ts('widget code', array('domain' => 'org.civicrm.wci')) ,
+ 'required' => false,
+ ) ,
+ 'ts' => array(
+ 'name' => 'ts',
+ 'type' => CRM_Utils_Type::T_TIMESTAMP,
+ 'title' => ts('timestamp', array('domain' => 'org.civicrm.wci')) ,
+ 'required' => false,
+ 'maxlength' => 64,
+ ) ,
+
+
+ );
+ }
+ return self::$_fields;
+ }
+ /**
+ * Returns an array containing, for each field, the arary key used for that
+ * field in self::$_fields.
+ *
+ * @access public
+ * @return array
+ */
+ static function &fieldKeys()
+ {
+ if (!(self::$_fieldKeys)) {
+ self::$_fieldKeys = array(
+ 'id' => 'widget_cache_id',
+ 'widget_id' => 'widget_id',
+ 'widget_code' => 'widget_code',
+ 'ts' => 'ts',
+ );
+ }
+ return self::$_fieldKeys;
+ }
+ /**
+ * returns the names of this table
+ *
+ * @access public
+ * @static
+ * @return string
+ */
+ static function getTableName()
+ {
+ return self::$_tableName;
+ }
+ /**
+ * returns if this table needs to be logged
+ *
+ * @access public
+ * @return boolean
+ */
+ function getLog()
+ {
+ return self::$_log;
+ }
+ /**
+ * returns the list of fields that can be imported
+ *
+ * @access public
+ * return array
+ * @static
+ */
+ static function &import($prefix = false)
+ {
+ if (!(self::$_import)) {
+ self::$_import = array();
+ $fields = self::fields();
+ foreach($fields as $name => $field) {
+ if (CRM_Utils_Array::value('import', $field)) {
+ if ($prefix) {
+ self::$_import['wci_progress_bar'] = & $fields[$name];
+ } else {
+ self::$_import[$name] = & $fields[$name];
+ }
+ }
+ }
+ }
+ return self::$_import;
+ }
+ /**
+ * returns the list of fields that can be exported
+ *
+ * @access public
+ * return array
+ * @static
+ */
+ static function &export($prefix = false)
+ {
+ if (!(self::$_export)) {
+ self::$_export = array();
+ $fields = self::fields();
+ foreach($fields as $name => $field) {
+ if (CRM_Utils_Array::value('export', $field)) {
+ if ($prefix) {
+ self::$_export['wci_progress_bar'] = & $fields[$name];
+ } else {
+ self::$_export[$name] = & $fields[$name];
+ }
+ }
+ }
+ }
+ return self::$_export;
+ }
+}
);*/
$this->add('text', 'default_profile', ts('Default profile'),true)->setSize(45);
+ $this->add('text', 'widget_cache_timeout', ts('Widget cache timeout'),true)->setSize(45);
$this->addButtons(array(
array(
'type' => 'submit',
),
));
- $widgetId = civicrm_api3('setting', 'getValue', array('group' => 'Wci Preference', 'name' => 'default_wci_widget'));
+ $cacheTime = civicrm_api3('setting', 'getValue', array('group' => 'Wci Preference', 'name' => 'widget_cache_timeout'));
$defProf = civicrm_api3('setting', 'getValue', array('group' => 'Wci Preference', 'name' => 'default_wci_profile'));
/*$this->setDefaults(array(
'default_widget' => $widgetId));*/
$this->setDefaults(array(
'default_profile' => $defProf));
+ $this->setDefaults(array(
+ 'widget_cache_timeout' => $cacheTime));
+
// export form elements
$this->assign('elementNames', $this->getRenderableElementNames());
$values = $this->exportValues();
/*civicrm_api3('setting', 'create', array('domain_id' => 1, 'default_wci_widget' => $values['default_widget'],));*/
civicrm_api3('setting', 'create', array('domain_id' => 1, 'default_wci_profile' => $values['default_profile'],));
+ civicrm_api3('setting', 'create', array('domain_id' => 1, 'widget_cache_timeout' => $values['widget_cache_timeout'],));
CRM_Core_Session::setStatus(ts('Widget settings are saved to database'), '', 'success');
parent::postProcess();
}
return TRUE;
}
+ public function upgrade_1001() {
+ $this->ctx->log->info('Applying update 1001');
+ CRM_Core_DAO::executeQuery('
+ CREATE TABLE IF NOT EXISTS civicrm_wci_widget_cache (
+ id int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT "cache Id.",
+ widget_id int(10) unsigned DEFAULT NULL COMMENT "widget id.",
+ widget_code text DEFAULT NULL COMMENT "Widget code.",
+ ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
+ ');
+ return TRUE;
+ }
/**
* Example: Run an external SQL script
--- /dev/null
+<?php
+require_once '../wci-helper-functions.php';
+
+class CRM_Wci_WidgetCode {
+
+ static function get_widget_realtime_code($widgetId) {
+ $data = CRM_Wci_BAO_Widget::getWidgetData($widgetId);
+ $template = CRM_Core_Smarty::singleton();
+ $template->assign('wciform', $data);
+ $template->assign('cpageId', $data['button_link_to']);
+// $template->assign('preview', $preview);
+
+ if ($data["override"] == '0') {
+ $template->template_dir[] = getWciWidgetTemplatePath();
+ $wcidata = $template->fetch('wciwidget.tpl');
+ } else {
+ $wcidata = $template->fetch('string:' . html_entity_decode($data['custom_template']));
+ }
+ $code = json_encode($wcidata);
+ CRM_Wci_BAO_WidgetCache::setWidgetCache($widgetId, $code);
+ return $code;
+ }
+
+ static function get_widget_code($embedId, $preview=0) {
+
+ if($preview) {
+ /**On preview time controller is called from create widget
+ form so id will be widget id */
+ $code = CRM_Wci_WidgetCode::get_widget_realtime_code($embedId);
+ } else {
+ $widgetId = CRM_Wci_BAO_EmbedCode::getWidgetId($embedId);
+ $code = CRM_Wci_BAO_WidgetCache::getWidgetCache($widgetId);
+
+ $tsDiff = CRM_Wci_BAO_WidgetCache::getCurrentTsDiff($widgetId);
+ $cacheTime = civicrm_api3('setting', 'getValue',
+ array('group' => 'Wci Preference', 'name' => 'widget_cache_timeout'));
+ if(($tsDiff > $cacheTime)||(empty($code))) {
+ $code = CRM_Wci_WidgetCode::get_widget_realtime_code($widgetId);
+ }
+ }
+ return $code;
+ }
+}
+
*/
require_once '../../../civicrm.config.php';
-require_once '../wci-helper-functions.php';
-require_once 'CRM/Core/Config.php';
-require_once 'CRM/Contribute/BAO/Widget.php';
-require_once 'CRM/Utils/Request.php';
-$wciembed_js = '// Cleanup functions for the document ready method
+$wciembed_js = '
+/*
+ @licstart The following is the entire license notice for the
+ JavaScript code in this page.
+
+ Copyright (C) 2014 Zyxware Technologies
+
+ The JavaScript code in this page is free software: you can
+ redistribute it and/or modify it under the terms of the GNU Affero
+ General Public License (GNU AGPL) as published by the Free Software
+ Foundation, either version 3 of the License, or (at your option)
+ any later version. The code is distributed WITHOUT ANY WARRANTY;
+ without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ @licend The above is the entire license notice
+ for the JavaScript code in this page.
+ */
+
+// Cleanup functions for the document ready method
if ( document.addEventListener ) {
DOMContentLoaded = function() {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
}';
$config = CRM_Core_Config::singleton();
-$template = CRM_Core_Smarty::singleton();
-$widgetId = CRM_Utils_Request::retrieve('widgetId', 'Positive', CRM_Core_DAO::$_nullObject);
-if(empty($widgetId)) {
- $embed = CRM_Utils_Request::retrieve('id', 'Positive', CRM_Core_DAO::$_nullObject);
- $widgetId = CRM_Wci_BAO_EmbedCode::getWidgetId($embed);
-
- if(empty($widgetId)) {
- $widgetId = civicrm_api3('setting', 'getValue', array('group' => 'Wci Preference', 'name' => 'default_wci_widget'));
- }
-}
+$embedId = CRM_Utils_Request::retrieve('id', 'Positive', CRM_Core_DAO::$_nullObject);
$preview = CRM_Utils_Request::retrieve('preview', 'Positive', CRM_Core_DAO::$_nullObject);
+$output = 'var wciwidgetcode = ' . CRM_Wci_WidgetCode::get_widget_code($embedId, $preview) . ';';
-if (isset($format)) {
- $jsonvar .= $cpageId;
-} else {
- $data = CRM_Wci_BAO_Widget::getWidgetData($widgetId);
- $template->assign('wciform', $data);
- $template->assign('cpageId', $data['button_link_to']);
- $template->assign('preview', $preview);
-
- if ($data["override"] == '0') {
- $template->template_dir[] = getWciWidgetTemplatePath();
- $wcidata = $template->fetch('wciwidget.tpl');
- } else {
- $wcidata = $template->fetch('string:' . html_entity_decode($data['custom_template']));
- }
- $output = 'var wciwidgetcode = ' . json_encode($wcidata) . ';';
-
- $output = $output . $wciembed_js;
- echo $output;
-}
+$output = $output . $wciembed_js;
+echo $output;
CRM_Utils_System::civiExit();
+++ /dev/null
-// Cleanup functions for the document ready method
-if ( document.addEventListener ) {
- DOMContentLoaded = function() {
- document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
- onReady();
- };
-} else if ( document.attachEvent ) {
- DOMContentLoaded = function() {
- // Make sure body exists, at least, in case IE gets a little overzealous
- if ( document.readyState === "complete" ) {
- document.detachEvent( "onreadystatechange", DOMContentLoaded );
- onReady();
- }
- };
-}
-if ( document.readyState === "complete" ) {
- // Handle it asynchronously to allow scripts the opportunity to delay ready
- setTimeout( onReady, 1 );
-}
-
-// Mozilla, Opera and webkit support this event
-if ( document.addEventListener ) {
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
- // A fallback to window.onload, that will always work
- window.addEventListener( "load", onReady, false );
- // If IE event model is used
-} else if ( document.attachEvent ) {
- // ensure firing before onload,
- // maybe late but safe also for iframes
- document.attachEvent("onreadystatechange", DOMContentLoaded);
-
- // A fallback to window.onload, that will always work
- window.attachEvent( "onload", onReady );
-}
-
-function onReady( ) {
- document.getElementById('widgetwci').innerHTML = wciwidgetcode;
-}
\ No newline at end of file
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
- * $Id$
- */
-
-
-/*
-<script type="text/javascript" src="http://drupal.local/sites/all/modules/civicrm/extensions/civicrm-wci/extern/wciwidget.php?widgetId=1"></script>
-*/
-
-require_once '../../../civicrm.config.php';
-require_once '../wci-helper-functions.php';
-require_once 'CRM/Core/Config.php';
-require_once 'CRM/Contribute/BAO/Widget.php';
-require_once 'CRM/Utils/Request.php';
-
-$config = CRM_Core_Config::singleton();
-$template = CRM_Core_Smarty::singleton();
-
-$widgetId = CRM_Utils_Request::retrieve('id', 'Positive', CRM_Core_DAO::$_nullObject);
-if(empty($widgetId)) {
- $widgetId = civicrm_api3('setting', 'getValue', array('group' => 'Wci Preference', 'name' => 'default_wci_widget'));
-}
-$embed = CRM_Utils_Request::retrieve('embed', 'Positive', CRM_Core_DAO::$_nullObject);
-
-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);
-
- $template->assign('wciform', $data);
- $template->assign('cpageId', $data['button_link_to']);
- $template->assign('embed', $embed);
-
- if ($data["override"] == '0') {
- $template->template_dir[] = getWciWidgetTemplatePath();
- $wcidata = $template->fetch('wciwidget.tpl');
- } else {
- $wcidata = $template->fetch('string:' . html_entity_decode($data['custom_template']));
- }
- $output = 'var wciwidgetcode = ' . json_encode($wcidata) . ';';
-
- $wciembed = file_get_contents('wciembed.js',FILE_USE_INCLUDE_PATH);
- $output = $output . $wciembed;
- echo $output;
-}
-
-CRM_Utils_System::civiExit();
'description' => 'Default profile id',
'help_text' => 'Sets default profile id',
),
+ 'widget_cache_timeout' => array(
+ 'group_name' => 'Wci Preference',
+ 'group' => 'wci',
+ 'name' => 'widget_cache_timeout',
+ 'type' => 'Integer',
+ 'default' => 0,
+ 'add' => '4.3',
+ 'is_domain' => 1,
+ 'is_contact' => 0,
+ 'description' => 'widget timeout',
+ 'help_text' => 'widget timeout',
+ ),
);
PRIMARY KEY (`id`),
UNIQUE KEY `unique_wci_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
+
+-- WCI widget cache.
+CREATE TABLE IF NOT EXISTS civicrm_wci_widget_cache (
+ id int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'cache Id.',
+ widget_id int(10) unsigned DEFAULT NULL COMMENT 'widget id.',
+ widget_code text DEFAULT NULL COMMENT 'Widget code.',
+ ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
{if $form.title.value != ""}
{php}
if(isset($_REQUEST['id'])) {
- $wid_id = $_REQUEST['id'];
+ /*$wid_id = $_REQUEST['id'];
$data = CRM_Wci_BAO_Widget::getWidgetData($wid_id);
$template = CRM_Core_Smarty::singleton();
$template->assign('wciform', $data);
$wcidata = $template->fetch('wciwidget.tpl');
} else {
$wcidata = $template->fetch('string:' . $wid_page[$dao->id]['custom_template']);
- }
+ }*/
$widget_controller_path = getWciWidgetControllerPath();
$extension_root_path = getExtensionRootPath();
}
<div class="description">
Click <strong>Save & Preview</strong> to save any changes to your settings, and preview the widget again on this page.
</div>
- <script type="text/javascript" src="{php}echo $widget_controller_path;{/php}?widgetId={php}echo $wid_id;{/php}&preview=1&referalid=2442"></script></script>
+<!-- <script type="text/javascript" src="{php}echo $widget_controller_path;{/php}?widgetId={php}echo $wid_id;{/php}&preview=1&referalid=2442"></script></script> -->
+ <script type="text/javascript" src="{php}echo $widget_controller_path;{/php}?id={php}echo $_REQUEST['id'];{/php}&preview=1&referalid=2442"></script></script>
<div id='widgetwci'></div>
</div>
<!-- <div class="col2">
{foreach from=$elementNames item=elementName}
<div class="crm-section">
<div class="label">{$form.$elementName.label}</div>
- <div class="content">{$form.$elementName.html}</div>
- <div class="content"><small>This profile id will be used for newsletter signup. User's mail id will be added to this group when they click subscribe button.'<small></div>
+ <div class="content">{$form.$elementName.html} {if "widget_cache_timeout" == $form.$elementName.id} Minutes{/if}</div>
+{if "default_profile" == $form.$elementName.id}
+ <div class="content"><small>This profile id will be used for newsletter signup. User's mail id will be added to this group when they click subscribe button.'</small></div>
+{/if}
+{if "widget_cache_timeout" == $form.$elementName.id}
+ <div class="content"><small>Cache will be cleared after specified minites.</small></div>
+{/if}
<div class="clear"></div>
</div>
{/foreach}