CRM-12865 - Define regions and CSS classes for profile forms
authorTim Otten <totten@civicrm.org>
Wed, 10 Jul 2013 03:22:39 +0000 (20:22 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 10 Jul 2013 03:42:07 +0000 (20:42 -0700)
With this revision, the following can be used:

 * civicrm/profile
   * CSS: form#Search .crm-profile-name-{NAME}
   * Region: profile-search-{NAME}
 * civicrm/profile/create:
   * CSS: form#Edit .crm-profile-name-{NAME}
   * Region: profile-form-{NAME}
 * civicrm/profile/edit:
   * CSS: form#Edit .crm-profile-name-{NAME}
   * Region: profile-form-{NAME}
 * civicrm/profile/view:
   * CSS: .crm-profile-view .crm-profile-name-{NAME}
   * Region: profile-view-{NAME}
 * civicrm/event/register:
   * CSS: .crm-event-register-form-block .crm-profile-name-{NAME}
 * civicrm/contribute/transact:
   * CSS: .crm-contribution-main-form-block .crm-profile-name-{NAME}

----------------------------------------
* CRM-12865: Define hook/CSS/region names for profile forms
  http://issues.civicrm.org/jira/browse/CRM-12865

CRM/Profile/Form.php
CRM/Profile/Page/Dynamic.php
CRM/Profile/Page/Listings.php
templates/CRM/Profile/Form/Dynamic.tpl
templates/CRM/Profile/Page/Dynamic.tpl
templates/CRM/Profile/Page/Listings.tpl

index 4adf3181ebbaa72479760205324e60954a551f17..e96653dbbefe35486ff71d071ad936177be8aad6 100644 (file)
@@ -256,13 +256,17 @@ class CRM_Profile_Form extends CRM_Core_Form {
     }
     $this->_isContactActivityProfile = CRM_Core_BAO_UFField::checkContactActivityProfileType($this->_gid);
 
-    //get values for captch and dupe update.
+    //get values for ufGroupName, captch and dupe update.
+    $this->assign('ufGroupName', 'unknown'); // override later (if possible)
     if ($this->_gid) {
       $dao = new CRM_Core_DAO_UFGroup();
       $dao->id = $this->_gid;
       if ($dao->find(TRUE)) {
         $this->_isUpdateDupe = $dao->is_update_dupe;
         $this->_isAddCaptcha = $dao->add_captcha;
+        if (!empty($dao->name)) {
+          $this->assign('ufGroupName', $dao->name);
+        }
       }
       $dao->free();
     }
index d66d1b547c8c4b9e539ad8bfebd0f6e145b54d3f..3847e71b056e20eccb3b338e57638eeab261f204 100644 (file)
@@ -333,6 +333,7 @@ class CRM_Profile_Page_Dynamic extends CRM_Core_Page {
     }
 
     $name = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'name');
+    $this->assign('ufGroupName', $name);
 
     if (strtolower($name) == 'summary_overlay') {
       $template->assign('overlayProfile', TRUE);
index e7993ab1f0ebdbe44537e805769aa24c59af207f..3f2b4a447adb61e2656ce4c57ca365e77e98cb94 100644 (file)
@@ -283,6 +283,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
     $this->preProcess();
 
     $this->assign('recentlyViewed', FALSE);
+    $this->assign('ufGroupName', 'unknown'); // override later (if possible)
 
     if ($this->_gid) {
       $ufgroupDAO = new CRM_Core_DAO_UFGroup();
@@ -297,6 +298,9 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
       if ($ufgroupDAO->title) {
         CRM_Utils_System::setTitle($ufgroupDAO->title);
       }
+      if ($ufgroupDAO->name) {
+        $this->assign('ufGroupName', $ufgroupDAO->name);
+      }
     }
 
     $this->assign('isReset', TRUE);
index ea1546762739fd0553ad0f11dd76d98d9dd47ee2..389f91f0c1e419666fc959de057596ad13eeb48d 100644 (file)
@@ -23,6 +23,9 @@
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
 *}
+<div class="crm-profile-name-{$ufGroupName}">
+{crmRegion name=profile-form-`$ufGroupName`}
+
 {* Profile forms when embedded in CMS account create (mode=1) or
     cms account edit (mode=8) or civicrm/profile (mode=4) pages *}
 {if ($context eq 'multiProfileDialog')}
@@ -374,3 +377,5 @@ cj(document).ready(function(){
 </script>
 {/literal}
 
+{/crmRegion}
+</div> {* end crm-profile-NAME *}
index 4166e61305d996daf3ee7c48661ab53b7754bcc6..8664b5124ea6ebc395c2581c9d7ebc10e8c3174a 100644 (file)
@@ -29,6 +29,8 @@
         {include file="CRM/Profile/Page/Overlay.tpl"}
     {else}
         <div id="crm-container" class="crm-container" lang="{$config->lcMessages|truncate:2:"":true}" xml:lang="{$config->lcMessages|truncate:2:"":true}">
+            <div class="crm-profile-name-{$ufGroupName}">
+            {crmRegion name=profile-view-`$ufGroupName`}
             {foreach from=$profileFields item=field key=rowName}
               <div id="row-{$rowName}" class="crm-section {$rowName}-section">
                 <div class="label">
@@ -40,6 +42,8 @@
                  <div class="clear"></div>
               </div>
             {/foreach}
+            {/crmRegion}
+            </div>
         </div>
     {/if}
 {/if} 
index dc1971a2c964f7b209d7f98530b15886dc62743b..21c579906e1c9fc3fee7d2688ba9e4519754780e 100644 (file)
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
 *}
+
+<div class="crm-profile-name-{$ufGroupName}">
+{crmRegion name=profile-search-`$ufGroupName`}
+
 {* make sure there are some fields in the selector *}
 {if ! empty( $columnHeaders ) || $isReset }
 
@@ -89,4 +93,7 @@
         {ts}No fields in this Profile have been configured to display as a result column in the search results table. Ask the site administrator to check the Profile setup.{/ts}
     </div>
 {/if}
-</div>
\ No newline at end of file
+</div>
+
+{/crmRegion}
+</div>{* crm-profile-name-NAME *}