Просмотр исходного кода

#26 - move location info into separate block

Alex Trofimov 12 лет назад
Родитель
Сommit
fc69837e03

+ 1 - 0
inc/classes/BxDolMetatags.php

@@ -213,6 +213,7 @@ class BxDolMetatags extends BxDol implements iBxDolFactoryObject
      */
     public function locationsString($iId)
     {
+        bx_import('BxDolForm');
         bx_import('BxDolFormQuery');
         $aCountries = BxDolFormQuery::getDataItems('Country');
         $aLocation = $this->locationGet($iId);

+ 13 - 0
modules/base/text/classes/BxBaseModTextModule.php

@@ -127,6 +127,19 @@ class BxBaseModTextModule extends BxBaseModGeneralModule
         return $this->_serviceEntityForm ('viewDataEntry', $iContentId);
     }
 
+    /**
+     * Entry location info
+     */
+    public function serviceEntityLocation ($iContentId = 0)
+    {
+        if (!$iContentId)
+            $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
+        if (!$iContentId)
+            return false;
+
+        return $this->_oTemplate->entryLocation ($iContentId);
+    }
+
     /**
      * Entry comments
      */

+ 16 - 2
modules/base/text/classes/BxBaseModTextTemplate.php

@@ -98,18 +98,32 @@ class BxBaseModTextTemplate extends BxBaseModGeneralTemplate
         $aVars = $aData;
         $aVars['entry_title'] = isset($aData[$CNF['FIELD_TITLE']]) ? $aData[$CNF['FIELD_TITLE']] : '';
         $aVars['entry_text'] = $aData[$CNF['FIELD_TEXT']];
-        $aVars['entry_location'] = '';
 
         if (!empty($CNF['OBJECT_METATAGS'])) {
             bx_import('BxDolMetatags');
             $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
             $aVars['text'] = $oMetatags->keywordsParse($aData[$CNF['FIELD_ID']], $aVars['text']);
-            $aVars['entry_location'] = $oMetatags->locationsString($aData[$CNF['FIELD_ID']]);
         }
 
         return $this->parseHtmlByName($sTemplateName, $aVars);
     }
 
+    function entryLocation ($iContentId)
+    {
+        $oModule = BxDolModule::getInstance($this->MODULE);
+        $CNF = &$oModule->_oConfig->CNF;
+
+        if (empty($CNF['OBJECT_METATAGS']))
+            return '';
+
+        bx_import('BxDolMetatags');
+        $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
+        $aVars = array (
+            'location' => $oMetatags->locationsString($iContentId)
+        );
+        return $this->parseHtmlByName('entry-location.html', $aVars);
+    }
+
     function entryAuthor ($aData, $sTemplateName = 'author.html')
     {
         $oModule = BxDolModule::getInstance($this->MODULE);

+ 3 - 0
modules/base/text/template/entry-location.html

@@ -0,0 +1,3 @@
+
+<p class="bx-base-text-entity-location bx-def-font-grayed">__location__</p>
+

+ 0 - 1
modules/base/text/template/entry-text.html

@@ -1,7 +1,6 @@
 
 <div class="bx-base-text-entity-content bx-def-constraint-list bx-def-constraint-pre bx-def-constraint-object bx-def-constraint-iframe bx-def-constraint-img">
     <h1>__title__</h1>
-    <p class="bx-base-text-entity-location bx-def-font-grayed bx-def-font-middle">__entry_location__</p>
     __text__
 </div>
 

+ 1 - 0
modules/boonex/posts/install/langs/en.xml

@@ -61,6 +61,7 @@
     <string name="_bx_posts_page_block_title_entry_author"><![CDATA[Author]]></string>
     <string name="_bx_posts_page_block_title_entry_actions"><![CDATA[Actions]]></string>
     <string name="_bx_posts_page_block_title_entry_comments"><![CDATA[Comments]]></string>
+    <string name="_bx_posts_page_block_title_entry_location"><![CDATA[Location]]></string>
     <string name="_bx_posts_page_title_sys_entries_popular"><![CDATA[Popular Posts]]></string>
     <string name="_bx_posts_page_title_entries_popular"><![CDATA[Popular Posts]]></string>
     <string name="_bx_posts_page_block_title_popular_entries"><![CDATA[Popular Posts]]></string>

+ 7 - 6
modules/boonex/posts/install/sql/enable.sql

@@ -48,12 +48,13 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designb
 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_posts_view_entry', '_bx_posts_page_title_sys_view_entry', '_bx_posts_page_title_view_entry', 'bx_posts', 11, 2147483647, 1, 'view-post', '', '', '', '', 0, 1, 0, 'BxPostsPageEntry', 'modules/boonex/posts/classes/BxPostsPageEntry.php');
 
-INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
-('bx_posts_view_entry', 2, 'bx_posts', '_bx_posts_page_block_title_entry_author', 3, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:13:\"entity_author\";}', 0, 0, 0),
-('bx_posts_view_entry', 3, 'bx_posts', '_bx_posts_page_block_title_entry_actions', 3, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:14:\"entity_actions\";}', 0, 0, 0),
-('bx_posts_view_entry', 1, 'bx_posts', '_bx_posts_page_block_title_entry_text', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:17:\"entity_text_block\";}', 0, 0, 0),
-('bx_posts_view_entry', 1, 'bx_posts', '_bx_posts_page_block_title_entry_social_sharing', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:21:\"entity_social_sharing\";}', 0, 0, 1),
-('bx_posts_view_entry', 1, 'bx_posts', '_bx_posts_page_block_title_entry_comments', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:15:\"entity_comments\";}', 0, 0, 2);
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
+('bx_posts_view_entry', 3, 'bx_posts', '_bx_posts_page_block_title_entry_location', 3, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:15:\"entity_location\";}', 0, 0, 1, 0),
+('bx_posts_view_entry', 2, 'bx_posts', '_bx_posts_page_block_title_entry_author', 3, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:13:\"entity_author\";}', 0, 0, 1, 0),
+('bx_posts_view_entry', 1, 'bx_posts', '_bx_posts_page_block_title_entry_actions', 3, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:14:\"entity_actions\";}', 0, 0, 1, 0),
+('bx_posts_view_entry', 4, 'bx_posts', '_bx_posts_page_block_title_entry_text', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:17:\"entity_text_block\";}', 0, 0, 1, 0),
+('bx_posts_view_entry', 4, 'bx_posts', '_bx_posts_page_block_title_entry_social_sharing', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:21:\"entity_social_sharing\";}', 0, 0, 1, 1),
+('bx_posts_view_entry', 4, 'bx_posts', '_bx_posts_page_block_title_entry_comments', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:15:\"entity_comments\";}', 0, 0, 1, 2);
 
 
 -- PAGE: view entry comments

+ 3 - 0
modules/boonex/posts/template/entry-location.html

@@ -0,0 +1,3 @@
+
+<bx_include_base:../modules/base/text/template/entry-location.html />
+