'custom_template' => $cust_templ));
}
}
+ $widget_controller_path = getWciWidgetControllerPath();
+
$emb_code = "<script src=\"http://code.jquery.com/jquery-1.9.1.min.js\"></script>
-<script type=\"text/javascript\" src=\"http://localhost/F3/sites/all/modules/civicrm/extensions/civicrm-wci/extern/wciwidget.php?widgetId=" . $this->_id . "\"></script>";
+<script type=\"text/javascript\" src=\"" . $widget_controller_path . "?widgetId=" . $this->_id . "\"></script>
+$( document ).ready(function() {
+$('#widgetwci').html(wciwidgetcode);
+});
+</script>
+<div id='widgetwci'>
+</div>";
$this->getElement('embd_code')->setValue($emb_code);
}
else {
private $_id;
function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, NULL, 'REQUEST');
- CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.wci', 'F3/sites/all/modules/civicrm/extensions/civicrm-wci/addmore.js');
+ CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.wci', 'addmore.js');
parent::preProcess();
}
function fillData() {
*/
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';
$data = CRM_Wci_BAO_Widget::getWidgetData($widgetId);
$template->assign('wciform', $data);
- $template->template_dir[] = $_SERVER['DOCUMENT_ROOT'] . "/F3/sites/all/modules/civicrm/extensions/civicrm-wci/templates/CRM/Wci/Page";
+ $template->template_dir[] = getWciWidgetTemplatePath();
$wcidata = $template->fetch('wciwidget.tpl');
$output = 'var wciwidgetcode = ' . json_encode($wcidata) . ';';
echo $output;
$data = CRM_Wci_BAO_Widget::getWidgetData($wid_id);
$template = CRM_Core_Smarty::singleton();
$template->assign('wciform', $data);
- $template->template_dir[] = $_SERVER['DOCUMENT_ROOT'] . "/F3/sites/all/modules/civicrm/extensions/civicrm-wci/templates/CRM/Wci/Page";
+ $template->template_dir[] = getWciWidgetTemplatePath();
$wcidata = $template->fetch('wciwidget.tpl');
}
{/php}
return $options;
}
+
+ function getExtensionRootPath() {
+ return '//' . $_SERVER['SERVER_NAME'] . str_replace($_SERVER['DOCUMENT_ROOT'], '', __DIR__);
+ }
+
+ function getWciWidgetControllerPath() {
+ $widget_controller_path = getExtensionRootPath() . '/extern/wciwidget.php';
+
+ return $widget_controller_path;
+ }
+
+ function getWciWidgetTemplatePath() {
+ $widget_tpl_path = getExtensionRootPath() . '/templates/CRM/Wci/Page';
+
+ return $widget_tpl_path;
+ }
\ No newline at end of file