From: Coleman Watts Date: Wed, 1 Jan 2014 22:11:47 +0000 (-0800) Subject: CRM-13863 - Ajax-enable most contact summary tabs X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4e8065a95320e3ed23983b9633aae0b9fe79a235;p=civicrm-core.git CRM-13863 - Ajax-enable most contact summary tabs --- diff --git a/CRM/Activity/Page/Tab.php b/CRM/Activity/Page/Tab.php index 970336b1bc..2ec117f13b 100644 --- a/CRM/Activity/Page/Tab.php +++ b/CRM/Activity/Page/Tab.php @@ -60,6 +60,7 @@ class CRM_Activity_Page_Tab extends CRM_Core_Page { $controller->set('contactId', $this->_contactId); $controller->setEmbedded(TRUE); $controller->run(); + $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('activity', $this->_contactId); } function edit() { diff --git a/CRM/Case/Page/Tab.php b/CRM/Case/Page/Tab.php index 3fde260ac1..63b166d231 100644 --- a/CRM/Case/Page/Tab.php +++ b/CRM/Case/Page/Tab.php @@ -163,6 +163,7 @@ class CRM_Case_Page_Tab extends CRM_Core_Page { if ($this->_contactId) { $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); $this->assign('displayName', $displayName); + $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('case', $this->_contactId); } } diff --git a/CRM/Contact/Page/View/GroupContact.php b/CRM/Contact/Page/View/GroupContact.php index 4091151ff5..29fc642571 100644 --- a/CRM/Contact/Page/View/GroupContact.php +++ b/CRM/Contact/Page/View/GroupContact.php @@ -66,6 +66,8 @@ class CRM_Contact_Page_View_GroupContact extends CRM_Core_Page { $contactSmartGroupSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_smart_group_display'); $this->assign('contactSmartGroupSettings', $contactSmartGroupSettings); + + $this->ajaxResponse['tabCount'] = count($in); } /** diff --git a/CRM/Contact/Page/View/Note.php b/CRM/Contact/Page/View/Note.php index 9a570257ae..1757db6cbe 100644 --- a/CRM/Contact/Page/View/Note.php +++ b/CRM/Contact/Page/View/Note.php @@ -158,6 +158,8 @@ class CRM_Contact_Page_View_Note extends CRM_Core_Page { $note->id ); $this->assign('commentAction', $commentAction); + + $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('note', $this->_contactId); } /** @@ -284,7 +286,6 @@ class CRM_Contact_Page_View_Note extends CRM_Core_Page { 'name' => ts('Delete'), 'url' => 'civicrm/contact/view/note', 'qs' => 'action=delete&reset=1&cid=%%cid%%&id=%%id%%&selectedChild=note', - 'extra' => 'onclick = "if (confirm(\'' . $deleteExtra . '\') ) this.href+=\'&confirmed=1\'; else return false;"', 'title' => ts('Delete Note'), ), ); diff --git a/CRM/Contact/Page/View/Relationship.php b/CRM/Contact/Page/View/Relationship.php index 06d5d99ee5..b3ab7bd1ad 100644 --- a/CRM/Contact/Page/View/Relationship.php +++ b/CRM/Contact/Page/View/Relationship.php @@ -171,6 +171,8 @@ class CRM_Contact_Page_View_Relationship extends CRM_Core_Page { // from relationship tab, not from dashboard $this->assign('relationshipTabContext', TRUE); $this->assign('inactiveRelationships', $inactiveRelationships); + + $this->ajaxResponse['tabCount'] = count($currentRelationships); } /** diff --git a/CRM/Contact/Page/View/Summary.php b/CRM/Contact/Page/View/Summary.php index 640d7f20f7..f0a5f44ec2 100644 --- a/CRM/Contact/Page/View/Summary.php +++ b/CRM/Contact/Page/View/Summary.php @@ -330,6 +330,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { 'title' => $elem['title'], 'weight' => $elem['weight'], 'count' => CRM_Contact_BAO_Contact::getCountComponent($u, $this->_contactId), + 'class' => 'livePage', ); // make sure to get maximum weight, rest of tabs go after // FIXME: not very elegant again @@ -355,6 +356,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { ), 'note' => array( 'title' => ts('Notes'), + 'class' => 'livePage', ), 'tag' => array( 'title' => ts('Tags'), diff --git a/CRM/Contribute/Page/Tab.php b/CRM/Contribute/Page/Tab.php index bedc1f5f67..ca154e71f0 100644 --- a/CRM/Contribute/Page/Tab.php +++ b/CRM/Contribute/Page/Tab.php @@ -265,6 +265,7 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page { if ($this->_contactId) { $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); $this->assign('displayName', $displayName); + $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('contribution', $this->_contactId); } } diff --git a/CRM/Event/Page/Tab.php b/CRM/Event/Page/Tab.php index 82f3e6917b..be4637fd38 100644 --- a/CRM/Event/Page/Tab.php +++ b/CRM/Event/Page/Tab.php @@ -59,6 +59,7 @@ class CRM_Event_Page_Tab extends CRM_Core_Page { if ($this->_contactId) { $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); $this->assign('displayName', $displayName); + $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('participant', $this->_contactId); } } diff --git a/CRM/Grant/Page/Tab.php b/CRM/Grant/Page/Tab.php index 8511759851..2befaec62b 100644 --- a/CRM/Grant/Page/Tab.php +++ b/CRM/Grant/Page/Tab.php @@ -66,6 +66,7 @@ class CRM_Grant_Page_Tab extends CRM_Contact_Page_View { if ($this->_contactId) { $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); $this->assign('displayName', $displayName); + $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('grant', $this->_contactId); } } diff --git a/CRM/Member/Page/Tab.php b/CRM/Member/Page/Tab.php index d62568a4ac..629aa6d3ad 100644 --- a/CRM/Member/Page/Tab.php +++ b/CRM/Member/Page/Tab.php @@ -205,6 +205,7 @@ class CRM_Member_Page_Tab extends CRM_Core_Page { if ($this->_contactId) { $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); $this->assign('displayName', $displayName); + $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('membership', $this->_contactId); } } diff --git a/CRM/Pledge/Page/Tab.php b/CRM/Pledge/Page/Tab.php index 1f6589d364..22b0897726 100644 --- a/CRM/Pledge/Page/Tab.php +++ b/CRM/Pledge/Page/Tab.php @@ -54,6 +54,7 @@ class CRM_Pledge_Page_Tab extends CRM_Core_Page { if ($this->_contactId) { $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); $this->assign('displayName', $displayName); + $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('pledge', $this->_contactId); } } diff --git a/templates/CRM/Contact/Page/View/GroupContact.tpl b/templates/CRM/Contact/Page/View/GroupContact.tpl index 811f023246..ccec5fe17f 100644 --- a/templates/CRM/Contact/Page/View/GroupContact.tpl +++ b/templates/CRM/Contact/Page/View/GroupContact.tpl @@ -212,8 +212,6 @@ }); }); {/literal} - // update count - CRM.updateTabCount('#tab_group', {$groupIn|@count}); // Hack to ensure status msg is properly translated CRM.strings.Added = "{ts escape='js'}Added{/ts}"; CRM.strings.Removed = "{ts escape='js'}Removed{/ts}"; diff --git a/templates/CRM/Contact/Page/View/Note.tpl b/templates/CRM/Contact/Page/View/Note.tpl index 2a9dbf73d2..d34a4cfc36 100644 --- a/templates/CRM/Contact/Page/View/Note.tpl +++ b/templates/CRM/Contact/Page/View/Note.tpl @@ -38,7 +38,7 @@ {include file="CRM/Form/attachment.tpl"} {/if} -
+
{if $comments}
@@ -108,7 +108,7 @@ {/if} -{if $permission EQ 'edit' AND ($action eq 16 or $action eq 4 or $action eq 8)} +{if $permission EQ 'edit' AND ($action eq 16)} @@ -116,7 +116,7 @@ {/if}
-{if $notes} +{if $notes and $action eq 16}