Alex Trofimov 6 лет назад
Родитель
Сommit
49f441e1a7

+ 5 - 0
inc/classes/BxDolPageQuery.php

@@ -105,6 +105,11 @@ class BxDolPageQuery extends BxDolDb
         return $this->getOne($sQuery);
     }
 
+    public function getPageBlockContentPlaceholder($iId)
+    {
+        $sQuery = $this->prepare("SELECT `id`, `module`, `template` FROM `sys_pages_content_placeholders` WHERE `id` = ?", $iId);
+        return $this->getRow($sQuery);
+    }
 }
 
 /** @} */

+ 12 - 10
install/sql/system.sql

@@ -4895,19 +4895,21 @@ INSERT INTO `sys_pages_design_boxes` (`id`, `title`, `template`, `order`) VALUES
 
 
 CREATE TABLE IF NOT EXISTS `sys_pages_content_placeholders` (
-  `id` int(11) NOT NULL,
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `module` varchar(32) NOT NULL,
   `title` varchar(255) NOT NULL,
-  `order` int(11) NOT NULL
+  `template` varchar(255) NOT NULL,
+  `order` int(11) NOT NULL,
+  PRIMARY KEY (`id`)
 );
 
-INSERT INTO `sys_pages_content_placeholders` (`id`, `title`, `order`) VALUES
-(1, '_sys_page_content_ph_loading_indicator', 1),
-(2, '_sys_page_content_ph_text', 2),
-(3, '_sys_page_content_ph_image', 3),
-(100, '_sys_page_content_ph_timeline', 100),
-(110, '_sys_page_content_ph_profile_units', 110),
-(120, '_sys_page_content_ph_text_units_list', 120),
-(130, '_sys_page_content_ph_text_units_gallery', 130);
+INSERT INTO `sys_pages_content_placeholders` (`id`, `module`, `title`, `template`, `order`) VALUES
+(1, 'system', '_sys_page_content_ph_loading_indicator', 'block_async_loading_indicator.html', 1),
+(2, 'system', '_sys_page_content_ph_text', 'block_async_text.html', 2),
+(3, 'system', '_sys_page_content_ph_image', 'block_async_image.html', 3),
+(100, 'system', '_sys_page_content_ph_profile_units', 'block_async_profile_units.html', 100),
+(110, 'system', '_sys_page_content_ph_text_units_list', 'block_async_text_units_list.html', 110),
+(120, 'system', '_sys_page_content_ph_text_units_gallery', 'block_async_text_units_gallery.html', 120);
 
 
 

+ 0 - 1
modules/boonex/english/data/langs/system/en.xml

@@ -2788,7 +2788,6 @@ If it is not enabled then please consider implement this optimization, since it
     <string name="_sys_page_content_ph_loading_indicator"><![CDATA[With loading indicator]]></string>
     <string name="_sys_page_content_ph_text"><![CDATA[With text placeholder]]></string>
     <string name="_sys_page_content_ph_image"><![CDATA[With image placeholder]]></string>
-    <string name="_sys_page_content_ph_timeline"><![CDATA[With timeline placeholder]]></string>
     <string name="_sys_page_content_ph_profile_units"><![CDATA[With profile units placeholder]]></string>
     <string name="_sys_page_content_ph_text_units_list"><![CDATA[With text units list placeholder]]></string>
     <string name="_sys_page_content_ph_text_units_gallery"><![CDATA[With text units gallery placeholder]]></string>

+ 2 - 0
modules/boonex/russian/data/langs/bx_timeline/ru.xml

@@ -147,6 +147,8 @@
     <string name="_bx_timeline_page_block_title_system_manage_administration"><![CDATA[Управление всеми событями ленты]]></string>
     <string name="_bx_timeline_page_block_title_manage"><![CDATA[Управление]]></string>
 
+    <string name="_bx_timeline_page_content_ph_timeline"><![CDATA[Лента: c заполнителем в виде ленты]]></string>
+
     <!-- Menus -->
     <string name="_bx_timeline_menu_title_view"><![CDATA[Просмотр]]></string>
     <string name="_bx_timeline_menu_set_title_view"><![CDATA[Просмотр]]></string>

+ 0 - 1
modules/boonex/russian/data/langs/system/ru.xml

@@ -2739,7 +2739,6 @@
     <string name="_sys_page_content_ph_loading_indicator"><![CDATA[С индикатором загрузки]]></string>
     <string name="_sys_page_content_ph_text"><![CDATA[С заполнителем в виде текста]]></string>
     <string name="_sys_page_content_ph_image"><![CDATA[С заполнителем в виде картинки]]></string>
-    <string name="_sys_page_content_ph_timeline"><![CDATA[С заполнителем в виде ленты]]></string>
     <string name="_sys_page_content_ph_profile_units"><![CDATA[С заполнителем в виде профайлов]]></string>
     <string name="_sys_page_content_ph_text_units_list"><![CDATA[С заполнителем в виде списка текстовых блоков]]></string>
     <string name="_sys_page_content_ph_text_units_gallery"><![CDATA[С заполнителем в виде галереи текстовых блоков]]></string>

+ 2 - 0
modules/boonex/timeline/install/langs/en.xml

@@ -147,6 +147,8 @@
     <string name="_bx_timeline_page_block_title_system_manage_administration"><![CDATA[Manage All]]></string>
     <string name="_bx_timeline_page_block_title_manage"><![CDATA[Manage]]></string>
 
+    <string name="_bx_timeline_page_content_ph_timeline"><![CDATA[Timeline: with timeline placeholder]]></string>
+
     <!-- Menus -->
     <string name="_bx_timeline_menu_title_view"><![CDATA[View]]></string>
     <string name="_bx_timeline_menu_set_title_view"><![CDATA[View]]></string>

+ 5 - 0
modules/boonex/timeline/install/sql/disable.sql

@@ -1,3 +1,8 @@
+
+-- CONTENT PLACEHOLDERS
+DELETE FROM `sys_pages_content_placeholders` WHERE `module` = 'bx_timeline';
+
+
 -- PAGES & BLOCKS
 DELETE FROM `sys_objects_page` WHERE `module` = 'bx_timeline';
 DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_timeline' OR `object` IN('bx_timeline_view', 'bx_timeline_view_home', 'bx_timeline_item', 'bx_photos_item_brief');

+ 6 - 0
modules/boonex/timeline/install/sql/enable.sql

@@ -1,3 +1,9 @@
+
+-- CONTENT PLACEHOLDERS
+SET @iCPHOrder = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_pages_content_placeholders` ORDER BY `order` DESC LIMIT 1);
+INSERT INTO `sys_pages_content_placeholders` (`module`, `title`, `template`, `order`) VALUES
+('bx_timeline', '_bx_timeline_page_content_ph_timeline', 'block_async_timeline.html', @iCPHOrder + 1);
+
 -- PAGES & BLOCKS
 INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_timeline_view', '_bx_timeline_page_title_sys_view', '_bx_timeline_page_title_view', 'bx_timeline', 5, 2147483647, 1, 'timeline-view', 'page.php?i=timeline-view', '', '', '', 0, 1, 0, 'BxTimelinePageView', 'modules/boonex/timeline/classes/BxTimelinePageView.php'),

+ 0 - 0
template/block_async_100.html → modules/boonex/timeline/template/block_async_timeline.html


+ 0 - 0
template/block_async_3.html → template/block_async_image.html


+ 0 - 0
template/block_async_1.html → template/block_async_loading_indicator.html


+ 0 - 0
template/block_async_110.html → template/block_async_profile_units.html


+ 0 - 0
template/block_async_2.html → template/block_async_text.html


+ 0 - 0
template/block_async_130.html → template/block_async_text_units_gallery.html


+ 0 - 0
template/block_async_120.html → template/block_async_text_units_list.html


+ 11 - 1
template/scripts/BxBasePage.php

@@ -263,7 +263,17 @@ class BxBasePage extends BxDolPage
      */
     public function getBlockAsyncCode($aBlock, $iAsync)
     {
-        return $this->_oTemplate->parseHtmlByName('block_async_' . $iAsync . '.html', $aBlock);
+        $aContentPlaceholder = $this->_oQuery->getPageBlockContentPlaceholder($iAsync);
+        if (!$aContentPlaceholder)
+            return _t('_sys_txt_error_occured');
+        $oTemplate = $this->_oTemplate;
+        if ('system' != $aContentPlaceholder['module']) {
+            $oModule = BxDolModule::getInstance($aContentPlaceholder['module']);
+            if (!$oModule)
+                return _t('_sys_txt_error_occured');
+            $oTemplate = $oModule->_oTemplate;
+        }
+        return $oTemplate->parseHtmlByName($aContentPlaceholder['template'], $aBlock);
     }
 
     /**