Changeset 15966
- Timestamp:
- 02/08/12 22:43:40 (4 months ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
install/sql/v70.sql (modified) (1 diff)
-
modules/boonex/english/install/data/langs/en.xml (modified) (3 diffs)
-
studio/classes/BxDolStudioBuilderPageQuery.php (modified) (2 diffs)
-
studio/classes/BxDolStudioUtils.php (modified) (1 diff)
-
studio/js/navigation_items.js (modified) (1 diff)
-
studio/templates/base/scripts/BxBaseStudioBuilderPage.php (modified) (3 diffs)
-
studio/templates/base/scripts/BxBaseStudioNavigationItems.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/install/sql/v70.sql
r15962 r15966 3039 3039 `title` varchar(255) NOT NULL, 3040 3040 `template` varchar(255) NOT NULL, 3041 `order` int(11) NOT NULL, 3041 3042 PRIMARY KEY (`id`) 3042 3043 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 3043 3044 3044 INSERT INTO `sys_pages_design_boxes` (`id`, `title`, `template` ) VALUES3045 (0, '_sys_designbox_0', 'designbox_0.html' ),3046 (1, '_sys_designbox_1', 'designbox_1.html' ),3047 (2, '_sys_designbox_2', 'designbox_2.html' ),3048 (3, '_sys_designbox_3', 'designbox_3.html' ),3049 (10, '_sys_designbox_10', 'designbox_10.html' ),3050 (11, '_sys_designbox_11', 'designbox_11.html' ),3051 (13, '_sys_designbox_13', 'designbox_13.html' );3045 INSERT INTO `sys_pages_design_boxes` (`id`, `title`, `template`, `order`) VALUES 3046 (0, '_sys_designbox_0', 'designbox_0.html', '1'), 3047 (1, '_sys_designbox_1', 'designbox_1.html', '4'), 3048 (2, '_sys_designbox_2', 'designbox_2.html', '0'), 3049 (3, '_sys_designbox_3', 'designbox_3.html', '2'), 3050 (10, '_sys_designbox_10', 'designbox_10.html', '0'), 3051 (11, '_sys_designbox_11', 'designbox_11.html', '5'), 3052 (13, '_sys_designbox_13', 'designbox_13.html', '3'); 3052 3053 3053 3054 -
trunk/modules/boonex/english/install/data/langs/en.xml
r15963 r15966 2205 2205 <string name="_adm_nav_txt_items_visible"><![CDATA[Visibile For]]></string> 2206 2206 <string name="_adm_nav_btn_items_visible"><![CDATA[Visibile For]]></string> 2207 <string name="_adm_nav_txt_items_anyone"><![CDATA[Anyone]]></string> 2207 2208 <string name="_adm_nav_txt_items_n_user_levels"><![CDATA[{0} User Levels]]></string> 2208 2209 <string name="_adm_nav_txt_items_create_popup"><![CDATA[Add New Item]]></string> … … 2240 2241 <string name="_adm_nav_txt_items_show_to_popup"><![CDATA[Show "{0}" menu item to: ]]></string> 2241 2242 <string name="_adm_nav_err_items_show_to"><![CDATA[Cannot update item]]></string> 2242 <string name="_adm_nav_txt_items_visible_for_levels"><![CDATA[User Levels]]></string> 2243 <string name="_adm_nav_txt_block_visible_for"><![CDATA[Visible For]]></string> 2244 <string name="_adm_nav_txt_block_visible_for_all"><![CDATA[Anyone]]></string> 2245 <string name="_adm_nav_txt_block_visible_for_selected"><![CDATA[Selected levels]]></string> 2246 <string name="_adm_nav_txt_items_visible_for_levels"><![CDATA[Select Levels]]></string> 2243 2247 <string name="_adm_nav_dsc_items_visible_for_levels"><![CDATA[Select user levels that can see this menu item]]></string> 2244 2248 <string name="_adm_lmi_cpt_forms"><![CDATA[Forms]]></string> … … 2481 2485 <string name="_adm_bp_txt_block_designbox_empty"><![CDATA[Select layout...]]></string> 2482 2486 <string name="_adm_bp_txt_block_visible_for"><![CDATA[Visible For]]></string> 2483 <string name="_adm_bp_txt_block_visible_for_all"><![CDATA[A ll]]></string>2487 <string name="_adm_bp_txt_block_visible_for_all"><![CDATA[Anyone]]></string> 2484 2488 <string name="_adm_bp_txt_block_visible_for_selected"><![CDATA[Selected levels]]></string> 2485 2489 <string name="_adm_bp_txt_block_visible_for_levels"><![CDATA[Select Levels]]></string> -
trunk/studio/classes/BxDolStudioBuilderPageQuery.php
r15949 r15966 134 134 135 135 if(!isset($aParams['order']) || empty($aParams['order'])) 136 $sOrderClause = "ORDER BY `tpd`.` id` ASC";136 $sOrderClause = "ORDER BY `tpd`.`order` ASC"; 137 137 138 138 switch($aParams['type']) { … … 140 140 $aMethod['name'] = 'getRow'; 141 141 $sWhereClause = $this->prepare("AND `tpd`.`id`=? ", $aParams['value']); 142 break; 143 case 'ordered': 144 $sWhereClause = "AND `tpd`.`order`<>0 "; 142 145 break; 143 146 case 'all': -
trunk/studio/classes/BxDolStudioUtils.php
r15963 r15966 76 76 } 77 77 78 public static function getVisibilityCount($iValue, $aLevels) { 79 $iResult = 0; 80 81 $iValue = (int)$iValue; 82 if($iValue == 0) 83 return $iResult; 84 else if($iValue == BX_DOL_INT_MAX) 85 return -1; 86 87 $iIndex = 1; 88 do { 89 if(array_key_exists($iIndex++, $aLevels)) 90 $iResult += $iValue & 1; 91 } while(($iValue = $iValue >> 1) != 0); 92 93 return $iResult; 94 } 95 78 96 public static function getVisibilityValue($sVisibleFor, $aVisibleForLevels) { 79 97 if($sVisibleFor == BX_DOL_STUDIO_VISIBLE_ALL) 80 return PHP_INT_MAX;98 return BX_DOL_INT_MAX; 81 99 82 100 $iVisibleFor = 0; -
trunk/studio/js/navigation_items.js
r15962 r15966 37 37 glGrids[this.sObjNameGrid].setFilter(sValueModule + this.sParamsDivider + sValueSearch, true); 38 38 }; 39 BxDolStudioNavigationItems.prototype.onChangeVisibleFor = function(oSelect) { 40 $('#bx-form-element-visible_for_levels').bx_anim($(oSelect).val() == 'all' ? 'hide' : 'show', this.sAnimationEffect, this.iAnimationSpeed); 41 }; 39 42 /** @} */ -
trunk/studio/templates/base/scripts/BxBaseStudioBuilderPage.php
r15963 r15966 772 772 'caption' => _t('_adm_bp_txt_block_visible_for'), 773 773 'info' => '', 774 'value' => $aBlock['visible_for_levels'] == PHP_INT_MAX ? BX_DOL_STUDIO_VISIBLE_ALL : BX_DOL_STUDIO_VISIBLE_SELECTED,774 'value' => $aBlock['visible_for_levels'] == BX_DOL_INT_MAX ? BX_DOL_STUDIO_VISIBLE_ALL : BX_DOL_STUDIO_VISIBLE_SELECTED, 775 775 'values' => array( 776 776 array('key' => BX_DOL_STUDIO_VISIBLE_ALL, 'value' => _t('_adm_bp_txt_block_visible_for_all')), … … 793 793 'values' => array(), 794 794 'tr_attrs' => array( 795 'style' => $aBlock['visible_for_levels'] == PHP_INT_MAX ? 'display:none' : ''795 'style' => $aBlock['visible_for_levels'] == BX_DOL_INT_MAX ? 'display:none' : '' 796 796 ), 797 797 'db' => array ( … … 821 821 822 822 $aDBoxes = array(); 823 $this->oDb->getDesignBoxes(array('type' => ' all'), $aDBoxes, false);823 $this->oDb->getDesignBoxes(array('type' => 'ordered'), $aDBoxes, false); 824 824 foreach($aDBoxes as $aDBox) 825 825 $aForm['inputs']['designbox_id']['values'][] = array('key' => $aDBox['id'], 'value' => _t($aDBox['title'])); -
trunk/studio/templates/base/scripts/BxBaseStudioNavigationItems.php
r15962 r15966 531 531 ), 532 532 ), 533 'visible_for' => array( 534 'type' => 'select', 535 'name' => 'visible_for', 536 'caption' => _t('_adm_nav_txt_block_visible_for'), 537 'info' => '', 538 'value' => $aItem['visible_for_levels'] == BX_DOL_INT_MAX ? BX_DOL_STUDIO_VISIBLE_ALL : BX_DOL_STUDIO_VISIBLE_SELECTED, 539 'values' => array( 540 array('key' => BX_DOL_STUDIO_VISIBLE_ALL, 'value' => _t('_adm_nav_txt_block_visible_for_all')), 541 array('key' => BX_DOL_STUDIO_VISIBLE_SELECTED, 'value' => _t('_adm_nav_txt_block_visible_for_selected')), 542 ), 543 'required' => '0', 544 'attrs' => array( 545 'onchange' => $this->getJsObject() . '.onChangeVisibleFor(this)' 546 ), 547 'db' => array ( 548 'pass' => 'Xss', 549 ) 550 ), 533 551 'visible_for_levels' => array( 534 552 'type' => 'checkbox_set', … … 538 556 'value' => '', 539 557 'values' => array(), 540 'checker' => array ( 541 'func' => '', 542 'params' => array(), 543 'error' => '', 558 'tr_attrs' => array( 559 'style' => $aItem['visible_for_levels'] == BX_DOL_INT_MAX ? 'display:none' : '' 544 560 ), 545 561 'db' => array ( … … 568 584 ); 569 585 570 bx_import('BxDolAcl'); 571 $aLevels = BxDolAcl::getInstance()->getMemberships(); 572 foreach($aLevels as $iKey => $sValue) { 573 if(((int)$aItem['visible_for_levels'] & pow(2, (int)$iKey - 1)) != 0) 574 $aForm['inputs']['visible_for_levels']['value'][] = $iKey; 575 576 $aForm['inputs']['visible_for_levels']['values'][$iKey] = _t($sValue); 577 } 578 586 BxDolStudioUtils::getVisibilityValues($aItem['visible_for_levels'], $aForm['inputs']['visible_for_levels']['values'], $aForm['inputs']['visible_for_levels']['value']); 587 579 588 bx_import('BxTemplStudioFormView'); 580 589 $oForm = new BxTemplStudioFormView($aForm); … … 582 591 583 592 if($oForm->isSubmittedAndValid()) { 584 $iHideFrom = 0; 585 $aLevelIds = $oForm->getCleanValue('visible_for_levels'); 586 foreach($aLevelIds as $iLevelId) 587 $iHideFrom += pow(2, $iLevelId - 1); 588 BxDolForm::setSubmittedValue('visible_for_levels', $iHideFrom, $aForm['form_attrs']['method']); 593 $iVisibleFor = BxDolStudioUtils::getVisibilityValue($oForm->getCleanValue('visible_for'), $oForm->getCleanValue('visible_for_levels')); 594 BxDolForm::setSubmittedValue('visible_for_levels', $iVisibleFor, $aForm['form_attrs']['method']); 595 unset($oForm->aInputs['visible_for']); 589 596 590 597 if($oForm->update($iId) !== false) … … 662 669 663 670 protected function _getCellVisibleForLevels ($mixedValue, $sKey, $aField, $aRow) { 664 $iIndex = 1; 665 $iCount = 0; 666 $mixedValue = (int)$aRow['visible_for_levels']; 667 if(($mixedValue = (int)$mixedValue) != 0) { 668 do { 669 if(array_key_exists($iIndex++, $this->aMemberships)) 670 $iCount += $mixedValue & 1; 671 } while(($mixedValue = $mixedValue >> 1) != 0); 672 } 671 $iCount = BxDolStudioUtils::getVisibilityCount($aRow['visible_for_levels'], $this->aMemberships); 673 672 674 673 $mixedValue = $this->_oTemplate->parseHtmlByName('bx_a.html', array( … … 679 678 array('key' => 'bx_grid_action_data', 'value' => $aRow['id']) 680 679 ), 681 'content' => _t('_adm_nav_txt_items_n_user_levels', $iCount)680 'content' => $iCount != -1 ? _t('_adm_nav_txt_items_n_user_levels', $iCount) : _t('_adm_nav_txt_items_anyone') 682 681 )); 683 682
Note: See TracChangeset
for help on using the changeset viewer.