Commits

Hisateru Tanaka committed 80daa78 Merge

Merged

Comments (0)

Files changed (45)

 10ecb5216d06e94adbd978ea2db5cec98f3ba8ee stable
 03f2734b34d3a91caeeefb751b372032414e29a3 stable
 03f2734b34d3a91caeeefb751b372032414e29a3 0.7.80
+757b52dcaaab894a19daf3a437006443559ae4f5 0.8.00
+17596b51d97d227e5e2f9a18946144921cd9a01c unstable
+757b52dcaaab894a19daf3a437006443559ae4f5 unstable
+03f2734b34d3a91caeeefb751b372032414e29a3 stable
+757b52dcaaab894a19daf3a437006443559ae4f5 stable

app/protected/commands/ManageMetadataCommand.php

                 $viewClassNames  = $module::getViewClassNames();
                 if (count($viewClassNames))
                 {
-                    foreach($viewClassNames as $className)
+                    foreach ($viewClassNames as $className)
                     {
-
                         $classToEvaluate     = new ReflectionClass($className);
                         if (is_subclass_of($className, 'MetadataView') &&
                             !$classToEvaluate->isAbstract() &&

app/protected/commands/UpgradeZurmoCommand.php

                 $confirm = true;
             }
 
-
             if ($confirm)
             {
                 UpgradeUtil::runPart1($messageStreamer);

app/protected/config/common.php

                         'class'  => 'CFileLogRoute',
                         'levels' => 'error, warning',
                     ),
-                        /*
-                    array(
-                        'class'=>'application.extensions.sentrylog.RSentryLog',
-                        'dsn' => 'http://5232100222bc4404b368026413df2d9a:47f7a2f1542348d68bea7b00f2261ede@sentry.zurmo.com/2',
-                        'levels'=>'error',
-                    ),
-                    */
                 ),
             ),
             'mappingHelper' => array(

app/protected/core/components/ConsoleApplication.php

         {
             $this->_theme = $value;
         }
+
+        public function createAbsoluteUrl($route, $params = array(), $schema = '', $ampersand = '&')
+        {
+            $url = $this->createUrl($route, $params, $ampersand);
+            if(strpos($url, 'http') === 0)
+            {
+                return $url;
+            }
+            else
+            {
+                return Yii::app()->getRequest()->getHostInfo($schema).$url;
+            }
+        }
     }
 ?>

app/protected/core/components/ThemeManager.php

     {
         const DEFAULT_THEME_COLOR = 'blue';
 
-
         public function resolveAndGetThemeColorValue(User $user)
         {
             assert('$user instanceOf User && $user->id > 0');
 
         public function getActiveThemeColor()
         {
-            if(Yii::app()->user->userModel == null)
+            if (Yii::app()->user->userModel == null)
             {
                 return $this->getDefaultThemeColor();
             }
 
         public function getActiveBackgroundTexture()
         {
-            if(Yii::app()->user->userModel == null)
+            if (Yii::app()->user->userModel == null)
             {
                 return null;
             }

app/protected/core/exceptions/FailedToValidateException.php

-<?php
-    /*********************************************************************************
-     * Zurmo is a customer relationship management program developed by
-     * Zurmo, Inc. Copyright (C) 2012 Zurmo Inc.
-     *
-     * Zurmo is free software; you can redistribute it and/or modify it under
-     * the terms of the GNU General Public License version 3 as published by the
-     * Free Software Foundation with the addition of the following permission added
-     * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
-     * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
-     * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
-     *
-     * Zurmo is distributed in the hope that it will be useful, but WITHOUT
-     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-     * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-     * details.
-     *
-     * You should have received a copy of the GNU General Public License along with
-     * this program; if not, see http://www.gnu.org/licenses or write to the Free
-     * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-     * 02110-1301 USA.
-     *
-     * You can contact Zurmo, Inc. with a mailing address at 113 McHenry Road Suite 207,
-     * Buffalo Grove, IL 60089, USA. or at email address contact@zurmo.com.
-     ********************************************************************************/
-
-    /**
-     * Exception thrown when some form attributes fails to validate .
-     */
-    class FailedToValidateException extends CException
-    {
-    }
-?>
+<?php
+    /*********************************************************************************
+     * Zurmo is a customer relationship management program developed by
+     * Zurmo, Inc. Copyright (C) 2012 Zurmo Inc.
+     *
+     * Zurmo is free software; you can redistribute it and/or modify it under
+     * the terms of the GNU General Public License version 3 as published by the
+     * Free Software Foundation with the addition of the following permission added
+     * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
+     * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
+     * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
+     *
+     * Zurmo is distributed in the hope that it will be useful, but WITHOUT
+     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+     * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+     * details.
+     *
+     * You should have received a copy of the GNU General Public License along with
+     * this program; if not, see http://www.gnu.org/licenses or write to the Free
+     * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+     * 02110-1301 USA.
+     *
+     * You can contact Zurmo, Inc. with a mailing address at 113 McHenry Road Suite 207,
+     * Buffalo Grove, IL 60089, USA. or at email address contact@zurmo.com.
+     ********************************************************************************/
+
+    /**
+     * Exception thrown when some form attributes fails to validate .
+     */
+    class FailedToValidateException extends CException
+    {
+    }
+?>

app/protected/core/views/EditView.php

             $formEnd  = $clipWidget->renderEndWidget();
             $content .= $formEnd;
             $content .= '</div>';
-            if($this->wrapContentInWrapperDiv)
+            if ($this->wrapContentInWrapperDiv)
             {
                 return ZurmoHtml::tag('div', array('class' => 'wrapper'), $content);
             }

app/protected/core/views/ListView.php

                 'afterAjaxUpdate'      => $this->getCGridViewAfterAjaxUpdate(),
                 'columns'              => $columns,
                 'nullDisplay'          => '&#160;',
-                'pagerCssClass'		   => static::getPagerCssClass(),
+                'pagerCssClass'        => static::getPagerCssClass(),
                 'showTableOnEmpty'     => $this->getShowTableOnEmpty(),
                 'emptyText'            => $this->getEmptyText(),
                 'template'             => static::getGridTemplate(),

app/protected/core/views/ModalView.php

             {
                 $heightContent = $height;
             }
-            if(is_array($position))
+            if (is_array($position))
             {
                 $position = CJSON::encode($position);
             }

app/protected/core/views/PageView.php

         {
             $classContent      = Yii::app()->themeManager->getActiveThemeColor();
             $backgroundTexture = Yii::app()->themeManager->getActiveBackgroundTexture();
-            if($backgroundTexture != null)
+            if ($backgroundTexture != null)
             {
                 $classContent .= ' ' . $backgroundTexture;
             }

app/protected/core/widgets/AmChart.php

         public $scriptFile = 'amcharts.js';
 
         public $assetFolderName = 'amChart';
-       
+
         public $id;
-        
+
         public function run()
-        {            
-            echo "<div id='chartContainer{$this->id}' style='width: 100%; height: 400px;'></div>";                                                                                                                   
+        {
+            echo "<div id='chartContainer{$this->id}' style='width: 100%; height: 400px;'></div>";
         }
     }
 ?>

app/protected/core/widgets/Redactor.php

                     $(document).ready(
                         function()
                         {
-                            $('#{$id}').redactor({
+                            $('#{$id}').redactor(
+                            {
                                 buttons:    {$this->buttons},
                                 source:     {$this->source},
                                 paragraphy: {$this->paragraphy},

app/protected/modules/activities/views/related/ContactLatestActivtiesForPortletView.php

      */
     class ContactLatestActivtiesForPortletView extends LatestActivtiesForPortletView
     {
-            public static function getDefaultMetadata()
+        public static function getDefaultMetadata()
         {
             $metadata = parent::getDefaultMetadata();
             return array_merge($metadata, array(
                 ),
             )));
         }
+
         public function getLatestActivitiesViewClassName()
         {
             return 'LatestActivitiesForContactListView';

app/protected/modules/designer/tests/unit/DesignerTestHelper.php

-<?php
-    /*********************************************************************************
-     * Zurmo is a customer relationship management program developed by
-     * Zurmo, Inc. Copyright (C) 2012 Zurmo Inc.
-     *
-     * Zurmo is free software; you can redistribute it and/or modify it under
-     * the terms of the GNU General Public License version 3 as published by the
-     * Free Software Foundation with the addition of the following permission added
-     * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
-     * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
-     * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
-     *
-     * Zurmo is distributed in the hope that it will be useful, but WITHOUT
-     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-     * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-     * details.
-     *
-     * You should have received a copy of the GNU General Public License along with
-     * this program; if not, see http://www.gnu.org/licenses or write to the Free
-     * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-     * 02110-1301 USA.
-     *
-     * You can contact Zurmo, Inc. with a mailing address at 113 McHenry Road Suite 207,
-     * Buffalo Grove, IL 60089, USA. or at email address contact@zurmo.com.
-     ********************************************************************************/
-
-    class DesignerTestHelper
-    {
-        public static function createCheckBoxAttribute($attributeName, $withDefaultData, $modelClassName)
-        {
-            assert('isset($attributeName) && $attributeName != null');
-            assert('isset($withDefaultData) && is_bool($withDefaultData)');
-            $attributeForm = new CheckBoxAttributeForm();
-            $attributeForm->attributeName    = $attributeName;
-            $attributeForm->attributeLabels  = array(
-                'de' => 'Test' . $attributeName . 'de',
-                'en' => 'Test' . $attributeName . 'en',
-                'es' => 'Test' . $attributeName . 'es',
-                'fr' => 'Test' . $attributeName . 'fr',
-                'it' => 'Test' . $attributeName . 'it',
-            );
-            $attributeForm->isAudited        = true;
-            if ($withDefaultData)
-            {
-                $attributeForm->defaultValue     = 1; //means checked.
-            }
-            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
-            $validate = $attributeForm->validate();
-            if ($validate == false)
-            {
-                throw new FailedToValidateException();
-            }
-            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
-            try
-            {
-                $adapter->setAttributeMetadataFromForm($attributeForm);
-            }
-            catch (FailedDatabaseSchemaChangeException $e)
-            {
-                echo $e->getMessage();
-                Yii::app()->end(0,false);
-            }
-        }
-
-        public static function createCurrencyAttribute($attributeName, $withDefaultData, $modelClassName)
-        {
-            assert('isset($attributeName) && $attributeName != null');
-            assert('isset($withDefaultData) && is_bool($withDefaultData)');
-            $attributeForm = new CurrencyValueAttributeForm();
-            $attributeForm->attributeName    = $attributeName;
-            $attributeForm->attributeLabels  = array(
-                'de' => 'Test' . $attributeName . 'de',
-                'en' => 'Test' . $attributeName . 'en',
-                'es' => 'Test' . $attributeName . 'es',
-                'fr' => 'Test' . $attributeName . 'fr',
-                'it' => 'Test' . $attributeName . 'it',
-            );
-            $attributeForm->isAudited     = true;
-            $attributeForm->isRequired    = false;
-            $validate = $attributeForm->validate();
-            if ($validate == false)
-            {
-                throw new FailedToValidateException();
-            }
-            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
-            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
-            try
-            {
-                $adapter->setAttributeMetadataFromForm($attributeForm);
-            }
-            catch (FailedDatabaseSchemaChangeException $e)
-            {
-                echo $e->getMessage();
-                Yii::app()->end(0,false);
-            }
-        }
-
-        public static function createDateAttribute($attributeName, $withDefaultData, $modelClassName)
-        {
-            assert('isset($attributeName) && $attributeName != null');
-            assert('isset($withDefaultData) && is_bool($withDefaultData)');
-            $attributeForm = new DateAttributeForm();
-            $attributeForm->attributeName = $attributeName;
-            $attributeForm->attributeLabels  = array(
-                'de' => 'Test' . $attributeName . 'de',
-                'en' => 'Test' . $attributeName . 'en',
-                'es' => 'Test' . $attributeName . 'es',
-                'fr' => 'Test' . $attributeName . 'fr',
-                'it' => 'Test' . $attributeName . 'it',
-            );
-            $attributeForm->isAudited     = true;
-            $attributeForm->isRequired    = false;
-            if ($withDefaultData)
-            {
-                $attributeForm->defaultValueCalculationType  = DateTimeCalculatorUtil::YESTERDAY;
-            }
-            $validate = $attributeForm->validate();
-            if ($validate == false)
-            {
-                throw new FailedToValidateException();
-            }
-            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
-            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
-            try
-            {
-                $adapter->setAttributeMetadataFromForm($attributeForm);
-            }
-            catch (FailedDatabaseSchemaChangeException $e)
-            {
-                echo $e->getMessage();
-                Yii::app()->end(0,false);
-            }
-        }
-
-        public static function createDateTimeAttribute($attributeName, $withDefaultData, $modelClassName)
-        {
-            assert('isset($attributeName) && $attributeName != null');
-            assert('isset($withDefaultData) && is_bool($withDefaultData)');
-            $attributeForm = new DateTimeAttributeForm();
-            $attributeForm->attributeName = $attributeName;
-            $attributeForm->attributeLabels  = array(
-                'de' => 'Test' . $attributeName . 'de',
-                'en' => 'Test' . $attributeName . 'en',
-                'es' => 'Test' . $attributeName . 'es',
-                'fr' => 'Test' . $attributeName . 'fr',
-                'it' => 'Test' . $attributeName . 'it',
-            );
-            $attributeForm->isAudited                    = true;
-            $attributeForm->isRequired                   = false;
-            if ($withDefaultData)
-            {
-                $attributeForm->defaultValueCalculationType  = DateTimeCalculatorUtil::NOW;
-            }
-            else
-            {
-                $attributeForm->defaultValueCalculationType  = null;
-            }
-            $validate = $attributeForm->validate();
-            if ($validate == false)
-            {
-                throw new FailedToValidateException();
-            }
-            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
-            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
-            try
-            {
-                $adapter->setAttributeMetadataFromForm($attributeForm);
-            }
-            catch (FailedDatabaseSchemaChangeException $e)
-            {
-                echo $e->getMessage();
-                Yii::app()->end(0,false);
-            }
-        }
-
-
-        public static function createDecimalAttribute($attributeName, $withDefaultData, $modelClassName)
-        {
-            assert('isset($attributeName) && $attributeName != null');
-            assert('isset($withDefaultData) && is_bool($withDefaultData)');
-            $attributeForm = new DecimalAttributeForm();
-            $attributeForm->attributeName   = $attributeName;
-            $attributeForm->attributeLabels  = array(
-                'de' => 'Test' . $attributeName . 'de',
-                'en' => 'Test' . $attributeName . 'en',
-                'es' => 'Test' . $attributeName . 'es',
-                'fr' => 'Test' . $attributeName . 'fr',
-                'it' => 'Test' . $attributeName . 'it',
-            );
-            $attributeForm->isAudited       = true;
-            $attributeForm->isRequired      = false;
-            $attributeForm->maxLength       = 11;
-            $attributeForm->precisionLength = 5;
-            if ($withDefaultData)
-            {
-                $attributeForm->defaultValue    = 34.213;
-            }
-            $validate = $attributeForm->validate();
-            if ($validate == false)
-            {
-                throw new FailedToValidateException();
-            }
-            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
-            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
-            try
-            {
-                $adapter->setAttributeMetadataFromForm($attributeForm);
-            }
-            catch (FailedDatabaseSchemaChangeException $e)
-            {
-                echo $e->getMessage();
-                Yii::app()->end(0,false);
-            }
-        }
-
-
-        public static function createDropDownAttribute($attributeName, $withDefaultData, $modelClassName)
-        {
-            assert('isset($attributeName) && $attributeName != null');
-            assert('isset($withDefaultData) && is_bool($withDefaultData)');
-            $values = array(
-                '747',
-                'A380',
-                'Seaplane',
-                'Dive Bomber',
-            );
-            $labels = array('fr' => array('747 fr', 'A380 fr', 'Seaplane fr', 'Dive Bomber fr'),
-                            'de' => array('747 de', 'A380 de', 'Seaplane de', 'Dive Bomber de'),
-            );
-            $airplanesFieldData = CustomFieldData::getByName('Airplanes');
-            $airplanesFieldData->serializedData = serialize($values);
-            $airplanesFieldData->save();
-            $attributeForm = new DropDownAttributeForm();
-            $attributeForm->attributeName       = $attributeName;
-            $attributeForm->attributeLabels  = array(
-                'de' => 'Test' . $attributeName . 'de',
-                'en' => 'Test' . $attributeName . 'en',
-                'es' => 'Test' . $attributeName . 'es',
-                'fr' => 'Test' . $attributeName . 'fr',
-                'it' => 'Test' . $attributeName . 'it',
-            );
-            $attributeForm->isAudited             = true;
-            $attributeForm->isRequired            = false;
-            $attributeForm->defaultValueOrder     = 1;
-            $attributeForm->customFieldDataData   = $values;
-            $attributeForm->customFieldDataName   = 'Airplanes';
-            $attributeForm->customFieldDataLabels = $labels;
-            $validate = $attributeForm->validate();
-            if ($validate == false)
-            {
-                throw new FailedToValidateException();
-            }
-            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
-            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
-            try
-            {
-                $adapter->setAttributeMetadataFromForm($attributeForm);
-            }
-            catch (FailedDatabaseSchemaChangeException $e)
-            {
-                echo $e->getMessage();
-                Yii::app()->end(0,false);
-            }
-        }
-
-
-        public static function createIntegerAttribute($attributeName, $withDefaultData, $modelClassName)
-        {
-            assert('isset($attributeName) && $attributeName != null');
-            assert('isset($withDefaultData) && is_bool($withDefaultData)');
-            $attributeForm = new IntegerAttributeForm();
-            $attributeForm->attributeName = $attributeName;
-            $attributeForm->attributeLabels  = array(
-                 'de' => 'Test' . $attributeName . 'de',
-                'en' => 'Test' . $attributeName . 'en',
-                'es' => 'Test' . $attributeName . 'es',
-                'fr' => 'Test' . $attributeName . 'fr',
-                'it' => 'Test' . $attributeName . 'it',
-            );
-            $attributeForm->isAudited     = true;
-            $attributeForm->isRequired    = false;
-            $attributeForm->maxLength     = 11;
-            $attributeForm->minValue      = -500;
-            $attributeForm->maxValue      = 500;
-            if ($withDefaultData)
-            {
-                $attributeForm->defaultValue  = 458;
-            }
-            $validate = $attributeForm->validate();
-
-            if ($validate == false)
-            {
-                throw new FailedToValidateException();
-            }
-            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
-            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
-            try
-            {
-                $adapter->setAttributeMetadataFromForm($attributeForm);
-            }
-            catch (FailedDatabaseSchemaChangeException $e)
-            {
-                echo $e->getMessage();
-                Yii::app()->end(0,false);
-            }
-        }
-
-        public static function createMultiSelectDropDownAttribute($attributeName, $withDefaultData, $modelClassName)
-        {
-            assert('isset($attributeName) && $attributeName != null');
-            assert('isset($withDefaultData) && is_bool($withDefaultData)');
-            $values = array(
-                'Reading',
-                'Writing',
-                'Singing',
-                'Surfing',
-            );
-            $labels = array('fr' => array('Reading fr', 'Writing fr', 'Singing fr', 'Surfing fr'),
-                            'de' => array('Reading de', 'Writing de', 'Singing de', 'Surfing de'),
-                            'en' => array('Reading en', 'Writing en', 'Singing en', 'Surfing en'),
-            );
-            $hobbiesFieldData = CustomFieldData::getByName('Hobbies');
-            $hobbiesFieldData->serializedData = serialize($values);
-            $hobbiesFieldData->save();
-            $attributeForm = new MultiSelectDropDownAttributeForm();
-            $attributeForm->attributeName    = $attributeName;
-            $attributeForm->attributeLabels  = array(
-                'de' => 'Test' . $attributeName . 'de',
-                'en' => 'Test' . $attributeName . 'en',
-                'es' => 'Test' . $attributeName . 'es',
-                'fr' => 'Test' . $attributeName . 'fr',
-                'it' => 'Test' . $attributeName . 'it',
-            );
-            $attributeForm->isAudited             = true;
-            $attributeForm->isRequired            = false;
-            $attributeForm->customFieldDataData   = $values;
-            $attributeForm->customFieldDataName   = 'Hobbies';
-            $attributeForm->customFieldDataLabels = $labels;
-            if ($withDefaultData)
-            {
-                $attributeForm->defaultValueOrder = 1;
-            }
-            else
-            {
-                $attributeForm->defaultValue      = null;
-                $attributeForm->defaultValueOrder = null;
-            }
-            $validate = $attributeForm->validate();
-            if ($validate == false)
-            {
-                throw new FailedToValidateException();
-            }
-            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
-            $adapter                         = new $modelAttributesAdapterClassName(new $modelClassName());
-            try
-            {
-                $adapter->setAttributeMetadataFromForm($attributeForm);
-            }
-            catch (FailedDatabaseSchemaChangeException $e)
-            {
-                echo $e->getMessage();
-                Yii::app()->end(0,false);
-            }
-        }
-
-        public static function createTagCloudAttribute($attributeName, $withDefaultData, $modelClassName)
-        {
-            assert('isset($attributeName) && $attributeName != null');
-            assert('isset($withDefaultData) && is_bool($withDefaultData)');
-            $values = array(
-                'English',
-                'French',
-                'Danish',
-                'Spanish',
-            );
-            $labels = array('fr' => array('English fr', 'French fr', 'Danish fr', 'Spanish fr'),
-                            'de' => array('English de', 'French de', 'Danish de', 'Spanish de'),
-            );
-            $languageFieldData = CustomFieldData::getByName('Languages');
-            $languageFieldData->save();
-            $attributeForm                   = new TagCloudAttributeForm();
-            $attributeForm->attributeName    = $attributeName;
-            $attributeForm->attributeLabels  = array(
-                'de' => 'Test' . $attributeName . 'de',
-                'en' => 'Test' . $attributeName . 'en',
-                'es' => 'Test' . $attributeName . 'es',
-                'fr' => 'Test' . $attributeName . 'fr',
-                'it' => 'Test' . $attributeName . 'it',
-            );
-            $attributeForm->isAudited             = true;
-            $attributeForm->isRequired            = false;
-            $attributeForm->customFieldDataData   = $values;
-            $attributeForm->customFieldDataName   = 'Languages';
-            $attributeForm->customFieldDataLabels = $labels;
-            if ($withDefaultData)
-            {
-                $attributeForm->defaultValueOrder = 1;
-            }
-            else
-            {
-                $attributeForm->defaultValueOrder = null;
-            }
-            $validate = $attributeForm->validate();
-            if ($validate == false)
-            {
-                throw new FailedToValidateException();
-            }
-            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
-            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
-            try
-            {
-                $adapter->setAttributeMetadataFromForm($attributeForm);
-            }
-            catch (FailedDatabaseSchemaChangeException $e)
-            {
-                echo $e->getMessage();
-                Yii::app()->end(0,false);
-            }
-        }
-
-       public static function createPhoneAttribute($attributeName, $withDefaultData, $modelClassName)
-        {
-            assert('isset($attributeName) && $attributeName != null');
-            assert('isset($withDefaultData) && is_bool($withDefaultData)');
-            $attributeForm = new PhoneAttributeForm();
-            $attributeForm->attributeName = $attributeName;
-            $attributeForm->attributeLabels  = array(
-                'de' => 'Test' . $attributeName . 'de',
-                'en' => 'Test' . $attributeName . 'en',
-                'es' => 'Test' . $attributeName . 'es',
-                'fr' => 'Test' . $attributeName . 'fr',
-                'it' => 'Test' . $attributeName . 'it',
-            );
-            $attributeForm->isAudited     = true;
-            $attributeForm->isRequired    = false;
-            $attributeForm->maxLength     = 20;
-
-            if ($withDefaultData)
-            {
-                $attributeForm->defaultValue  = '1-800-111-2233';
-            }
-            $validate = $attributeForm->validate();
-            if ($validate == false)
-            {
-                throw new FailedToValidateException();
-            }
-            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
-            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
-            try
-            {
-                $adapter->setAttributeMetadataFromForm($attributeForm);
-            }
-            catch (FailedDatabaseSchemaChangeException $e)
-            {
-                echo $e->getMessage();
-                Yii::app()->end(0,false);
-            }
-        }
-
-       public static function createRadioDropDownAttribute($attributeName, $withDefaultData, $modelClassName)
-        {
-            assert('isset($attributeName) && $attributeName != null');
-            assert('isset($withDefaultData) && is_bool($withDefaultData)');
-            $values = array(
-                'Wing',
-                'Nose',
-                'Seat',
-                'Wheel',
-            );
-            $airplanePartsFieldData = CustomFieldData::getByName('AirplaneParts');
-            $airplanePartsFieldData->serializedData = serialize($values);
-            $airplanePartsFieldData->save();
-            $attributeForm = new RadioDropDownAttributeForm();
-            $attributeForm->attributeName       = 'testAirPlaneParts';
-            $attributeForm->attributeLabels  = array(
-                'de' => 'Test' . $attributeName . 'de',
-                'en' => 'Test' . $attributeName . 'en',
-                'es' => 'Test' . $attributeName . 'es',
-                'fr' => 'Test' . $attributeName . 'fr',
-                'it' => 'Test' . $attributeName . 'it',
-            );
-            $attributeForm->isAudited           = true;
-            $attributeForm->isRequired          = false;
-            $attributeForm->defaultValueOrder   = 3;
-            $attributeForm->customFieldDataData = $values;
-            $attributeForm->customFieldDataName = 'AirplaneParts';
-            $validate = $attributeForm->validate();
-            if ($validate == false)
-            {
-                throw new FailedToValidateException();
-            }
-            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
-            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
-            try
-            {
-                $adapter->setAttributeMetadataFromForm($attributeForm);
-            }
-            catch (FailedDatabaseSchemaChangeException $e)
-            {
-                echo $e->getMessage();
-                Yii::app()->end(0,false);
-            }
-        }
-
-
-       public static function createTextAttribute($attributeName, $withDefaultData, $modelClassName)
-        {
-            assert('isset($attributeName) && $attributeName != null');
-            assert('isset($withDefaultData) && is_bool($withDefaultData)');
-            $attributeForm = new TextAttributeForm();
-            $attributeForm->attributeName = $attributeName;
-            $attributeForm->attributeLabels  = array(
-                'de' => 'Test' . $attributeName . 'de',
-                'en' => 'Test' . $attributeName . 'en',
-                'es' => 'Test' . $attributeName . 'es',
-                'fr' => 'Test' . $attributeName . 'fr',
-                'it' => 'Test' . $attributeName . 'it',
-            );
-            $attributeForm->isAudited     = true;
-            $attributeForm->isRequired    = false;
-            $attributeForm->maxLength     = 50;
-            if ($withDefaultData)
-            {
-                $attributeForm->defaultValue  = 'Kangaroo';
-            }
-            $validate = $attributeForm->validate();
-            if ($validate == false)
-            {
-                throw new FailedToValidateException();
-            }
-            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
-            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
-            try
-            {
-                $adapter->setAttributeMetadataFromForm($attributeForm);
-            }
-            catch (FailedDatabaseSchemaChangeException $e)
-            {
-                echo $e->getMessage();
-                Yii::app()->end(0,false);
-            }
-        }
-
-       public static function createTextAreaAttribute($attributeName, $withDefaultData, $modelClassName)
-        {
-            assert('isset($attributeName) && $attributeName != null');
-            assert('isset($withDefaultData) && is_bool($withDefaultData)');
-            $attributeForm = new TextAreaAttributeForm();
-            $attributeForm->attributeName = $attributeName;
-            $attributeForm->attributeLabels  = array(
-                'de' => 'Test' . $attributeName . 'de',
-                'en' => 'Test' . $attributeName . 'en',
-                'es' => 'Test' . $attributeName . 'es',
-                'fr' => 'Test' . $attributeName . 'fr',
-                'it' => 'Test' . $attributeName . 'it',
-            );
-            $attributeForm->isAudited     = true;
-            $attributeForm->isRequired    = false;
-            if ($withDefaultData)
-            {
-                $attributeForm->defaultValue  = 'Kangaroo Pouch';
-            }
-            $validate = $attributeForm->validate();
-            if ($validate == false)
-            {
-                throw new FailedToValidateException();
-            }
-            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
-            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
-            try
-            {
-                $adapter->setAttributeMetadataFromForm($attributeForm);
-            }
-            catch (FailedDatabaseSchemaChangeException $e)
-            {
-                echo $e->getMessage();
-                Yii::app()->end(0,false);
-            }
-        }
-
-       public static function createUrlAttribute($attributeName, $withDefaultData, $modelClassName)
-        {
-            assert('isset($attributeName) && $attributeName != null');
-            assert('isset($withDefaultData) && is_bool($withDefaultData)');
-            $attributeForm = new UrlAttributeForm();
-            $attributeForm->attributeName = $attributeName;
-            $attributeForm->attributeLabels  = array(
-                'de' => 'Test' . $attributeName . 'de',
-                'en' => 'Test' . $attributeName . 'en',
-                'es' => 'Test' . $attributeName . 'es',
-                'fr' => 'Test' . $attributeName . 'fr',
-                'it' => 'Test' . $attributeName . 'it',
-            );
-            $attributeForm->isAudited     = true;
-            $attributeForm->isRequired    = false;
-            $attributeForm->maxLength     = 50;
-            if ($withDefaultData)
-            {
-                $attributeForm->defaultValue  = 'http://www.outback.com';
-            }
-            $validate = $attributeForm->validate();
-            if ($validate == false)
-            {
-                throw new FailedToValidateException();
-            }
-            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
-            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
-            try
-            {
-                $adapter->setAttributeMetadataFromForm($attributeForm);
-            }
-            catch (FailedDatabaseSchemaChangeException $e)
-            {
-                echo $e->getMessage();
-                Yii::app()->end(0,false);
-            }
-        }
-    }
-
-?>
+<?php
+    /*********************************************************************************
+     * Zurmo is a customer relationship management program developed by
+     * Zurmo, Inc. Copyright (C) 2012 Zurmo Inc.
+     *
+     * Zurmo is free software; you can redistribute it and/or modify it under
+     * the terms of the GNU General Public License version 3 as published by the
+     * Free Software Foundation with the addition of the following permission added
+     * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
+     * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
+     * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
+     *
+     * Zurmo is distributed in the hope that it will be useful, but WITHOUT
+     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+     * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+     * details.
+     *
+     * You should have received a copy of the GNU General Public License along with
+     * this program; if not, see http://www.gnu.org/licenses or write to the Free
+     * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+     * 02110-1301 USA.
+     *
+     * You can contact Zurmo, Inc. with a mailing address at 113 McHenry Road Suite 207,
+     * Buffalo Grove, IL 60089, USA. or at email address contact@zurmo.com.
+     ********************************************************************************/
+
+    class DesignerTestHelper
+    {
+        public static function createCheckBoxAttribute($attributeName, $withDefaultData, $modelClassName)
+        {
+            assert('isset($attributeName) && $attributeName != null');
+            assert('isset($withDefaultData) && is_bool($withDefaultData)');
+            $attributeForm = new CheckBoxAttributeForm();
+            $attributeForm->attributeName    = $attributeName;
+            $attributeForm->attributeLabels  = array(
+                'de' => 'Test' . $attributeName . 'de',
+                'en' => 'Test' . $attributeName . 'en',
+                'es' => 'Test' . $attributeName . 'es',
+                'fr' => 'Test' . $attributeName . 'fr',
+                'it' => 'Test' . $attributeName . 'it',
+            );
+            $attributeForm->isAudited        = true;
+            if ($withDefaultData)
+            {
+                $attributeForm->defaultValue     = 1; //means checked.
+            }
+            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
+            $validate = $attributeForm->validate();
+            if ($validate == false)
+            {
+                throw new FailedToValidateException();
+            }
+            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
+            try
+            {
+                $adapter->setAttributeMetadataFromForm($attributeForm);
+            }
+            catch (FailedDatabaseSchemaChangeException $e)
+            {
+                echo $e->getMessage();
+                Yii::app()->end(0, false);
+            }
+        }
+
+        public static function createCurrencyAttribute($attributeName, $withDefaultData, $modelClassName)
+        {
+            assert('isset($attributeName) && $attributeName != null');
+            assert('isset($withDefaultData) && is_bool($withDefaultData)');
+            $attributeForm = new CurrencyValueAttributeForm();
+            $attributeForm->attributeName    = $attributeName;
+            $attributeForm->attributeLabels  = array(
+                'de' => 'Test' . $attributeName . 'de',
+                'en' => 'Test' . $attributeName . 'en',
+                'es' => 'Test' . $attributeName . 'es',
+                'fr' => 'Test' . $attributeName . 'fr',
+                'it' => 'Test' . $attributeName . 'it',
+            );
+            $attributeForm->isAudited     = true;
+            $attributeForm->isRequired    = false;
+            $validate = $attributeForm->validate();
+            if ($validate == false)
+            {
+                throw new FailedToValidateException();
+            }
+            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
+            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
+            try
+            {
+                $adapter->setAttributeMetadataFromForm($attributeForm);
+            }
+            catch (FailedDatabaseSchemaChangeException $e)
+            {
+                echo $e->getMessage();
+                Yii::app()->end(0, false);
+            }
+        }
+
+        public static function createDateAttribute($attributeName, $withDefaultData, $modelClassName)
+        {
+            assert('isset($attributeName) && $attributeName != null');
+            assert('isset($withDefaultData) && is_bool($withDefaultData)');
+            $attributeForm = new DateAttributeForm();
+            $attributeForm->attributeName = $attributeName;
+            $attributeForm->attributeLabels  = array(
+                'de' => 'Test' . $attributeName . 'de',
+                'en' => 'Test' . $attributeName . 'en',
+                'es' => 'Test' . $attributeName . 'es',
+                'fr' => 'Test' . $attributeName . 'fr',
+                'it' => 'Test' . $attributeName . 'it',
+            );
+            $attributeForm->isAudited     = true;
+            $attributeForm->isRequired    = false;
+            if ($withDefaultData)
+            {
+                $attributeForm->defaultValueCalculationType  = DateTimeCalculatorUtil::YESTERDAY;
+            }
+            $validate = $attributeForm->validate();
+            if ($validate == false)
+            {
+                throw new FailedToValidateException();
+            }
+            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
+            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
+            try
+            {
+                $adapter->setAttributeMetadataFromForm($attributeForm);
+            }
+            catch (FailedDatabaseSchemaChangeException $e)
+            {
+                echo $e->getMessage();
+                Yii::app()->end(0, false);
+            }
+        }
+
+        public static function createDateTimeAttribute($attributeName, $withDefaultData, $modelClassName)
+        {
+            assert('isset($attributeName) && $attributeName != null');
+            assert('isset($withDefaultData) && is_bool($withDefaultData)');
+            $attributeForm = new DateTimeAttributeForm();
+            $attributeForm->attributeName = $attributeName;
+            $attributeForm->attributeLabels  = array(
+                'de' => 'Test' . $attributeName . 'de',
+                'en' => 'Test' . $attributeName . 'en',
+                'es' => 'Test' . $attributeName . 'es',
+                'fr' => 'Test' . $attributeName . 'fr',
+                'it' => 'Test' . $attributeName . 'it',
+            );
+            $attributeForm->isAudited                    = true;
+            $attributeForm->isRequired                   = false;
+            if ($withDefaultData)
+            {
+                $attributeForm->defaultValueCalculationType  = DateTimeCalculatorUtil::NOW;
+            }
+            else
+            {
+                $attributeForm->defaultValueCalculationType  = null;
+            }
+            $validate = $attributeForm->validate();
+            if ($validate == false)
+            {
+                throw new FailedToValidateException();
+            }
+            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
+            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
+            try
+            {
+                $adapter->setAttributeMetadataFromForm($attributeForm);
+            }
+            catch (FailedDatabaseSchemaChangeException $e)
+            {
+                echo $e->getMessage();
+                Yii::app()->end(0, false);
+            }
+        }
+
+        public static function createDecimalAttribute($attributeName, $withDefaultData, $modelClassName)
+        {
+            assert('isset($attributeName) && $attributeName != null');
+            assert('isset($withDefaultData) && is_bool($withDefaultData)');
+            $attributeForm = new DecimalAttributeForm();
+            $attributeForm->attributeName   = $attributeName;
+            $attributeForm->attributeLabels  = array(
+                'de' => 'Test' . $attributeName . 'de',
+                'en' => 'Test' . $attributeName . 'en',
+                'es' => 'Test' . $attributeName . 'es',
+                'fr' => 'Test' . $attributeName . 'fr',
+                'it' => 'Test' . $attributeName . 'it',
+            );
+            $attributeForm->isAudited       = true;
+            $attributeForm->isRequired      = false;
+            $attributeForm->maxLength       = 11;
+            $attributeForm->precisionLength = 5;
+            if ($withDefaultData)
+            {
+                $attributeForm->defaultValue    = 34.213;
+            }
+            $validate = $attributeForm->validate();
+            if ($validate == false)
+            {
+                throw new FailedToValidateException();
+            }
+            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
+            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
+            try
+            {
+                $adapter->setAttributeMetadataFromForm($attributeForm);
+            }
+            catch (FailedDatabaseSchemaChangeException $e)
+            {
+                echo $e->getMessage();
+                Yii::app()->end(0, false);
+            }
+        }
+
+        public static function createDropDownAttribute($attributeName, $withDefaultData, $modelClassName)
+        {
+            assert('isset($attributeName) && $attributeName != null');
+            assert('isset($withDefaultData) && is_bool($withDefaultData)');
+            $values = array(
+                '747',
+                'A380',
+                'Seaplane',
+                'Dive Bomber',
+            );
+            $labels = array('fr' => array('747 fr', 'A380 fr', 'Seaplane fr', 'Dive Bomber fr'),
+                            'de' => array('747 de', 'A380 de', 'Seaplane de', 'Dive Bomber de'),
+            );
+            $airplanesFieldData = CustomFieldData::getByName('Airplanes');
+            $airplanesFieldData->serializedData = serialize($values);
+            $airplanesFieldData->save();
+            $attributeForm = new DropDownAttributeForm();
+            $attributeForm->attributeName       = $attributeName;
+            $attributeForm->attributeLabels  = array(
+                'de' => 'Test' . $attributeName . 'de',
+                'en' => 'Test' . $attributeName . 'en',
+                'es' => 'Test' . $attributeName . 'es',
+                'fr' => 'Test' . $attributeName . 'fr',
+                'it' => 'Test' . $attributeName . 'it',
+            );
+            $attributeForm->isAudited             = true;
+            $attributeForm->isRequired            = false;
+            $attributeForm->defaultValueOrder     = 1;
+            $attributeForm->customFieldDataData   = $values;
+            $attributeForm->customFieldDataName   = 'Airplanes';
+            $attributeForm->customFieldDataLabels = $labels;
+            $validate = $attributeForm->validate();
+            if ($validate == false)
+            {
+                throw new FailedToValidateException();
+            }
+            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
+            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
+            try
+            {
+                $adapter->setAttributeMetadataFromForm($attributeForm);
+            }
+            catch (FailedDatabaseSchemaChangeException $e)
+            {
+                echo $e->getMessage();
+                Yii::app()->end(0, false);
+            }
+        }
+
+        public static function createIntegerAttribute($attributeName, $withDefaultData, $modelClassName)
+        {
+            assert('isset($attributeName) && $attributeName != null');
+            assert('isset($withDefaultData) && is_bool($withDefaultData)');
+            $attributeForm = new IntegerAttributeForm();
+            $attributeForm->attributeName = $attributeName;
+            $attributeForm->attributeLabels  = array(
+                 'de' => 'Test' . $attributeName . 'de',
+                'en' => 'Test' . $attributeName . 'en',
+                'es' => 'Test' . $attributeName . 'es',
+                'fr' => 'Test' . $attributeName . 'fr',
+                'it' => 'Test' . $attributeName . 'it',
+            );
+            $attributeForm->isAudited     = true;
+            $attributeForm->isRequired    = false;
+            $attributeForm->maxLength     = 11;
+            $attributeForm->minValue      = -500;
+            $attributeForm->maxValue      = 500;
+            if ($withDefaultData)
+            {
+                $attributeForm->defaultValue  = 458;
+            }
+            $validate = $attributeForm->validate();
+
+            if ($validate == false)
+            {
+                throw new FailedToValidateException();
+            }
+            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
+            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
+            try
+            {
+                $adapter->setAttributeMetadataFromForm($attributeForm);
+            }
+            catch (FailedDatabaseSchemaChangeException $e)
+            {
+                echo $e->getMessage();
+                Yii::app()->end(0, false);
+            }
+        }
+
+        public static function createMultiSelectDropDownAttribute($attributeName, $withDefaultData, $modelClassName)
+        {
+            assert('isset($attributeName) && $attributeName != null');
+            assert('isset($withDefaultData) && is_bool($withDefaultData)');
+            $values = array(
+                'Reading',
+                'Writing',
+                'Singing',
+                'Surfing',
+            );
+            $labels = array('fr' => array('Reading fr', 'Writing fr', 'Singing fr', 'Surfing fr'),
+                            'de' => array('Reading de', 'Writing de', 'Singing de', 'Surfing de'),
+                            'en' => array('Reading en', 'Writing en', 'Singing en', 'Surfing en'),
+            );
+            $hobbiesFieldData = CustomFieldData::getByName('Hobbies');
+            $hobbiesFieldData->serializedData = serialize($values);
+            $hobbiesFieldData->save();
+            $attributeForm = new MultiSelectDropDownAttributeForm();
+            $attributeForm->attributeName    = $attributeName;
+            $attributeForm->attributeLabels  = array(
+                'de' => 'Test' . $attributeName . 'de',
+                'en' => 'Test' . $attributeName . 'en',
+                'es' => 'Test' . $attributeName . 'es',
+                'fr' => 'Test' . $attributeName . 'fr',
+                'it' => 'Test' . $attributeName . 'it',
+            );
+            $attributeForm->isAudited             = true;
+            $attributeForm->isRequired            = false;
+            $attributeForm->customFieldDataData   = $values;
+            $attributeForm->customFieldDataName   = 'Hobbies';
+            $attributeForm->customFieldDataLabels = $labels;
+            if ($withDefaultData)
+            {
+                $attributeForm->defaultValueOrder = 1;
+            }
+            else
+            {
+                $attributeForm->defaultValue      = null;
+                $attributeForm->defaultValueOrder = null;
+            }
+            $validate = $attributeForm->validate();
+            if ($validate == false)
+            {
+                throw new FailedToValidateException();
+            }
+            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
+            $adapter                         = new $modelAttributesAdapterClassName(new $modelClassName());
+            try
+            {
+                $adapter->setAttributeMetadataFromForm($attributeForm);
+            }
+            catch (FailedDatabaseSchemaChangeException $e)
+            {
+                echo $e->getMessage();
+                Yii::app()->end(0, false);
+            }
+        }
+
+        public static function createTagCloudAttribute($attributeName, $withDefaultData, $modelClassName)
+        {
+            assert('isset($attributeName) && $attributeName != null');
+            assert('isset($withDefaultData) && is_bool($withDefaultData)');
+            $values = array(
+                'English',
+                'French',
+                'Danish',
+                'Spanish',
+            );
+            $labels = array('fr' => array('English fr', 'French fr', 'Danish fr', 'Spanish fr'),
+                            'de' => array('English de', 'French de', 'Danish de', 'Spanish de'),
+            );
+            $languageFieldData = CustomFieldData::getByName('Languages');
+            $languageFieldData->save();
+            $attributeForm                   = new TagCloudAttributeForm();
+            $attributeForm->attributeName    = $attributeName;
+            $attributeForm->attributeLabels  = array(
+                'de' => 'Test' . $attributeName . 'de',
+                'en' => 'Test' . $attributeName . 'en',
+                'es' => 'Test' . $attributeName . 'es',
+                'fr' => 'Test' . $attributeName . 'fr',
+                'it' => 'Test' . $attributeName . 'it',
+            );
+            $attributeForm->isAudited             = true;
+            $attributeForm->isRequired            = false;
+            $attributeForm->customFieldDataData   = $values;
+            $attributeForm->customFieldDataName   = 'Languages';
+            $attributeForm->customFieldDataLabels = $labels;
+            if ($withDefaultData)
+            {
+                $attributeForm->defaultValueOrder = 1;
+            }
+            else
+            {
+                $attributeForm->defaultValueOrder = null;
+            }
+            $validate = $attributeForm->validate();
+            if ($validate == false)
+            {
+                throw new FailedToValidateException();
+            }
+            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
+            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
+            try
+            {
+                $adapter->setAttributeMetadataFromForm($attributeForm);
+            }
+            catch (FailedDatabaseSchemaChangeException $e)
+            {
+                echo $e->getMessage();
+                Yii::app()->end(0, false);
+            }
+        }
+
+       public static function createPhoneAttribute($attributeName, $withDefaultData, $modelClassName)
+        {
+            assert('isset($attributeName) && $attributeName != null');
+            assert('isset($withDefaultData) && is_bool($withDefaultData)');
+            $attributeForm = new PhoneAttributeForm();
+            $attributeForm->attributeName = $attributeName;
+            $attributeForm->attributeLabels  = array(
+                'de' => 'Test' . $attributeName . 'de',
+                'en' => 'Test' . $attributeName . 'en',
+                'es' => 'Test' . $attributeName . 'es',
+                'fr' => 'Test' . $attributeName . 'fr',
+                'it' => 'Test' . $attributeName . 'it',
+            );
+            $attributeForm->isAudited     = true;
+            $attributeForm->isRequired    = false;
+            $attributeForm->maxLength     = 20;
+
+            if ($withDefaultData)
+            {
+                $attributeForm->defaultValue  = '1-800-111-2233';
+            }
+            $validate = $attributeForm->validate();
+            if ($validate == false)
+            {
+                throw new FailedToValidateException();
+            }
+            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
+            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
+            try
+            {
+                $adapter->setAttributeMetadataFromForm($attributeForm);
+            }
+            catch (FailedDatabaseSchemaChangeException $e)
+            {
+                echo $e->getMessage();
+                Yii::app()->end(0, false);
+            }
+        }
+
+       public static function createRadioDropDownAttribute($attributeName, $withDefaultData, $modelClassName)
+        {
+            assert('isset($attributeName) && $attributeName != null');
+            assert('isset($withDefaultData) && is_bool($withDefaultData)');
+            $values = array(
+                'Wing',
+                'Nose',
+                'Seat',
+                'Wheel',
+            );
+            $airplanePartsFieldData = CustomFieldData::getByName('AirplaneParts');
+            $airplanePartsFieldData->serializedData = serialize($values);
+            $airplanePartsFieldData->save();
+            $attributeForm = new RadioDropDownAttributeForm();
+            $attributeForm->attributeName       = 'testAirPlaneParts';
+            $attributeForm->attributeLabels  = array(
+                'de' => 'Test' . $attributeName . 'de',
+                'en' => 'Test' . $attributeName . 'en',
+                'es' => 'Test' . $attributeName . 'es',
+                'fr' => 'Test' . $attributeName . 'fr',
+                'it' => 'Test' . $attributeName . 'it',
+            );
+            $attributeForm->isAudited           = true;
+            $attributeForm->isRequired          = false;
+            $attributeForm->defaultValueOrder   = 3;
+            $attributeForm->customFieldDataData = $values;
+            $attributeForm->customFieldDataName = 'AirplaneParts';
+            $validate = $attributeForm->validate();
+            if ($validate == false)
+            {
+                throw new FailedToValidateException();
+            }
+            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
+            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
+            try
+            {
+                $adapter->setAttributeMetadataFromForm($attributeForm);
+            }
+            catch (FailedDatabaseSchemaChangeException $e)
+            {
+                echo $e->getMessage();
+                Yii::app()->end(0, false);
+            }
+        }
+
+       public static function createTextAttribute($attributeName, $withDefaultData, $modelClassName)
+        {
+            assert('isset($attributeName) && $attributeName != null');
+            assert('isset($withDefaultData) && is_bool($withDefaultData)');
+            $attributeForm = new TextAttributeForm();
+            $attributeForm->attributeName = $attributeName;
+            $attributeForm->attributeLabels  = array(
+                'de' => 'Test' . $attributeName . 'de',
+                'en' => 'Test' . $attributeName . 'en',
+                'es' => 'Test' . $attributeName . 'es',
+                'fr' => 'Test' . $attributeName . 'fr',
+                'it' => 'Test' . $attributeName . 'it',
+            );
+            $attributeForm->isAudited     = true;
+            $attributeForm->isRequired    = false;
+            $attributeForm->maxLength     = 50;
+            if ($withDefaultData)
+            {
+                $attributeForm->defaultValue  = 'Kangaroo';
+            }
+            $validate = $attributeForm->validate();
+            if ($validate == false)
+            {
+                throw new FailedToValidateException();
+            }
+            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
+            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
+            try
+            {
+                $adapter->setAttributeMetadataFromForm($attributeForm);
+            }
+            catch (FailedDatabaseSchemaChangeException $e)
+            {
+                echo $e->getMessage();
+                Yii::app()->end(0, false);
+            }
+        }
+
+       public static function createTextAreaAttribute($attributeName, $withDefaultData, $modelClassName)
+        {
+            assert('isset($attributeName) && $attributeName != null');
+            assert('isset($withDefaultData) && is_bool($withDefaultData)');
+            $attributeForm = new TextAreaAttributeForm();
+            $attributeForm->attributeName = $attributeName;
+            $attributeForm->attributeLabels  = array(
+                'de' => 'Test' . $attributeName . 'de',
+                'en' => 'Test' . $attributeName . 'en',
+                'es' => 'Test' . $attributeName . 'es',
+                'fr' => 'Test' . $attributeName . 'fr',
+                'it' => 'Test' . $attributeName . 'it',
+            );
+            $attributeForm->isAudited     = true;
+            $attributeForm->isRequired    = false;
+            if ($withDefaultData)
+            {
+                $attributeForm->defaultValue  = 'Kangaroo Pouch';
+            }
+            $validate = $attributeForm->validate();
+            if ($validate == false)
+            {
+                throw new FailedToValidateException();
+            }
+            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
+            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
+            try
+            {
+                $adapter->setAttributeMetadataFromForm($attributeForm);
+            }
+            catch (FailedDatabaseSchemaChangeException $e)
+            {
+                echo $e->getMessage();
+                Yii::app()->end(0, false);
+            }
+        }
+
+       public static function createUrlAttribute($attributeName, $withDefaultData, $modelClassName)
+        {
+            assert('isset($attributeName) && $attributeName != null');
+            assert('isset($withDefaultData) && is_bool($withDefaultData)');
+            $attributeForm = new UrlAttributeForm();
+            $attributeForm->attributeName = $attributeName;
+            $attributeForm->attributeLabels  = array(
+                'de' => 'Test' . $attributeName . 'de',
+                'en' => 'Test' . $attributeName . 'en',
+                'es' => 'Test' . $attributeName . 'es',
+                'fr' => 'Test' . $attributeName . 'fr',
+                'it' => 'Test' . $attributeName . 'it',
+            );
+            $attributeForm->isAudited     = true;
+            $attributeForm->isRequired    = false;
+            $attributeForm->maxLength     = 50;
+            if ($withDefaultData)
+            {
+                $attributeForm->defaultValue  = 'http://www.outback.com';
+            }
+            $validate = $attributeForm->validate();
+            if ($validate == false)
+            {
+                throw new FailedToValidateException();
+            }
+            $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
+            $adapter = new $modelAttributesAdapterClassName(new $modelClassName());
+            try
+            {
+                $adapter->setAttributeMetadataFromForm($attributeForm);
+            }
+            catch (FailedDatabaseSchemaChangeException $e)
+            {
+                echo $e->getMessage();
+                Yii::app()->end(0, false);
+            }
+        }
+    }
+?>

app/protected/modules/designer/views/AttributesCollectionView.php

          */
         protected function isAttributeOnModelOrCastedUp($attributeName)
         {
-
             assert('is_string($attributeName)');
             $attributeAdapter = new RedBeanModelAttributeToDataProviderAdapter($this->modelClassName, $attributeName);
-            if(!$attributeAdapter->getModel()->isAttribute($attributeName))
+            if (!$attributeAdapter->getModel()->isAttribute($attributeName))
             {
                 return false;
             }

app/protected/modules/emailMessages/components/EmailHelper.php

     class EmailHelper extends CApplicationComponent
     {
         const OUTBOUND_TYPE_SMTP = 'smtp';
+
         /**
          * Currently supports smtp.
          * @var string
                 foreach ($settingsToLoad as $keyName)
                 {
                     $this->$keyName = $userEmailAccount->$keyName;
-
                 }
             }
             else

app/protected/modules/emailMessages/controllers/DefaultController.php

             $contactPrimaryEmailForm       = new ContactPrimaryEmailForm();
             $contactPrimaryEmailForm->name = strval($contact);
             $this->actionValidatePopulateContactEmailBeforeCreating($postData, $contactPrimaryEmailForm);
-            if(isset($postData[get_class($contactPrimaryEmailForm)]))
+            if (isset($postData[get_class($contactPrimaryEmailForm)]))
             {
                 //Process saving the email address and redirecting to create email view
                 $contactPrimaryEmailForm->setAttributes($postData[get_class($contactPrimaryEmailForm)]);
                 $email->emailAddress   = $contactPrimaryEmailForm->emailAddress;
                 $contact->primaryEmail = $email;
                 $saved = $contact->save();
-                if(!$saved)
+                if (!$saved)
                 {
                     throw new FailedToSaveModelException($message, $code, $previous);
                 }
             $emailMessageForm = new CreateEmailMessageForm($emailMessage);
             $emailMessageForm->setScenario('createNonDraft');
             $postVariableName = get_class($emailMessageForm);
-            if($toAddress == null && $personOrAccount != null && $personOrAccount->primaryEmail->emailAddress != null)
+            if ($toAddress == null && $personOrAccount != null && $personOrAccount->primaryEmail->emailAddress != null)
             {
                 $toAddress = $personOrAccount->primaryEmail->emailAddress;
             }
             if (isset($postData[$postVariableName]))
             {
-                if($relatedId != null && $relatedModelClassName != null && $toAddress != null)
+                if ($relatedId != null && $relatedModelClassName != null && $toAddress != null)
                 {
                     $messageRecipient                   = new EmailMessageRecipient();
                     $messageRecipient->toName           = strval($personOrAccount);
         protected function resolvePersonOrAccountFromGet($relatedId = null, $relatedModelClassName = null)
         {
             $personOrAccount = null;
-            if($relatedId != null && $relatedModelClassName != null)
+            if ($relatedId != null && $relatedModelClassName != null)
             {
                 $personOrAccount = $relatedModelClassName::getById((int)$relatedId);
                 //Only attempt to populate email if the user has write permissions
-                if($relatedModelClassName == 'Contact' &&
+                if ($relatedModelClassName == 'Contact' &&
                    $personOrAccount->primaryEmail->emailAddress == null &&
                    ControllerSecurityUtil::doesCurrentUserHavePermissionOnSecurableItem($personOrAccount, Permission::WRITE))
                 {

app/protected/modules/emailMessages/controllers/filters/EmailConfigurationCheckControllerFilter.php

             {
                 return true;
             }
-            if(Yii::app()->emailHelper->outboundHost != null)
+            if (Yii::app()->emailHelper->outboundHost != null)
             {
                 return true;
             }

app/protected/modules/emailMessages/elements/EmailMessageSentDateTimeElement.php

         protected function renderControlNonEditable()
         {
             assert('$this->model instanceof EmailMessage');
-            if($this->model->folder->type == EmailFolder::TYPE_SENT)
+            if ($this->model->folder->type == EmailFolder::TYPE_SENT)
             {
                 return parent::renderControlNonEditable();
             }

app/protected/modules/emailMessages/elements/actions/CreateEmailMessageFromRelatedListLinkActionElement.php

 
         protected function getDefaultRoute()
         {
-
             return Yii::app()->createUrl('/emailMessages/default/createEmailMessage', $this->resolveRouteParamters());
         }
 
         protected function resolveRouteParamters()
         {
             $routeParameters = $this->getRouteParameters();
-            if(!isset($routeParameters['relatedId']))
+            if (!isset($routeParameters['relatedId']))
             {
                 $routeParameters['relatedId'] = $this->modelId;
             }

app/protected/modules/emailMessages/elements/derived/EmailMessageAllRecipientTypesElement.php

             $existingPeople = array();
             foreach ($this->model->recipients as $recipient)
             {
-                if($recipient->type == constant('EmailMessageRecipient::TYPE_' . strtoupper($prefix)))
+                if ($recipient->type == constant('EmailMessageRecipient::TYPE_' . strtoupper($prefix)))
                 {
                     $existingPeople[] = array('id'   => $recipient->toAddress,
                                               'name' => $recipient->toName . ' (' . $recipient->toAddress . ')');

app/protected/modules/emailMessages/forms/CreateEmailMessageForm.php

          */
         public function validateMinimumToRecipients($attribute, $params)
         {
-            if(isset($this->recipientsData['to']) && $this->recipientsData['to'] != null)
+            if (isset($this->recipientsData['to']) && $this->recipientsData['to'] != null)
             {
                 return;
             }
             $this->addError($attribute . '_to', Yii::t('Default', 'To address cannot be blank'));
         }
-
     }
 ?>

app/protected/modules/emailMessages/jobs/EmailArchivingJob.php

         public function run()
         {
             self::$jobOwnerUserModel = Yii::app()->user->userModel;
-            if(Yii::app()->imap->connect())
+            if (Yii::app()->imap->connect())
             {
                 $lastImapCheckTime     = EmailMessagesModule::getLastImapDropboxCheckTime();
                 if (isset($lastImapCheckTime) && $lastImapCheckTime != '')

app/protected/modules/emailMessages/models/EmailAccount.php

                 $emailAccount->user              = $user;
                 $emailAccount->name              = self::DEFAULT_NAME;
                 $emailAccount->fromName          = $user->getFullName();
-                if($user->primaryEmail->id > 0 && $user->primaryEmail->emailAddress != null)
+                if ($user->primaryEmail->id > 0 && $user->primaryEmail->emailAddress != null)
                 {
                     $emailAccount->fromAddress       = $user->primaryEmail->emailAddress;
                 }
                     'user'     => array(RedBeanModel::HAS_ONE,  'User'),
                 ),
                 'rules'     => array(
-                                  array('fromName',             	 'required'),
-                                  array('fromAddress',          	 'required'),
-                                  array('name',                 	 'type',      'type' => 'string'),
-                                  array('fromName',             	 'type',      'type' => 'string'),
-                                  array('replyToName',          	 'type',      'type' => 'string'),
-                                  array('outboundHost',         	 'type',      'type' => 'string'),
-                                  array('outboundUsername',     	 'type',      'type' => 'string'),
-                                  array('outboundPassword',     	 'type',      'type' => 'string'),
-                                  array('outboundSecurity',     	 'type',      'type' => 'string'),
-                                  array('outboundType',         	 'type',      'type' => 'string'),
-                                  array('outboundPort',         	 'type',      'type' => 'integer'),
+                                  array('fromName',                  'required'),
+                                  array('fromAddress',               'required'),
+                                  array('name',                      'type',      'type' => 'string'),
+                                  array('fromName',                  'type',      'type' => 'string'),
+                                  array('replyToName',               'type',      'type' => 'string'),
+                                  array('outboundHost',              'type',      'type' => 'string'),