Merge branch 'angular-tests' of https://github.com/giant-rabbit/civicrm-core into...
[civicrm-core.git] / CRM / UF / Form / Group.php
index ed56a0c26ae67d44603017986df94f8ea81c57a1..5a6e4ef7ece6952ec6c64ae912ec6cc46c50ce16 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
 class CRM_UF_Form_Group extends CRM_Core_Form {
 
   /**
-   * the form id saved to the session for an update
+   * The form id saved to the session for an update
    *
    * @var int
-   * @access protected
    */
   protected $_id;
 
   /**
-   * the title for group
+   * The title for group
    *
    * @var int
-   * @access protected
    */
   protected $_title;
   protected $_groupElement;
@@ -58,10 +56,9 @@ class CRM_UF_Form_Group extends CRM_Core_Form {
   protected $_allPanes;
 
   /**
-   * Function to set variables up before form is built
+   * Set variables up before form is built
    *
    * @return void
-   * @access public
    */
   public function preProcess() {
     // current form id
@@ -109,10 +106,9 @@ class CRM_UF_Form_Group extends CRM_Core_Form {
   }
 
   /**
-   * Function to actually build the form
+   * Build the form object
    *
    * @return void
-   * @access public
    */
   public function buildQuickForm() {
     if ($this->_action & (CRM_Core_Action::DISABLE | CRM_Core_Action::DELETE)) {
@@ -208,14 +204,13 @@ class CRM_UF_Form_Group extends CRM_Core_Form {
   }
 
   /**
-   * This function sets the default values for the form. Note that in edit/view mode
+   * Set default values for the form. Note that in edit/view mode
    * the default values are retrieved from the database
    *
-   * @access public
    *
    * @return void
    */
-  function setDefaultValues() {
+  public function setDefaultValues() {
     $defaults = array();
     $showHide = new CRM_Core_ShowHideBlocks();
 
@@ -284,17 +279,16 @@ class CRM_UF_Form_Group extends CRM_Core_Form {
   }
 
   /**
-   * global form rule
+   * Global form rule
    *
    * @param array $fields  the input form values
    * @param array $files   the uploaded files if any
    * @param array $self    current form object.
    *
    * @return true if no errors, else array of errors
-   * @access public
    * @static
    */
-  static function formRule($fields, $files, $self) {
+  public static function formRule($fields, $files, $self) {
     $errors = array();
 
     //validate profile title as well as name.
@@ -316,7 +310,6 @@ class CRM_UF_Form_Group extends CRM_Core_Form {
    * Process the form
    *
    * @return void
-   * @access public
    */
   public function postProcess() {
     if ($this->_action & CRM_Core_Action::DELETE) {
@@ -368,7 +361,9 @@ class CRM_UF_Form_Group extends CRM_Core_Form {
         CRM_Core_Session::setStatus(ts("Your CiviCRM Profile '%1' has been saved.", array(1 => $ufGroup->title)), ts('Profile Saved'), 'success');
       }
       else {
-        $url = CRM_Utils_System::url('civicrm/admin/uf/group/field/add', 'reset=1&action=add&gid=' . $ufGroup->id);
+        // Jump directly to adding a field if popups are disabled
+        $action = CRM_Core_Resources::singleton()->ajaxPopupsEnabled ? '' : '/add';
+        $url = CRM_Utils_System::url("civicrm/admin/uf/group/field$action", 'reset=1&new=1&gid=' . $ufGroup->id . '&action=' . ($action ? 'add' : 'browse'));
         CRM_Core_Session::setStatus(ts('Your CiviCRM Profile \'%1\' has been added. You can add fields to this profile now.',
             array(1 => $ufGroup->title)
           ), ts('Profile Added'), 'success');
@@ -381,4 +376,3 @@ class CRM_UF_Form_Group extends CRM_Core_Form {
     CRM_Utils_System::updateCategories();
   }
 }
-