$controller->set('contactId', $this->_contactId);
$controller->setEmbedded(TRUE);
$controller->run();
+ $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('activity', $this->_contactId);
}
function edit() {
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);
}
}
$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);
}
/**
$note->id
);
$this->assign('commentAction', $commentAction);
+
+ $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('note', $this->_contactId);
}
/**
'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'),
),
);
// from relationship tab, not from dashboard
$this->assign('relationshipTabContext', TRUE);
$this->assign('inactiveRelationships', $inactiveRelationships);
+
+ $this->ajaxResponse['tabCount'] = count($currentRelationships);
}
/**
'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
),
'note' => array(
'title' => ts('Notes'),
+ 'class' => 'livePage',
),
'tag' => array(
'title' => ts('Tags'),
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
});
});
{/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}";
{include file="CRM/Form/attachment.tpl"}
{/if}
</table>
- <div class="crm-submit-buttons"><input type="button" name='cancel' value="{ts}Done{/ts}" onclick="location.href='{crmURL p='civicrm/contact/view' q='action=browse&selectedChild=note'}';"/></div>
+ <div class="crm-submit-buttons"><input type="submit" class='cancel form-submit' value="{ts}Done{/ts}"/></div>
{if $comments}
<fieldset>
{/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)}
<div class="action-link">
<a accesskey="N" href="{crmURL p='civicrm/contact/view/note' q="cid=`$contactId`&action=add"}" class="button"><span><div class="icon add-icon"></div>{ts}Add Note{/ts}</span></a>
</div>
{/if}
<div class="crm-content-block">
-{if $notes}
+{if $notes and $action eq 16}
<script type="text/javascript">
var commentAction = '{$commentAction|escape:quotes}'
{/strip}
</div>
</div>
-{elseif ! ($action eq 1)}
+{elseif ($action eq 16)}
<div class="messages status no-popup">
<div class="icon inform-icon"></div>
- {capture assign=crmURL}{crmURL p='civicrm/contact/view/note' q="cid=`$contactId`&action=add"}{/capture}
- {ts 1=$crmURL}There are no Notes for this contact. You can <a accesskey="N" href='%1'>add one</a>.{/ts}
+ {capture assign=link}class="action-item action-item-first" accesskey="N" href="{crmURL p='civicrm/contact/view/note' q="cid=`$contactId`&action=add"}"{/capture}
+ {ts 1=$link}There are no Notes for this contact. You can <a %1>add one</a>.{/ts}
</div>
{/if}
</div>
}
// Update changelog tab and contact footer
if (response.changeLog.count) {
- CRM.updateTabCount('#tab_log', response.changeLog.count);
+ CRM.tabHeader.updateCount('#tab_log', response.changeLog.count);
}
$("#crm-record-log").replaceWith(response.changeLog.markup);
// Refresh tab contents - Advanced logging
<div id="help">
{ts 1=$displayName}Pledges received from %1 since inception.{/ts}
{if $permission EQ 'edit'}
- {capture assign=newContribURL}{crmURL p="civicrm/contact/view/pledge" q="reset=1&action=add&cid=`$contactId`&context=pledge"}{/capture}
- {ts 1=$newContribURL}Click <a href='%1'>Add Pledge</a> to record a new pledge received from this contact.{/ts}
+ {capture assign=newContribURL}class="action-item action-item-first" href="{crmURL p="civicrm/contact/view/pledge" q="reset=1&action=add&cid=`$contactId`&context=pledge"}"{/capture}
+ {ts 1=$newContribURL}Click <a %1>Add Pledge</a> to record a new pledge received from this contact.{/ts}
{/if}
</div>
tags.push($(this).text());
});
// showing count of tags in summary tab
- CRM.updateTabCount('#tab_tag', tags.length);
+ CRM.tabHeader.updateCount('#tab_tag', tags.length);
// update summary tab
$("#tags").html(tags.join(', '));
};
return false;
});
}
+ ui.panel
+ .off('crmLoad.tabCount')
+ .on('crmLoad.tabCount', function(e, data) {
+ if (typeof(data.tabCount) !== 'undefined') {
+ CRM.tabHeader.updateCount(ui.tab, data.tabCount);
+ }
+ });
CRM[method]($('a', ui.tab).attr('href'), params);
}
e.preventDefault();
.tabs(tabSettings);
});
(function($) {
- CRM.updateTabCount = function(tab, count) {
+ // Utility functions
+ CRM.tabHeader = CRM.tabHeader || {};
+ CRM.tabHeader.updateCount = function(tab, count) {
$(tab)
- .removeClass($(tab).attr('class').match(/(crm-count-\d+)/)[0])
+ .removeClass($(tab).attr('class').match(/(crm-count-\d+)/)[0] || 'null')
.addClass('crm-count-' + count)
.find('a em').html('' + count);
}