From: Coleman Watts Date: Mon, 23 Dec 2013 03:43:23 +0000 (-0800) Subject: CRM-14015 - Fix ajax for relationship type X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=52395565aba849d1bb626063ba1766d32f06ee57;p=civicrm-core.git CRM-14015 - Fix ajax for relationship type --- diff --git a/CRM/Admin/Form.php b/CRM/Admin/Form.php index 78b50a0d00..5d72d72d86 100644 --- a/CRM/Admin/Form.php +++ b/CRM/Admin/Form.php @@ -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( diff --git a/CRM/Admin/Form/RelationshipType.php b/CRM/Admin/Form/RelationshipType.php index 4e374e4ece..4b45602dba 100644 --- a/CRM/Admin/Form/RelationshipType.php +++ b/CRM/Admin/Form/RelationshipType.php @@ -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)); } } diff --git a/CRM/Admin/Page/RelationshipType.php b/CRM/Admin/Page/RelationshipType.php index ae551ea2e4..8034733f58 100644 --- a/CRM/Admin/Page/RelationshipType.php +++ b/CRM/Admin/Page/RelationshipType.php @@ -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( diff --git a/templates/CRM/Admin/Form/RelationshipType.tpl b/templates/CRM/Admin/Form/RelationshipType.tpl index 5b78dba7ef..8c570a2bbf 100644 --- a/templates/CRM/Admin/Form/RelationshipType.tpl +++ b/templates/CRM/Admin/Form/RelationshipType.tpl @@ -26,11 +26,7 @@ {* this template is used for adding/editing relationship types *}

{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}

- {if $action neq 4} {* action is not view *} -
{include file="CRM/common/formButtons.tpl" location="top"}
- {else} -
{$form.done.html}
- {/if} +
{include file="CRM/common/formButtons.tpl" location="top"}
{if $action eq 8}
@@ -68,9 +64,5 @@ {/if} - {if $action neq 4} {* action is not view *} -
{include file="CRM/common/formButtons.tpl" location="bottom"}
- {else} -
{$form.done.html}
- {/if} +
{include file="CRM/common/formButtons.tpl" location="bottom"}
diff --git a/templates/CRM/Admin/Page/RelationshipType.tpl b/templates/CRM/Admin/Page/RelationshipType.tpl index ad6a2e12b9..847b7650a6 100644 --- a/templates/CRM/Admin/Page/RelationshipType.tpl +++ b/templates/CRM/Admin/Page/RelationshipType.tpl @@ -25,15 +25,14 @@ *} {capture assign=customURL}{crmURL p='civicrm/admin/custom/group' q="reset=1"}{/capture} {capture assign=docLink}{docURL page="user/organising-your-data/relationships"}{/capture} -
-

{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 >-< Child, Employer >-< Employee). For some types of relationships, the labels may be the same in both directions (e.g. Spouse >-< Spouse).{/ts} {$docLink}

-

{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 Administer CiviCRM » Custom Data.{/ts}{help id='id-relationship-types'}

-
{if $action eq 1 or $action eq 2 or $action eq 4 or $action eq 8} {include file="CRM/Admin/Form/RelationshipType.tpl"} {else} - +
+

{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 >-< Child, Employer >-< Employee). For some types of relationships, the labels may be the same in both directions (e.g. Spouse >-< Spouse).{/ts} {$docLink}

+

{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 Administer CiviCRM » Custom Data.{/ts}{help id='id-relationship-types'}

+
{if $rows} {if !($action eq 1 and $action eq 2)}