1
0
Эх сурвалжийг харах

Merge branch 'master' of https://github.com/boonex/dolphin

AntonLV 12 жил өмнө
parent
commit
720149afb9

+ 10 - 1
inc/classes/BxDolMetatags.php

@@ -83,13 +83,22 @@ class BxDolMetatags extends BxDol implements iBxDolFactoryObject
      * Add all available meta tags to the head section 
      * @return number of successfully added metas
      */
-    public function metaAdd($iId) 
+    public function metaAdd($iId, $mixedImage = false)
     {
         $i = 0;
         foreach ($this->_aMetas as $sMeta) {
             $sFunc = $sMeta . 'AddMeta';
             $i += $this->$sFunc($iId);
         }
+
+        if ($mixedImage && is_array($mixedImage)) {
+            bx_import('BxDolStorage');
+            $oStorage = BxDolStorage::getObjectInstance($mixedImage['object']);
+            $mixedImage = $oStorage ? $oStorage->getFileUrlById($mixedImage['id']) : false;
+        }
+        if ($mixedImage) 
+            BxDolTemplate::getInstance()->addPageMetaImage($mixedImage);
+
         return $i;
     }
 

+ 16 - 4
inc/classes/BxDolTemplate.php

@@ -738,6 +738,15 @@ class BxDolTemplate extends BxDol implements iBxDolSingleton
     {
         $this->aPage['location'] = array('lat' => $fLat, 'lng' => $fLng, 'country' => $sCountryCode);
     }
+    /**
+     * Set page meta image.
+     *
+     * @param $sImageUrl meta image url
+     */
+    function addPageMetaImage($sImageUrl)
+    {
+        $this->aPage['image'] = $sImageUrl;
+    }
     /**
      * Returns page meta info, like meta keyword, meta description, location, etc
      */
@@ -757,6 +766,13 @@ class BxDolTemplate extends BxDol implements iBxDolSingleton
                 <meta name="geo.position" content="' . $this->aPage['location']['lat'] . ';' . $this->aPage['location']['lng'] . '" />
                 <meta name="geo.region" content="' . bx_html_attribute($this->aPage['location']['country']) . '" />';
 
+        if (!empty($this->aPage['image'])) {
+            $sRet .= '<meta property="og:image" content="' . $this->aPage['image'] . '" />';
+        } else {
+            bx_import('BxTemplFunctions');
+            $sRet .= BxTemplFunctions::getInstance()->getMetaIcons();
+        }
+
         return $sRet;
     }
     /**
@@ -996,10 +1012,6 @@ class BxDolTemplate extends BxDol implements iBxDolSingleton
                 if(isset($this->aPage['header_text']))
                     $sRet = bx_process_output($this->aPage['header_text']);
                 break;
-            case 'page_icons':
-                bx_import('BxTemplFunctions');
-                $sRet = BxTemplFunctions::getInstance()->getMetaIcons();
-                break;
             case 'popup_loading':
                 $sContent = $this->parsePageByName('popup_loading.html', array());
 

+ 0 - 1
install/sql/system.sql

@@ -3173,7 +3173,6 @@ CREATE TABLE `sys_objects_metatags` (
   `table_keywords` varchar(255) NOT NULL,
   `table_locations` varchar(255) NOT NULL,
   `table_mentions` varchar(255) NOT NULL,
-  `table_pictures` varchar(255) NOT NULL,
   `override_class_name` varchar(255) NOT NULL,
   `override_class_file` varchar(255) NOT NULL,
   PRIMARY KEY (`id`),

+ 10 - 2
modules/base/general/classes/BxBaseModGeneralPageEntry.php

@@ -29,28 +29,36 @@ class BxBaseModGeneralPageEntry extends BxTemplPage
 
     public function getCode ()
     {
+        // check if content exists
         if (!$this->_aContentInfo) { // if entry is not found - display standard "404 page not found" page
             $this->_oTemplate->displayPageNotFound();
             exit;
         }
 
+        // permissions check 
         if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedView($this->_aContentInfo))) {
             $this->_oTemplate->displayAccessDenied($sMsg);
             exit;
         }
         $this->_oModule->checkAllowedView($this->_aContentInfo, true);
 
+        // count views
         $CNF = &$this->_oModule->_oConfig->CNF;
         if (!empty($CNF['OBJECT_VIEWS'])) {
             bx_import('BxDolView');
             BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $this->_aContentInfo[$CNF['FIELD_ID']])->doView();
         }
 
+        // add content metatags
         if (!empty($CNF['OBJECT_METATAGS'])) {
             bx_import('BxDolMetatags');
             $o = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
-            if ($o)
-                $o->metaAdd($this->_aContentInfo[$CNF['FIELD_ID']]);
+            if ($o) {
+                $aThumb = false;
+                if (!empty($CNF['FIELD_THUMB']) && !empty($this->_aContentInfo[$CNF['FIELD_THUMB']]) && !empty($CNF['OBJECT_STORAGE']))
+                    $aThumb = array('id' => $this->_aContentInfo[$CNF['FIELD_THUMB']], 'object' => $CNF['OBJECT_STORAGE']);
+                $o->metaAdd($this->_aContentInfo[$CNF['FIELD_ID']], $aThumb);
+            }
         }
 
         return parent::getCode ();

+ 5 - 0
modules/base/text/template/css/main.css

@@ -54,6 +54,11 @@
     margin-top:0;
 }
 
+.bx-base-text-entity-content p:last-child,
+.bx-base-text-entity-content h1:last-child {
+    margin-bottom:0;
+}
+
 .bx-base-text-entity-share .bx-vote,
 .bx-base-text-entity-share .bx-tl-share,
 .bx-base-text-entity-share .bx-social-sharing {

+ 35 - 19
modules/boonex/convos/classes/BxCnvModule.php

@@ -143,35 +143,29 @@ class BxCnvModule extends BxBaseModTextModule
      */
     public function actionFolder ($iFolderId)
     {
-        // TODO: add to page builder
-        bx_import('BxDolGrid');
-        $oGrid = BxDolGrid::getObjectInstance($this->_oConfig->CNF['OBJECT_GRID']);
-        if (!$oGrid){
-            $this->_oTemplate->displayErrorOccured();
-            exit;
-        }
+        $oTemplate = BxDolTemplate::getInstance();
 
+        bx_import('BxDolPage');
         $aFolder = $this->_oDb->getFolder((int)$iFolderId);
-        if (!$aFolder) {
+        $oPage = BxDolPage::getObjectInstance('bx_convos_home');
+
+        if (!$aFolder || !$oPage) {
             $this->_oTemplate->displayPageNotFound();
             exit;
         }
 
-        $this->setModuleSubmenu ((int)$iFolderId);
-
-        // TODO: incorporate markers into custom class, so replace will work in search and so on
-        $oGrid->addMarkers(array(
+        // add replaceable markers
+        $oPage->addMarkers(array(
             'folder_id' => (int)$iFolderId,
-            'profile_id' => bx_get_logged_profile_id(),
+            'folder' => _t($aFolder['name']),
         ));
 
-        // TODO: refactor below
-        $oTemplate = BxDolTemplate::getInstance();
-        $oTemplate->setPageNameIndex (BX_PAGE_DEFAULT);
-        $oTemplate->setPageHeader (str_replace('{folder}', _t($aFolder['name']), _t('_bx_cnv_page_title_folder')));
-        $oTemplate->setPageContent ('page_main_code', $oGrid->getCode());
-        $oTemplate->getPageCode();
+        $s = $oPage->getCode();
 
+        $this->_oTemplate = BxDolTemplate::getInstance();
+        $this->_oTemplate->setPageNameIndex (BX_PAGE_DEFAULT);
+        $this->_oTemplate->setPageContent ('page_main_code', $s);
+        $this->_oTemplate->getPageCode();
     }
 
     /**
@@ -187,6 +181,28 @@ class BxCnvModule extends BxBaseModTextModule
         echo(json_encode($a));
     }
 
+    public function serviceConversationsInFolder ($iFolderId = BX_CNV_FOLDER_INBOX)
+    {
+        bx_import('BxDolGrid');
+        $oGrid = BxDolGrid::getObjectInstance($this->_oConfig->CNF['OBJECT_GRID']);
+        if (!$oGrid)
+            return false;
+
+        $aFolder = $this->_oDb->getFolder((int)$iFolderId);
+        if (!$aFolder)
+            return false;
+
+        $this->setModuleSubmenu ((int)$iFolderId);
+
+        // TODO: incorporate markers into custom class, so replace will work in search and so on
+        $oGrid->addMarkers(array(
+            'folder_id' => (int)$iFolderId,
+            'profile_id' => bx_get_logged_profile_id(),
+        ));
+
+        return $oGrid->getCode();
+    }
+
     public function serviceMessagesPreviews ($iProfileId = 0)
     {
         if (!$iProfileId)

+ 26 - 0
modules/boonex/convos/classes/BxCnvPageFolder.php

@@ -0,0 +1,26 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    Convos Convos
+ * @ingroup     DolphinModules
+ *
+ * @{
+ */
+
+bx_import('BxTemplPage');
+
+/**
+ * Display conversations in the folder
+ */
+class BxCnvPageFolder extends BxTemplPage
+{
+    public function __construct($aObject, $oTemplate = false)
+    {
+        parent::__construct($aObject, $oTemplate);
+    }
+
+}
+
+/** @} */

+ 1 - 1
modules/boonex/convos/install/sql/enable.sql

@@ -48,7 +48,7 @@ INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `lay
 ('bx_convos_home', '_bx_cnv_page_title_sys_folder', '_bx_cnv_page_title_folder', 'bx_convos', 5, 2147483647, 1, 'convos-folder', 'modules/?r=convos/folder/1', '', '', '', 0, 1, 0, 'BxCnvPageBrowse', 'modules/boonex/convos/classes/BxCnvPageBrowse.php');
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
-('bx_convos_home', 1, 'bx_convos', '_bx_cnv_page_block_title_folder', 0, 2147483647, 'service', 'a:2:{s:6:\"module\";s:9:\"bx_convos\";s:6:\"method\";s:4:\"home\";}', 0, 1, 0);
+('bx_convos_home', 1, 'bx_convos', '_bx_cnv_page_block_title_folder', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_convos";s:6:"method";s:23:"conversations_in_folder";s:6:"params";a:1:{i:0;s:11:"{folder_id}";}}', 0, 1, 0);
 
 
 -- MENU: actions menu for view entry 

+ 2 - 2
modules/boonex/posts/install/sql/enable.sql

@@ -247,6 +247,6 @@ INSERT INTO `sys_objects_search` (`ObjectName`, `Title`, `ClassName`, `ClassPath
 ('bx_posts_cmts', '_bx_posts_cmts', 'BxPostsCmtsSearchResult', 'modules/boonex/posts/classes/BxPostsCmtsSearchResult.php');
 
 -- METATAGS
-INSERT INTO `sys_objects_metatags` (`object`, `table_keywords`, `table_locations`, `table_mentions`, `table_pictures`, `override_class_name`, `override_class_file`) VALUES
-('bx_posts', 'bx_posts_meta_keywords', 'bx_posts_meta_locations', '', '', '', '');
+INSERT INTO `sys_objects_metatags` (`object`, `table_keywords`, `table_locations`, `table_mentions`, `override_class_name`, `override_class_file`) VALUES
+('bx_posts', 'bx_posts_meta_keywords', 'bx_posts_meta_locations', '', '', '');
 

+ 6 - 3
modules/boonex/posts/install/sql/install.sql

@@ -150,21 +150,24 @@ INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `ch
 ('bx_posts', 'bx_posts', 'title', '', '', 0, 'text', '_bx_posts_form_entry_input_sys_title', '_bx_posts_form_entry_input_title', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_posts_form_entry_input_title_err', 'Xss', '', 1, 0),
 ('bx_posts', 'bx_posts', 'text', '', '', 0, 'textarea', '_bx_posts_form_entry_input_sys_text', '_bx_posts_form_entry_input_text', '', 1, 0, 2, '', '', '', 'Avail', '', '_bx_posts_form_entry_input_text_err', 'XssHtml', '', 1, 0),
 ('bx_posts', 'bx_posts', 'pictures', '', '', 0, 'files', '_bx_posts_form_entry_input_sys_pictures', '_bx_posts_form_entry_input_pictures', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
-('bx_posts', 'bx_posts', 'allow_view_to', '', '', 0, 'custom', '_bx_posts_form_entry_input_sys_allow_view_to', '_bx_posts_form_entry_input_allow_view_to', '', 1, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
+('bx_posts', 'bx_posts', 'allow_view_to', '', '', 0, 'custom', '_bx_posts_form_entry_input_sys_allow_view_to', '_bx_posts_form_entry_input_allow_view_to', '', 1, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+('bx_posts', 'bx_posts', 'location', '', '', 0, 'custom', '_sys_form_input_sys_location', '_sys_form_input_location', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
 
 INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
 ('bx_posts_entry_add', 'delete_confirm', 2147483647, 0, 1),
 ('bx_posts_entry_add', 'title', 2147483647, 1, 2),
 ('bx_posts_entry_add', 'text', 2147483647, 1, 3),
 ('bx_posts_entry_add', 'pictures', 2147483647, 1, 4),
-('bx_posts_entry_add', 'allow_view_to', 2147483647, 1, 6),
+('bx_posts_entry_add', 'allow_view_to', 2147483647, 1, 5),
+('bx_posts_entry_add', 'location', 2147483647, 1, 6),
 ('bx_posts_entry_add', 'do_submit', 2147483647, 1, 7),
 
 ('bx_posts_entry_edit', 'delete_confirm', 2147483647, 0, 1),
 ('bx_posts_entry_edit', 'title', 2147483647, 1, 2),
 ('bx_posts_entry_edit', 'text', 2147483647, 1, 3),
 ('bx_posts_entry_edit', 'pictures', 2147483647, 1, 4),
-('bx_posts_entry_edit', 'allow_view_to', 2147483647, 1, 6),
+('bx_posts_entry_edit', 'allow_view_to', 2147483647, 1, 5),
+('bx_posts_entry_edit', 'location', 2147483647, 1, 6),
 ('bx_posts_entry_edit', 'do_submit', 2147483647, 1, 7),
 
 ('bx_posts_entry_view', 'delete_confirm', 2147483647, 0, 0),

+ 0 - 1
studio/template/_header.html

@@ -6,7 +6,6 @@
 
         __meta_info__
 	    __page_robots__
-	    __page_icons__
 
         <bx_include_css />
 

+ 0 - 1
template/_header.html

@@ -8,7 +8,6 @@
 
     __meta_info__
     __page_robots__
-    __page_icons__
 
     <meta http-equiv="Content-Style-Type" content="text/css" />