CRM-14400 : migration to use LivePage AJAX
authorPratik Joshi <pratik.joshi@webaccess.co.in>
Fri, 28 Mar 2014 08:31:30 +0000 (14:01 +0530)
committerPratik Joshi <pratik.joshi@webaccess.co.in>
Fri, 28 Mar 2014 13:26:04 +0000 (18:56 +0530)
CRM/Profile/Form.php
CRM/Profile/Page/Dynamic.php
CRM/Profile/Page/MultipleRecordFieldsListing.php
templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl

index 038806f42a64cc470de7be0bc628ba4e48b2628b..f5a346eaff02a11b81d7a3eca791dccdda98008f 100644 (file)
@@ -358,6 +358,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
 
         } elseif (!empty($this->_multiRecordFields)
            && (!$this->_multiRecord || !in_array($this->_multiRecord, array(CRM_Core_Action::DELETE, CRM_Core_Action::UPDATE)) )) {
+          CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
           //multirecord listing page
           $multiRecordFieldListing = TRUE;
           $page = new CRM_Profile_Page_MultipleRecordFieldsListing();
index c187b667932be4796258c555f36016eb8faedf43..e8cd0aa4e039494e40d24de07f307fab9a09a53a 100644 (file)
@@ -352,7 +352,7 @@ class CRM_Profile_Page_Dynamic extends CRM_Core_Page {
       $fieldDetail = reset($fields);
       $fieldId = CRM_Core_BAO_CustomField::getKeyID($fieldDetail['name']);
       $customGroupDetails = CRM_Core_BAO_CustomGroup::getGroupTitles(array($fieldId));
-      $title = $customGroupDetails[$fieldId]['groupTitle'];
+      $multiRecTitle = $customGroupDetails[$fieldId]['groupTitle'];
     } else {
       $title = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'title');
     }
@@ -374,6 +374,7 @@ class CRM_Profile_Page_Dynamic extends CRM_Core_Page {
       $title .= ' - ' . $displayName;
     }
 
+    $title = isset($multiRecTitle) ? ts('View %1 Record', array(1 => $multiRecTitle)) : $title;
     CRM_Utils_System::setTitle($title);
 
     // invoke the pagRun hook, CRM-3906
index 3dfaabc4ee68a8bce14bbd310d7c4430948215db..316edbc0f2f2693df42e6015c015678e64c13e5b 100644 (file)
@@ -53,6 +53,7 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic {
   protected $_pageViewType = NULL;
 
   protected $_contactType = NULL;
+
   /**
    * Get BAO Name
    *
index 015c3ccaf833cb02b6d25792d4d6a8448668fa4d..f3bd6b9cd75c8c004ac30caf2702f85a14b9051d 100644 (file)
        class="button action-item"><span><div class="icon add-icon"></div>{ts}Add New Record{/ts}</span></a>
     {/if}
   {/if}
-{/if}
-{literal}
-  <script type='text/javascript'>
-    cj(function () {
-      var dialogId = '{/literal}{$dialogId}{literal}';
-      var pageViewType = '{/literal}{$pageViewType}{literal}';
-      // NOTE: Triggers two events, "profile-dialog:FOO:open" and "profile-dialog:FOO:close",
-      // where "FOO" is the internal name of a profile form
-      function formDialog(dialogName, dataURL, dialogTitle) {
-        cj.ajax({
-          url: dataURL,
-          success: function (content) {
-            cj('#' + dialogId).show().html(content).dialog({
-              title: dialogTitle,
-              modal: true,
-              width: 750,
-              overlay: {
-                opacity: 0.5,
-                background: "black"
-              },
-              open: function(event, ui) {
-                cj('#' + dialogId).trigger({
-                  type: "crmFormLoad",
-                  profileName: dialogName
-                });
-              },
-              close: function (event, ui) {
-                cj('#' + dialogId).trigger({
-                  type: "crmFormClose",
-                  profileName: dialogName
-                });
-                cj('#' + dialogId).html('');
-              }
-            });
-            cj('.action-link').hide();
-            if (pageViewType == 'customDataView') {
-              var labelElement = cj('#custom-record-dialog .html-adjust label').css('display', 'inline');
-            }
-            else {
-              var labelElement = cj('#profile-dialog #crm-profile-block .edit-value label').css('display', 'inline');
-            }
-          }
-        });
-      }
-
-      var profileName = {/literal}"{$ufGroupName}"{literal};
-
-      if (pageViewType == 'customDataView') {
-        var actionItemHeirarchy = '.action-item';
-        profileName = 'customRecordView';
-      }
-      else {
-        var actionItemHeirarchy = '.crm-profile-name-' + profileName + ' .action-item';
-      }
-    });
-    </script>
-  {/literal}
+{/if}
\ No newline at end of file