remove unwanted case type file, update navigation menu and add selector
authorkurund <kurund@civicrm.org>
Sun, 1 Jun 2014 14:50:06 +0000 (20:20 +0530)
committerkurund <kurund@civicrm.org>
Sun, 1 Jun 2014 14:50:06 +0000 (20:20 +0530)
CRM/Admin/Form/CaseType.php [deleted file]
CRM/Admin/Page/CaseType.php [deleted file]
partials/crmCaseType/list.html
templates/CRM/Admin/Form/CaseType.tpl [deleted file]
templates/CRM/Admin/Page/CaseType.tpl [deleted file]
templates/CRM/Case/Page/Tab.tpl
xml/templates/civicrm_navigation.tpl

diff --git a/CRM/Admin/Form/CaseType.php b/CRM/Admin/Form/CaseType.php
deleted file mode 100644 (file)
index 32b4bcc..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
- +--------------------------------------------------------------------+
- | 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-2014
- * $Id$
- *
- */
-
-/**
- * This class generates form components for Case Type
- *
- */
-class CRM_Admin_Form_CaseType extends CRM_Admin_Form {
-
-  /**
-   * Function to build the form
-   *
-   * @return void
-   * @access public
-   */
-  public function buildQuickForm() {
-    parent::buildQuickForm();
-    if ($this->_action & CRM_Core_Action::DELETE) {
-      return;
-    }
-    $this->applyFilter('__ALL__', 'trim');
-    $this->add('text', 'title', ts('Name'),
-      CRM_Core_DAO::getAttribute('CRM_Case_DAO_CaseType', 'title'),
-      TRUE
-    );
-    $enabled = $this->add('checkbox', 'is_active', ts('Enabled?'));
-    $this->add('text', 'description', ts('Description'),
-      CRM_Core_DAO::getAttribute('CRM_Case_DAO_CaseType', 'description')
-    );
-
-    $this->assign('cid', $this->_id);
-    $this->addFormRule(array('CRM_Admin_Form_CaseType', 'formRule'), $this);
-  }
-
-  /**
-   * global form rule
-   *
-   * @param array $fields the input form values
-   *
-   * @param $files
-   * @param $self
-   *
-   * @return true if no errors, else array of errors
-   * @access public
-   * @static
-   */
-  static function formRule($fields, $files, $self) {
-
-    $errors = array();
-
-    if ($self->_id) {
-      $caseName = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $self->_id, 'name');
-    }
-    else {
-      $caseName = ucfirst(CRM_Utils_String::munge($fields['title']));
-    }
-
-    if (!CRM_Core_DAO::objectExists($caseName, 'CRM_Case_DAO_CaseType', $self->_id)) {
-      $errors['title'] = ts('This case type name already exists in database. Case type names must be unique.');
-    }
-
-    $reservedKeyWords = CRM_Core_SelectValues::customGroupExtends();
-    //restrict "name" from being a reserved keyword when a new contact subtype is created
-    if (!$self->_id && in_array($caseName, array_keys($reservedKeyWords))) {
-      $errors['title'] = ts('Case Type names should not use reserved keywords.');
-    }
-    return empty($errors) ? TRUE : $errors;
-  }
-
-  /**
-   * Function to process the form
-   *
-   * @access public
-   *
-   * @return void
-   */
-  public function postProcess() {
-    CRM_Utils_System::flushCache();
-
-    if ($this->_action & CRM_Core_Action::DELETE) {
-      $isDelete = CRM_Case_BAO_CaseType::del($this->_id);
-      if ($isDelete) {
-        CRM_Core_Session::setStatus(ts('Selected case type has been deleted.'), ts('Record Deleted'), 'success');
-      }
-      else {
-        CRM_Core_Session::setStatus(ts("Selected case type can not be deleted."), ts('Sorry'), 'error');
-      }
-      return;
-    }
-    // store the submitted values in an array
-    $params = $this->exportValues();
-
-    if ($this->_action & CRM_Core_Action::ADD) {
-      $params['name'] = ucfirst(CRM_Utils_String::munge($params['title']));
-    } else {
-      $params['id'] = $this->_id;
-      $params['name'] = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $this->_id, 'name');
-    }
-    $caseType = CRM_Case_BAO_CaseType::add($params);
-    CRM_Core_Session::setStatus(ts("The Case Type '%1' has been saved.",
-        array(1 => $caseType->title)
-      ), ts('Saved'), 'success');
-  }
-}
-
diff --git a/CRM/Admin/Page/CaseType.php b/CRM/Admin/Page/CaseType.php
deleted file mode 100644 (file)
index d1bf11e..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
- +--------------------------------------------------------------------+
- | 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-2014
- *
- */
-
-/**
- * Page for displaying list of Case types
- */
-class CRM_Admin_Page_CaseType extends CRM_Core_Page_Basic {
-
-  /**
-   * The action links that we need to display for the browse screen
-   *
-   * @var array
-   * @static
-   */
-  static $_links = NULL;
-
-  /**
-   * Get BAO Name
-   *
-   * @return string Classname of BAO.
-   */
-  function getBAOName() {
-    return 'CRM_Case_BAO_CaseType';
-  }
-
-  /**
-   * Get action Links
-   *
-   * @return array (reference) of action links
-   */
-  function &links() {
-    if (!(self::$_links)) {
-      self::$_links = array(
-        CRM_Core_Action::UPDATE =>
-        array(
-          'name' => ts('Edit'),
-          'url' => 'civicrm/admin/options/case_type',
-          'qs' => 'action=update&id=%%id%%&reset=1',
-          'title' => ts('Edit Case Type'),
-        ),
-        CRM_Core_Action::DISABLE =>
-        array(
-          'name' => ts('Disable'),
-          'ref' => 'crm-enable-disable',
-          'title' => ts('Disable Case Type'),
-        ),
-        CRM_Core_Action::ENABLE =>
-        array(
-          'name' => ts('Enable'),
-          'ref' => 'crm-enable-disable',
-          'title' => ts('Enable Case Type'),
-        ),
-        CRM_Core_Action::DELETE =>
-        array(
-          'name' => ts('Delete'),
-          'url' => 'civicrm/admin/options/case_type',
-          'qs' => 'action=delete&id=%%id%%',
-          'title' => ts('Delete Case Type'),
-        ),
-      );
-    }
-    return self::$_links;
-  }
-
-  /**
-   * Get name of edit form
-   *
-   * @return string Classname of edit form.
-   */
-  function editForm() {
-    return 'CRM_Admin_Form_CaseType';
-  }
-
-  /**
-   * Get edit form name
-   *
-   * @return string name of this page.
-   */
-  function editName() {
-    return 'Case Types';
-  }
-
-  /**
-   * Get user context.
-   *
-   * @param null $mode
-   *
-   * @return string user context.
-   */
-  function userContext($mode = NULL) {
-    return 'civicrm/admin/options/case_type';
-  }
-}
index d3e0923b2a2d7b30e06551ea3af0cbf892b23c5c..8964ef1233d9ec9ee496d85d1488fe931975f2a7 100644 (file)
@@ -2,10 +2,29 @@
 Controller: CaseTypeListsCtrl
 Required vars: caseTypes
 -->
-<ul>
-  <li ng-repeat="caseType in caseTypes">
-    <a ng-href="#/caseType/{{caseType.id}}">{{caseType.title}}</a>
-  </li>
-</ul>
+<div id="help">
+  A Case Type describes a group of related tasks, interactions, or processes.
+</div>
 
-<a ng-href="#/caseType/new">New Case</a>
\ No newline at end of file
+<table class="display">
+  <thead>
+  <tr>
+    <th>Name</th>
+    <th>Title</th>
+    <th>Description</th>
+    <th>Enabled?</th>
+    <th></th>
+  </tr>
+  </thead>
+  <tr ng-repeat="caseType in caseTypes">
+    <td>{{caseType.name}}</td>
+    <td>{{caseType.title}}</td>
+    <td>{{caseType.description}}</td>
+    <td>{{caseType.is_active}}</td>
+    <td><a ng-href="#/caseType/{{caseType.id}}">Edit</a</td>
+  </tr>
+</table>
+
+<div class="action-link">
+  <a ng-href="#/caseType/new" class="button"><span>&raquo; New Case Type</span></a>
+</div>
\ No newline at end of file
diff --git a/templates/CRM/Admin/Form/CaseType.tpl b/templates/CRM/Admin/Form/CaseType.tpl
deleted file mode 100644 (file)
index 4bd67dc..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-{*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
- +--------------------------------------------------------------------+
- | 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        |
- +--------------------------------------------------------------------+
-*}
-{* This template is used for adding/editing a case type. *}
-<h3>{if $action eq 1}{ts}New Case Type{/ts}{elseif $action eq 2}{ts}Edit Case Type{/ts}{else}{ts}Delete Case Type{/ts}{/if}</h3>
-<div class="crm-block crm-form-block crm-case-type-form-block">
-<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
-{if $action eq 8}
-  <div class="messages status no-popup">
-     <div class="icon inform-icon"></div>
-        {ts}WARNING: Deleting this option will result in loss of type information for all case records which use the option.{/ts} {ts}This may mean the loss of a substantial amount of data, and the action cannot be undone.{/ts} {ts}Do you want to continue?{/ts}
-      </div>
-{else}
-  <table class="form-layout-compressed">
-      <tr class="crm-case-type-form-block-title">
-          <td class="label">{$form.title.label}</td>
-          <td>{$form.title.html}</td>
-      </tr>
-      <tr class="crm-case-type-form-block-description">
-          <td class="label">{$form.description.label}</td>
-          <td>{$form.description.html}</td>
-      </tr>
-      <tr class="crm-case-type-form-block-is_active">
-          <td class="label">{$form.is_active.label}</td>
-          <td>{$form.is_active.html}</td>
-      </tr>
-  </table>
-{/if}
-    <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
-</div>
diff --git a/templates/CRM/Admin/Page/CaseType.tpl b/templates/CRM/Admin/Page/CaseType.tpl
deleted file mode 100644 (file)
index 965ab4c..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-{*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
- +--------------------------------------------------------------------+
- | 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        |
- +--------------------------------------------------------------------+
-*}
-{if $action eq 1 or $action eq 2 or $action eq 8}
-   {include file="CRM/Admin/Form/CaseType.tpl"}
-{else}
-  <div id="help">
-    {ts}A Case Type describes a group of related tasks, interactions, or processes.{/ts}
-  </div>
-
-{if $rows}
-<div id="casetype">
-    {strip}
-  {* handle enable/disable actions*}
-   {include file="CRM/common/enableDisableApi.tpl"}
-   {include file="CRM/common/crmeditable.tpl"}
-    {include file="CRM/common/jsortable.tpl"}
-    <table id="options" class="display">
-    <thead>
-    <tr>
-        <th id="sortable">{ts}Name{/ts}</th>
-        <th>{ts}Title{/ts}</th>
-        <th id="nosort">{ts}Description{/ts}</th>
-        <th>{ts}Enabled?{/ts}</th>
-        <th>{ts}Reserved?{/ts}</th>
-        <th></th>
-    </tr>
-    </thead>
-    {foreach from=$rows item=row}
-    <tr id="case_type-{$row.id}" class="{cycle values="odd-row,even-row"} {$row.class} crm-entity {if NOT $row.is_active} disabled{/if}">
-        <td class="crm-caseType-name">{$row.name}</td>
-        <td class="crm-caseType-title">{$row.title}</td>
-        <td class="crm-caseType-description">{$row.description}</td>
-        <td id="row_{$row.id}_status" class="crm-caseType-is_active">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
-        <td class="crm-caseType-is_reserved" >{if $row.is_reserved eq 1}<img src="{$config->resourceBase}i/check.gif" alt="{ts}Reserved{/ts}" />{/if}&nbsp;</td>
-        <td>{$row.action|replace:'xx':$row.id}</td>
-    </tr>
-    {/foreach}
-    </table>
-    {/strip}
-
-    {if $action ne 1 and $action ne 2}
-    <div class="action-link">
-  <a href="{crmURL q="action=add&reset=1"}" id="newCaseType" class="button"><span>&raquo; {ts}New Case Type{/ts}</span></a>
-    </div>
-    {/if}
-</div>
-{else}
-    <div class="messages status no-popup">
-          <img src="{$config->resourceBase}i/Inform.gif" alt="{ts}status{/ts}"/>
-        {capture assign=crmURL}{crmURL p='civicrm/admin/options/case_type' q="action=add&reset=1"}{/capture}
-        {ts 1=$crmURL}There are no Case Types yet. You can <a href='%1'>add one</a>.{/ts}
-    </div>
-{/if}
-{/if}
index 26c12cf9b289142f3fbbeeae9fb3357eec9c7e7a..089c4a9de1e1f97ca637b046cbce080703c313f4 100644 (file)
@@ -31,7 +31,7 @@
       <div class="icon inform-icon"></div>&nbsp;
          <strong>{ts}Oops, It looks like there are no active case types.{/ts}</strong>
            {if call_user_func(array('CRM_Core_Permission','check'), ' administer CiviCase')}
-             {capture assign=adminCaseTypeURL}{crmURL p='civicrm/admin/options/case_type' q='reset=1'}
+             {capture assign=adminCaseTypeURL}{crmURL p='civicrm/a/#/caseType'}
        {/capture}
              {ts 1=$adminCaseTypeURL 2=$adminCaseStatusURL}Enable <a href='%1'>case types</a>.{/ts}
            {/if}
index 08443e3e77244b56778a9e2b8b360b90ef144577..ad8634752f710150373937c37e0e8330d927ac24 100644 (file)
@@ -490,7 +490,7 @@ SET @adminCaselastID:=LAST_INSERT_ID();
 INSERT INTO civicrm_navigation
     ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
 VALUES
-    ( @domainID, 'civicrm/admin/options/case_type?reset=1',            '{ts escape="sql" skip="true"}Case Types{/ts}',      'Case Types',      'administer CiviCase', NULL, @adminCaselastID, '1', NULL, 1 ),
+    ( @domainID, 'civicrm/a/#/caseType',            '{ts escape="sql" skip="true"}Case Types{/ts}',      'Case Types',      'administer CiviCase', NULL, @adminCaselastID, '1', NULL, 1 ),
     ( @domainID, 'civicrm/admin/options/redaction_rule?reset=1',  '{ts escape="sql" skip="true"}Redaction Rules{/ts}', 'Redaction Rules', 'administer CiviCase', NULL, @adminCaselastID, '1', NULL, 2 ),
     ( @domainID, 'civicrm/admin/options/case_status?reset=1',  '{ts escape="sql" skip="true"}Case Statuses{/ts}', 'Case Statuses', 'administer CiviCase', NULL, @adminCaselastID, '1', NULL, 3 ),
     ( @domainID, 'civicrm/admin/options/encounter_medium?reset=1',  '{ts escape="sql" skip="true"}Encounter Medium{/ts}', 'Encounter Medium', 'administer CiviCase', NULL, @adminCaselastID, '1', NULL, 4 );