RomanL пре 7 година
родитељ
комит
7d7b8ecc3d
25 измењених фајлова са 329 додато и 449 уклоњено
  1. 5 2
      modules/base/text/classes/BxBaseModTextConfig.php
  2. 148 1
      modules/base/text/classes/BxBaseModTextFormEntry.php
  3. 1 0
      modules/base/text/classes/BxBaseModTextFormsEntryHelper.php
  4. 26 0
      modules/base/text/classes/BxBaseModTextModule.php
  5. 5 0
      modules/base/text/template/category_list_inline.html
  6. 18 0
      modules/base/text/template/css/categories.css
  7. 27 0
      modules/base/text/template/form_categories.html
  8. 19 0
      modules/boonex/decorous/data/template/studio/scripts/BxTemplStudioFormsCategories.php
  9. 19 0
      modules/boonex/lucid/data/template/studio/scripts/BxTemplStudioFormsCategories.php
  10. 19 0
      modules/boonex/ocean/data/template/studio/scripts/BxTemplStudioFormsCategories.php
  11. 9 5
      modules/boonex/posts/classes/BxPostsConfig.php
  12. 0 45
      modules/boonex/posts/classes/BxPostsDb.php
  13. 0 128
      modules/boonex/posts/classes/BxPostsFormEntry.php
  14. 0 120
      modules/boonex/posts/classes/BxPostsGridCategories.php
  15. 0 30
      modules/boonex/posts/classes/BxPostsModule.php
  16. 4 8
      modules/boonex/posts/install/langs/en.xml
  17. 3 3
      modules/boonex/posts/install/sql/disable.sql
  18. 3 15
      modules/boonex/posts/install/sql/enable.sql
  19. 0 30
      modules/boonex/posts/install/sql/install.sql
  20. 1 1
      modules/boonex/posts/install/sql/uninstall.sql
  21. 1 5
      modules/boonex/posts/template/category_list_inline.html
  22. 1 18
      modules/boonex/posts/template/css/categories.css
  23. 1 19
      modules/boonex/posts/template/form_categories.html
  24. 0 19
      modules/boonex/posts/template/manage_item.html
  25. 19 0
      modules/boonex/protean/data/template/studio/scripts/BxTemplStudioFormsCategories.php

+ 5 - 2
modules/base/text/classes/BxBaseModTextConfig.php

@@ -48,6 +48,7 @@ class BxBaseModTextConfig extends BxBaseModGeneralConfig
             'PARAM_POLL_ENABLED' => true,
             'PARAM_POLL_ENABLED' => true,
             'PARAM_POLL_HIDDEN_RESULTS' => false,
             'PARAM_POLL_HIDDEN_RESULTS' => false,
             'PARAM_POLL_ANONYMOUS_VOTING' => true,
             'PARAM_POLL_ANONYMOUS_VOTING' => true,
+            'PARAM_MULTICAT_ENABLED' => false,
 
 
             // objects
             // objects
             'OBJECT_VOTES_POLL_ANSWERS' => $this->_sName . '_poll_answers',
             'OBJECT_VOTES_POLL_ANSWERS' => $this->_sName . '_poll_answers',
@@ -60,11 +61,13 @@ class BxBaseModTextConfig extends BxBaseModGeneralConfig
         );
         );
 
 
         $this->_aJsClasses = array(
         $this->_aJsClasses = array(
-            'poll' => $this->_sClassPrefix . 'Polls'
+            'poll' => $this->_sClassPrefix . 'Polls',
+            'categories' => $this->_sClassPrefix . 'Categories'
         );
         );
 
 
         $this->_aJsObjects = array(
         $this->_aJsObjects = array(
-            'poll' => 'o' . $this->_sClassPrefix . 'Polls'
+            'poll' => 'o' . $this->_sClassPrefix . 'Polls',
+            'categories' => 'o' . $this->_sClassPrefix . 'Categories'
         );
         );
 
 
         $sPrefix = str_replace('_', '-', $this->_sName);
         $sPrefix = str_replace('_', '-', $this->_sName);

+ 148 - 1
modules/base/text/classes/BxBaseModTextFormEntry.php

@@ -38,7 +38,15 @@ class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
             $sInclude .= $this->_oModule->_oTemplate->addJs(array('polls.js'), $bDynamicMode);
             $sInclude .= $this->_oModule->_oTemplate->addJs(array('polls.js'), $bDynamicMode);
 
 
             $sResult .= ($bDynamicMode ? $sInclude : '') . $this->_oModule->_oTemplate->getJsCode('poll');
             $sResult .= ($bDynamicMode ? $sInclude : '') . $this->_oModule->_oTemplate->getJsCode('poll');
-        }           
+        }   
+        
+        if(isset($CNF['PARAM_MULTICAT_ENABLED']) && $CNF['PARAM_MULTICAT_ENABLED'] === true) {
+            $sInclude2 = '';
+            $sInclude2 .= $this->_oModule->_oTemplate->addJs(array('categories.js'), $bDynamicMode);
+            $sInclude2 .= $this->_oModule->_oTemplate->addCss(array('categories.css'), $bDynamicMode);
+            
+            $sResult .= ($bDynamicMode ? $sInclude2 : '') . $this->_oModule->_oTemplate->getJsCode('categories');
+        }
 
 
     	return $sResult;
     	return $sResult;
     }
     }
@@ -68,6 +76,11 @@ class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
             if ($bValues)
             if ($bValues)
                 $this->aInputs[$CNF['FIELD_POLL']]['content_id'] = $aValues['id'];
                 $this->aInputs[$CNF['FIELD_POLL']]['content_id'] = $aValues['id'];
         }
         }
+        
+        if (isset($CNF['FIELD_MULTICAT']) && isset($this->aInputs[$CNF['FIELD_MULTICAT']]) && $CNF['PARAM_MULTICAT_ENABLED']) {
+            if ($bValues)
+                $this->aInputs[$CNF['FIELD_MULTICAT']]['content_id'] = $aValues['id'];
+        }
 
 
         parent::initChecker ($aValues, $aSpecificValues);
         parent::initChecker ($aValues, $aSpecificValues);
     }
     }
@@ -109,6 +122,140 @@ class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
 
 
         return true;
         return true;
     }
     }
+    
+    /**
+     * 
+     * MultiCategories related methods. 
+     * 
+     */
+    
+    protected function processMulticatBefore($sFieldName, &$aValsToAdd){
+        if (isset($this->aInputs[$sFieldName])){
+            $this->aInputs[$sFieldName]['value'] = array_unique(array_filter($this->aInputs[$sFieldName]['value'], function($sTmp){
+               return trim($sTmp);
+            }));  
+            $aValsToAdd[$sFieldName] = implode(',', $this->aInputs[$sFieldName]['value']);
+        }
+    }
+    
+    protected function processMulticatAfter($sFieldName, $iContentId){
+		$bAutoActivation = (isset($CNF['PARAM_MULTICAT_AUTO_ACTIVATION_FOR_CATEGORIES']) && getParam($CNF['PARAM_MULTICAT_AUTO_ACTIVATION_FOR_CATEGORIES']) == 'on') ? true : false;
+		$oCategories = BxDolCategories::getInstance();
+        if (isset($this->aInputs[$sFieldName])){
+            $oCategories->delete($this->_oModule->getName(), $iContentId);
+            foreach($this->aInputs[$sFieldName]['value'] as  $sValue) {
+                $oCategories->add($this->_oModule->getName(), bx_get_logged_profile_id(), $sValue, $iContentId, $bAutoActivation);
+            }
+        }
+    }
+    
+    protected function genCustomViewRowValueMulticat(&$aInput)
+    {
+		$oCategories = BxDolCategories::getInstance();
+        $aValues = $oCategories->getData(array('type' => 'by_module_and_object', 'module' => $this->_oModule->getName(), 'object_id' => (!empty($aInput['content_id']) ? (int)$aInput['content_id'] : 0 )));
+        if (count($aValues) > 0){
+            $aVars = array('bx_repeat:cats' => array());
+            foreach ($aValues as  $sValue) {
+                $aVars['bx_repeat:cats'][] = array(
+                    'url' => $oCategories->getUrl($this->_oModule->getName(), $sValue),
+                    'name' => $sValue,
+                    'bx_if:more' => array(
+                        'condition' => $sValue === end($aValues) ? false : true,
+                        'content' => array('1')
+                    ),
+                );
+            }
+            
+            if (!$aVars['bx_repeat:cats'])
+                return '';
+
+            return $this->_oModule->_oTemplate->parseHtmlByName('category_list_inline.html', $aVars);
+        }
+        return '';
+    }
+    
+    protected function genCustomInputMulticat(&$aInput)
+    {
+        $sJsObject = $this->_oModule->_oConfig->getJsObject('categories');
+		$aValuesForSelect = BxDolCategories::getInstance()->getData(array('type' => 'by_module_and_author', 'module' => $this->_oModule->getName(), 'author' => bx_get_logged_profile_id()));
+   
+        $aSelectedItems = array();        
+        if(!empty($aInput['value'])) {
+            if (!is_array($aInput['value']))
+                $aValues = BxDolCategories::getInstance()->getData(array('type' => 'by_module_and_object', 'module' => $this->_oModule->getName(), 'object_id' => (!empty($aInput['content_id']) ? (int)$aInput['content_id'] : 0 )));
+            else
+                $aValues = $aInput['value'];
+            
+            $aValues = array_filter($aValues);
+            foreach($aValues as $sValue) {
+                if (!array_key_exists($sValue, $aValuesForSelect)){
+                    $aValuesForSelect[$sValue] = array('key' => $sValue, 'value' => $sValue);
+                }
+            }
+            foreach($aValues as $sValue) {
+                $sInput = $this->genCustomInputMulticatSelect($aInput, $aValuesForSelect, $sValue);
+                $aSelectedItems[] = array('js_object' => $sJsObject, 'select_cat' => $sInput);
+            }
+        }
+        else{
+            $aSelectedItems = array();
+        } 
+        return $this->_oModule->_oTemplate->parseHtmlByName('form_categories.html', array(
+            'bx_repeat:items' => $aSelectedItems,
+            'js_object' => $sJsObject, 
+            'select_cat' => $this->genCustomInputMulticatSelect($aInput, $aValuesForSelect, -1),
+            'input_cat' => $this->genCustomInputMulticatInput($aInput),
+            'js_object' => $sJsObject,
+            'btn_add' => $this->genCustomInputMulticatButton($aInput),
+            'btn_add_new' => $this->genCustomInputMulticatButtonNew($aInput)
+        ));
+    }
+    
+    protected function genCustomInputMulticatSelect($aInput, $aValues, $mixedValue = '')
+    {
+        foreach($aValues as $sKey => $aValue) {
+            $aValues[$sKey]['value'] = _t($aValue['key']);
+        }
+        $aValues = array_merge(array('1' => array('key' => false, 'value' =>  _t('_sys_please_select'))), $aValues);
+        
+        $aInput['type'] = 'select';
+        $aInput['name'] .= '[]';
+        $aInput['value'] = $mixedValue;
+        $aInput['values'] = $aValues;
+        return $this->genInput($aInput);
+    }
+    
+    protected function genCustomInputMulticatInput($aInput)
+    {
+        $aInput['type'] = 'text';
+        $aInput['name'] .= '[]';
+        $aInput['value'] = '';
+        return $this->genInput($aInput);
+    }
+    
+    protected function genCustomInputMulticatButton($aInput)
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+        $sName = $aInput['name'];
+        $aInput['type'] = 'button';
+        $aInput['name'] .= '_add';
+        $aInput['value'] = _t($CNF['T']['txt_multicat_button_caption_add']);
+        $aInput['attrs']['class'] = 'bx-def-margin-right bx-def-margin-sec-top';
+        $aInput['attrs']['onclick'] = $this->_oModule->_oConfig->getJsObject('categories') . ".categoryAdd(this, '" . $sName . "');";
+        return $this->genInputButton($aInput);
+    }
+    
+    protected function genCustomInputMulticatButtonNew($aInput)
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+        $sName = $aInput['name'];
+        $aInput['type'] = 'button';
+        $aInput['name'] .= '_add';
+        $aInput['value'] = _t($CNF['T']['txt_multicat_button_caption_addnew']);
+        $aInput['attrs']['class'] = 'bx-def-margin-sec-top';
+        $aInput['attrs']['onclick'] = $this->_oModule->_oConfig->getJsObject('categories') . ".categoryAddNew(this, '" . $sName . "');";
+        return $this->genInputButton($aInput);
+    }
 
 
     protected function _getVideoGhostTmplVars($aContentInfo = array())
     protected function _getVideoGhostTmplVars($aContentInfo = array())
     {
     {

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

@@ -110,6 +110,7 @@ class BxBaseModTextFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
             return $sResult;
             return $sResult;
 
 
         $this->_oModule->_oDb->deletePolls(array('content_id' => $iContentId));
         $this->_oModule->_oDb->deletePolls(array('content_id' => $iContentId));
+        BxDolCategories::getInstance()->delete($this->_oModule->getName(), $iContentId);
 
 
         return '';
         return '';
     }
     }

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

@@ -273,6 +273,32 @@ class BxBaseModTextModule extends BxBaseModGeneralModule implements iBxDolConten
 
 
         return $iCount;
         return $iCount;
     }
     }
+    
+    /**
+     * Entry multicategiries block
+     */
+    public function serviceCategoriesMultiList($bDisplayEmptyCats = true)
+    {
+		$oCategories = BxDolCategories::getInstance();
+        $aCats = $oCategories->getData(array('type' => 'by_module_with_num', 'module' => $this->getName()));
+        $aVars = array('bx_repeat:cats' => array());
+        foreach ($aCats as $oCat) {
+            $sValue = $oCat['value'];
+            $iNum = $oCat['num'];
+            
+            $aVars['bx_repeat:cats'][] = array(
+                'url' => $oCategories->getUrl($this->getName(), $sValue),
+                'name' => _t($sValue),
+                'value' => $sValue,
+                'num' => $iNum,
+            );
+        }
+        
+        if (!$aVars['bx_repeat:cats'])
+            return '';
+
+        return $this->_oTemplate->parseHtmlByName('category_list.html', $aVars);
+    }
 
 
     // ====== PERMISSION METHODS
     // ====== PERMISSION METHODS
 
 

+ 5 - 0
modules/base/text/template/category_list_inline.html

@@ -0,0 +1,5 @@
+<div class="bx-category-list">
+    <bx_repeat:cats>
+        <a href="__url__">__name__</a><bx_if:more>, </bx_if:more>
+</bx_repeat:cats>
+</div>

+ 18 - 0
modules/base/text/template/css/categories.css

@@ -0,0 +1,18 @@
+.bx-form-input-category,
+.bx-form-input-category-new
+ {
+    display: -webkit-flex;
+    display: flex;
+    -webkit-align-items: center;
+    align-items: center;
+}
+.bx-form-input-category-cell.bx-fi-sc-txt {
+    -webkit-flex: 1 1 auto;
+    -ms-flex: 1 1 auto;
+    flex: 1 1 auto;
+}
+.bx-form-input-category-cell.bx-fi-sc-btn {
+    -webkit-flex: 0 0 auto;
+    -ms-flex: 0 0 auto;
+    flex: 0 0 auto;
+}

+ 27 - 0
modules/base/text/template/form_categories.html

@@ -0,0 +1,27 @@
+<div class="bx-form-input-categories">
+    <div style="display:none">
+        <div class="bx-form-input-category bx-def-padding-thd-topbottom">
+            <div class="bx-form-input-category-cell bx-fi-sc-txt">__select_cat__</div>
+            <div class="bx-form-input-category-cell bx-fi-sc-btn bx-def-padding-sec-left">
+                <a class="bx-btn" href="javascript:void(0)" onclick="javascript: __js_object__.categoryDelete(this)"><i class="sys-icon times"></i></a>
+            </div>
+        </div>
+    </div>
+    <bx_repeat:items>
+        <div class="bx-form-input-category bx-def-padding-thd-topbottom">
+            <div class="bx-form-input-category-cell bx-fi-sc-txt">__select_cat__</div>
+            <div class="bx-form-input-category-cell bx-fi-sc-btn bx-def-padding-sec-left">
+                <a class="bx-btn" href="javascript:void(0)" onclick="javascript: __js_object__.categoryDelete(this)"><i class="sys-icon times"></i></a>
+            </div>
+        </div>
+    </bx_repeat:items>
+    <div style="display:none">
+        <div class="bx-form-input-category-new bx-def-padding-thd-topbottom">
+            <div class="bx-form-input-category-cell bx-fi-sc-txt">__input_cat__</div>
+            <div class="bx-form-input-category-cell bx-fi-sc-btn bx-def-padding-sec-left">
+                <a class="bx-btn" href="javascript:void(0)" onclick="javascript: __js_object__.categoryDeleteNew(this)"><i class="sys-icon times"></i></a>
+            </div>
+        </div>
+    </div>
+    <div class="bx-form-input-category-add">__btn_add__</div><div class="bx-form-input-category-add">__btn_add_new__</div>
+    </div>

+ 19 - 0
modules/boonex/decorous/data/template/studio/scripts/BxTemplStudioFormsCategories.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudioView UNA Studio Representation classes
+ * @ingroup     UnaStudio
+ * @{
+ */
+defined('BX_DOL') or die('hack attempt');
+
+class BxTemplStudioFormsCategories extends BxBaseStudioFormsCategories
+{
+    function __construct($aOptions, $oTemplate = false)
+    {
+        parent::__construct($aOptions, $oTemplate);
+    }
+}
+/** @} */

+ 19 - 0
modules/boonex/lucid/data/template/studio/scripts/BxTemplStudioFormsCategories.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudioView UNA Studio Representation classes
+ * @ingroup     UnaStudio
+ * @{
+ */
+defined('BX_DOL') or die('hack attempt');
+
+class BxTemplStudioFormsCategories extends BxBaseStudioFormsCategories
+{
+    function __construct($aOptions, $oTemplate = false)
+    {
+        parent::__construct($aOptions, $oTemplate);
+    }
+}
+/** @} */

+ 19 - 0
modules/boonex/ocean/data/template/studio/scripts/BxTemplStudioFormsCategories.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudioView UNA Studio Representation classes
+ * @ingroup     UnaStudio
+ * @{
+ */
+defined('BX_DOL') or die('hack attempt');
+
+class BxTemplStudioFormsCategories extends BxBaseStudioFormsCategories
+{
+    function __construct($aOptions, $oTemplate = false)
+    {
+        parent::__construct($aOptions, $oTemplate);
+    }
+}
+/** @} */

+ 9 - 5
modules/boonex/posts/classes/BxPostsConfig.php

@@ -62,6 +62,10 @@ class BxPostsConfig extends BxBaseModTextConfig
             'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
             'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
             'FIELDS_DELAYED_PROCESSING' => 'videos', // can be array of fields or comma separated string of field names
             'FIELDS_DELAYED_PROCESSING' => 'videos', // can be array of fields or comma separated string of field names
 
 
+             // some params
+            'PARAM_MULTICAT_ENABLED' => true,
+            'PARAM_MULTICAT_AUTO_ACTIVATION_FOR_CATEGORIES' => 'bx_posts_auto_activation_for_categories',
+            
             // page URIs
             // page URIs
             'URI_VIEW_ENTRY' => 'view-post',
             'URI_VIEW_ENTRY' => 'view-post',
             'URI_AUTHOR_ENTRIES' => 'posts-author',
             'URI_AUTHOR_ENTRIES' => 'posts-author',
@@ -186,18 +190,18 @@ class BxPostsConfig extends BxBaseModTextConfig
                 'txt_poll_menu_view_' => '_bx_posts_txt_poll_view_',
                 'txt_poll_menu_view_' => '_bx_posts_txt_poll_view_',
                 'txt_poll_answer_vote_do_by' => '_bx_posts_txt_poll_answer_vote_do_by',
                 'txt_poll_answer_vote_do_by' => '_bx_posts_txt_poll_answer_vote_do_by',
                 'txt_poll_answer_vote_counter' => '_bx_posts_txt_poll_answer_vote_counter',
                 'txt_poll_answer_vote_counter' => '_bx_posts_txt_poll_answer_vote_counter',
-                'txt_poll_answer_vote_percent' => '_bx_posts_txt_poll_answer_vote_percent'
+                'txt_poll_answer_vote_percent' => '_bx_posts_txt_poll_answer_vote_percent',
+                'txt_multicat_button_caption_add' => '_bx_posts_form_entry_input_category_add',
+                'txt_multicat_button_caption_addnew' => '_bx_posts_form_entry_input_category_add_new',
             ),
             ),
         ));
         ));
         
         
         $this->_aJsClasses = array_merge($this->_aJsClasses, array(
         $this->_aJsClasses = array_merge($this->_aJsClasses, array(
-            'manage_tools' => 'BxPostsManageTools',
-            'categories' => 'BxPostsCategories'
+            'manage_tools' => 'BxPostsManageTools'
         ));
         ));
 
 
         $this->_aJsObjects = array_merge($this->_aJsObjects, array(
         $this->_aJsObjects = array_merge($this->_aJsObjects, array(
-            'manage_tools' => 'oBxPostsManageTools',
-            'categories' => 'oBxPostsCategories'
+            'manage_tools' => 'oBxPostsManageTools'
         ));
         ));
 
 
         $this->_aGridObjects = array(
         $this->_aGridObjects = array(

+ 0 - 45
modules/boonex/posts/classes/BxPostsDb.php

@@ -18,51 +18,6 @@ class BxPostsDb extends BxBaseModTextDb
     {
     {
         parent::__construct($oConfig);
         parent::__construct($oConfig);
     }
     }
-    
-    public function getCategories($sModule, $iProfileId = 0)
-    {
-        $sQuery = "";
-        if ($iProfileId > 0){
-            $sQuery = $this->prepare("SELECT *, `value` as `key`, `Value` as `value` FROM `sys_categories` WHERE `module` = ? AND (`author` = 0 OR `author` = ?) AND (status = 'active') ORDER BY `Value` DESC", $sModule, $iProfileId);
-        }
-        else{
-            $sQuery = $this->prepare("SELECT *, `value` as `key` FROM `sys_categories` WHERE `module` = ? AND (status = 'active') ORDER BY `Value` DESC", $sModule);
-        }
-        return $this->getAllWithKey($sQuery, 'value');
-    }
-    
-    public function getItemsNumByCategories($sValue)
-    {
-        $CNF = &$this->_oConfig->CNF;
-        $sQuery = "SELECT COUNT(*) FROM `" . $CNF['TABLE_ENTRIES'] . "` WHERE CONCAT(',', `" . $CNF['FIELD_MULTICAT'] . "`, ',') LIKE '%," . $sValue . ",%'";
-        return $this->getOne($sQuery);
-    }
-    
-    
-    public function getCategoryInfoById($iId)
-    { 
-        $sQuery = $this->prepare("SELECT * FROM `sys_categories` WHERE `id` = ?", $iId);
-        return $this->getFirstRow($sQuery);
-    }
-    
-    public function addCategory($sModule, $iProfileId, $sValue)
-    {
-        $sStatus = getParam('bx_posts_auto_activation_for_categories') == 'on' ? 'active' : 'hidden';
-        $aBindings = array(
-            'value' => $sValue,
-            'module' => $sModule,
-            'author' => $iProfileId 
-        );
-        $sQuery = "SELECT COUNT(*) FROM `sys_categories` WHERE `value` = :value AND `module` = :module AND (`author` = 0 OR `author` = :author)";
-
-        if((int)$this->getOne($sQuery, $aBindings) == 0){   
-            $aBindings['status'] = $sStatus;
-            $aBindings['added'] = time();
-            $sQuery = "INSERT INTO `sys_categories` (`value`, `module`, `status`, `added`, `author`) VALUES(:value, :module, :status, :added, :author)";
-            return $this->query($sQuery, $aBindings);
-        }
-        return false;
-    }
 }
 }
 
 
 /** @} */
 /** @} */

+ 0 - 128
modules/boonex/posts/classes/BxPostsFormEntry.php

@@ -79,20 +79,6 @@ class BxPostsFormEntry extends BxBaseModTextFormEntry
         }
         }
     }
     }
 
 
-    public function getCode($bDynamicMode = false)
-    {
-        $sJs = $this->_oModule->_oTemplate->addJs(array('categories.js'), $bDynamicMode);
-        $sJs = $this->_oModule->_oTemplate->addCss(array('categories.css'));
-        $sCode = '';
-        if($bDynamicMode)
-        	$sCode .= $sJs;
-
-		$sCode .= $this->_oModule->_oTemplate->getJsCode('categories');
-		$sCode .= parent::getCode($bDynamicMode);
-
-        return $sCode;
-    }
-    
     function initChecker ($aValues = array (), $aSpecificValues = array())
     function initChecker ($aValues = array (), $aSpecificValues = array())
     {
     {
         $CNF = &$this->_oModule->_oConfig->CNF;
         $CNF = &$this->_oModule->_oConfig->CNF;
@@ -196,120 +182,6 @@ class BxPostsFormEntry extends BxBaseModTextFormEntry
             'editor_id' => isset($CNF['FIELD_TEXT_ID']) ? $CNF['FIELD_TEXT_ID'] : ''
             'editor_id' => isset($CNF['FIELD_TEXT_ID']) ? $CNF['FIELD_TEXT_ID'] : ''
     	);
     	);
     }
     }
-    
-    protected function processMulticatBefore($sFieldName, &$aValsToAdd){
-        if (isset($this->aInputs[$sFieldName])){
-            $this->aInputs[$sFieldName]['value'] = array_unique(array_filter($this->aInputs[$sFieldName]['value'], function($sTmp){
-               return trim($sTmp);
-            }));  
-            $aValsToAdd[$sFieldName] = implode(',', $this->aInputs[$sFieldName]['value']);
-        }
-    }
-    
-    protected function processMulticatAfter($sFieldName, $iContentId){
-        if (isset($this->aInputs[$sFieldName])){
-            foreach($this->aInputs[$sFieldName]['value'] as  $sValue) {
-                $this->_oModule->_oDb->addCategory($this->_oModule->getName(), bx_get_logged_profile_id(), $sValue);
-            }
-        }
-    }
-    
-    protected function genCustomViewRowValueMulticat(&$aInput)
-    {
-        $aCats = explode(',', $aInput['value']);
-        if (count($aCats) > 0){
-            $aVars = array('bx_repeat:cats' => array());
-            foreach ($aCats as $sKey => $sValue) {
-                $aVars['bx_repeat:cats'][] = array(
-                    'url' => $this->_oModule->getCategoriesMultiUrl($sValue),
-                    'name' => $sValue,
-                    'bx_if:more' => array(
-                        'condition' => $sValue === end($aCats) ? false : true,
-                        'content' => array('1')
-                    ),
-                );
-            }
-        
-            if (!$aVars['bx_repeat:cats'])
-                return '';
-
-            return $this->_oModule->_oTemplate->parseHtmlByName('category_list_inline.html', $aVars);
-        }
-        return '';
-    }
-    
-    protected function genCustomInputMulticat(&$aInput)
-    {
-        $sJsObject = $this->_oModule->_oConfig->getJsObject('categories');
-        $aValuesList = $this->_oModule->_oDb->getCategories($this->_oModule->getName(), bx_get_logged_profile_id());
-        if(!empty($aInput['value'])) {
-            if (!is_array($aInput['value']))
-                $aValues = explode(',', $aInput['value']);
-            else
-                $aValues = $aInput['value'];
-            $aTmplVarsSubentries = array();
-            foreach($aValues as $sValue) {
-                if (!array_key_exists($sValue, $aValuesList)){
-                    $aValuesList[$sValue] = array('key' => $sValue, 'value' => $sValue);
-                }
-            }
-            foreach($aValues as $sValue) {
-                $sInput = $this->genCustomInputMulticatSelect($aInput, $aValuesList, $sValue);
-                $aTmplVarsSubentries[] = array('js_object' => $sJsObject, 'select_cat' => $sInput);
-            }
-        }
-        else{
-            $aTmplVarsSubentries = array(
-                array('js_object' => $sJsObject, 'select_cat' => $this->genCustomInputMulticatSelect($aInput, $aValuesList))
-            );
-        } 
-        return $this->_oModule->_oTemplate->parseHtmlByName('form_categories.html', array(
-            'bx_repeat:items' => $aTmplVarsSubentries,
-            'input_cat' => $this->genCustomInputMulticatInput($aInput),
-            'js_object' => $sJsObject,
-            'btn_add' => $this->genCustomInputMulticatButton($aInput),
-            'btn_add_new' => $this->genCustomInputMulticatButtonNew($aInput)
-        ));
-    }
-    
-    protected function genCustomInputMulticatSelect($aInput, $aValues, $mixedValue = '')
-    {
-        $aInput['type'] = 'select';
-        $aInput['name'] .= '[]';
-        $aInput['value'] = $mixedValue;
-        $aInput['values'] = $aValues;
-        return $this->genInput($aInput);
-    }
-    
-    protected function genCustomInputMulticatInput($aInput)
-    {
-        $aInput['type'] = 'text';
-        $aInput['name'] .= '[]';
-        $aInput['value'] = '';
-        return $this->genInput($aInput);
-    }
-    
-    protected function genCustomInputMulticatButton($aInput)
-    {
-        $sName = $aInput['name'];
-        $aInput['type'] = 'button';
-        $aInput['name'] .= '_add';
-        $aInput['value'] = _t('_bx_posts_form_entry_input_category_add');
-        $aInput['attrs']['class'] = 'bx-def-margin-right bx-def-margin-sec-top';
-        $aInput['attrs']['onclick'] = $this->_oModule->_oConfig->getJsObject('categories') . ".categoryAdd(this, '" . $sName . "');";
-        return $this->genInputButton($aInput);
-    }
-    
-    protected function genCustomInputMulticatButtonNew($aInput)
-    {
-        $sName = $aInput['name'];
-        $aInput['type'] = 'button';
-        $aInput['name'] .= '_add';
-        $aInput['value'] = _t('_bx_posts_form_entry_input_category_add_new');
-        $aInput['attrs']['class'] = 'bx-def-margin-sec-top';
-        $aInput['attrs']['onclick'] = $this->_oModule->_oConfig->getJsObject('categories') . ".categoryAddNew(this, '" . $sName . "');";
-        return $this->genInputButton($aInput);
-    }
 }
 }
 
 
 /** @} */
 /** @} */

+ 0 - 120
modules/boonex/posts/classes/BxPostsGridCategories.php

@@ -1,120 +0,0 @@
-<?php defined('BX_DOL') or die('hack attempt');
-/**
- * Copyright (c) UNA, Inc - https://una.io
- * MIT License - https://opensource.org/licenses/MIT
- *
- * @defgroup    Posts Posts
- * @ingroup     UnaModules
- * 
- * @{
- */
-
-class BxPostsGridCategories extends BxTemplGrid
-{
-    protected $MODULE;
-    protected $_oModule;
-    
-    public function __construct ($aOptions, $oTemplate = false)
-    {
-    	$this->MODULE = 'bx_posts';
-        $this->_oModule = BxDolModule::getInstance($this->MODULE);
-        parent::__construct ($aOptions, $oTemplate);
-        $this->_sDefaultSortingOrder = 'DESC';
-    }
-    
-    public function performActionAdd()
-    {
-        $sAction = 'add';
-        $oForm = BxDolForm::getObjectInstance('bx_posts_category', 'bx_posts_category_add'); 
-        if (!$oForm)
-            return '';
-        $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?' . bx_encode_url_params($_GET, array('ids', '_r'));
-        $oForm->initChecker();
-        if($oForm->isSubmittedAndValid()) {
-            $mixedResult = $oForm->insert(array('added' => time(), 'module' => $this->MODULE));
-            if(is_numeric($mixedResult))
-                $aRes = array('grid' => $this->getCode(false), 'blink' => $mixedResult);
-            else
-                $aRes = array('msg' => $mixedResult);
-            echoJson($aRes);
-        }
-        else {
-            $sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx_posts_form_category_add', _t('_bx_posts_form_category_add_title'), $this->_oModule->_oTemplate->parseHtmlByName('manage_item.html', array(
-                'form_id' => $oForm->id,
-                'form' => $oForm->getCode(true),
-                'object' => $this->_sObject,
-                'action' => $sAction
-            )));
-            echoJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => true))));
-        }
-    }
-    
-    public function performActionEdit()
-    {
-        $sAction = 'edit';
-        $aIds = bx_get('ids');
-        $iId = $aIds[0];
-        $oForm = BxDolForm::getObjectInstance('bx_posts_category', 'bx_posts_category_edit'); 
-        if (!$oForm)
-            return '';
-        $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?' . bx_encode_url_params($_GET, array('_r'));
-        $aContentInfo = array();
-        $aContentInfo = $this->_oModule->_oDb->getCategoryInfoById($iId);
-        $oForm->initChecker($aContentInfo, array());
-        if($oForm->isSubmittedAndValid()) {
-            $mixedResult = $oForm->update($iId);
-            if(is_numeric($mixedResult))
-                $aRes = array('grid' => $this->getCode(false), 'blink' => $mixedResult);
-            else
-                $aRes = array('msg' => $mixedResult);
-            echoJson($aRes);
-        }
-        else {
-            
-            $sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx_posts_form_category_edit', _t('_bx_posts_form_category_edit_title'), $this->_oModule->_oTemplate->parseHtmlByName('manage_item.html', array(
-                'form_id' => $oForm->id,
-                'form' => $oForm->getCode(true),
-                'object' => $this->_sObject,
-                'action' => $sAction
-            )));
-            echoJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))));
-        }
-    }
-
-    protected function _switcherChecked2State($isChecked)
-    {
-        return $isChecked ? 'active' : 'hidden';
-    }
-
-    protected function _switcherState2Checked($mixedState)
-    {
-        return 'active' == $mixedState ? true : false;
-    }
-    
-    protected function _getCellAuthor($mixedValue, $sKey, $aField, $aRow)
-    {
-        if ($aRow['author'] > 0){
-    	    $oProfile = BxDolProfile::getInstanceMagic($aRow['author']);
-    	    $sProfile = $oProfile->getDisplayName();
-
-            $mixedValue =  $this->_oTemplate->parseHtmlByName('account_link.html', array(
-                'href' => $oProfile->getUrl(),
-                'title' => $sProfile,
-                'content' => $sProfile,
-                'class' => 'bx-def-font-grayed'
-            ));
-        }
-        else{
-            $mixedValue = '';
-        }
-        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
-    }
-    
-   
-    protected function _getCellAdded($mixedValue, $sKey, $aField, $aRow)
-    {
-        return parent::_getCellDefault(bx_time_js($mixedValue), $sKey, $aField, $aRow);
-    }
-}
-
-/** @} */

+ 0 - 30
modules/boonex/posts/classes/BxPostsModule.php

@@ -62,36 +62,6 @@ class BxPostsModule extends BxBaseModTextModule
 
 
         return parent::serviceCheckAllowedCommentsView($iContentId, $sObjectComments);
         return parent::serviceCheckAllowedCommentsView($iContentId, $sObjectComments);
     }
     }
-    
-    public function serviceCategoriesMultiList($bDisplayEmptyCats = true)
-    {
-        $aCats = $this->_oDb->getCategories($this->getName());
-        $aVars = array('bx_repeat:cats' => array());
-        foreach ($aCats as $oCat) {
-            $sValue = $oCat['value'];
-            $iNum = $this->_oDb->getItemsNumByCategories($sValue);
-
-            if (!$bDisplayEmptyCats && !$iNum)
-                continue;
-            
-            $aVars['bx_repeat:cats'][] = array(
-                'url' => $this->getCategoriesMultiUrl($sValue),
-                'name' => $sValue,
-                'value' => $sValue,
-                'num' => $iNum,
-            );
-        }
-        
-        if (!$aVars['bx_repeat:cats'])
-            return '';
-
-        return $this->_oTemplate->parseHtmlByName('category_list.html', $aVars);
-    }
-    
-    public function getCategoriesMultiUrl ($sValue)
-    {
-        return  BX_DOL_URL_ROOT . 'searchKeyword.php?keyword=' . rawurlencode($sValue) . '&cat=multi&section=' . $this->getName();
-    }
 }
 }
 
 
 /** @} */
 /** @} */

+ 4 - 8
modules/boonex/posts/install/langs/en.xml

@@ -29,11 +29,11 @@
     <string name="_bx_posts_form_entry_input_sys_cat"><![CDATA[Category]]></string>
     <string name="_bx_posts_form_entry_input_sys_cat"><![CDATA[Category]]></string>
     <string name="_bx_posts_form_entry_input_cat"><![CDATA[Category]]></string>
     <string name="_bx_posts_form_entry_input_cat"><![CDATA[Category]]></string>
     <string name="_bx_posts_form_entry_input_cat_err"><![CDATA[Please select category]]></string>
     <string name="_bx_posts_form_entry_input_cat_err"><![CDATA[Please select category]]></string>
-    <string name="_bx_posts_form_entry_input_sys_multicat"><![CDATA[Category]]></string>
-    <string name="_bx_posts_form_entry_input_multicat"><![CDATA[Category]]></string>
+    <string name="_bx_posts_form_entry_input_sys_multicat"><![CDATA[Categories]]></string>
+    <string name="_bx_posts_form_entry_input_multicat"><![CDATA[Categories]]></string>
     <string name="_bx_posts_form_entry_input_multicat_err"><![CDATA[Please select category]]></string>
     <string name="_bx_posts_form_entry_input_multicat_err"><![CDATA[Please select category]]></string>
     <string name="_bx_posts_form_entry_input_category_add"><![CDATA[Add]]></string>
     <string name="_bx_posts_form_entry_input_category_add"><![CDATA[Add]]></string>
-    <string name="_bx_posts_form_entry_input_category_add_new"><![CDATA[Add new]]></string>
+    <string name="_bx_posts_form_entry_input_category_add_new"><![CDATA[Create own category]]></string>
     <string name="_bx_posts_form_entry_input_sys_text"><![CDATA[Text]]></string>
     <string name="_bx_posts_form_entry_input_sys_text"><![CDATA[Text]]></string>
     <string name="_bx_posts_form_entry_input_text"><![CDATA[Text]]></string>
     <string name="_bx_posts_form_entry_input_text"><![CDATA[Text]]></string>
     <string name="_bx_posts_form_entry_input_text_err"><![CDATA[Text field can't be empty]]></string>
     <string name="_bx_posts_form_entry_input_text_err"><![CDATA[Text field can't be empty]]></string>
@@ -84,8 +84,6 @@
     <string name="_bx_posts_category_form_entry_input_sys_value"><![CDATA[Value]]></string>
     <string name="_bx_posts_category_form_entry_input_sys_value"><![CDATA[Value]]></string>
     <string name="_bx_posts_category_form_entry_input_value"><![CDATA[Value]]></string>>
     <string name="_bx_posts_category_form_entry_input_value"><![CDATA[Value]]></string>>
     <string name="_bx_posts_category_form_entry_input_value_err"><![CDATA[Value is essential. Please, fill in this field]]></string>
     <string name="_bx_posts_category_form_entry_input_value_err"><![CDATA[Value is essential. Please, fill in this field]]></string>
-    <string name="_bx_posts_form_category_add_title"><![CDATA[Add category]]></string>
-    <string name="_bx_posts_form_category_edit_title"><![CDATA[Edit category]]></string>
     <string name="_bx_posts_lmi_cpt_categories"><![CDATA[Categories]]></string>
     <string name="_bx_posts_lmi_cpt_categories"><![CDATA[Categories]]></string>
 
 
   <string name="_bx_posts_acl_action_create_entry"><![CDATA[Create Post]]></string>
   <string name="_bx_posts_acl_action_create_entry"><![CDATA[Create Post]]></string>
@@ -243,9 +241,7 @@
 	<string name="_bx_posts_grid_filter_item_title_adm_hidden"><![CDATA[Hidden]]></string>
 	<string name="_bx_posts_grid_filter_item_title_adm_hidden"><![CDATA[Hidden]]></string>
 	<string name="_bx_posts_grid_column_title_adm_active"><![CDATA[Active]]></string>
 	<string name="_bx_posts_grid_column_title_adm_active"><![CDATA[Active]]></string>
     <string name="_bx_posts_grid_column_title_adm_title"><![CDATA[Title]]></string>
     <string name="_bx_posts_grid_column_title_adm_title"><![CDATA[Title]]></string>
-    <string name="_bx_posts_grid_column_title_adm_added"><![CDATA[Added]]></string>
-    <string name="_bx_posts_grid_column_title_adm_author"><![CDATA[Author]]></string>
-  <string name="_bx_posts_grid_column_title_adm_value"><![CDATA[Value]]></string>
+    <string name="_bx_posts_grid_column_title_adm_author"><![CDATA[Author]]></string>>
     <string name="_bx_posts_grid_action_title_adm_add"><![CDATA[Add]]></string>
     <string name="_bx_posts_grid_action_title_adm_add"><![CDATA[Add]]></string>
     <string name="_bx_posts_grid_action_title_adm_edit"><![CDATA[Edit]]></string>
     <string name="_bx_posts_grid_action_title_adm_edit"><![CDATA[Edit]]></string>
     <string name="_bx_posts_grid_action_title_adm_delete"><![CDATA[Delete]]></string>
     <string name="_bx_posts_grid_action_title_adm_delete"><![CDATA[Delete]]></string>

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

@@ -38,9 +38,9 @@ DELETE FROM `sys_statistics` WHERE `name` LIKE 'bx_posts%';
 DELETE FROM `sys_objects_chart` WHERE `object` LIKE 'bx_posts%';
 DELETE FROM `sys_objects_chart` WHERE `object` LIKE 'bx_posts%';
 
 
 -- GRIDS
 -- GRIDS
-DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_posts_administration', 'bx_posts_common', 'bx_posts_categories');
-DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_posts_administration', 'bx_posts_common', 'bx_posts_categories');
-DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_posts_administration', 'bx_posts_common', 'bx_posts_categories');
+DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_posts_administration', 'bx_posts_common');
+DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_posts_administration', 'bx_posts_common');
+DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_posts_administration', 'bx_posts_common');
 
 
 -- UPLOADERS
 -- UPLOADERS
 DELETE FROM `sys_objects_uploader` WHERE `object` LIKE 'bx_posts_%';
 DELETE FROM `sys_objects_uploader` WHERE `object` LIKE 'bx_posts_%';

+ 3 - 15
modules/boonex/posts/install/sql/enable.sql

@@ -430,9 +430,7 @@ INSERT INTO `sys_objects_chart` (`object`, `title`, `table`, `field_date_ts`, `f
 -- GRIDS: moderation tools
 -- GRIDS: moderation tools
 INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `field_id`, `field_order`, `field_active`, `paginate_url`, `paginate_per_page`, `paginate_simple`, `paginate_get_start`, `paginate_get_per_page`, `filter_fields`, `filter_fields_translatable`, `filter_mode`, `sorting_fields`, `sorting_fields_translatable`, `visible_for_levels`, `override_class_name`, `override_class_file`) VALUES
 INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `field_id`, `field_order`, `field_active`, `paginate_url`, `paginate_per_page`, `paginate_simple`, `paginate_get_start`, `paginate_get_per_page`, `filter_fields`, `filter_fields_translatable`, `filter_mode`, `sorting_fields`, `sorting_fields_translatable`, `visible_for_levels`, `override_class_name`, `override_class_file`) VALUES
 ('bx_posts_administration', 'Sql', 'SELECT * FROM `bx_posts_posts` WHERE 1 ', 'bx_posts_posts', 'id', 'added', 'status_admin', '', 20, NULL, 'start', '', 'title,text', '', 'like', 'reports', '', 192, 'BxPostsGridAdministration', 'modules/boonex/posts/classes/BxPostsGridAdministration.php'),
 ('bx_posts_administration', 'Sql', 'SELECT * FROM `bx_posts_posts` WHERE 1 ', 'bx_posts_posts', 'id', 'added', 'status_admin', '', 20, NULL, 'start', '', 'title,text', '', 'like', 'reports', '', 192, 'BxPostsGridAdministration', 'modules/boonex/posts/classes/BxPostsGridAdministration.php'),
-('bx_posts_common', 'Sql', 'SELECT * FROM `bx_posts_posts` WHERE 1 ', 'bx_posts_posts', 'id', 'added', 'status', '', 20, NULL, 'start', '', 'title,text', '', 'like', '', '', 2147483647, 'BxPostsGridCommon', 'modules/boonex/posts/classes/BxPostsGridCommon.php'),
-('bx_posts_categories', 'Sql', 'SELECT * FROM `sys_categories` WHERE 1 ', 'sys_categories', 'id', 'added', 'status', '', 20, NULL, 'start', '', 'value', '', 'like', '', '', 2147483647, 'BxPostsGridCategories', 'modules/boonex/posts/classes/BxPostsGridCategories.php');
-
+('bx_posts_common', 'Sql', 'SELECT * FROM `bx_posts_posts` WHERE 1 ', 'bx_posts_posts', 'id', 'added', 'status', '', 20, NULL, 'start', '', 'title,text', '', 'like', '', '', 2147483647, 'BxPostsGridCommon', 'modules/boonex/posts/classes/BxPostsGridCommon.php');
 
 
 INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
 INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
 ('bx_posts_administration', 'checkbox', '_sys_select', '2%', 0, '', '', 1),
 ('bx_posts_administration', 'checkbox', '_sys_select', '2%', 0, '', '', 1),
@@ -446,13 +444,7 @@ INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable
 ('bx_posts_common', 'switcher', '_bx_posts_grid_column_title_adm_active', '8%', 0, '', '', 2),
 ('bx_posts_common', 'switcher', '_bx_posts_grid_column_title_adm_active', '8%', 0, '', '', 2),
 ('bx_posts_common', 'title', '_bx_posts_grid_column_title_adm_title', '40%', 0, '35', '', 3),
 ('bx_posts_common', 'title', '_bx_posts_grid_column_title_adm_title', '40%', 0, '35', '', 3),
 ('bx_posts_common', 'added', '_bx_posts_grid_column_title_adm_added', '30%', 1, '25', '', 4),
 ('bx_posts_common', 'added', '_bx_posts_grid_column_title_adm_added', '30%', 1, '25', '', 4),
-('bx_posts_common', 'actions', '', '20%', 0, '', '', 5),
-('bx_posts_categories', 'checkbox', '_sys_select', '2%', 0, '', '', 1),
-('bx_posts_categories', 'switcher', '_bx_posts_grid_column_title_adm_active', '8%', 0, '', '', 2),
-('bx_posts_categories', 'value', '_bx_posts_grid_column_title_adm_value', '35%', 0, '35', '', 3),
-('bx_posts_categories', 'author', '_bx_posts_grid_column_title_adm_author', '20%', 0, '35', '', 3),
-('bx_posts_categories', 'added', '_bx_posts_grid_column_title_adm_added', '15%', 1, '25', '', 4),
-('bx_posts_categories', 'actions', '', '20%', 0, '', '', 5);
+('bx_posts_common', 'actions', '', '20%', 0, '', '', 5);
 
 
 
 
 INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon_only`, `confirm`, `order`) VALUES
 INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon_only`, `confirm`, `order`) VALUES
@@ -463,11 +455,7 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon
 ('bx_posts_common', 'bulk', 'delete', '_bx_posts_grid_action_title_adm_delete', '', 0, 1, 1),
 ('bx_posts_common', 'bulk', 'delete', '_bx_posts_grid_action_title_adm_delete', '', 0, 1, 1),
 ('bx_posts_common', 'single', 'edit', '_bx_posts_grid_action_title_adm_edit', 'pencil-alt', 1, 0, 1),
 ('bx_posts_common', 'single', 'edit', '_bx_posts_grid_action_title_adm_edit', 'pencil-alt', 1, 0, 1),
 ('bx_posts_common', 'single', 'delete', '_bx_posts_grid_action_title_adm_delete', 'remove', 1, 1, 2),
 ('bx_posts_common', 'single', 'delete', '_bx_posts_grid_action_title_adm_delete', 'remove', 1, 1, 2),
-('bx_posts_common', 'single', 'settings', '_bx_posts_grid_action_title_adm_more_actions', 'cog', 1, 0, 3),
-('bx_posts_categories', 'bulk', 'delete', '_bx_posts_grid_action_title_adm_delete', '', 0, 1, 1),
-('bx_posts_categories', 'single', 'edit', '_bx_posts_grid_action_title_adm_edit', 'pencil-alt', 1, 0, 1),
-('bx_posts_categories', 'single', 'delete', '_bx_posts_grid_action_title_adm_delete', 'remove', 1, 1, 2),
-('bx_posts_categories', 'independent', 'add', '_bx_posts_grid_action_title_adm_add', '', 0, 0, 1);
+('bx_posts_common', 'single', 'settings', '_bx_posts_grid_action_title_adm_more_actions', 'cog', 1, 0, 3);
 
 
 -- UPLOADERS
 -- UPLOADERS
 
 

+ 0 - 30
modules/boonex/posts/install/sql/install.sql

@@ -312,16 +312,6 @@ CREATE TABLE IF NOT EXISTS `bx_posts_polls_answers_votes_track` (
   KEY `vote` (`object_id`, `author_nip`)
   KEY `vote` (`object_id`, `author_nip`)
 );
 );
 
 
-CREATE TABLE IF NOT EXISTS `sys_categories` (
-  `id` int(11) NOT NULL AUTO_INCREMENT,
-  `value` varchar(100) NOT NULL,
-  `module` varchar(32) NOT NULL,
-  `status` enum ('active', 'hidden') NOT NULL DEFAULT 'active',
-  `added` int(11) NOT NULL,
-  `author` int(11) NOT NULL,
-  PRIMARY KEY (`id`)
-);
-
 -- STORAGES & TRANSCODERS
 -- STORAGES & TRANSCODERS
 SET @sStorageEngine = (SELECT `value` FROM `sys_options` WHERE `name` = 'sys_storage_default');
 SET @sStorageEngine = (SELECT `value` FROM `sys_options` WHERE `name` = 'sys_storage_default');
 
 
@@ -468,26 +458,6 @@ INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_fo
 ('bx_posts_poll_add', 'do_submit', 2147483647, 1, 4),
 ('bx_posts_poll_add', 'do_submit', 2147483647, 1, 4),
 ('bx_posts_poll_add', 'do_cancel', 2147483647, 1, 5);
 ('bx_posts_poll_add', 'do_cancel', 2147483647, 1, 5);
 
 
-
--- FORMS: category
-INSERT INTO `sys_objects_form`(`object`, `module`, `title`, `action`, `form_attrs`, `table`, `key`, `uri`, `uri_title`, `submit_name`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
-('bx_posts_category', 'bx_posts', '_bx_posts_category_form_entry', '', 'a:1:{s:7:"enctype";s:19:"multipart/form-data";}', 'sys_categories', 'id', '', '', 'a:2:{i:0;s:9:"do_submit";i:1;s:10:"do_publish";}', '', 0, 1, '', '');
-
-INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES 
-('bx_posts_category', 'bx_posts_category_add', 'bx_posts', 0, '_bx_posts_category_display_add'),
-('bx_posts_category', 'bx_posts_category_edit', 'bx_posts', 0, '_bx_posts_category_display_edit');
-
-INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES 
-('bx_posts_category', 'bx_posts', 'value', '', '', 0, 'text', '_bx_posts_category_form_entry_input_sys_value', '_bx_posts_category_form_entry_input_value', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_posts_category_form_entry_input_value_err', 'Xss', '', 1, 0),
-('bx_posts_category', 'bx_posts', 'do_submit', '_bx_posts_form_entry_input_do_submit', '', 0, 'submit', '_bx_posts_form_entry_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0);
-
-INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES 
-('bx_posts_category_add', 'value', 2147483647, 1, 1),
-('bx_posts_category_add', 'do_submit', 2147483647, 1, 2),
-('bx_posts_category_edit', 'value', 2147483647, 1, 1),
-('bx_posts_category_edit', 'do_submit', 2147483647, 1, 2);
-
-
 -- PRE-VALUES
 -- PRE-VALUES
 INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
 INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
 ('bx_posts_cats', '_bx_posts_pre_lists_cats', 'bx_posts', '0');
 ('bx_posts_cats', '_bx_posts_pre_lists_cats', 'bx_posts', '0');

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

@@ -1,6 +1,6 @@
 
 
 -- TABLES
 -- TABLES
-DROP TABLE IF EXISTS `bx_posts_posts`, `bx_posts_covers`, `bx_posts_files`, `bx_posts_photos`, `bx_posts_photos_resized`, `bx_posts_videos`, `bx_posts_videos_resized`, `bx_posts_cmts`, `bx_posts_votes`, `bx_posts_votes_track`, `bx_posts_reactions`, `bx_posts_reactions_track`, `bx_posts_views_track`, `bx_posts_meta_keywords`, `bx_posts_meta_locations`, `bx_posts_meta_mentions`, `bx_posts_reports`, `bx_posts_reports_track`, `bx_posts_favorites_track`, `bx_posts_scores`, `bx_posts_scores_track`, `bx_posts_polls`, `bx_posts_polls_answers`, `bx_posts_polls_answers_votes`, `bx_posts_polls_answers_votes_track`, `sys_categories`;
+DROP TABLE IF EXISTS `bx_posts_posts`, `bx_posts_covers`, `bx_posts_files`, `bx_posts_photos`, `bx_posts_photos_resized`, `bx_posts_videos`, `bx_posts_videos_resized`, `bx_posts_cmts`, `bx_posts_votes`, `bx_posts_votes_track`, `bx_posts_reactions`, `bx_posts_reactions_track`, `bx_posts_views_track`, `bx_posts_meta_keywords`, `bx_posts_meta_locations`, `bx_posts_meta_mentions`, `bx_posts_reports`, `bx_posts_reports_track`, `bx_posts_favorites_track`, `bx_posts_scores`, `bx_posts_scores_track`, `bx_posts_polls`, `bx_posts_polls_answers`, `bx_posts_polls_answers_votes`, `bx_posts_polls_answers_votes_track`;
 
 
 -- STORAGES & TRANSCODERS
 -- STORAGES & TRANSCODERS
 DELETE FROM `sys_objects_storage` WHERE `object` LIKE 'bx_posts_%';
 DELETE FROM `sys_objects_storage` WHERE `object` LIKE 'bx_posts_%';

+ 1 - 5
modules/boonex/posts/template/category_list_inline.html

@@ -1,5 +1 @@
-<div class="bx-category-list">
-    <bx_repeat:cats>
-        <a href="__url__">__name__</a><bx_if:more>, </bx_if:more>
-</bx_repeat:cats>
-</div>
+<bx_include_base:../modules/base/text/template/category_list_inline.html />

+ 1 - 18
modules/boonex/posts/template/css/categories.css

@@ -1,18 +1 @@
-.bx-form-input-category,
-.bx-form-input-category-new
- {
-    display: -webkit-flex;
-    display: flex;
-    -webkit-align-items: center;
-    align-items: center;
-}
-.bx-form-input-category-cell.bx-fi-sc-txt {
-    -webkit-flex: 1 1 auto;
-    -ms-flex: 1 1 auto;
-    flex: 1 1 auto;
-}
-.bx-form-input-category-cell.bx-fi-sc-btn {
-    -webkit-flex: 0 0 auto;
-    -ms-flex: 0 0 auto;
-    flex: 0 0 auto;
-}
+@import url(../../../../base/text/template/css/categories.css);

+ 1 - 19
modules/boonex/posts/template/form_categories.html

@@ -1,19 +1 @@
-<div class="bx-form-input-categories">
-    <bx_repeat:items>
-        <div class="bx-form-input-category bx-def-padding-thd-topbottom">
-            <div class="bx-form-input-category-cell bx-fi-sc-txt">__select_cat__</div>
-            <div class="bx-form-input-category-cell bx-fi-sc-btn bx-def-padding-sec-left">
-                <a class="bx-btn" href="javascript:void(0)" onclick="javascript: __js_object__.categoryDelete(this)"><i class="sys-icon times"></i></a>
-            </div>
-        </div>
-    </bx_repeat:items>
-    <div style="display:none">
-        <div class="bx-form-input-category-new bx-def-padding-thd-topbottom">
-            <div class="bx-form-input-category-cell bx-fi-sc-txt">__input_cat__</div>
-            <div class="bx-form-input-category-cell bx-fi-sc-btn bx-def-padding-sec-left">
-                <a class="bx-btn" href="javascript:void(0)" onclick="javascript: __js_object__.categoryDeleteNew(this)"><i class="sys-icon times"></i></a>
-            </div>
-        </div>
-    </div>
-    <div class="bx-form-input-category-add">__btn_add__</div><div class="bx-form-input-category-add">__btn_add_new__</div>
-</div>
+<bx_include_base:../modules/base/text/template/form_categories.html />

+ 0 - 19
modules/boonex/posts/template/manage_item.html

@@ -1,19 +0,0 @@
-<div class="bx-pgt-new-key bx-def-color-bg-block">
-    <div class="bx-pgt-new-key-cnt">
-        __form__
-        <script type="text/javascript">
-            $(document).ready(function () {
-                $("#__form_id__").ajaxForm({ 
-                    dataType: "json",
-                    beforeSubmit: function (formData, jqForm, options) {
-                        bx_loading($("#__form_id__"), true);
-                    },
-                    success: function (data) {
-                        $(".bx-popup-applied:visible").dolPopupHide();
-                        glGrids.__object__.processJson(data, '__action__');
-                    }
-                });
-            });
-        </script>
-    </div>
-</div>

+ 19 - 0
modules/boonex/protean/data/template/studio/scripts/BxTemplStudioFormsCategories.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudioView UNA Studio Representation classes
+ * @ingroup     UnaStudio
+ * @{
+ */
+defined('BX_DOL') or die('hack attempt');
+
+class BxTemplStudioFormsCategories extends BxBaseStudioFormsCategories
+{
+    function __construct($aOptions, $oTemplate = false)
+    {
+        parent::__construct($aOptions, $oTemplate);
+    }
+}
+/** @} */