AntonLV 6 yıl önce
ebeveyn
işleme
17d9361bf3

+ 32 - 32
studio/classes/BxDolStudioBuilderPage.php

@@ -57,38 +57,38 @@ class BxDolStudioBuilderPage extends BxTemplStudioPage
     function init()
     {
         if(($sAction = bx_get('bp_action')) === false) 
-        	return;
-
-		$sAction = bx_process_input($sAction);
-
-		$aResult = array('code' => 1, 'message' => _t('_adm_bp_err_cannot_process_action'));
-		switch($sAction) {
-			case 'reorder':
-				if(empty($this->aPageRebuild) || !is_array($this->aPageRebuild))
-					break;
-
-				$bResult = false;
-				for($i = 1; $i <= $this->aPageRebuild['layout_cells_number']; $i++) {
-					$aItems = bx_get('bp_items_' . $i);
-					$iItems = count($aItems);
-
-					for($j = 0; $j < $iItems; $j++)
-					$bResult |= $this->oDb->updateBlock((int)$aItems[$j], array(
-						'cell_id' => $i,
-						'order' => $j
-					));
-				}
-				$aResult = $bResult ? array('code' => 0, 'message' => _t('_adm_bp_scs_save')) : array('code' => 1, 'message' => _t('_adm_bp_err_nothing_changed'));
-				break;
-
-			default:
-				$sMethod = 'action' . $this->getClassName($sAction);
-				if(method_exists($this, $sMethod))
-			    	$aResult = $this->$sMethod();
-		}
-
-		echo json_encode($aResult);
-		exit;
+            return;
+
+        $sAction = bx_process_input($sAction);
+
+        $aResult = array('code' => 1, 'message' => _t('_adm_bp_err_cannot_process_action'));
+        switch($sAction) {
+            case 'reorder':
+                if(empty($this->aPageRebuild) || !is_array($this->aPageRebuild))
+                    break;
+
+                $bResult = false;
+                for($i = 0; $i <= $this->aPageRebuild['layout_cells_number']; $i++) {
+                    $aItems = bx_get('bp_items_' . $i);
+                    $iItems = count($aItems);
+
+                    for($j = 0; $j < $iItems; $j++)
+                        $bResult |= $this->oDb->updateBlock((int)$aItems[$j], array(
+                            'cell_id' => $i,
+                            'order' => $j
+                        ));
+                }
+                $aResult = $bResult ? array('code' => 0, 'message' => _t('_adm_bp_scs_save')) : array('code' => 1, 'message' => _t('_adm_bp_err_nothing_changed'));
+                break;
+
+            default:
+                $sMethod = 'action' . $this->getClassName($sAction);
+                if(method_exists($this, $sMethod))
+                    $aResult = $this->$sMethod();
+        }
+
+        echo json_encode($aResult);
+        exit;
     }
 
     function processAction($sAction)

+ 1 - 1
studio/classes/BxDolStudioBuilderPageQuery.php

@@ -475,7 +475,7 @@ class BxDolStudioBuilderPageQuery extends BxDolStudioPageQuery
 
     function resetBlocksByPage($sObject, $iCellId, $bDeactivate = false)
     {
-        $aSetClause = array('cell_id' => $iCellId);
+        $aSetClause = array('cell_id' => 0);
         if($bDeactivate)
             $aSetClause['active'] = 0;
 

+ 26 - 18
studio/template/scripts/BxBaseStudioBuilderPage.php

@@ -163,22 +163,26 @@ class BxBaseStudioBuilderPage extends BxDolStudioBuilderPage
         $sContent = "";
         if(($bPage = $this->sPage != '') === true) {
             /**
-             * Reset and deactivate blocks which cannot be seen, 
+             * Reset (move to hidden sell) blocks which cannot be seen, 
              * because of unsuitable cell number to currently selected layout.
              */
-            $this->oDb->resetBlocksByPage($this->aPageRebuild['object'], $this->aPageRebuild['layout_cells_number'], true);
+            $this->oDb->resetBlocksByPage($this->aPageRebuild['object'], $this->aPageRebuild['layout_cells_number']);
 
             $aTmplVars = array(
-                'page_id' => 'bx-page-' . $this->aPageRebuild['uri']
+                'page_id' => 'bx-page-' . $this->aPageRebuild['uri'],
+                'bx_if:show_layout_row_dump' => array(
+                    'condition' => true,
+                    'content' => array()
+                )
             );
-            for($i = 1; $i <= $this->aPageRebuild['layout_cells_number']; $i++) {
+            for($i = 0; $i <= $this->aPageRebuild['layout_cells_number']; $i++) {
                 $aBlocks = array();
                 $this->oDb->getBlocks(array('type' => 'by_object_cell', 'object' => $this->aPageRebuild['object'], 'cell' => $i), $aBlocks, false);
 
                 $aTmplVarsCell = array('id' => $i, 'bx_repeat:blocks' => array());
                 foreach($aBlocks as $aBlock) {
-                	$sTitle = !empty($aBlock['title_system']) ? _t($aBlock['title_system']) : $oPage->getBlockTitle($aBlock);
-                	list($sIcon, $sIconUrl) = $this->getBlockIcon($aBlock);
+                    $sTitle = !empty($aBlock['title_system']) ? _t($aBlock['title_system']) : $oPage->getBlockTitle($aBlock);
+                    list($sIcon, $sIconUrl) = $this->getBlockIcon($aBlock);
 
                     $aTmplVarsCell['bx_repeat:blocks'][] = array(
                         'html_id' => $this->aHtmlIds['block_id'] . $aBlock['id'],
@@ -198,13 +202,13 @@ class BxBaseStudioBuilderPage extends BxDolStudioBuilderPage
                             'content' => array()
                         ),
                         'bx_if:image' => array (
-			                'condition' => (bool)$sIconUrl,
-			                'content' => array('icon_url' => $sIconUrl),
-			            ),
-						'bx_if:icon' => array (
-			                'condition' => (bool)$sIcon,
-			                'content' => array('icon' => $sIcon),
-			            ),
+                            'condition' => (bool)$sIconUrl,
+                            'content' => array('icon_url' => $sIconUrl),
+                        ),
+                        'bx_if:icon' => array (
+                            'condition' => (bool)$sIcon,
+                            'content' => array('icon' => $sIcon),
+                        ),
                         'module' => $this->getModuleTitle($aBlock['module']),
                         'visible_for' => _t('_adm_bp_txt_visible_for', BxDolStudioUtils::getVisibilityTitle($aBlock['visible_for_levels'])),
                         'bx_if:show_checkbox' => array(
@@ -218,7 +222,11 @@ class BxBaseStudioBuilderPage extends BxDolStudioBuilderPage
                     );
                 }
 
-                $aTmplVars['cell_' . $i] = $oTemplate->parseHtmlByName('bp_cell.html', $aTmplVarsCell);
+                $sCell = $oTemplate->parseHtmlByName('bp_cell.html', $aTmplVarsCell);
+                if($i == 0)
+                    $aTmplVars['bx_if:show_layout_row_dump']['content']['cell_' . $i] = $sCell;
+                else
+                    $aTmplVars['cell_' . $i] = $sCell;
             }
 
             $sContent = $oTemplate->parseHtmlByName($this->aPageRebuild['layout_template'], $aTmplVars);
@@ -235,13 +243,13 @@ class BxBaseStudioBuilderPage extends BxDolStudioBuilderPage
             'html_ids' => json_encode($this->aHtmlIds),
             'languahes' => json_encode($aLanguages),
             'content' => $this->getBlockCode(array(
-				'items' => $sContent
-			))
+                'items' => $sContent
+            ))
         );
 
         $oTemplate->addJsTranslation(array(
-        	'_adm_bp_wrn_page_delete',
-        	'_adm_bp_wrn_page_block_delete'
+            '_adm_bp_wrn_page_delete',
+            '_adm_bp_wrn_page_block_delete'
         ));
         return $oTemplate->parseHtmlByName('builder_page.html', $aTmplVars);
     }

+ 9 - 0
template/_row_1_column_dump.html

@@ -0,0 +1,9 @@
+<bx_if:show_layout_row_dump>
+    <div class="bx-layout-row bx-lr-dump bx-clearfix">
+        <div class="bx-layout-col bx-layout-1-column-column1 bx-layout-column-fullwidth">
+            <div class="bx-layout-cell" id="bx-layout-cell-0">
+                __cell_0__
+            </div>
+        </div>
+    </div>
+</bx_if:show_layout_row_dump>

+ 12 - 6
template/css/page_layouts.css

@@ -1,18 +1,24 @@
 
 /* common styles */
+.bx-layout-row.bx-lr-dump {
+    display: block;
+}
+.bx-layout-row.bx-lr-dump .adm-bp-cell.bx-def-border {
+    border-style: dashed;
+}
 
 .bx-layout-col {
     float:left;
 }
 
-/* layout 1 column */
 
+/* layout 1 column */
 .bx-layout-1-column-column1 {
     float:none;
 }
 
-/* layout 3 columns */
 
+/* layout 3 columns */
 .bx-layout-3-columns-column3,
 .bx-layout-3-columns-column1 {
     width:33.3%;
@@ -21,8 +27,8 @@
     width:33.4%;
 }
 
-/* layout bar content bar */
 
+/* layout bar content bar */
 .bx-layout-bcb-bar1,
 .bx-layout-bcb-bar2 {
     width:25.0%;
@@ -31,15 +37,15 @@
     width:50.0%;
 }
 
-/* layout 2 columns */
 
+/* layout 2 columns */
 .bx-layout-2-columns-column1,
 .bx-layout-2-columns-column2 {
     width:50%;
 }
 
-/* layout bar left */
 
+/* layout bar left */
 .bx-layout-bar-left-bar {
     width:34%;
 }
@@ -48,8 +54,8 @@
     width:66%;
 }
 
-/* layout bar right */
 
+/* layout bar right */
 .bx-layout-bar-right-bar {
     width:34%;
 }

+ 2 - 1
template/layout_1_column.html

@@ -1,5 +1,6 @@
 <!-- layout 1 column [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-1-column bx-layout-column-fullwidth">
+    <bx_include_auto:_row_1_column_dump.html />
     <bx_include_auto:_row_1_column.html />
 </div>
-<!-- layout 1 column [  end  ] -->
+<!-- layout 1 column [  end  ] -->

+ 2 - 1
template/layout_2_columns.html

@@ -1,5 +1,6 @@
 <!-- layout 2 columns [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-2-columns">
+    <bx_include_auto:_row_1_column_dump.html />
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-2-columns-column1 bx-layout-column-half">
             <div class="bx-layout-cell bx-def-padding-sec-right" id="bx-layout-cell-1">
@@ -13,4 +14,4 @@
         </div>
     </div>
 </div>
-<!-- layout 2 columns [  end  ] -->
+<!-- layout 2 columns [  end  ] -->

+ 2 - 1
template/layout_3_columns.html

@@ -1,5 +1,6 @@
 <!-- layout 3 columns [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-3-columns">
+    <bx_include_auto:_row_1_column_dump.html />
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-3-columns-column1 bx-layout-column-thin">
             <div class="bx-layout-cell bx-def-padding-sec-right" id="bx-layout-cell-1">
@@ -18,4 +19,4 @@
         </div>
     </div>
 </div>
-<!-- layout 3 columns [  end  ] -->
+<!-- layout 3 columns [  end  ] -->

+ 2 - 1
template/layout_bar_content_bar.html

@@ -1,5 +1,6 @@
 <!-- layout bar content bar (bcb) [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-bcb">
+    <bx_include_auto:_row_1_column_dump.html />
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-bcb-bar1 bx-layout-column-thin">
             <div class="bx-layout-cell bx-def-padding-sec-right" id="bx-layout-cell-1">
@@ -18,4 +19,4 @@
         </div>
     </div>
 </div>
-<!-- layout bar content bar (bcb) [  end  ] -->
+<!-- layout bar content bar (bcb) [  end  ] -->

+ 2 - 1
template/layout_bar_left.html

@@ -1,5 +1,6 @@
 <!-- layout bar left [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-bar-left">
+    <bx_include_auto:_row_1_column_dump.html />
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-bar-left-bar bx-layout-column-thin">
             <div class="bx-layout-cell bx-def-padding-sec-right" id="bx-layout-cell-1">
@@ -13,4 +14,4 @@
         </div>
     </div>
 </div>
-<!-- layout bar left [  end  ] -->
+<!-- layout bar left [  end  ] -->

+ 2 - 1
template/layout_bar_right.html

@@ -1,5 +1,6 @@
 <!-- layout bar right [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-bar-right">
+    <bx_include_auto:_row_1_column_dump.html />
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-bar-right-content bx-layout-column-wide">
             <div class="bx-layout-cell bx-def-padding-sec-right" id="bx-layout-cell-1">
@@ -13,4 +14,4 @@
         </div>
     </div>
 </div>
-<!-- layout bar right [  end  ] -->
+<!-- layout bar right [  end  ] -->

+ 2 - 6
template/layout_bottom_area_2_columns.html

@@ -1,6 +1,6 @@
 <!-- layout top area 2 columns [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-top-area-2-columns">
-
+    <bx_include_auto:_row_1_column_dump.html />
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-2-columns-column1 bx-layout-column-half">
             <div class="bx-layout-cell bx-def-padding-sec-right" id="bx-layout-cell-2">
@@ -13,11 +13,7 @@
             </div>
         </div>
     </div>
-
     <bx_include_auto:_row_1_column.html />
-
 </div>
-
 <bx_include_auto:_layout_align_columns.html />
-
-<!-- layout top area 2 columns [  end  ] -->
+<!-- layout top area 2 columns [  end  ] -->

+ 2 - 4
template/layout_top_area_2_columns.html

@@ -1,8 +1,7 @@
 <!-- layout top area 2 columns [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-top-area-2-columns">
-
+    <bx_include_auto:_row_1_column_dump.html />
     <bx_include_auto:_row_1_column.html />
-
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-2-columns-column1 bx-layout-column-half">
             <div class="bx-layout-cell bx-def-padding-sec-right" id="bx-layout-cell-2">
@@ -15,6 +14,5 @@
             </div>
         </div>
     </div>
-
 </div>
-<!-- layout top area 2 columns [  end  ] -->
+<!-- layout top area 2 columns [  end  ] -->

+ 2 - 4
template/layout_top_area_3_columns.html

@@ -1,8 +1,7 @@
 <!-- layout top area 3 columns [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-top-area-3-columns">
-
+    <bx_include_auto:_row_1_column_dump.html />
     <bx_include_auto:_row_1_column.html />
-
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-3-columns-column1 bx-layout-column-thin">
             <div class="bx-layout-cell bx-def-padding-sec-right" id="bx-layout-cell-2">
@@ -20,6 +19,5 @@
             </div>
         </div>
     </div>
-
 </div>
-<!-- layout top area 3 columns [  end  ] -->
+<!-- layout top area 3 columns [  end  ] -->

+ 2 - 1
template/layout_top_area_bar_content_bar.html

@@ -1,5 +1,6 @@
 <!-- layout top area bar content bar (bcb) [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-top-area-bcb">
+    <bx_include_auto:_row_1_column_dump.html />
     <bx_include_auto:_row_1_column.html />
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-bcb-bar1 bx-layout-column-thin">
@@ -19,4 +20,4 @@
         </div>
     </div>
 </div>
-<!-- layout top area bar content bar (bcb) [  end  ] -->
+<!-- layout top area bar content bar (bcb) [  end  ] -->

+ 2 - 4
template/layout_top_area_bar_left.html

@@ -1,8 +1,7 @@
 <!-- layout top area bar left [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-top-area-bar-left">
-
+    <bx_include_auto:_row_1_column_dump.html />
     <bx_include_auto:_row_1_column.html />
-
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-bar-left-bar bx-layout-column-thin">
             <div class="bx-layout-cell bx-def-padding-sec-right" id="bx-layout-cell-2">
@@ -15,6 +14,5 @@
             </div>
         </div>
     </div>
-
 </div>
-<!-- layout top area bar left [  end  ] -->
+<!-- layout top area bar left [  end  ] -->

+ 2 - 4
template/layout_top_area_bar_right.html

@@ -1,8 +1,7 @@
 <!-- layout top area bar right [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-top-area-bar-right">
-
+    <bx_include_auto:_row_1_column_dump.html />
     <bx_include_auto:_row_1_column.html />
-
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-bar-right-content bx-layout-column-wide">
             <div class="bx-layout-cell bx-def-padding-sec-right" id="bx-layout-cell-2">
@@ -15,6 +14,5 @@
             </div>
         </div>
     </div>
-
 </div>
-<!-- layout top area bar right [  end  ] -->
+<!-- layout top area bar right [  end  ] -->

+ 2 - 7
template/layout_topbottom_area_2_columns.html

@@ -1,8 +1,7 @@
 <!-- layout top area 2 columns [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-top-area-2-columns">
-
+    <bx_include_auto:_row_1_column_dump.html />
     <bx_include_auto:_row_1_column.html />
-
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-2-columns-column1 bx-layout-column-half">
             <div class="bx-layout-cell bx-def-padding-sec-right" id="bx-layout-cell-2">
@@ -15,7 +14,6 @@
             </div>
         </div>
     </div>
-
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-1-column-column1 bx-layout-column-fullwidth">
             <div class="bx-layout-cell" id="bx-layout-cell-4">
@@ -23,9 +21,6 @@
             </div>
         </div>
     </div>
-
 </div>
-
 <bx_include_auto:_layout_align_columns.html />
-
-<!-- layout top area 2 columns [  end  ] -->
+<!-- layout top area 2 columns [  end  ] -->

+ 2 - 7
template/layout_topbottom_area_bar_left.html

@@ -1,8 +1,7 @@
 <!-- layout top & bottom areas bar left [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-topbottom-area-bar-left">
-
+    <bx_include_auto:_row_1_column_dump.html />
     <bx_include_auto:_row_1_column.html />
-
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-bar-left-bar bx-layout-column-thin">
             <div class="bx-layout-cell bx-def-padding-sec-right" id="bx-layout-cell-2">
@@ -15,7 +14,6 @@
             </div>
         </div>
     </div>
-
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-1-column-column1 bx-layout-column-fullwidth">
             <div class="bx-layout-cell" id="bx-layout-cell-4">
@@ -23,9 +21,6 @@
             </div>
         </div>
     </div>
-
 </div>
-
 <bx_include_auto:_layout_align_columns.html />
-
-<!-- layout top area 2 columns [  end  ] -->
+<!-- layout top area 2 columns [  end  ] -->

+ 2 - 7
template/layout_topbottom_area_bar_right.html

@@ -1,8 +1,7 @@
 <!-- layout top & bottom areas bar right [ start ] -->
 <div id="__page_id__" class="bx-layout-wrapper bx-layout-topbottom-area-bar-right">
-
+    <bx_include_auto:_row_1_column_dump.html />
     <bx_include_auto:_row_1_column.html />
-
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-bar-right-content bx-layout-column-wide">
             <div class="bx-layout-cell bx-def-padding-sec-right" id="bx-layout-cell-2">
@@ -15,7 +14,6 @@
             </div>
         </div>
     </div>
-
     <div class="bx-layout-row bx-clearfix">
         <div class="bx-layout-col bx-layout-1-column-column1 bx-layout-column-fullwidth">
             <div class="bx-layout-cell" id="bx-layout-cell-4">
@@ -23,9 +21,6 @@
             </div>
         </div>
     </div>
-
 </div>
-
 <bx_include_auto:_layout_align_columns.html />
-
-<!-- layout top area 2 columns [  end  ] -->
+<!-- layout top area 2 columns [  end  ] -->

+ 4 - 0
template/scripts/BxBasePage.php

@@ -299,6 +299,10 @@ class BxBasePage extends BxDolPage
 
         $aVars = array (
             'page_id' => 'bx-page-' . $this->_aObject['uri'],
+            'bx_if:show_layout_row_dump' => array(
+                'condition' => false,
+                'content' => array()
+            )
         );
         $aBlocks = $this->_oQuery->getPageBlocks();
         foreach ($aBlocks as $sKey => $aCell) {