From 13e70378f26269e439b759aee47f0c9471e15d5b Mon Sep 17 00:00:00 2001 From: Jagadedes Date: Mon, 10 Nov 2014 17:25:11 +0530 Subject: [PATCH] #31101 Decouple widgets and embed code --- CRM/Wci/BAO/EmbedCode.php | 149 +++++++++++++ CRM/Wci/BAO/Widget.php | 20 ++ CRM/Wci/DAO/NewEmbedCode.php | 240 +++++++++++++++++++++ CRM/Wci/Form/NewEmbedCode.php | 132 ++++++++++++ CRM/Wci/Page/ManageEmbedCode.php | 98 +++++++++ extern/embed.php | 84 ++++++++ extern/wciwidget.php | 2 +- sql/install.sql | 9 + templates/CRM/Wci/Form/CreateWidget.tpl | 6 +- templates/CRM/Wci/Form/NewEmbedCode.tpl | 72 +++++++ templates/CRM/Wci/Page/ManageEmbedCode.tpl | 80 +++++++ wci-helper-functions.php | 2 +- wci.php | 28 ++- xml/Menu/wci.xml | 12 ++ 14 files changed, 927 insertions(+), 7 deletions(-) create mode 100644 CRM/Wci/BAO/EmbedCode.php create mode 100644 CRM/Wci/DAO/NewEmbedCode.php create mode 100644 CRM/Wci/Form/NewEmbedCode.php create mode 100644 CRM/Wci/Page/ManageEmbedCode.php create mode 100644 extern/embed.php create mode 100644 templates/CRM/Wci/Form/NewEmbedCode.tpl create mode 100644 templates/CRM/Wci/Page/ManageEmbedCode.tpl diff --git a/CRM/Wci/BAO/EmbedCode.php b/CRM/Wci/BAO/EmbedCode.php new file mode 100644 index 0000000..e20c6d9 --- /dev/null +++ b/CRM/Wci/BAO/EmbedCode.php @@ -0,0 +1,149 @@ +copyValues($params); + + $embed_code->save(); + + return $embed_code; + } + + /** + * 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(); + + $progress_bar_formula = new CRM_Wci_BAO_ProgressBarFormula(); + $progress_bar_formula->copyValues($params); + $progress_bar_formula->find(); + + while ($progress_bar_formula->fetch()) { + $result[(int) $progress_bar_formula->id] = clone $progress_bar_formula; + } + + $progress_bar_formula->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; + + $embed_code = self::retrieve(array('id' => $id)); + + if (!array_key_exists($id, $embed_code)) { + CRM_Core_Error::fatal("No formula entry with ID $id exists."); + } + + return $embed_code[$id]; + } + + /** + * Check if there is absolute minimum of data to add the object + * + * @param array $params (reference ) an assoc array of name/value pairs + * + * @return boolean + * @access public + */ + public static function dataExists($params) { + if (CRM_Utils_Array::value('contribution_page_id', $params) && CRM_Utils_Array::value('progress_bar_id', $params)) { + return TRUE; + } + return FALSE; + } + + /** + * Returns widget id for the embed code + * Fields : id + * @return widget id + * @access public + */ + public static function getWidgetId($embed_id) { + + $widgetId = 0; + $query = "SELECT * FROM civicrm_wci_embed_code where id=".$embed_id; + $params = array(); + $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_EmbedCode'); + if ($dao->fetch()) { + $widgetId = $dao->widget_id; + } + + return $widgetId; + } +} diff --git a/CRM/Wci/BAO/Widget.php b/CRM/Wci/BAO/Widget.php index a21cdf9..06aada5 100644 --- a/CRM/Wci/BAO/Widget.php +++ b/CRM/Wci/BAO/Widget.php @@ -170,4 +170,24 @@ class CRM_Wci_BAO_Widget extends CRM_Wci_DAO_Widget { } return $data; } + /** + * Returns array of widgets + * Fields : id, name + * @return widget array + * @access public + */ + public static function getWidgetList() { + $query = "SELECT * FROM civicrm_wci_widget"; + $params = array(); + $widgList = array(); + + $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_Widget'); + + while ($dao->fetch()) { + $widgList[$dao->id] = array(); + CRM_Core_DAO::storeValues($dao, $widgList[$dao->id]); + } + + return $widgList; + } } diff --git a/CRM/Wci/DAO/NewEmbedCode.php b/CRM/Wci/DAO/NewEmbedCode.php new file mode 100644 index 0000000..88a1412 --- /dev/null +++ b/CRM/Wci/DAO/NewEmbedCode.php @@ -0,0 +1,240 @@ +__table = 'civicrm_wci_embed_code'; + 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( + 'embed_code_id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('WCI embed code Id', array('domain' => 'org.civicrm.wci')) , + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('embed cide Name', array('domain' => 'org.civicrm.wci')) , + 'required' => true, + 'maxlength' => 64, + ) , + 'widget_id' => array( + 'name' => 'widget_id', + 'type' => CRM_Utils_Type::T_INT, + 'required' => false, + ) , + ); + } + 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' => 'progress_bar_id', + 'name' => 'name', + 'widget_id' => 'widget_id', + ); + } + 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; + } +} diff --git a/CRM/Wci/Form/NewEmbedCode.php b/CRM/Wci/Form/NewEmbedCode.php new file mode 100644 index 0000000..7d8372d --- /dev/null +++ b/CRM/Wci/Form/NewEmbedCode.php @@ -0,0 +1,132 @@ +_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, + FALSE, NULL, 'REQUEST' ); + } + + function buildQuickForm() { + $this->add('text', 'title', ts('Title'),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 + ); + $this->addButtons(array( + array( + 'type' => 'submit', + 'name' => ts('Save'), + 'isDefault' => TRUE, + ), + array( + 'type' => 'next', + 'name' => ts('Save & Preview'), + ), + )); + + if (isset($this->_id)) { + $query = "SELECT * FROM civicrm_wci_embed_code WHERE id=" . $this->_id; + $params = array(); + + $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_EmbedCode'); + + while ($dao->fetch()) { + + $emb_code[$dao->id] = array(); + CRM_Core_DAO::storeValues($dao, $emb_code[$dao->id]); + + $this->setDefaults(array( + 'title' => $emb_code[$dao->id]['name'])); + $this->setDefaults(array( + 'widget' => $emb_code[$dao->id]['widget_id'])); + } + CRM_Utils_System::setTitle(ts('Edit embed code')); + } + else { + CRM_Utils_System::setTitle(ts('New embed code')); + } + // export form elements + $this->assign('elementNames', $this->getRenderableElementNames()); + parent::buildQuickForm(); + } + + function postProcess() { + $values = $this->exportValues(); + + $title = str_replace("'", "''", $values['title']); + + if (isset($this->_id)) { + $sql = "UPDATE civicrm_wci_embed_code SET name = '" . $title + . "', widget_id = '" . $values['widget'] . "' where id =" . $this->_id ; + } + else { + $sql = "INSERT INTO civicrm_wci_embed_code (name, widget_id)VALUES ('" + . $title . "','" . $values['widget'] . "')"; + } + $errorScope = CRM_Core_TemporaryErrorScope::useException(); + try { + $transaction = new CRM_Core_Transaction(); + CRM_Core_DAO::executeQuery($sql); + $transaction->commit(); + CRM_Core_Session::setStatus(ts('Embed code created successfuly'), '', 'success'); + if(isset($_REQUEST['_qf_NewEmbedCode_next'])) { + (isset($this->_id)) ? $embed_id = $this->_id : + $embed_id = CRM_Core_DAO::singleValueQuery('SELECT LAST_INSERT_ID()'); + CRM_Utils_System::redirect('?action=update&reset=1&id=' . $embed_id); + } else { + CRM_Utils_System::redirect('embed-code?reset=1'); + } + } + catch (Exception $e) { + CRM_Core_Session::setStatus(ts('Failed to create embed code'), '', 'error'); + $transaction->rollback(); + } + parent::postProcess(); + } + function getWidgets() { + $options = array( + '' => ts('- select -'), + ); + $widgList = CRM_Wci_BAO_Widget::getWidgetList(); + foreach ($widgList as $widg) { + $options[$widg['id']] = $widg['title']; + } + + return $options; + } + + /** + * Get the fields/elements defined in this form. + * + * @return array (string) + */ + function getRenderableElementNames() { + // The _elements list includes some items which should not be + // auto-rendered in the loop -- such as "qfKey" and "buttons". These + // items don't have labels. We'll identify renderable by filtering on + // the 'label'. + $elementNames = array(); + foreach ($this->_elements as $element) { + $label = $element->getLabel(); + if (!empty($label)) { + $elementNames[] = $element->getName(); + } + } + return $elementNames; + } +} diff --git a/CRM/Wci/Page/ManageEmbedCode.php b/CRM/Wci/Page/ManageEmbedCode.php new file mode 100644 index 0000000..5644274 --- /dev/null +++ b/CRM/Wci/Page/ManageEmbedCode.php @@ -0,0 +1,98 @@ +assign('action', $action); + $id = CRM_Utils_Request::retrieve('id', 'Positive', + $this, FALSE, 0 + ); + + if ($action & CRM_Core_Action::UPDATE) { + $controller = new CRM_Core_Controller_Simple('CRM_Wci_Form_NewEmbedCode', + 'Edit Embed Code', + CRM_Core_Action::UPDATE + ); + $controller->set('id', $id); + $controller->process(); + return $controller->run(); + } + elseif ($action & CRM_Core_Action::DELETE) { + try { + $transaction = new CRM_Core_Transaction(); + + $sql = "DELETE FROM civicrm_wci_embed_code where id = " . $id; + CRM_Core_DAO::executeQuery($sql); + $transaction->commit(); + } + catch (Exception $e) { + //TODO + print_r($e->getMessage()); + $transaction->rollback(); + } + } + + + CRM_Utils_System::setTitle(ts('Embed Code List')); + $query = "SELECT * FROM civicrm_wci_embed_code"; + $params = array(); + + $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_EmbedCode'); + + while ($dao->fetch()) { + $emb_code[$dao->id] = array(); + CRM_Core_DAO::storeValues($dao, $emb_code[$dao->id]); + $emb_code[$dao->id]['id'] = $emb_code[$dao->id]['id']; + $emb_code[$dao->id]['name'] = $emb_code[$dao->id]['name']; + + $action = array_sum(array_keys($this->actionLinks())); + //build the normal action links. + $emb_code[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), + $action, + array('id' => $dao->id), + ts('more'), + TRUE + ); + } + + if (isset($emb_code)) { + $this->assign('rows', $emb_code); + } + + + parent::run(); + } + function &actionLinks() { + // check if variable _actionsLinks is populated + if (!isset(self::$_actionLinks)) { + // helper variable for nicer formatting + $deleteExtra = ts('Are you sure you want to delete this Widget?'); + + self::$_actionLinks = array( + CRM_Core_Action::UPDATE => array( + 'name' => ts('Edit'), + 'url' => CRM_Utils_System::currentPath(), + 'qs' => 'action=update&reset=1&id=%%id%%', + 'title' => ts('Update'), + ), + CRM_Core_Action::DELETE => array( + 'name' => ts('Delete'), + 'url' => CRM_Utils_System::currentPath(), + 'qs' => 'action=delete&reset=1&id=%%id%%', + 'title' => ts('Delete Custom Field'), + 'extra' => 'onclick = "return confirm(\'' . $deleteExtra . '\');"', + ), + ); + } + return self::$_actionLinks; + } +} diff --git a/extern/embed.php b/extern/embed.php new file mode 100644 index 0000000..5b0a2dd --- /dev/null +++ b/extern/embed.php @@ -0,0 +1,84 @@ + +*/ + +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('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')); + } +} +$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(); diff --git a/extern/wciwidget.php b/extern/wciwidget.php index e5b6b69..303916c 100644 --- a/extern/wciwidget.php +++ b/extern/wciwidget.php @@ -46,7 +46,7 @@ require_once 'CRM/Utils/Request.php'; $config = CRM_Core_Config::singleton(); $template = CRM_Core_Smarty::singleton(); -$widgetId = CRM_Utils_Request::retrieve('widgetId', 'Positive', CRM_Core_DAO::$_nullObject); +$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')); } diff --git a/sql/install.sql b/sql/install.sql index 86a0cd8..0b58365 100644 --- a/sql/install.sql +++ b/sql/install.sql @@ -53,3 +53,12 @@ CREATE TABLE IF NOT EXISTS civicrm_wci_widget ( 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 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- WCI embed code. +CREATE TABLE IF NOT EXISTS civicrm_wci_embed_code ( + id int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Custom Progress bar Id.', + name varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Embed code.', + widget_id int(10) unsigned DEFAULT NULL COMMENT 'widget id.', + PRIMARY KEY (`id`), + UNIQUE KEY `unique_wci_name` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; diff --git a/templates/CRM/Wci/Form/CreateWidget.tpl b/templates/CRM/Wci/Form/CreateWidget.tpl index ebce801..0041224 100644 --- a/templates/CRM/Wci/Form/CreateWidget.tpl +++ b/templates/CRM/Wci/Form/CreateWidget.tpl @@ -35,7 +35,7 @@
- Preview Widget and Get Code + Preview Widget
@@ -44,7 +44,7 @@
-
+
{/if} diff --git a/templates/CRM/Wci/Form/NewEmbedCode.tpl b/templates/CRM/Wci/Form/NewEmbedCode.tpl new file mode 100644 index 0000000..3e6a148 --- /dev/null +++ b/templates/CRM/Wci/Form/NewEmbedCode.tpl @@ -0,0 +1,72 @@ +{* HEADER *} +
+
+{include file="CRM/common/formButtons.tpl" location="top"} +
+ +{* FIELD EXAMPLE: OPTION 1 (AUTOMATIC LAYOUT) *} + +{foreach from=$elementNames item=elementName} +
+
{$form.$elementName.label}
+
{$form.$elementName.html}
+
+
+{/foreach} + {if $form.title.value != ""} + {php} + if(isset($_REQUEST['id'])) { + $emb_id = $_REQUEST['id']; + $wid_id = CRM_Wci_BAO_EmbedCode::getWidgetId($emb_id); + $data = CRM_Wci_BAO_Widget::getWidgetData($wid_id); + $template = CRM_Core_Smarty::singleton(); + $template->assign('wciform', $data); + if($data["override"] == 0) { + $template->template_dir[] = getWciWidgetTemplatePath(); + $wcidata = $template->fetch('wciwidget.tpl'); + } else { + $wcidata = $template->fetch('string:' . $wid_page[$dao->id]['custom_template']); + } + $widget_controller_path = getWciWidgetControllerPath(); + $extension_root_path = getExtensionRootPath(); + } + {/php} + +
+
+ + Preview Widget and Get Code + +
+
+ Click Save & Preview to save any changes to your settings, and preview the widget again on this page. +
+ +
+
+
+
+ Add this widget to any web page by copying and pasting the code below. +
+ +
+ + » Select Code + +
+
+
+ {/if} +{* FIELD EXAMPLE: OPTION 2 (MANUAL LAYOUT) + +
+ {$form.favorite_color.label} + {$form.favorite_color.html} +
+ +{* FOOTER *} +
+{include file="CRM/common/formButtons.tpl" location="bottom"} +
+
diff --git a/templates/CRM/Wci/Page/ManageEmbedCode.tpl b/templates/CRM/Wci/Page/ManageEmbedCode.tpl new file mode 100644 index 0000000..ef93454 --- /dev/null +++ b/templates/CRM/Wci/Page/ManageEmbedCode.tpl @@ -0,0 +1,80 @@ +{*

This new page is generated by CRM/Wci/Page/ManageEmbedCode.php

+ + Example: Display a variable directly +

The current time is {$currentTime}

*} + +{* Example: Display a translated string -- which happens to include a variable +

{ts 1=$currentTime}(In your native language) The current time is %1.{/ts}

*} + + {if $rows} +
+ {strip} + + {include file="CRM/common/pager.tpl" location="top"} + {include file="CRM/common/pagerAToZ.tpl"} + {include file="CRM/common/jsortable.tpl"} + + + + + {* *} + + + + {foreach from=$rows item=row} + {* class="{if NOT $row.is_active} disabled{/if}" *} + + {* *} + + + + {/foreach} +
{ts}Title{/ts}{ts}Description{/ts}
{$row.name}{$row.description} + + {if $row.configureActionLinks} +
+ {$row.configureActionLinks|replace:'xx':$row.id} +
+ {/if} + + {if $row.contributionLinks} +
+ {$row.contributionLinks|replace:'xx':$row.id} +
+ {/if} + + {if $row.onlineContributionLinks} +
+ {$row.onlineContributionLinks|replace:'xx':$row.id} +
+ {/if} + +
+ {$row.action|replace:'xx':$row.id} +
+ +
+ + {/strip} +
+ {else} + {if $isSearch eq 1} +
+ {ts}status{/ts} + {capture assign=browseURL}{crmURL p='civicrm/contribute/manage' q="reset=1"}{/capture} + {ts}No available Contribution Pages match your search criteria. Suggestions:{/ts} +
+ + {ts 1=$browseURL}Or you can browse all available Contribution Pages.{/ts} +
+ {else} +
+
  + {ts 1=$newPageURL}No embeded code have been selected yet. Click here to select a wci widget for the embeded code.{/ts} +
+ {/if} + {/if} diff --git a/wci-helper-functions.php b/wci-helper-functions.php index a6a0edd..5629066 100644 --- a/wci-helper-functions.php +++ b/wci-helper-functions.php @@ -18,7 +18,7 @@ } function getWciWidgetControllerPath() { - $widget_controller_path = getExtensionRootPath() . '/extern/wciwidget.php'; + $widget_controller_path = getExtensionRootPath() . '/extern/embed.php'; return $widget_controller_path; } diff --git a/wci.php b/wci.php index 0c5f6cc..4a8cf2e 100644 --- a/wci.php +++ b/wci.php @@ -179,14 +179,38 @@ function wci_civicrm_navigationMenu( &$params ) { '5' => array ( 'attributes' => array ( + 'label' => ts('New Embed Code'), + 'name' => 'new_embed-code', + 'url' => 'civicrm/wci/embed-code/add', + 'permission' => 'access CiviReport,access CiviContribute', + 'operator' => 'OR', + 'separator' => 1, + 'parentID' => $navId, + 'navID' => $navId+5, + 'active' => 1)), + + '6' => array ( + 'attributes' => array ( + 'label' => ts('Manage Embed Code'), + 'name' => 'manage-emebed-code', + 'url' => 'civicrm/wci/embed-code?reset=1', + 'permission' => 'access CiviReport,access CiviContribute', + 'operator' => 'OR', + 'separator' => 1, + 'parentID' => $navId, + 'navID' => $navId+6, + 'active' => 1)), + + '7' => array ( + 'attributes' => array ( 'label' => ts('Widget Settings'), - 'name' => 'manage_progress_bar', + 'name' => 'widget-settings', 'url' => 'civicrm/wci/settings?reset=1', 'permission' => 'access CiviReport,access CiviContribute', 'operator' => 'OR', 'separator' => 1, 'parentID' => $navId, - 'navID' => $navId+5, + 'navID' => $navId+7, 'active' => 1)), ), ); diff --git a/xml/Menu/wci.xml b/xml/Menu/wci.xml index 0f0bf12..d073232 100644 --- a/xml/Menu/wci.xml +++ b/xml/Menu/wci.xml @@ -36,4 +36,16 @@ WCISettings access CiviCRM + + civicrm/wci/embed-code/add + CRM_Wci_Form_NewEmbedCode + NewEmbedCode + access CiviCRM + + + civicrm/wci/embed-code + CRM_Wci_Page_ManageEmbedCode + ManageEmbedCode + access CiviCRM + -- 2.25.1