From: Tim Otten Date: Wed, 30 Oct 2019 00:29:26 +0000 (-0700) Subject: DB Tpl Strings - Remove unused form 'civicrm/admin/tplstrings' X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b86b457195ee8ec9a86252ce9fa7d4120c335746;p=civicrm-core.git DB Tpl Strings - Remove unused form 'civicrm/admin/tplstrings' If you grep for this (in v3.2, v5.20, and universe), you will find that the only usages are self-referential or pro-forma: - There is / never been a navigation item pointing to the page. - There is no codepath which *consumes* data produced here. --- diff --git a/CRM/Admin/Form/Persistent.php b/CRM/Admin/Form/Persistent.php deleted file mode 100644 index e62d3313bc..0000000000 --- a/CRM/Admin/Form/Persistent.php +++ /dev/null @@ -1,106 +0,0 @@ -_indexID = CRM_Utils_Request::retrieve('id', 'Integer', $this, FALSE); - $this->_config = CRM_Utils_Request::retrieve('config', 'Integer', $this, 0); - $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE); - - $session = CRM_Core_Session::singleton(); - $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/tplstrings', 'reset=1')); - CRM_Utils_System::setTitle(ts('DB Template Strings')); - parent::preProcess(); - } - - /** - * Set default values. - * - * @return array - */ - public function setDefaultValues() { - $defaults = []; - - if ($this->_indexID && ($this->_action & (CRM_Core_Action::UPDATE))) { - $params = ['id' => $this->_indexID]; - CRM_Core_BAO_Persistent::retrieve($params, $defaults); - if (CRM_Utils_Array::value('is_config', $defaults) == 1) { - $defaults['data'] = implode(',', $defaults['data']); - } - } - return $defaults; - } - - public function buildQuickForm() { - $this->add('text', 'context', ts('Context:'), NULL, TRUE); - $this->add('text', 'name', ts('Name:'), NULL, TRUE); - $this->add('textarea', 'data', ts('Data:'), ['rows' => 4, 'cols' => 50], TRUE); - $this->addButtons([ - [ - 'type' => 'submit', - 'name' => ts('Save'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ]); - } - - public function postProcess() { - $params = $ids = []; - $params = $this->controller->exportValues($this->_name); - - $params['is_config'] = $this->_config; - - if ($this->_action & CRM_Core_Action::ADD) { - CRM_Core_Session::setStatus(ts('DB Template has been added successfully.'), ts("Saved"), "success"); - } - if ($this->_action & CRM_Core_Action::UPDATE) { - $ids['persistent'] = $this->_indexID; - CRM_Core_Session::setStatus(ts('DB Template has been updated successfully.'), ts("Saved"), "success"); - } - CRM_Core_BAO_Persistent::add($params, $ids); - - CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/tplstrings', "reset=1")); - } - -} diff --git a/CRM/Admin/Page/Persistent.php b/CRM/Admin/Page/Persistent.php deleted file mode 100644 index 4524da5444..0000000000 --- a/CRM/Admin/Page/Persistent.php +++ /dev/null @@ -1,147 +0,0 @@ - [ - 'name' => ts('Edit'), - 'url' => 'civicrm/admin/tplstrings/add', - 'qs' => 'reset=1&action=update&id=%%id%%', - 'title' => ts('Configure'), - ], - ]; - } - return self::$_stringActionLinks; - } - - /** - * @return array - */ - public function &customizeActionLinks() { - // check if variable _actionsLinks is populated - if (!isset(self::$_customizeActionLinks)) { - - self::$_customizeActionLinks = [ - CRM_Core_Action::UPDATE => [ - 'name' => ts('Edit'), - 'url' => 'civicrm/admin/tplstrings/add', - 'qs' => 'reset=1&action=update&id=%%id%%&config=1', - 'title' => ts('Configure'), - ], - ]; - } - return self::$_customizeActionLinks; - } - - /** - * Run the basic page (run essentially starts execution for that page). - */ - public function run() { - CRM_Utils_System::setTitle(ts('DB Template Strings')); - $this->browse(); - return parent::run(); - } - - /** - * Browse all options. - */ - public function browse() { - $permission = FALSE; - $this->assign('editClass', FALSE); - if (CRM_Core_Permission::check('access CiviCRM')) { - $this->assign('editClass', TRUE); - $permission = TRUE; - } - - $daoResult = new CRM_Core_DAO_Persistent(); - $daoResult->find(); - $schoolValues = []; - while ($daoResult->fetch()) { - $values[$daoResult->id] = []; - CRM_Core_DAO::storeValues($daoResult, $values[$daoResult->id]); - if ($daoResult->is_config == 1) { - $values[$daoResult->id]['action'] = CRM_Core_Action::formLink(self::customizeActionLinks(), - NULL, - ['id' => $daoResult->id], - ts('more'), - FALSE, - 'persistent.config.actions', - 'Persistent', - $daoResult->id - ); - $values[$daoResult->id]['data'] = implode(',', unserialize($daoResult->data)); - $configCustomization[$daoResult->id] = $values[$daoResult->id]; - } - if ($daoResult->is_config == 0) { - $values[$daoResult->id]['action'] = CRM_Core_Action::formLink(self::stringActionLinks(), - NULL, - ['id' => $daoResult->id], - ts('more'), - FALSE, - 'persistent.row.actions', - 'Persistent', - $daoResult->id - ); - $configStrings[$daoResult->id] = $values[$daoResult->id]; - } - } - $rows = [ - 'configTemplates' => $configStrings, - 'customizeTemplates' => $configCustomization, - ]; - $this->assign('rows', $rows); - } - -} diff --git a/CRM/Core/xml/Menu/Admin.xml b/CRM/Core/xml/Menu/Admin.xml index e581780379..be9c335de5 100644 --- a/CRM/Core/xml/Menu/Admin.xml +++ b/CRM/Core/xml/Menu/Admin.xml @@ -677,16 +677,6 @@ Price Field Options CRM_Price_Page_Option - - civicrm/admin/tplstrings/add - CRM_Admin_Form_Persistent - administer CiviCRM,access CiviCRM - - - civicrm/admin/tplstrings - CRM_Admin_Page_Persistent - administer CiviCRM,access CiviCRM - civicrm/ajax/mapping CRM_Admin_Page_AJAX::mappingList diff --git a/templates/CRM/Admin/Form/Persistent.tpl b/templates/CRM/Admin/Form/Persistent.tpl deleted file mode 100644 index 90b6200192..0000000000 --- a/templates/CRM/Admin/Form/Persistent.tpl +++ /dev/null @@ -1,20 +0,0 @@ -
-DB Template Strings Information -
-
{include file="CRM/common/formButtons.tpl" location="top"}
- - - - - - - - - - -
{$form.context.label}{$form.context.html|crmAddClass:huge} -
{$form.name.label}{$form.name.html|crmAddClass:huge} -
{$form.data.label}{$form.data.html} -
-
{include file="CRM/common/formButtons.tpl" location="bottom"}
-
diff --git a/templates/CRM/Admin/Page/Persistent.tpl b/templates/CRM/Admin/Page/Persistent.tpl deleted file mode 100644 index 499fdd4bf7..0000000000 --- a/templates/CRM/Admin/Page/Persistent.tpl +++ /dev/null @@ -1,61 +0,0 @@ -{foreach from=$rows item=template_row key=type} -{if $type eq 'configTemplates'} - - - {if !empty( $template_row) } - - - - - {if $editClass} - - {/if} - - {foreach from=$template_row item=values} - - - - - {if $editClass} - - {/if} - - {/foreach} - {/if} -
ContextNameData
{$values.context}{$values.name}{$values.data}{$values.action}
-{/if} -{if $type eq 'customizeTemplates'} - - -

Config String

- -
- -
- {if !empty( $template_row) } - - - - - {if $editClass} - - {/if} - - {foreach from=$template_row item=values} - - - - - {if $editClass} - - {/if} - - {/foreach} - {/if} -
ContextNameData
{$values.context}{$values.name}{$values.data}{$values.action}
-{/if} -{/foreach}