HomeHelpTrac

Changeset 15963 for trunk


Ignore:
Timestamp:
02/08/12 05:13:10 (4 months ago)
Author:
Anton Lesnikov
Message:
  1. "Page Builder" checklist from Andrew
  2. Visible For Levels feature unification.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/boonex/english/install/data/langs/en.xml

    r15962 r15963  
    19001900    <string name="_Status Message"><![CDATA[Status Message]]></string> 
    19011901    <string name="_Set up your status"><![CDATA[Set up your status]]></string> 
    1902     <string name="_adm_tmi_cpt_edit"><![CDATA[Edit]]></string> 
     1902     
     1903    <string name="_adm_tmi_cpt_edit"><![CDATA[Manage Launcher]]></string> 
    19031904    <string name="_adm_tmi_cpt_home"><![CDATA[Favorites]]></string> 
    19041905    <string name="_adm_tmi_cpt_modules"><![CDATA[Modules]]></string> 
    1905     <string name="_adm_tmi_cpt_site"><![CDATA[Site's home page]]></string> 
     1906    <string name="_adm_tmi_cpt_site"><![CDATA[Go To Site]]></string> 
    19061907    <string name="_adm_tmi_cpt_logout"><![CDATA[Logout]]></string> 
    19071908    <string name="_adm_txt_back_to_launcher"><![CDATA[Back to Launcher]]></string> 
     
    20522053    <string name="_adm_page_cpt_builder_menus"><![CDATA[Navigation]]></string> 
    20532054    <string name="_adm_wgt_cpt_builder_menus"><![CDATA[Navigation]]></string> 
    2054     <string name="_adm_page_cpt_builder_forms"><![CDATA[Forms Builder]]></string> 
     2055    <string name="_adm_page_cpt_builder_forms"><![CDATA[Forms]]></string> 
    20552056    <string name="_adm_wgt_cpt_builder_forms"><![CDATA[Forms]]></string> 
    20562057    <string name="_adm_page_cpt_builder_permissions"><![CDATA[Permissions]]></string> 
     
    24482449   
    24492450    <string name="_adm_txt_module_skeletons"><![CDATA[Skeletons]]></string> 
    2450     <string name="_adm_page_cpt_builder_pages"><![CDATA[Pages Builder]]></string> 
     2451    <string name="_adm_page_cpt_builder_pages"><![CDATA[Pages]]></string> 
    24512452    <string name="_adm_wgt_cpt_builder_pages"><![CDATA[Pages]]></string> 
    24522453    <string name="_adm_bp_cpt_type_system"><![CDATA[System]]></string> 
     
    24552456    <string name="_adm_bp_txt_select_page"><![CDATA[Select Page...]]></string> 
    24562457    <string name="_adm_bp_btn_delete"><![CDATA[Delete]]></string> 
    2457     <string name="_adm_bp_btn_create_new"><![CDATA[Create New]]></string> 
     2458    <string name="_adm_bp_btn_create_new"><![CDATA[Add New Page]]></string> 
    24582459    <string name="_adm_bp_btn_view_page"><![CDATA[View Page]]></string> 
    24592460    <string name="_adm_bp_btn_settings"><![CDATA[Settings]]></string> 
     
    24742475    <string name="_adm_bp_err_block_remove_old_image"><![CDATA[Cannot remove an old image]]></string> 
    24752476    <string name="_adm_bp_txt_block_title"><![CDATA[Title]]></string> 
    2476     <string name="_adm_bp_dsc_block_title"><![CDATA[You need to enter field title]]></string> 
     2477    <string name="_adm_bp_dsc_block_title"><![CDATA[Short name for the block, visible in block header.]]></string> 
    24772478    <string name="_adm_bp_err_block_title"><![CDATA[Enter title, more then 3 characters]]></string> 
    2478     <string name="_adm_bp_txt_block_designbox"><![CDATA[Design Box]]></string> 
    2479     <string name="_adm_bp_err_block_designbox"><![CDATA[Select a design box for the block]]></string> 
    2480     <string name="_adm_bp_txt_block_designbox_empty"><![CDATA[Select Design Box...]]></string> 
    2481     <string name="_adm_bp_txt_block_visible_for_levels"><![CDATA[User Levels]]></string> 
     2479    <string name="_adm_bp_txt_block_designbox"><![CDATA[Block Layout]]></string> 
     2480    <string name="_adm_bp_err_block_designbox"><![CDATA[Select a layout box for the block]]></string> 
     2481    <string name="_adm_bp_txt_block_designbox_empty"><![CDATA[Select layout...]]></string> 
     2482    <string name="_adm_bp_txt_block_visible_for"><![CDATA[Visible For]]></string> 
     2483    <string name="_adm_bp_txt_block_visible_for_all"><![CDATA[All]]></string> 
     2484    <string name="_adm_bp_txt_block_visible_for_selected"><![CDATA[Selected levels]]></string> 
     2485    <string name="_adm_bp_txt_block_visible_for_levels"><![CDATA[Select Levels]]></string> 
    24822486    <string name="_adm_bp_dsc_block_visible_for_levels"><![CDATA[Select user levels that can see this block]]></string> 
    24832487    <string name="_adm_bp_btn_block_save"><![CDATA[Save]]></string> 
     
    34263430    <string name="_sys_menu_template_title_ver"><![CDATA[Vertical Links]]></string> 
    34273431    <string name="_sys_menu_template_title_toolbar"><![CDATA[Toolbar Buttons]]></string> 
    3428     <string name="_sys_designbox_0"><![CDATA[Box with content only (no borders, no background, no caption, no padding)]]></string> 
    3429     <string name="_sys_designbox_1"><![CDATA[Box with content, borders and caption (no padding)]]></string> 
    3430     <string name="_sys_designbox_2"><![CDATA[Just empty box, regardless of content or title]]></string> 
    3431     <string name="_sys_designbox_3"><![CDATA[Box with content and borders, but without caption (no padding)]]></string> 
    3432     <string name="_sys_designbox_10"><![CDATA[Box with content only wrapped with default padding (no borders, no background, no caption)]]></string> 
    3433     <string name="_sys_designbox_11"><![CDATA[Box with content wrapped with default padding, borders and caption]]></string> 
    3434     <string name="_sys_designbox_13"><![CDATA[Box with content wrapped with default padding, but without caption]]></string> 
     3432    <string name="_sys_designbox_0"><![CDATA[Content only]]></string> 
     3433    <string name="_sys_designbox_1"><![CDATA[Content + title + background]]></string> 
     3434    <string name="_sys_designbox_2"><![CDATA[Empty box]]></string> 
     3435    <string name="_sys_designbox_3"><![CDATA[Content + background]]></string> 
     3436    <string name="_sys_designbox_10"><![CDATA[Content only + padding]]></string> 
     3437    <string name="_sys_designbox_11"><![CDATA[Content + title + background + padding]]></string> 
     3438    <string name="_sys_designbox_13"><![CDATA[Content + background + padding]]></string> 
    34353439</resources> 
  • trunk/studio/classes/BxDolStudioUtils.php

    r15958 r15963  
    1313define('BX_DOL_STUDIO_MODULE_SYSTEM', 'system'); 
    1414define('BX_DOL_STUDIO_MODULE_CUSTOM', 'custom'); 
     15 
     16define('BX_DOL_STUDIO_VISIBLE_ALL', 'all'); 
     17define('BX_DOL_STUDIO_VISIBLE_SELECTED', 'selected'); 
    1518 
    1619class BxDolStudioUtils extends BxDol { 
     
    7376    } 
    7477 
     78    public static function getVisibilityValue($sVisibleFor, $aVisibleForLevels) { 
     79        if($sVisibleFor == BX_DOL_STUDIO_VISIBLE_ALL) 
     80            return PHP_INT_MAX; 
     81 
     82        $iVisibleFor = 0; 
     83        foreach($aVisibleForLevels as $iLevelId) 
     84            $iVisibleFor += pow(2, (int)$iLevelId - 1); 
     85 
     86        return $iVisibleFor; 
     87    } 
     88 
     89    public static function getVisibilityValues($iValue, &$aValuesAll, &$aValuesSelected) { 
     90        bx_import('BxDolAcl'); 
     91        $aLevels = BxDolAcl::getInstance()->getMemberships(); 
     92        foreach($aLevels as $iKey => $sValue) { 
     93            if(((int)$iValue & pow(2, (int)$iKey - 1)) != 0) 
     94                $aValuesSelected[] = $iKey; 
     95             
     96            $aValuesAll[$iKey] = _t($sValue); 
     97        } 
     98    } 
     99     
    75100    public static function addInArray($aInput, $sKey, $aValues) { 
    76101        reset($aInput); 
  • trunk/studio/js/builder_page.js

    r15949 r15963  
    131131}; 
    132132 
     133BxDolStudioBuilderPage.prototype.onChangeVisibleFor = function(oSelect) { 
     134    $('#bx-form-element-visible_for_levels').bx_anim($(oSelect).val() == 'all' ? 'hide' : 'show', this.sAnimationEffect, this.iAnimationSpeed); 
     135}; 
     136 
    133137BxDolStudioBuilderPage.prototype.onEditBlock = function(oData) { 
    134138    window.location.href = this.sActionsUrl + '?type=' + this.sType + '&page=' + this.sPage; 
  • trunk/studio/templates/base/scripts/BxBaseStudioBuilderPage.php

    r15957 r15963  
    767767                    ), 
    768768                ), 
     769                'visible_for' => array( 
     770                    'type' => 'select', 
     771                    'name' => 'visible_for', 
     772                    'caption' => _t('_adm_bp_txt_block_visible_for'), 
     773                    'info' => '', 
     774                    'value' => $aBlock['visible_for_levels'] == PHP_INT_MAX ? BX_DOL_STUDIO_VISIBLE_ALL : BX_DOL_STUDIO_VISIBLE_SELECTED, 
     775                    'values' => array( 
     776                        array('key' => BX_DOL_STUDIO_VISIBLE_ALL, 'value' => _t('_adm_bp_txt_block_visible_for_all')), 
     777                        array('key' => BX_DOL_STUDIO_VISIBLE_SELECTED, 'value' => _t('_adm_bp_txt_block_visible_for_selected')), 
     778                    ), 
     779                    'required' => '0', 
     780                    'attrs' => array( 
     781                        'onchange' => $this->getPageJsObject() . '.onChangeVisibleFor(this)' 
     782                    ), 
     783                    'db' => array ( 
     784                        'pass' => 'Xss', 
     785                    ) 
     786                ), 
    769787                'visible_for_levels' => array( 
    770788                    'type' => 'checkbox_set', 
     
    772790                    'caption' => _t('_adm_bp_txt_block_visible_for_levels'), 
    773791                    'info' => _t('_adm_bp_dsc_block_visible_for_levels'), 
    774                     'value' => '', 
     792                    'value' => array(), 
    775793                    'values' => array(), 
     794                    'tr_attrs' => array( 
     795                        'style' => $aBlock['visible_for_levels'] == PHP_INT_MAX ? 'display:none' : '' 
     796                    ), 
    776797                    'db' => array ( 
    777798                        'pass' => 'Int', 
     
    804825            $aForm['inputs']['designbox_id']['values'][] = array('key' => $aDBox['id'], 'value' => _t($aDBox['title'])); 
    805826 
    806         bx_import('BxDolAcl'); 
    807         $aLevels = BxDolAcl::getInstance()->getMemberships(); 
    808         foreach($aLevels as $iKey => $sValue) { 
    809             if(((int)$aBlock['visible_for_levels'] & pow(2, (int)$iKey - 1)) != 0) 
    810                 $aForm['inputs']['visible_for_levels']['value'][] = $iKey; 
    811              
    812             $aForm['inputs']['visible_for_levels']['values'][$iKey] = _t($sValue); 
    813         } 
     827        BxDolStudioUtils::getVisibilityValues($aBlock['visible_for_levels'], $aForm['inputs']['visible_for_levels']['values'], $aForm['inputs']['visible_for_levels']['value']); 
    814828 
    815829        switch($aBlock['type']) { 
     
    10001014            BxDolForm::setSubmittedValue('title', $aBlock['title'], $aForm['form_attrs']['method']); 
    10011015 
    1002             $iHideFrom = 0; 
    1003             $aLevelIds = $oForm->getCleanValue('visible_for_levels'); 
    1004             foreach($aLevelIds as $iLevelId) 
    1005                 $iHideFrom += pow(2, (int)$iLevelId - 1); 
    1006             BxDolForm::setSubmittedValue('visible_for_levels', $iHideFrom, $aForm['form_attrs']['method']); 
     1016            $iVisibleFor = BxDolStudioUtils::getVisibilityValue($oForm->getCleanValue('visible_for'), $oForm->getCleanValue('visible_for_levels')); 
     1017            BxDolForm::setSubmittedValue('visible_for_levels', $iVisibleFor, $aForm['form_attrs']['method']); 
     1018            unset($oForm->aInputs['visible_for']); 
    10071019 
    10081020            //--- Process Image fields 
Note: See TracChangeset for help on using the changeset viewer.