Parcourir la source

#87 - metatags refactoring, adding keywords support in Persons and Orgs modules

Alex Trofimov il y a 12 ans
Parent
commit
705ff35656
26 fichiers modifiés avec 221 ajouts et 77 suppressions
  1. 57 0
      inc/classes/BxDolMetatags.php
  2. 65 0
      modules/base/general/classes/BxBaseModGeneralFormEntry.php
  3. 25 4
      modules/base/general/classes/BxBaseModGeneralFormsEntryHelper.php
  4. 16 0
      modules/base/general/classes/BxBaseModGeneralTemplate.php
  5. 0 0
      modules/base/general/template/entry-location.html
  6. 0 34
      modules/base/text/classes/BxBaseModTextFormEntry.php
  7. 0 13
      modules/base/text/classes/BxBaseModTextFormsEntryHelper.php
  8. 8 18
      modules/base/text/classes/BxBaseModTextTemplate.php
  9. 0 1
      modules/base/text/template/entry-text.html
  10. 1 0
      modules/boonex/albums/classes/BxAlbumsConfig.php
  11. 1 1
      modules/boonex/albums/template/entry-location.html
  12. 5 1
      modules/boonex/albums/template/entry-text.html
  13. 2 0
      modules/boonex/organizations/classes/BxOrgsConfig.php
  14. 1 0
      modules/boonex/organizations/classes/BxOrgsSearchResult.php
  15. 4 1
      modules/boonex/organizations/install/sql/disable.sql
  16. 4 0
      modules/boonex/organizations/install/sql/enable.sql
  17. 8 0
      modules/boonex/organizations/install/sql/install.sql
  18. 1 1
      modules/boonex/organizations/install/sql/uninstall.sql
  19. 2 0
      modules/boonex/persons/classes/BxPersonsConfig.php
  20. 1 0
      modules/boonex/persons/classes/BxPersonsSearchResult.php
  21. 4 1
      modules/boonex/persons/install/sql/disable.sql
  22. 4 0
      modules/boonex/persons/install/sql/enable.sql
  23. 9 0
      modules/boonex/persons/install/sql/install.sql
  24. 1 1
      modules/boonex/persons/install/sql/uninstall.sql
  25. 1 0
      modules/boonex/posts/classes/BxPostsConfig.php
  26. 1 1
      modules/boonex/posts/template/entry-location.html

+ 57 - 0
inc/classes/BxDolMetatags.php

@@ -47,6 +47,10 @@ define('BX_METATAGS_KEYWORDS_MAX', 9);
  * - override_class_name: class name to override  
  * - override_class_file: class file path to override
  *
+ * To simplify operations with metatags in modules which are derived from some 'base' modules, specify it in module config class in 'CNF' array: 
+ * - FIELDS_WITH_KEYWORDS: array or comma separated list of field names with keywords support, or 'auto' to automatically use all 'textarea' fields
+ * - OBJECT_METATAGS: metatags object name
+ *
  *
  *
  * @section metatags_locations Location
@@ -97,6 +101,8 @@ define('BX_METATAGS_KEYWORDS_MAX', 9);
  *
  * Upon page display call BxDolMetatags::metaAdd to add keywords (and all other, including content image) meta information to the page header.
  *
+ * To be able to search by tags metatgs object must be specified in *SearchResult class as 'object_metatags' in 'aCurrent' array.
+ *
  *
  *
  * @section metatags_mention @mention
@@ -210,6 +216,49 @@ class BxDolMetatags extends BxDol implements iBxDolFactoryObject
         return $this->_oQuery->keywordsAdd($iId, array_slice($a[0], 0, BX_METATAGS_KEYWORDS_MAX));
     }
 
+    /**
+     * Add #keywords from the content fields
+     * @param $iId content id
+     * @param $s string with #keywords
+     * @return number of found keywords
+     */
+    public function keywordsAddAuto($iId, $aContentInfo, $CNF, $sFormDisplay) 
+    {
+        $aFields = $this->keywordsFields($aContentInfo, $CNF, $sFormDisplay); 
+        $sTextWithKeywords = '';
+        foreach ($aFields as $sField)
+            $sTextWithKeywords .= $aContentInfo[$sField];
+
+        return $this->keywordsAdd($iId, $sTextWithKeywords);
+    }
+
+    /**
+     * Get field names which are subject to parse keywords
+     */
+    public function keywordsFields($aContentInfo, $CNF, $sFormDisplay)
+    {
+        $aFields = array();
+        if (empty($CNF['FIELDS_WITH_KEYWORDS'])) {
+            return array();
+        }
+        elseif (is_string($CNF['FIELDS_WITH_KEYWORDS']) && 'auto' == $CNF['FIELDS_WITH_KEYWORDS']) {
+            if (!($oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $sFormDisplay)))
+                return array();
+
+            foreach ($oForm->aInputs as $k => $a)
+                if ('textarea' == $a['type'])
+                    $aFields[] = $a['name'];
+        } 
+        elseif (is_array($CNF['FIELDS_WITH_KEYWORDS'])) {
+            $aFields = $CNF['FIELDS_WITH_KEYWORDS'];
+        } 
+        elseif (is_string($CNF['FIELDS_WITH_KEYWORDS'])) {
+            $aFields = explode(',', $CNF['FIELDS_WITH_KEYWORDS']);
+        }
+
+        return $aFields;
+    }
+
     /**
      * Add links to the #keywords in the string
      * @param $iId content id
@@ -264,6 +313,7 @@ class BxDolMetatags extends BxDol implements iBxDolFactoryObject
             'type' => 'INNER',
             'table' => $this->_aObject['table_keywords'],
             'mainField' => $oSearchResult->aCurrent['ident'],
+            'mainTable' => !empty($oSearchResult->aCurrent['tableSearch']) ? $oSearchResult->aCurrent['tableSearch'] : $oSearchResult->aCurrent['table'],
             'onField' => 'object_id',
             'joinFields' => array(),
         );
@@ -299,6 +349,9 @@ class BxDolMetatags extends BxDol implements iBxDolFactoryObject
      */
     public function locationsAddFromForm($iId, $sPrefix = '', $oForm = null)
     {
+        if (empty($this->_aObject['table_locations']))
+            return;
+
         if ($sPrefix)
             $sPrefix .= '_';
         if (!$oForm)
@@ -364,6 +417,7 @@ class BxDolMetatags extends BxDol implements iBxDolFactoryObject
             'type' => 'INNER',
             'table' => $this->_aObject['table_locations'],
             'mainField' => $oSearchResult->aCurrent['ident'],
+            'mainTable' => !empty($oSearchResult->aCurrent['tableSearch']) ? $oSearchResult->aCurrent['tableSearch'] : $oSearchResult->aCurrent['table'],
             'onField' => 'object_id',
             'joinFields' => array(),
         );
@@ -377,6 +431,9 @@ class BxDolMetatags extends BxDol implements iBxDolFactoryObject
      */
     public function locationGet($iId, $sPrefix = '')
     {
+        if (empty($this->_aObject['table_locations']))
+            return array();
+
         $a = $this->_oQuery->locationGet($iId);
         if (!$sPrefix)
             return $a;

+ 65 - 0
modules/base/general/classes/BxBaseModGeneralFormEntry.php

@@ -20,6 +20,10 @@ class BxBaseModGeneralFormEntry extends BxTemplFormView
 
     protected $_oModule;
 
+    protected $_aMetatagsFieldsWithKeywords = array();
+    protected $_oMetatagsObject = null;
+    protected $_oMetatagsContentId = 0;
+
     public function __construct($aInfo, $oTemplate = false)
     {
         parent::__construct($aInfo, $oTemplate);
@@ -53,6 +57,50 @@ class BxBaseModGeneralFormEntry extends BxTemplFormView
         return parent::update ($iContentId, $aValsToAdd, $aTrackTextFieldsChanges);
     }
 
+    function delete ($iContentId, $aContentInfo = array())
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        // delete associated files
+
+        if (!empty($CNF['OBJECT_STORAGE'])) {
+            bx_import('BxDolStorage');
+            $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
+            if ($oStorage)
+                $oStorage->queueFilesForDeletionFromGhosts($aContentInfo[$CNF['FIELD_AUTHOR']], $iContentId);
+        }
+
+        // delete associated objects data
+
+        if (!empty($CNF['OBJECT_VIEWS'])) {
+            bx_import('BxDolView');
+            $o = BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $iContentId);
+            if ($o) $o->onObjectDelete();
+        }
+
+        if (!empty($CNF['OBJECT_VOTES'])) {
+            bx_import('BxDolVote');
+            $o = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES'], $iContentId);
+            if ($o) $o->onObjectDelete();
+        }
+
+        if (!empty($CNF['OBJECT_COMMENTS'])) {
+            bx_import('BxDolCmts');
+            $o = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS'], $iContentId);
+            if ($o) $o->onObjectDelete();
+        }
+
+        if (!empty($CNF['OBJECT_METATAGS'])) {
+            bx_import('BxDolMetatags');
+            $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
+            $oMetatags->onDeleteContent($iContentId);
+        }
+
+        // delete db record
+
+        return parent::delete($iContentId);
+    }
+
     protected function genCustomInputLocation ($aInput) 
     {
         $sProto = (0 == strncmp('https', BX_DOL_URL_ROOT, 5)) ? 'https' : 'http';
@@ -98,6 +146,23 @@ class BxBaseModGeneralFormEntry extends BxTemplFormView
         return parent::addCssJs ();
     }
 
+    function genViewRowValue(&$aInput)
+    {
+        $s = parent::genViewRowValue($aInput);
+
+        if ($this->_oMetatagsObject && in_array($aInput['name'], $this->_aMetatagsFieldsWithKeywords))
+            $s = $this->_oMetatagsObject->keywordsParse($this->_oMetatagsContentId, $s);
+
+        return $s;
+    }
+
+    function setMetatagsKeywordsData($iId, $a, $o)
+    {
+        $this->_oMetatagsContentId = $iId;
+        $this->_aMetatagsFieldsWithKeywords = $a;
+        $this->_oMetatagsObject = $o;
+    }
+
 }
 
 /** @} */

+ 25 - 4
modules/base/general/classes/BxBaseModGeneralFormsEntryHelper.php

@@ -53,6 +53,13 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
                 return MsgBox(_t('_sys_txt_error_entry_creation'));
         }
 
+        if (!empty($CNF['OBJECT_METATAGS'])) {
+            bx_import('BxDolMetatags');
+            $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
+            $oMetatags->keywordsAdd($aContentInfo[$CNF['FIELD_ID']], $aContentInfo, $CNF, $CNF['OBJECT_FORM_ENTRY_DISPLAY_ADD']);
+            $oMetatags->locationsAddFromForm($aContentInfo[$CNF['FIELD_ID']], $CNF['FIELD_LOCATION_PREFIX']);
+        }
+
         $sResult = $this->onDataAddAfter ($iContentId);
         if ($sResult)
             return $sResult;
@@ -85,11 +92,11 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
         if (!$oForm)
             return MsgBox(_t('_sys_txt_error_occured'));
 
-        $aSpecificValues = array();
-        bx_import('BxDolMetatags');
+        $aSpecificValues = array();        
         if (!empty($CNF['OBJECT_METATAGS'])) {
+            bx_import('BxDolMetatags');
             $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
-            $aSpecificValues = $oMetatags->locationGet($iContentId, $CNF['FIELD_LOCATION_PREFIX']);
+            $aSpecificValues = $oMetatags->locationGet($iContentId, empty($CNF['FIELD_LOCATION_PREFIX']) ? '' : $CNF['FIELD_LOCATION_PREFIX']);
         }
         $oForm->initChecker($aContentInfo, $aSpecificValues);
 
@@ -108,6 +115,13 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
                 return MsgBox(_t('_sys_txt_error_entry_update'));
         }
 
+        if (!empty($CNF['OBJECT_METATAGS'])) { // && isset($aTrackTextFieldsChanges['changed_fields'][$CNF['FIELD_TEXT']])) { // TODO: check if aTrackTextFieldsChanges works 
+            bx_import('BxDolMetatags');
+            $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
+            $oMetatags->keywordsAddAuto($aContentInfo[$CNF['FIELD_ID']], $aContentInfo, $CNF, $sDisplay);
+            $oMetatags->locationsAddFromForm($aContentInfo[$CNF['FIELD_ID']], empty($CNF['FIELD_LOCATION_PREFIX']) ? '' : $CNF['FIELD_LOCATION_PREFIX']);
+        }
+
         $sResult = $this->onDataEditAfter ($aContentInfo[$CNF['FIELD_ID']], $aContentInfo, $aTrackTextFieldsChanges, $oProfile);
         if ($sResult)
             return $sResult;
@@ -213,11 +227,18 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
         if (!$oForm)
             return MsgBox(_t('_sys_txt_error_occured'));
 
+
+        if (!empty($CNF['OBJECT_METATAGS'])) {
+            bx_import('BxDolMetatags');
+            $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
+            $aFields = $oMetatags->keywordsFields($aContentInfo, $CNF, $CNF['OBJECT_FORM_ENTRY_DISPLAY_VIEW']);
+            $oForm->setMetatagsKeywordsData($iContentId, $aFields, $oMetatags);
+        }        
+
         // display profile
         $oForm->initChecker($aContentInfo);
         return $oForm->getCode();
     }
-
 }
 
 /** @} */

+ 16 - 0
modules/base/general/classes/BxBaseModGeneralTemplate.php

@@ -41,6 +41,22 @@ class BxBaseModGeneralTemplate extends BxDolModuleTemplate
 
         return !$bWrap ? $sContent : $this->_wrapInTagJsCode($sContent);
     }
+
+    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);
+    }
 }
 
 /** @} */

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


+ 0 - 34
modules/base/text/classes/BxBaseModTextFormEntry.php

@@ -108,40 +108,6 @@ class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
         return $iRet;
     }
 
-    function delete ($iContentId, $aContentInfo = array())
-    {
-        $CNF = &$this->_oModule->_oConfig->CNF;
-
-        // delete associated files
-
-        bx_import('BxDolStorage');
-        $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
-        if ($oStorage)
-            $oStorage->queueFilesForDeletionFromGhosts($aContentInfo[$CNF['FIELD_AUTHOR']], $iContentId);
-
-        // delete associated objects data
-
-        bx_import('BxDolView');
-        $o = BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $iContentId);
-        if ($o) $o->onObjectDelete();
-
-        bx_import('BxDolVote');
-        $o = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES'], $iContentId);
-        if ($o) $o->onObjectDelete();
-
-        bx_import('BxDolCmts');
-        $o = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS'], $iContentId);
-        if ($o) $o->onObjectDelete();
-
-        bx_import('BxDolMetatags');
-        $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
-        $oMetatags->onDeleteContent($iContentId);
-
-        // delete db record
-
-        return parent::delete($iContentId);
-    }
-
     function _processFiles ($mixedFileIds, $iContentId = 0, $isAssociateWithContent = false)
     {
         $CNF = &$this->_oModule->_oConfig->CNF;

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

@@ -100,12 +100,6 @@ class BxBaseModTextFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
         // change profile to 'pending' only if profile is 'active'
         if ($oProfile->isActive() && !empty($aTrackTextFieldsChanges['changed_fields']))
             $oProfile->disapprove(BX_PROFILE_ACTION_AUTO);
-        if (!empty($CNF['OBJECT_METATAGS'])) { // && isset($aTrackTextFieldsChanges['changed_fields'][$CNF['FIELD_TEXT']])) { // TODO: check if aTrackTextFieldsChanges works 
-            bx_import('BxDolMetatags');
-            $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
-            $oMetatags->keywordsAdd($aContentInfo[$CNF['FIELD_ID']], $aContentInfo[$CNF['FIELD_TEXT']]);
-            $oMetatags->locationsAddFromForm($aContentInfo[$CNF['FIELD_ID']], $CNF['FIELD_LOCATION_PREFIX']);
-        }
 
         // create an alert
         bx_import('BxDolPrivacy');
@@ -121,13 +115,6 @@ class BxBaseModTextFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
         if (!($aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId)))
             return MsgBox(_t('_sys_txt_error_occured'));
 
-        if (!empty($CNF['OBJECT_METATAGS'])) {
-            bx_import('BxDolMetatags');
-            $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
-            $oMetatags->keywordsAdd($aContentInfo[$CNF['FIELD_ID']], $aContentInfo[$CNF['FIELD_TEXT']]);
-            $oMetatags->locationsAddFromForm($aContentInfo[$CNF['FIELD_ID']], $CNF['FIELD_LOCATION_PREFIX']);
-        }
-
         // alert
         bx_import('BxDolPrivacy');
         $aParams = isset($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) ? array('privacy_view' => $aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) : array();

+ 8 - 18
modules/base/text/classes/BxBaseModTextTemplate.php

@@ -98,29 +98,19 @@ class BxBaseModTextTemplate extends BxBaseModGeneralTemplate
         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['location'] = $oMetatags->locationsString($aData[$CNF['FIELD_ID']], $aVars['text']);
+    
+            // keywords
+            $aFields = $oMetatags->keywordsFields($aData, $CNF, $CNF['OBJECT_FORM_ENTRY_DISPLAY_VIEW']);
+            foreach ($aFields as $sField)
+                $aVars[$sField] = $oMetatags->keywordsParse($aData[$CNF['FIELD_ID']], $aVars[$sField]);
+
+            // location
+            $aVars['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);

+ 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>
-    <div class="bx-base-text-entity-location bx-def-font-grayed">__location__</div>
     __text__
 </div>
 

+ 1 - 0
modules/boonex/albums/classes/BxAlbumsConfig.php

@@ -36,6 +36,7 @@ class BxAlbumsConfig extends BxBaseModTextConfig
             'FIELD_THUMB' => 'thumb',
             'FIELD_COMMENTS' => 'comments',
             'FIELD_LOCATION_PREFIX' => 'location',
+            'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
 
             // page URIs
             'URI_VIEW_ENTRY' => 'view-album',

+ 1 - 1
modules/boonex/albums/template/entry-location.html

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

+ 5 - 1
modules/boonex/albums/template/entry-text.html

@@ -1,3 +1,7 @@
 
-<bx_include_base:../modules/base/text/template/entry-text.html />
+<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>
+    <div class="bx-base-text-entity-location bx-def-font-grayed">__location__</div>
+    __text__
+</div>
 

+ 2 - 0
modules/boonex/organizations/classes/BxOrgsConfig.php

@@ -45,6 +45,7 @@ class BxOrgsConfig extends BxBaseModProfileConfig
             'FIELD_COVER' => 'cover',
             'FIELD_COVER_PREVIEW' => 'cover_preview',
             'FIELDS_QUICK_SEARCH' => array('org_name'),
+            'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
 
             // page URIs
             'URI_VIEW_ENTRY' => 'view-organization-profile',
@@ -73,6 +74,7 @@ class BxOrgsConfig extends BxBaseModProfileConfig
             'OBJECT_IMAGES_TRANSCODER_COVER' => 'bx_organizations_cover',
             'OBJECT_IMAGES_TRANSCODER_COVER_THUMB' => 'bx_organizations_cover_thumb',
             'OBJECT_VIEWS' => 'bx_organizations',
+            'OBJECT_METATAGS' => 'bx_organizations',
             'OBJECT_FORM_ENTRY' => 'bx_organization',
             'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => 'bx_organization_view',
             'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_organization_add',

+ 1 - 0
modules/boonex/organizations/classes/BxOrgsSearchResult.php

@@ -19,6 +19,7 @@ class BxOrgsSearchResult extends BxBaseModProfileSearchResult
 
         $this->aCurrent =  array(
             'name' => 'bx_organizations',
+            'object_metatags' => 'bx_organizations',
             'title' => _t('_bx_orgs_page_title_browse'),
             'table' => 'sys_profiles',
             'tableSearch' => 'bx_organizations_data',

+ 4 - 1
modules/boonex/organizations/install/sql/disable.sql

@@ -25,10 +25,13 @@ DELETE FROM `sys_acl_actions` WHERE `Module` = 'bx_organizations';
 -- VIEWS
 DELETE FROM `sys_objects_view` WHERE `Name` = 'bx_organizations';
 
+-- METATAGS
+DELETE FROM `sys_objects_metatags` WHERE `object` = 'bx_organizations';
+
 -- SEARCH
 DELETE FROM `sys_objects_search` WHERE `ObjectName` = 'bx_organizations';
 
 -- GRIDS
 DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_organizations_administration', 'bx_organizations_moderation', 'bx_organizations_common');
 DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_organizations_administration', 'bx_organizations_moderation', 'bx_organizations_common');
-DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_organizations_administration', 'bx_organizations_moderation', 'bx_organizations_common');
+DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_organizations_administration', 'bx_organizations_moderation', 'bx_organizations_common');

+ 4 - 0
modules/boonex/organizations/install/sql/enable.sql

@@ -278,6 +278,10 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
 ('bx_organizations', 'bx_organizations_views_track', '86400', '1', 'bx_organizations_data', 'id', 'views', '', '');
 
+-- METATAGS
+INSERT INTO `sys_objects_metatags` (`object`, `table_keywords`, `table_locations`, `table_mentions`, `override_class_name`, `override_class_file`) VALUES
+('bx_organizations', 'bx_organizations_meta_keywords', '', '', '', '');
+
 -- SEARCH
 INSERT INTO `sys_objects_search` (`ObjectName`, `Title`, `ClassName`, `ClassPath`) VALUES
 ('bx_organizations', '_bx_orgs', 'BxOrgsSearchResult', 'modules/boonex/organizations/classes/BxOrgsSearchResult.php');

+ 8 - 0
modules/boonex/organizations/install/sql/install.sql

@@ -56,6 +56,14 @@ CREATE TABLE `bx_organizations_views_track` (
   KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
+-- TABLE: metas
+CREATE TABLE `bx_organizations_meta_keywords` (
+  `object_id` int(10) unsigned NOT NULL,
+  `keyword` varchar(255) NOT NULL,
+  KEY `object_id` (`object_id`),
+  KEY `keyword` (`keyword`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
 -- STORAGES & TRANSCODERS
 
 INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES

+ 1 - 1
modules/boonex/organizations/install/sql/uninstall.sql

@@ -1,7 +1,7 @@
 
 -- TABLES
 
-DROP TABLE IF EXISTS `bx_organizations_data`, `bx_organizations_pics`, `bx_organizations_pics_resized`, `bx_organizations_views_track`;
+DROP TABLE IF EXISTS `bx_organizations_data`, `bx_organizations_pics`, `bx_organizations_pics_resized`, `bx_organizations_views_track`, `bx_organizations_meta_keywords`;
 
 -- PROFILES
 

+ 2 - 0
modules/boonex/persons/classes/BxPersonsConfig.php

@@ -45,6 +45,7 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'FIELD_COVER' => 'cover',
             'FIELD_COVER_PREVIEW' => 'cover_preview',
             'FIELDS_QUICK_SEARCH' => array('fullname'),
+            'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
 
             // page URIs
             'URI_VIEW_ENTRY' => 'view-persons-profile',
@@ -73,6 +74,7 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'OBJECT_IMAGES_TRANSCODER_COVER' => 'bx_persons_cover',
             'OBJECT_IMAGES_TRANSCODER_COVER_THUMB' => 'bx_persons_cover_thumb',
             'OBJECT_VIEWS' => 'bx_persons',
+            'OBJECT_METATAGS' => 'bx_persons',
             'OBJECT_FORM_ENTRY' => 'bx_person',
             'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => 'bx_person_view',
             'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_person_add',

+ 1 - 0
modules/boonex/persons/classes/BxPersonsSearchResult.php

@@ -19,6 +19,7 @@ class BxPersonsSearchResult extends BxBaseModProfileSearchResult
 
         $this->aCurrent =  array(
             'name' => 'bx_persons',
+            'object_metatags' => 'bx_persons',
             'title' => _t('_bx_persons_page_title_browse'),
             'table' => 'sys_profiles',
             'tableSearch' => 'bx_persons_data',

+ 4 - 1
modules/boonex/persons/install/sql/disable.sql

@@ -25,10 +25,13 @@ DELETE FROM `sys_acl_actions` WHERE `Module` = 'bx_persons';
 -- VIEWS
 DELETE FROM `sys_objects_view` WHERE `Name` = 'bx_persons';
 
+-- METATAGS
+DELETE FROM `sys_objects_metatags` WHERE `object` = 'bx_persons';
+
 -- SEARCH
 DELETE FROM `sys_objects_search` WHERE `ObjectName` = 'bx_persons';
 
 -- GRIDS
 DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_persons_administration', 'bx_persons_moderation', 'bx_persons_common');
 DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_persons_administration', 'bx_persons_moderation', 'bx_persons_common');
-DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_persons_administration', 'bx_persons_moderation', 'bx_persons_common');
+DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_persons_administration', 'bx_persons_moderation', 'bx_persons_common');

+ 4 - 0
modules/boonex/persons/install/sql/enable.sql

@@ -280,6 +280,10 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
 ('bx_persons', 'bx_persons_views_track', '86400', '1', 'bx_persons_data', 'id', 'views', '', '');
 
+-- METATAGS
+INSERT INTO `sys_objects_metatags` (`object`, `table_keywords`, `table_locations`, `table_mentions`, `override_class_name`, `override_class_file`) VALUES
+('bx_persons', 'bx_persons_meta_keywords', '', '', '', '');
+
 -- SEARCH
 INSERT INTO `sys_objects_search` (`ObjectName`, `Title`, `ClassName`, `ClassPath`) VALUES
 ('bx_persons', '_bx_persons', 'BxPersonsSearchResult', 'modules/boonex/persons/classes/BxPersonsSearchResult.php');

+ 9 - 0
modules/boonex/persons/install/sql/install.sql

@@ -56,6 +56,15 @@ CREATE TABLE `bx_persons_views_track` (
   KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
+-- TABLE: metas
+
+CREATE TABLE `bx_persons_meta_keywords` (
+  `object_id` int(10) unsigned NOT NULL,
+  `keyword` varchar(255) NOT NULL,
+  KEY `object_id` (`object_id`),
+  KEY `keyword` (`keyword`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
 -- STORAGES & TRANSCODERS
 
 INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES

+ 1 - 1
modules/boonex/persons/install/sql/uninstall.sql

@@ -1,7 +1,7 @@
 
 -- TABLES
 
-DROP TABLE IF EXISTS `bx_persons_data`,`bx_persons_pictures`, `bx_persons_pictures_resized`, `bx_persons_views_track`;
+DROP TABLE IF EXISTS `bx_persons_data`,`bx_persons_pictures`, `bx_persons_pictures_resized`, `bx_persons_views_track`, `bx_persons_meta_keywords`;
 
 -- PROFILES
 

+ 1 - 0
modules/boonex/posts/classes/BxPostsConfig.php

@@ -35,6 +35,7 @@ class BxPostsConfig extends BxBaseModTextConfig
             'FIELD_THUMB' => 'thumb',
             'FIELD_COMMENTS' => 'comments',
             'FIELD_LOCATION_PREFIX' => 'location',
+            'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
 
             // page URIs
             'URI_VIEW_ENTRY' => 'view-post',

+ 1 - 1
modules/boonex/posts/template/entry-location.html

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