HomeHelpTrac

Changeset 15911 for trunk


Ignore:
Timestamp:
01/23/12 22:57:45 (4 months ago)
Author:
Anton Lesnikov
Message:

Unique getModuleTitle and getModules methods in Studio Grids.

Location:
trunk/studio/templates/base/scripts
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/studio/templates/base/scripts/BxBaseStudioFormsDisplays.php

    r15906 r15911  
    160160    } 
    161161 
     162    protected function _getCellModule($mixedValue, $sKey, $aField, $aRow) { 
     163        $mixedValue = $this->_limitMaxLength($this->getModuleTitle($aRow['module']), $sKey, $aField, $aRow, $this->_isDisplayPopupOnTextOverflow); 
     164        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); 
     165    } 
     166 
    162167    protected function _getCellFormTitle ($mixedValue, $sKey, $aField, $aRow) {         
    163168        $mixedValue = $this->_limitMaxLength(_t($aRow['form_title']), $sKey, $aField, $aRow, $this->_isDisplayPopupOnTextOverflow); 
     
    216221            'value' => '', 
    217222            'values' => array( 
    218                 array('key' => '', 'value' => _t('_adm_form_txt_all_modules')), 
    219                 array('key' => BX_DOL_STUDIO_GRID_MODULE_SYSTEM, 'value' => _t('_adm_txt_module_system')), 
    220             ) 
    221         ); 
    222  
    223         bx_import('BxDolModuleQuery'); 
    224         $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules', 'active' => 1)); 
    225         foreach($aModules as $aModule) 
    226             $aInputModules['values'][] = array('key' => $aModule['name'], 'value' => $aModule['title']); 
     223                array('key' => '', 'value' => _t('_adm_form_txt_all_modules')) 
     224            ) 
     225        ); 
     226        $aInputModules['values'] = array_merge($aInputModules['values'], $this->getModules(false)); 
    227227 
    228228        $sContent .= $oForm->genRow($aInputModules); 
  • trunk/studio/templates/base/scripts/BxBaseStudioFormsFields.php

    r15906 r15911  
    149149    protected function _getCellTitle ($mixedValue, $sKey, $aField, $aRow) { 
    150150        $mixedValue = $this->_limitMaxLength(_t($aRow['title']), $sKey, $aField, $aRow, $this->_isDisplayPopupOnTextOverflow); 
     151        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); 
     152    } 
     153 
     154    protected function _getCellModule($mixedValue, $sKey, $aField, $aRow) { 
     155        $mixedValue = $this->_limitMaxLength($this->getModuleTitle($aRow['module']), $sKey, $aField, $aRow, $this->_isDisplayPopupOnTextOverflow); 
    151156        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); 
    152157    } 
  • trunk/studio/templates/base/scripts/BxBaseStudioFormsForms.php

    r15870 r15911  
    160160    } 
    161161 
     162    protected function _getCellModule($mixedValue, $sKey, $aField, $aRow) { 
     163        $mixedValue = $this->_limitMaxLength($this->getModuleTitle($aRow['module']), $sKey, $aField, $aRow, $this->_isDisplayPopupOnTextOverflow); 
     164        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); 
     165    } 
     166 
    162167    protected function _getCellDisplays ($mixedValue, $sKey, $aField, $aRow) { 
    163168        $aDisplayes = array(); 
     
    191196            'value' => '', 
    192197            'values' => array( 
    193                 array('key' => '', 'value' => _t('_adm_form_txt_all_modules')), 
    194                 array('key' => BX_DOL_STUDIO_GRID_MODULE_SYSTEM, 'value' => _t('_adm_txt_module_system')) 
     198                array('key' => '', 'value' => _t('_adm_form_txt_all_modules')) 
    195199            ) 
    196200        ); 
    197  
    198         bx_import('BxDolModuleQuery'); 
    199         $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules', 'active' => 1)); 
    200         foreach($aModules as $aModule) 
    201             $aInputModules['values'][] = array('key' => $aModule['name'], 'value' => $aModule['title']); 
     201        $aInputModules['values'] = array_merge($aInputModules['values'], $this->getModules(false)); 
    202202 
    203203        $sContent .= $oForm->genRow($aInputModules); 
  • trunk/studio/templates/base/scripts/BxBaseStudioFormsPreLists.php

    r15888 r15911  
    319319    } 
    320320 
     321    protected function _getCellModule($mixedValue, $sKey, $aField, $aRow) { 
     322        $mixedValue = $this->_limitMaxLength($this->getModuleTitle($aRow['module']), $sKey, $aField, $aRow, $this->_isDisplayPopupOnTextOverflow); 
     323        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); 
     324    } 
     325 
    321326    protected function _getCellUseForSets ($mixedValue, $sKey, $aField, $aRow) { 
    322327        $aChanger = array( 
  • trunk/studio/templates/base/scripts/BxBaseStudioGrid.php

    r15794 r15911  
    2121    } 
    2222 
    23     protected function _getModuleTitle($sName) { 
     23    protected function getModuleTitle($sName) { 
     24        $sPrefix = '_adm_txt_module_'; 
     25 
     26        if(in_array($sName, array(BX_DOL_STUDIO_GRID_MODULE_SYSTEM, BX_DOL_STUDIO_GRID_MODULE_CUSTOM))) 
     27            return _t($sPrefix . $sName); 
     28 
    2429        bx_import('BxDolModuleQuery'); 
    2530        $aModule = BxDolModuleQuery::getInstance()->getModuleByName($sName); 
     
    2732            return $aModule['title']; 
    2833 
    29         return _t('_adm_txt_module_' . strtolower($sName)); 
     34        return _t($sPrefix . strtolower($sName)); 
     35    } 
     36 
     37    protected function getModules($bShowCustom = true, $bShowSystem = true) { 
     38        $aResult = array(); 
     39 
     40        if($bShowSystem) 
     41            $aResult[] = array('key' => BX_DOL_STUDIO_GRID_MODULE_SYSTEM, 'value' => $this->getModuleTitle(BX_DOL_STUDIO_GRID_MODULE_SYSTEM)); 
     42 
     43        if($bShowCustom) 
     44            $aResult[] = array('key' => BX_DOL_STUDIO_GRID_MODULE_CUSTOM, 'value' => $this->getModuleTitle(BX_DOL_STUDIO_GRID_MODULE_CUSTOM)); 
     45 
     46        bx_import('BxDolModuleQuery'); 
     47        $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules', 'active' => 1)); 
     48        foreach($aModules as $aModule) 
     49            $aResult[] = array('key' => $aModule['name'], 'value' => $aModule['title']); 
     50 
     51        return $aResult; 
    3052    } 
    3153} 
  • trunk/studio/templates/base/scripts/BxBaseStudioNavigationImport.php

    r15820 r15911  
    120120    } 
    121121 
     122    protected function _getCellModule($mixedValue, $sKey, $aField, $aRow) { 
     123        $mixedValue = $this->_limitMaxLength($this->getModuleTitle($aRow['module']), $sKey, $aField, $aRow, $this->_isDisplayPopupOnTextOverflow); 
     124        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); 
     125    } 
     126 
    122127    protected function _getActionDone ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array()) { 
    123128        $a['attr']['onclick'] = "$('.bx-popup-applied:visible').dolPopupHide()"; 
     
    163168            'values' => array( 
    164169                array('key' => '', 'value' => _t('_adm_nav_txt_all_modules')), 
    165                 array('key' => BX_DOL_STUDIO_GRID_MODULE_SYSTEM, 'value' => _t('_adm_txt_module_system')), 
    166                 array('key' => BX_DOL_STUDIO_GRID_MODULE_CUSTOM, 'value' => _t('_adm_txt_module_custom')) 
    167170            ) 
    168171        ); 
    169  
    170         bx_import('BxDolModuleQuery'); 
    171         $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules', 'active' => 1)); 
    172         foreach($aModules as $aModule) 
    173             $aInputModules['values'][] = array('key' => $aModule['name'], 'value' => $aModule['title']); 
     172        $aInputModules['values'] = array_merge($aInputModules['values'], $this->getModules()); 
    174173 
    175174        $sContent .= $oForm->genRow($aInputModules); 
  • trunk/studio/templates/base/scripts/BxBaseStudioNavigationItems.php

    r15902 r15911  
    571571    } 
    572572 
     573    protected function _getCellModule($mixedValue, $sKey, $aField, $aRow) { 
     574        $mixedValue = $this->_limitMaxLength($this->getModuleTitle($aRow['module']), $sKey, $aField, $aRow, $this->_isDisplayPopupOnTextOverflow); 
     575        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); 
     576    } 
     577 
    573578    protected function _getCellVisibleForLevels ($mixedValue, $sKey, $aField, $aRow) { 
    574579        $iIndex = 1; 
     
    659664            'value' => '', 
    660665            'values' => array( 
    661                 array('key' => '', 'value' => _t('_adm_nav_txt_all_modules')), 
    662                 array('key' => BX_DOL_STUDIO_GRID_MODULE_SYSTEM, 'value' => _t('_adm_txt_module_system')), 
    663                 array('key' => BX_DOL_STUDIO_GRID_MODULE_CUSTOM, 'value' => _t('_adm_txt_module_custom')) 
     666                array('key' => '', 'value' => _t('_adm_nav_txt_all_modules')) 
    664667            ) 
    665668        ); 
    666  
    667         bx_import('BxDolModuleQuery'); 
    668         $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules', 'active' => 1)); 
    669         foreach($aModules as $aModule) 
    670             $aInputModules['values'][] = array('key' => $aModule['name'], 'value' => $aModule['title']); 
     669        $aInputModules['values'] = array_merge($aInputModules['values'], $this->getModules()); 
    671670 
    672671        $sContent .= $oForm->genRow($aInputModules); 
  • trunk/studio/templates/base/scripts/BxBaseStudioNavigationMenus.php

    r15817 r15911  
    401401    } 
    402402 
     403    protected function _getCellModule($mixedValue, $sKey, $aField, $aRow) { 
     404        $mixedValue = $this->_limitMaxLength($this->getModuleTitle($aRow['module']), $sKey, $aField, $aRow, $this->_isDisplayPopupOnTextOverflow); 
     405        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); 
     406    } 
     407 
    403408    protected function _getActionDelete ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array()) { 
    404409        if ($sType == 'single' && (int)$aRow['deleteable'] != 1) 
     
    426431            'values' => array( 
    427432                array('key' => '', 'value' => _t('_adm_nav_txt_all_modules')), 
    428                 array('key' => BX_DOL_STUDIO_GRID_MODULE_SYSTEM, 'value' => _t('_adm_txt_module_system')), 
    429                 array('key' => BX_DOL_STUDIO_GRID_MODULE_CUSTOM, 'value' => _t('_adm_txt_module_custom')) 
    430433            ) 
    431434        ); 
    432  
    433         bx_import('BxDolModuleQuery'); 
    434         $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules', 'active' => 1)); 
    435         foreach($aModules as $aModule) 
    436             $aInputModules['values'][] = array('key' => $aModule['name'], 'value' => $aModule['title']); 
     435        $aInputModules['values'] = array_merge($aInputModules['values'], $this->getModules()); 
    437436 
    438437        $sContent .= $oForm->genRow($aInputModules); 
  • trunk/studio/templates/base/scripts/BxBaseStudioNavigationSets.php

    r15818 r15911  
    307307    } 
    308308 
     309    protected function _getCellModule($mixedValue, $sKey, $aField, $aRow) { 
     310        $mixedValue = $this->_limitMaxLength($this->getModuleTitle($aRow['module']), $sKey, $aField, $aRow, $this->_isDisplayPopupOnTextOverflow); 
     311        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); 
     312    } 
     313 
    309314    protected function _getCellItems ($mixedValue, $sKey, $aField, $aRow) { 
    310315        $aSets = array(); 
     
    345350            'value' => '', 
    346351            'values' => array( 
    347                 array('key' => '', 'value' => _t('_adm_nav_txt_all_modules')), 
    348                 array('key' => BX_DOL_STUDIO_GRID_MODULE_SYSTEM, 'value' => _t('_adm_txt_module_system')), 
    349                 array('key' => BX_DOL_STUDIO_GRID_MODULE_CUSTOM, 'value' => _t('_adm_txt_module_custom')) 
     352                array('key' => '', 'value' => _t('_adm_nav_txt_all_modules')) 
    350353            ) 
    351354        ); 
    352  
    353         bx_import('BxDolModuleQuery'); 
    354         $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules', 'active' => 1)); 
    355         foreach($aModules as $aModule) 
    356             $aInputModules['values'][] = array('key' => $aModule['name'], 'value' => $aModule['title']); 
     355        $aInputModules['values'] = array_merge($aInputModules['values'], $this->getModules()); 
    357356 
    358357        $sContent .= $oForm->genRow($aInputModules); 
  • trunk/studio/templates/base/scripts/BxBaseStudioPermissionsActions.php

    r15794 r15911  
    232232 
    233233    protected function _getCellModule($mixedValue, $sKey, $aField, $aRow) { 
    234         $mixedValue = $this->_limitMaxLength($this->_getModuleTitle($aRow['Module']), $sKey, $aField, $aRow, $this->_isDisplayPopupOnTextOverflow); 
     234        $mixedValue = $this->_limitMaxLength($this->getModuleTitle($aRow['Module']), $sKey, $aField, $aRow, $this->_isDisplayPopupOnTextOverflow); 
    235235        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); 
    236236    } 
     
    281281            'values' => array( 
    282282                array('key' => '', 'value' => _t('_adm_prm_txt_all_modules')), 
    283                 array('key' => 'system', 'value' => _t('_adm_txt_module_system')) 
    284283            ) 
    285284        ); 
    286  
    287         bx_import('BxDolModuleQuery'); 
    288         $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules', 'active' => 1)); 
    289         foreach($aModules as $aModule) 
    290             $aInputModules['values'][] = array('key' => $aModule['name'], 'value' => $aModule['title']); 
     285        $aInputModules['values'] = array_merge($aInputModules['values'], $this->getModules(false)); 
    291286 
    292287        $sContent .= $oForm->genRow($aInputModules); 
Note: See TracChangeset for help on using the changeset viewer.