From: Coleman Watts Date: Thu, 9 Jan 2014 20:11:15 +0000 (-0800) Subject: CRM-13863 - Improve activity popup behavior X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a10432db1515129d254388b49c2904c5f51d84c5;p=civicrm-core.git CRM-13863 - Improve activity popup behavior --- diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index 9081ed92ec..6378317e31 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -230,10 +230,6 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } $this->assign('contactId', $this->_currentlyViewedContactId); - if ($this->_currentlyViewedContactId) { - CRM_Contact_Page_View::setTitle($this->_currentlyViewedContactId); - } - //give the context. if (!isset($this->_context)) { $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); @@ -305,10 +301,22 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } } - // Assign pageTitle to be "Activity - "+ activity name + // Set title if (isset($activityTName)) { - $pageTitle = 'Activity - ' . CRM_Utils_Array::value($this->_activityTypeId, $activityTName); - $this->assign('pageTitle', $pageTitle); + $activityName = CRM_Utils_Array::value($this->_activityTypeId, $activityTName); + $this->assign('pageTitle', ts('%1 Activity', $activityName)); + + if ($this->_currentlyViewedContactId) { + $displayName = CRM_Contact_BAO_Contact::displayName($this->_currentlyViewedContactId); + // Check if this is default domain contact CRM-10482 + if (CRM_Contact_BAO_Contact::checkDomainContact($this->_currentlyViewedContactId)) { + $displayName .= ' (' . ts('default organization') . ')'; + } + CRM_Utils_System::setTitle($displayName . ' - ' . $activityName); + } + else { + CRM_Utils_System::setTitle(ts('%1 Activity', $activityName)); + } } //check the mode when this form is called either single or as diff --git a/CRM/Activity/Form/ActivityView.php b/CRM/Activity/Form/ActivityView.php index 9904b737d2..1fbd56f27e 100644 --- a/CRM/Activity/Form/ActivityView.php +++ b/CRM/Activity/Form/ActivityView.php @@ -121,7 +121,7 @@ class CRM_Activity_Form_ActivityView extends CRM_Core_Form { public function buildQuickForm() { $this->addButtons(array( array( - 'type' => 'next', + 'type' => 'cancel', 'name' => ts('Done'), 'spacing' => '         ', 'isDefault' => TRUE, diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index f34b6e378d..333451e9ff 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -2763,7 +2763,6 @@ AND civicrm_openid.is_primary = 1"; 'weight' => 35, 'ref' => 'new-activity', 'key' => 'activity', - 'tab' => 'activity', 'permissions' => array('edit all contacts'), ), 'pledge' => array( diff --git a/js/Common.js b/js/Common.js index 77a7f337d1..3c59e8d2fd 100644 --- a/js/Common.js +++ b/js/Common.js @@ -963,6 +963,13 @@ CRM.validate = CRM.validate || { } } }; + // Hack to make delete dialogs smaller + if (url.indexOf('/delete') > 0 || url.indexOf('action=delete') > 0) { + settings.dialog = { + width: 400, + height: 300 + }; + } // Move options that belong to crmForm. Others will be passed through to crmSnippet options && $.each(options, function(key, value) { if (typeof(settings.crmForm[key]) !== 'undefined') { @@ -1019,9 +1026,9 @@ CRM.validate = CRM.validate || { }, beforeSerialize: function(form, options) { if (window.CKEDITOR && window.CKEDITOR.instances) { - for (var instance in CKEDITOR.instances) { - CKEDITOR.instances[instance].updateElement(); - } + $.each(CKEDITOR.instances, function() { + this.updateElement && this.updateElement(); + }); } }, beforeSubmit: function(submission) { diff --git a/js/crm.livePage.js b/js/crm.livePage.js index 9ee6d03c4c..dff3beff86 100644 --- a/js/crm.livePage.js +++ b/js/crm.livePage.js @@ -7,21 +7,13 @@ cj(function($) { // Open action links in a popup .off('click.crmLivePage') .on('click.crmLivePage', 'a.button, a.action-item', function() { - var - dialogSettings = {}, - url = $(this).attr('href'); + var url = $(this).attr('href'); // only follow real links not javascript buttons if (url === '#' || $(this).attr('onclick') || $(this).hasClass('no-popup')) { return; } - // Hack to make delete dialogs smaller - if (url.indexOf('/delete') > 0 || url.indexOf('action=delete') > 0) { - dialogSettings.width = 400; - dialogSettings.height = 300; - } CRM.loadForm(url, { - openInline: 'a:not("[href=#], .no-popup")', - dialog: dialogSettings + openInline: 'a:not("[href=#], .no-popup")' }).on('crmFormSuccess', function(e, data) { // Refresh page when form completes $('#crm-main-content-wrapper').crmSnippet('refresh'); diff --git a/templates/CRM/Activity/Form/ActivityLinks.tpl b/templates/CRM/Activity/Form/ActivityLinks.tpl index f48e17b61b..6bad5c71b6 100644 --- a/templates/CRM/Activity/Form/ActivityLinks.tpl +++ b/templates/CRM/Activity/Form/ActivityLinks.tpl @@ -55,6 +55,7 @@ {/literal} {else}