CRM-13863 - Improve activity popup behavior
authorColeman Watts <coleman@civicrm.org>
Thu, 9 Jan 2014 20:11:15 +0000 (12:11 -0800)
committerColeman Watts <coleman@civicrm.org>
Thu, 9 Jan 2014 20:14:40 +0000 (12:14 -0800)
CRM/Activity/Form/Activity.php
CRM/Activity/Form/ActivityView.php
CRM/Contact/BAO/Contact.php
js/Common.js
js/crm.livePage.js
templates/CRM/Activity/Form/ActivityLinks.tpl
templates/CRM/common/TabHeader.js

index 9081ed92ec4591518bd229e72384e9a0ecc44910..6378317e31080ecf4578f13ae64e0fbf44b27173 100644 (file)
@@ -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
index 9904b737d25880ddd4eb2944f3856da2abeebe62..1fbd56f27e0d8671745759aad3176e598841ee31 100644 (file)
@@ -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' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
           'isDefault' => TRUE,
index f34b6e378d260211575bd789fc522d80e015366c..333451e9ff088c59bfc71b9230b8aac0809789f1 100644 (file)
@@ -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(
index 77a7f337d16f00c11d0ed7917f7d3e0ec32f71bd..3c59e8d2fd5a4efc433dcc5b18b2a00638882b18 100644 (file)
@@ -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) {
index 9ee6d03c4ce5b39c78c79f23948b1699a93ea978..dff3beff868df33ca65998617181205e7ebf906d 100644 (file)
@@ -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');
index f48e17b61bb0106df31a73c135edafeb68344cd6..6bad5c71b6d0114ba6bcf1e1d0e404361362d470 100644 (file)
@@ -55,6 +55,7 @@
 {/literal}
 {else}
 <ul>
+  <li class="crm-activity-tab"><a href="#" data-tab="activity">{ts}Record Activity:{/ts}</a></li>
 {foreach from=$activityTypes key=k item=link}
 <li class="crm-activity-type_{$k}"><a href="{$urls.$k}" data-tab="activity">{$link}</a></li>
 {/foreach}
index e6e4e1b727da234a7d99049fd71d9696beb90203..89ebe826010fdba348950cc1632c1fefa0655c25 100644 (file)
@@ -33,21 +33,13 @@ cj(function($) {
           ui.panel
             .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 when form completes
                   ui.panel.crmSnippet('refresh');