CRM-14015 - Fix ajax for relationship type
authorColeman Watts <coleman@civicrm.org>
Mon, 23 Dec 2013 03:43:23 +0000 (19:43 -0800)
committerColeman Watts <coleman@civicrm.org>
Mon, 6 Jan 2014 19:10:40 +0000 (11:10 -0800)
CRM/Admin/Form.php
CRM/Admin/Form/RelationshipType.php
CRM/Admin/Page/RelationshipType.php
templates/CRM/Admin/Form/RelationshipType.tpl
templates/CRM/Admin/Page/RelationshipType.tpl

index 78b50a0d00e52ad01d48505411addf5a7825fac5..5d72d72d869dd320d11f848ae22e0dc7b6119361 100644 (file)
@@ -126,6 +126,16 @@ class CRM_Admin_Form extends CRM_Core_Form {
         )
       );
     }
+    elseif ($this->_action & CRM_Core_Action::VIEW) {
+      $this->addButtons(array(
+          array(
+            'type' => 'cancel',
+            'name' => ts('Done'),
+            'isDefault' => TRUE,
+          ),
+        )
+      );
+    }
     else {
       $this->addButtons(array(
           array(
index 4e374e4ecea93e9500900147e7abff258741070c..4b45602dbad8e3575914676a336c5428faaace42 100644 (file)
@@ -99,9 +99,6 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
 
     if ($this->_action & CRM_Core_Action::VIEW) {
       $this->freeze();
-      $url = CRM_Utils_System::url('civicrm/admin/reltype&reset=1');
-      $location = "window.location='$url'";
-      $this->addElement('button', 'done', ts('Done'), array('onclick' => $location));
     }
   }
 
index ae551ea2e41b898398e2bbd1dac3670cde143bac..8034733f58ab127ede9869e1b7aa473ae4f0b5fb 100644 (file)
@@ -61,6 +61,7 @@ class CRM_Admin_Page_RelationshipType extends CRM_Core_Page_Basic {
    * @return array (reference) of action links
    */
   function &links() {
+    CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
     if (!(self::$_links)) {
       self::$_links = array(
         CRM_Core_Action::VIEW => array(
index 5b78dba7ef66b500a7f0d4baa3d417cbcca5f463..8c570a2bbf63aa58455e60ef99f1772c6ca8e4d6 100644 (file)
 {* this template is used for adding/editing relationship types  *}
 <h3>{if $action eq 1}{ts}New Relationship Type{/ts}{elseif $action eq 2}{ts}Edit Relationship Type{/ts}{elseif $action eq 8}{ts}Delete Relationship Type{/ts}{else}{ts}View Relationship Type{/ts}{/if}</h3>
 <div class="crm-block crm-form-block crm-relationship-type-form-block">
-    {if $action neq 4} {* action is not view *}
-        <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
-    {else}
-        <div class="crm-submit-buttons">{$form.done.html}</div>
-    {/if}
+      <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>
@@ -68,9 +64,5 @@
             </tr>
         </table>
     {/if}
-  {if $action neq 4} {* action is not view *}
-            <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
-        {else}
-            <div class="crm-submit-buttons">{$form.done.html}</div>
-        {/if}
+    <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
 </div>
index ad6a2e12b9523336d861c14bc1536b67e1d45b50..847b7650a605e4642e7e5ebe66d00db9eceead81 100644 (file)
 *}
 {capture assign=customURL}{crmURL p='civicrm/admin/custom/group' q="reset=1"}{/capture}
 {capture assign=docLink}{docURL page="user/organising-your-data/relationships"}{/capture}
-<div id="help">
-    <p>{ts}Relationship types describe relationships between people, households and organizations. Relationship types labels describe the relationship from the perspective of each of the two entities (e.g. Parent &gt;-&lt; Child, Employer &gt;-&lt; Employee). For some types of relationships, the labels may be the same in both directions (e.g. Spouse &gt;-&lt; Spouse).{/ts} {$docLink}</p>
-    <p>{ts 1=$customURL}You can define as many additional relationships types as needed to cover the types of relationships you want to track. Once a relationship type is created, you may also define custom fields to extend relationship information for that type from <a href='%1'>Administer CiviCRM &raquo; Custom Data</a>.{/ts}{help id='id-relationship-types'} </p>
-</div>
 
 {if $action eq 1 or $action eq 2 or $action eq 4 or $action eq 8}
    {include file="CRM/Admin/Form/RelationshipType.tpl"}
 {else}
-
+  <div id="help">
+    <p>{ts}Relationship types describe relationships between people, households and organizations. Relationship types labels describe the relationship from the perspective of each of the two entities (e.g. Parent &gt;-&lt; Child, Employer &gt;-&lt; Employee). For some types of relationships, the labels may be the same in both directions (e.g. Spouse &gt;-&lt; Spouse).{/ts} {$docLink}</p>
+    <p>{ts 1=$customURL}You can define as many additional relationships types as needed to cover the types of relationships you want to track. Once a relationship type is created, you may also define custom fields to extend relationship information for that type from <a href='%1'>Administer CiviCRM &raquo; Custom Data</a>.{/ts}{help id='id-relationship-types'} </p>
+  </div>
 {if $rows}
 {if !($action eq 1 and $action eq 2)}
     <div class="action-link">