Преглед на файлове

Ticket #5298 - Resources module.

AntonLV преди 10 месеца
родител
ревизия
1a2e78aaff

+ 3 - 1
modules/boonex/resources/classes/BxResourcesConfig.php

@@ -52,7 +52,7 @@ class BxResourcesConfig extends BxBaseModTextConfig
             'FIELD_TEXT_ID' => 'post-text',
             'FIELD_TEXT_ID' => 'post-text',
             'FIELD_CATEGORY' => 'cat',
             'FIELD_CATEGORY' => 'cat',
             'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
             'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
-            'FIELD_CF' => 'cf',
+            'FIELD_CF' => '',
             'FIELD_COVER' => 'covers',
             'FIELD_COVER' => 'covers',
             'FIELD_PHOTO' => '',
             'FIELD_PHOTO' => '',
             'FIELD_VIDEO' => '',
             'FIELD_VIDEO' => '',
@@ -226,6 +226,8 @@ class BxResourcesConfig extends BxBaseModTextConfig
         $this->_aHtmlIds = array_merge($this->_aHtmlIds, [
         $this->_aHtmlIds = array_merge($this->_aHtmlIds, [
             'lists' => $sPrefix . '-lists',
             'lists' => $sPrefix . '-lists',
             'list' =>  $sPrefix . '-list-',
             'list' =>  $sPrefix . '-list-',
+            'entry_popup_add' => $sPrefix . '-add-entry-popup',
+            'entry_popup_edit' => $sPrefix . '-add-entry-popup',
         ]);
         ]);
 
 
         $this->_bAttachmentsInTimeline = false;
         $this->_bAttachmentsInTimeline = false;

+ 159 - 8
modules/boonex/resources/classes/BxResourcesGridCommon.php

@@ -13,7 +13,7 @@ class BxResourcesGridCommon extends BxBaseModTextGridCommon
 {
 {
     protected $_aCategories;
     protected $_aCategories;
 
 
-    protected $_iContextPid;
+    protected $_iProfileId;
 
 
     public function __construct ($aOptions, $oTemplate = false)
     public function __construct ($aOptions, $oTemplate = false)
     {
     {
@@ -25,16 +25,119 @@ class BxResourcesGridCommon extends BxBaseModTextGridCommon
 
 
         $this->_aCategories = BxDolFormQuery::getDataItems($CNF['OBJECT_CATEGORY']);
         $this->_aCategories = BxDolFormQuery::getDataItems($CNF['OBJECT_CATEGORY']);
 
 
-        if(($iContextPid = bx_get('context_pid')) !== false) 
-            $this->setContextPid($iContextPid);
+        if(($iProfileId = bx_get('profile_id')) !== false) 
+            $this->setProfileId($iProfileId);
     }
     }
 
 
-    public function setContextPid($iContextPid)
+    public function getFormBlockTitleAPI($sAction, $iId = 0)
     {
     {
+        $sResult = '';
+
+        switch($sAction) {
+            case 'add':
+                $sResult = _t('_bx_resources_grid_popup_title_adm_add');
+                break;
+
+            case 'edit':
+                $sResult = _t('_bx_resources_grid_popup_title_adm_edit');
+                break;
+        }
+
+        return $sResult;
+    }
+
+    public function getFormCallBackUrlAPI($sAction, $iId = 0)
+    {
+        return '/api.php?r=system/perfom_action_api/TemplServiceGrid/&params[]=&o=' . $this->_sObject . '&profile_id=' . $this->_iProfileId . '&a=' . $sAction . '&id=' . $iId;
+    }
+
+    public function performActionAdd()
+    {
+        $sAction = 'add';
+
+        if(!$this->_oModule->isAllowAdd($this->_iProfileId))
+            return $this->_bIsApi ? [] : echoJson([]);
+
         $CNF = &$this->_oModule->_oConfig->CNF;
         $CNF = &$this->_oModule->_oConfig->CNF;
 
 
-        $this->_iContextPid = (int)$iContextPid;
-        $this->_aQueryAppend['context_pid'] = $this->_iContextPid;   
+        $oForm = $this->_getFormObject($sAction);
+        $oForm->initChecker();
+
+        if($oForm->isSubmittedAndValid()) {
+            $aResult = [];
+
+            $iId = $oForm->insert([$CNF['FIELD_ALLOW_VIEW_TO'] => -$this->_iProfileId, $CNF['FIELD_LIST'] => $this->_oModule->getListDefault($this->_iProfileId)]);
+            if($iId) {
+                $this->_oModule->onPublished($iId); 
+
+                $aResult = ['grid' => $this->getCode(false), 'blink' => $iId];
+            }
+            else
+                $aResult = ['msg' => _t('_bx_resources_txt_err_cannot_perform_action')];
+
+            return $this->_bIsApi ? [] : echoJson($aResult);
+        }
+
+        if($this->_bIsApi)
+            return $this->getFormBlockAPI($oForm, $sAction);
+
+        $sContent = BxTemplFunctions::getInstance()->popupBox($this->_oModule->_oConfig->getHtmlIds('entry_popup_' . $sAction), _t('_bx_resources_grid_popup_title_adm_add'), $this->_oModule->_oTemplate->parseHtmlByName('popup_form.html', [
+            'form_id' => $oForm->aFormAttrs['id'],
+            'form' => $oForm->getCode(true),
+            'object' => $this->_sObject,
+            'action' => $sAction
+        ]));
+
+        return echoJson(['popup' => ['html' => $sContent, 'options' => ['closeOnOuterClick' => false, 'removeOnClose' => true]]]);
+    }
+
+    public function performActionEdit()
+    {
+        $sAction = 'edit';
+
+        $aEntry = [];
+        if(($aIds = $this->_getIds()) !== false) {
+            $aEntry = $this->_oModule->_oDb->getContentInfoById(array_shift($aIds));
+            if(empty($aEntry) || !is_array($aEntry) || !$this->_oModule->isAllowManage($aEntry))
+                return $this->_bIsApi ? [] : echoJson([]);
+        }
+        else
+            return $this->_bIsApi ? [] : echoJson([]);
+
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        $iEntryId = (int)$aEntry[$CNF['FIELD_ID']];
+
+        $oForm = $this->_getFormObject($sAction, $aEntry);
+        $oForm->initChecker($aEntry);
+
+        if($oForm->isSubmittedAndValid()) {
+            $aResult = [];
+            if($oForm->update($iEntryId) !== false)
+                $aResult = ['grid' => $this->getCode(false), 'blink' => $iEntryId];
+            else
+                $aResult = ['msg' => _t('_bx_resources_txt_err_cannot_perform_action')];
+
+            return $this->_bIsApi ? [] : echoJson($aResult);
+        }
+
+        if($this->_bIsApi)
+            return $this->getFormBlockAPI($oForm, $sAction, $iEntryId);
+
+        $sContent = BxTemplFunctions::getInstance()->popupBox($this->_oModule->_oConfig->getHtmlIds('entry_popup_' . $sAction), _t('_bx_resources_grid_popup_title_adm_' . $sAction), $this->_oModule->_oTemplate->parseHtmlByName('popup_form.html', [
+            'form_id' => $oForm->aFormAttrs['id'],
+            'form' => $oForm->getCode(true),
+            'object' => $this->_sObject,
+            'action' => $sAction
+        ]));
+
+        return echoJson(['popup' => ['html' => $sContent, 'options' => ['closeOnOuterClick' => false, 'removeOnClose' => true]]]);
+    }
+
+    public function setProfileId($iProfileId)
+    {
+        $this->_iProfileId = (int)$iProfileId;
+        $this->_aQueryAppend['profile_id'] = $this->_iProfileId;   
     }
     }
 
 
     protected function _getCellCat($mixedValue, $sKey, $aField, $aRow)
     protected function _getCellCat($mixedValue, $sKey, $aField, $aRow)
@@ -44,13 +147,61 @@ class BxResourcesGridCommon extends BxBaseModTextGridCommon
         return parent::_getCellDefault($this->_aCategories[$aRow[$CNF['FIELD_CATEGORY']]] ?? '', $sKey, $aField, $aRow);
         return parent::_getCellDefault($this->_aCategories[$aRow[$CNF['FIELD_CATEGORY']]] ?? '', $sKey, $aField, $aRow);
     }
     }
 
 
+    protected function _getActionAdd($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = [])
+    {
+        if(!$this->_oModule->isAllowAdd($this->_iProfileId))
+            return $this->_bIsApi ? [] : '';
+
+        return $this->_getActionDefault ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
+    }
+
+    protected function _getActionEdit($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = [])
+    {
+        if(!$this->_oModule->isAllowManage($aRow['id']))
+            return $this->_bIsApi ? [] : '';
+
+        return $this->_getActionDefault ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
+    }
+
     protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
     protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
     {
     {
-        if($this->_iContextPid)
-            $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND ABS(`allow_view_to`)=?", $this->_iContextPid);
+        if(!$this->_iProfileId)
+            return [];
+
+        $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND ABS(`allow_view_to`)=?", $this->_iProfileId);
 
 
         return $this->__getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
         return $this->__getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
     }
     }
+
+    protected function _getFormObject($sAction, $aEntry = [])
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        $sForm = $CNF['OBJECT_FORM_ENTRY_DISPLAY_' . strtoupper($sAction)];
+        $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $sForm);
+        $oForm->setId($sForm);
+
+        $aActionParams = ['o' => $this->_sObject, 'a' => $sAction, 'profile_id' => $this->_iProfileId];
+        if(!empty($aEntry['id']))
+            $aActionParams['id'] = $aEntry['id'];
+        $oForm->setAction(BX_DOL_URL_ROOT . bx_append_url_params('grid.php', $aActionParams));
+
+        return $oForm;
+    }
+
+    protected function _getIds()
+    {
+        $aIds = bx_get('ids');
+        if(!$aIds || !is_array($aIds)) {
+            $iId = (int)bx_get('id');
+            if(!$iId) 
+                return false;
+
+            $aIds = [$iId];
+        }
+
+        return $aIds;
+    }
 }
 }
 
 
 /** @} */
 /** @} */

+ 25 - 9
modules/boonex/resources/classes/BxResourcesModule.php

@@ -107,15 +107,7 @@ class BxResourcesModule extends BxBaseModTextModule
 
 
         $oForm->initChecker();
         $oForm->initChecker();
         if($oForm->isSubmittedAndValid()) {
         if($oForm->isSubmittedAndValid()) {
-            if(!$iListId) {
-                $aList = $this->_oDb->getListDefault($iContextId);
-                if(empty($aList) || !is_array($aList))
-                    $iListId = $this->_oDb->addListDefault($iContextId);
-                else
-                    $iListId = (int)$aList[$CNF['FIELD_LIST_ID']];
-            }
-
-            $iContentId = $oForm->insert([$CNF['FIELD_ALLOW_VIEW_TO'] => -$iContextId, $CNF['FIELD_LIST'] => $iListId]);
+            $iContentId = $oForm->insert([$CNF['FIELD_ALLOW_VIEW_TO'] => -$iContextId, $CNF['FIELD_LIST'] => $iListId ?: $this->getListDefault($iContextId)]);
             if($iContentId)
             if($iContentId)
                 $this->onPublished($iContentId);
                 $this->onPublished($iContentId);
 
 
@@ -189,6 +181,15 @@ class BxResourcesModule extends BxBaseModTextModule
         return parent::serviceCheckAllowedCommentsView($iContentId, $sObjectComments);
         return parent::serviceCheckAllowedCommentsView($iContentId, $sObjectComments);
     }
     }
 
 
+    public function serviceManageTools($sType = 'common')
+    {
+        $aResult = parent::serviceManageTools('common');
+        if($sType == 'common' && isset($aResult['menu']))
+            unset($aResult['menu']);
+
+        return $aResult;
+    }
+
     public function serviceBrowseContextByCategory($iProfileId = 0, $mixedCategory = false)
     public function serviceBrowseContextByCategory($iProfileId = 0, $mixedCategory = false)
     {
     {
         $aParams = [];
         $aParams = [];
@@ -263,6 +264,21 @@ class BxResourcesModule extends BxBaseModTextModule
 
 
         return false;
         return false;
     }
     }
+    
+    public function getListDefault($iContextId)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        $aList = $this->_oDb->getListDefault($iContextId);
+
+        $iListId = 0;
+        if(empty($aList) || !is_array($aList))
+            $iListId = $this->_oDb->addListDefault($iContextId);
+        else
+            $iListId = (int)$aList[$CNF['FIELD_LIST_ID']];
+
+        return $iListId;
+    }
 
 
     /**
     /**
      * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. So make sure to make strict(===) checking.
      * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. So make sure to make strict(===) checking.

+ 2 - 0
modules/boonex/resources/install/config.php

@@ -52,7 +52,9 @@ $aConfig = [
      */
      */
     'menu_triggers' => [
     'menu_triggers' => [
         'trigger_profile_view_submenu',
         'trigger_profile_view_submenu',
+        'trigger_profile_view_actions',
         'trigger_group_view_submenu',
         'trigger_group_view_submenu',
+        'trigger_group_view_actions'
     ],
     ],
 
 
     /**
     /**

+ 9 - 5
modules/boonex/resources/install/langs/en.xml

@@ -122,10 +122,10 @@
     <string name="_bx_resources_page_block_title_browse_cmts"><![CDATA[Resources' Activity]]></string>
     <string name="_bx_resources_page_block_title_browse_cmts"><![CDATA[Resources' Activity]]></string>
     <string name="_bx_resources_page_title_sys_manage"><![CDATA[Manage Own]]></string>
     <string name="_bx_resources_page_title_sys_manage"><![CDATA[Manage Own]]></string>
     <string name="_bx_resources_page_title_sys_manage_administration"><![CDATA[Manage All]]></string>
     <string name="_bx_resources_page_title_sys_manage_administration"><![CDATA[Manage All]]></string>
-    <string name="_bx_resources_page_title_manage"><![CDATA[Manage]]></string>
+    <string name="_bx_resources_page_title_manage"><![CDATA[Manage Resources]]></string>
     <string name="_bx_resources_page_block_title_system_manage"><![CDATA[Manage Own]]></string>
     <string name="_bx_resources_page_block_title_system_manage"><![CDATA[Manage Own]]></string>
     <string name="_bx_resources_page_block_title_system_manage_administration"><![CDATA[Manage All]]></string>
     <string name="_bx_resources_page_block_title_system_manage_administration"><![CDATA[Manage All]]></string>
-    <string name="_bx_resources_page_block_title_manage"><![CDATA[Manage]]></string>
+    <string name="_bx_resources_page_block_title_manage"><![CDATA[Manage Resources]]></string>
     <string name="_bx_resources_page_block_title_popular_keywords"><![CDATA[Popular Hashtags]]></string>
     <string name="_bx_resources_page_block_title_popular_keywords"><![CDATA[Popular Hashtags]]></string>
     <string name="_bx_resources_page_block_title_cats"><![CDATA[Resources Categories]]></string>
     <string name="_bx_resources_page_block_title_cats"><![CDATA[Resources Categories]]></string>
     <string name="_bx_resources_page_block_title_entry_info"><![CDATA[Info]]></string>
     <string name="_bx_resources_page_block_title_entry_info"><![CDATA[Info]]></string>
@@ -147,8 +147,8 @@
     <string name="_bx_resources_menu_item_title_system_view_entry"><![CDATA[View Resource]]></string>
     <string name="_bx_resources_menu_item_title_system_view_entry"><![CDATA[View Resource]]></string>
     <string name="_bx_resources_menu_item_title_system_entries_home"><![CDATA[Resources]]></string>
     <string name="_bx_resources_menu_item_title_system_entries_home"><![CDATA[Resources]]></string>
     <string name="_bx_resources_menu_item_title_entries_home"><![CDATA[Resources]]></string>
     <string name="_bx_resources_menu_item_title_entries_home"><![CDATA[Resources]]></string>
-    <string name="_bx_resources_menu_item_title_system_entries_manage"><![CDATA[Manage]]></string>
-    <string name="_bx_resources_menu_item_title_entries_manage"><![CDATA[Manage]]></string>
+    <string name="_bx_resources_menu_item_title_system_entries_manage"><![CDATA[Manage Resources]]></string>
+    <string name="_bx_resources_menu_item_title_entries_manage"><![CDATA[Manage Resources]]></string>
     <string name="_bx_resources_menu_item_title_system_entries_search"><![CDATA[Search]]></string>
     <string name="_bx_resources_menu_item_title_system_entries_search"><![CDATA[Search]]></string>
     <string name="_bx_resources_menu_item_title_entries_search"><![CDATA[Search]]></string>
     <string name="_bx_resources_menu_item_title_entries_search"><![CDATA[Search]]></string>
     <string name="_bx_resources_menu_title_view_entry_submenu"><![CDATA[View Resource Submenu]]></string>
     <string name="_bx_resources_menu_title_view_entry_submenu"><![CDATA[View Resource Submenu]]></string>
@@ -180,18 +180,22 @@
     <string name="_bx_resources_grid_filter_item_title_adm_hidden"><![CDATA[Hidden]]></string>
     <string name="_bx_resources_grid_filter_item_title_adm_hidden"><![CDATA[Hidden]]></string>
     <string name="_bx_resources_grid_filter_item_title_adm_pending"><![CDATA[Pending]]></string>
     <string name="_bx_resources_grid_filter_item_title_adm_pending"><![CDATA[Pending]]></string>
     <string name="_bx_resources_grid_column_title_adm_active"><![CDATA[Active]]></string>
     <string name="_bx_resources_grid_column_title_adm_active"><![CDATA[Active]]></string>
+    <string name="_bx_resources_grid_column_title_adm_link"><![CDATA[Link]]></string>
     <string name="_bx_resources_grid_column_title_adm_title"><![CDATA[Title]]></string>
     <string name="_bx_resources_grid_column_title_adm_title"><![CDATA[Title]]></string>
-    <string name="_bx_resources_grid_column_title_adm_cat"><![CDATA[Category]]></string>
     <string name="_bx_resources_grid_column_title_adm_added"><![CDATA[Added]]></string>
     <string name="_bx_resources_grid_column_title_adm_added"><![CDATA[Added]]></string>
     <string name="_bx_resources_grid_column_title_adm_author"><![CDATA[Author]]></string>>
     <string name="_bx_resources_grid_column_title_adm_author"><![CDATA[Author]]></string>>
     <string name="_bx_resources_grid_column_title_adm_status_admin"><![CDATA[Moderation]]></string>
     <string name="_bx_resources_grid_column_title_adm_status_admin"><![CDATA[Moderation]]></string>
+    <string name="_bx_resources_grid_action_title_adm_add"><![CDATA[Add]]></string>
     <string name="_bx_resources_grid_action_title_adm_audit_content"><![CDATA[Audit actions]]></string>
     <string name="_bx_resources_grid_action_title_adm_audit_content"><![CDATA[Audit actions]]></string>
     <string name="_bx_resources_grid_action_title_adm_clear_reports"><![CDATA[Сlear reports]]></string>
     <string name="_bx_resources_grid_action_title_adm_clear_reports"><![CDATA[Сlear reports]]></string>
     <string name="_bx_resources_grid_action_title_adm_edit"><![CDATA[Edit]]></string>
     <string name="_bx_resources_grid_action_title_adm_edit"><![CDATA[Edit]]></string>
     <string name="_bx_resources_grid_action_title_adm_delete"><![CDATA[Delete]]></string>
     <string name="_bx_resources_grid_action_title_adm_delete"><![CDATA[Delete]]></string>
     <string name="_bx_resources_grid_action_title_adm_more_actions"><![CDATA[More Actions]]></string>
     <string name="_bx_resources_grid_action_title_adm_more_actions"><![CDATA[More Actions]]></string>
     <string name="_bx_resources_grid_action_err_delete"><![CDATA[Cannot delete the selected resource(s).]]></string>
     <string name="_bx_resources_grid_action_err_delete"><![CDATA[Cannot delete the selected resource(s).]]></string>
+    <string name="_bx_resources_grid_popup_title_adm_add"><![CDATA[Add Resource]]></string>
+    <string name="_bx_resources_grid_popup_title_adm_edit"><![CDATA[Edit Resource]]></string>
     <string name="_bx_resources_grid_txt_account_manager"><![CDATA[Redirect to manage account.]]></string>
     <string name="_bx_resources_grid_txt_account_manager"><![CDATA[Redirect to manage account.]]></string>
+    
 
 
     <string name="_bx_resources_chart_growth"><![CDATA[Resources: Growth]]></string>
     <string name="_bx_resources_chart_growth"><![CDATA[Resources: Growth]]></string>
     <string name="_bx_resources_chart_growth_speed"><![CDATA[Resources: Growth Speed]]></string>
     <string name="_bx_resources_chart_growth_speed"><![CDATA[Resources: Growth Speed]]></string>

+ 10 - 6
modules/boonex/resources/install/sql/enable.sql

@@ -83,7 +83,7 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `t
 
 
 -- PAGE: manage own entries
 -- PAGE: manage own entries
 INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
 INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
-('bx_resources_manage', '_bx_resources_page_title_sys_manage', '_bx_resources_page_title_manage', 'bx_resources', 5, 2147483647, 1, 'resources-manage', 'page.php?i=resources-manage', '', '', '', 0, 1, 0, 'BxResourcesPageBrowse', 'modules/boonex/resources/classes/BxResourcesPageBrowse.php');
+('bx_resources_manage', '_bx_resources_page_title_sys_manage', '_bx_resources_page_title_manage', 'bx_resources', 5, 2147483647, 1, 'resources-manage', 'page.php?i=resources-manage', '', '', '', 0, 1, 0, 'BxResourcesPageAuthor', 'modules/boonex/resources/classes/BxResourcesPageAuthor.php');
 
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
 ('bx_resources_manage', 1, 'bx_resources', '_bx_resources_page_block_title_system_manage', '_bx_resources_page_block_title_manage', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_resources";s:6:"method";s:12:"manage_tools";}', 0, 1, 0);
 ('bx_resources_manage', 1, 'bx_resources', '_bx_resources_page_block_title_system_manage', '_bx_resources_page_block_title_manage', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_resources";s:6:"method";s:12:"manage_tools";}', 0, 1, 0);
@@ -169,7 +169,10 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 -- MENU: add menu item to profiles modules (trigger* menu sets are processed separately upon modules enable/disable)
 -- MENU: add menu item to profiles modules (trigger* menu sets are processed separately upon modules enable/disable)
 INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
 INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
 ('trigger_profile_view_submenu', 'bx_resources', 'resources-author', '_bx_resources_menu_item_title_system_view_entries_author', '_bx_resources_menu_item_title_view_entries_author', 'page.php?i=resources-author&profile_id={profile_id}', '', '', 'warehouse col-green2', '', 2147483647, 1, 0, 0),
 ('trigger_profile_view_submenu', 'bx_resources', 'resources-author', '_bx_resources_menu_item_title_system_view_entries_author', '_bx_resources_menu_item_title_view_entries_author', 'page.php?i=resources-author&profile_id={profile_id}', '', '', 'warehouse col-green2', '', 2147483647, 1, 0, 0),
-('trigger_group_view_submenu', 'bx_resources', 'resources-context', '_bx_resources_menu_item_title_system_view_entries_in_context', '_bx_resources_menu_item_title_view_entries_in_context', 'page.php?i=resources-context&profile_id={profile_id}', '', '', 'warehouse col-green2', '', 2147483647, 1, 0, 0);
+('trigger_profile_view_actions', 'bx_resources', 'resources-manage', '_bx_resources_menu_item_title_system_entries_manage', '_bx_resources_menu_item_title_entries_manage', 'page.php?i=resources-manage&profile_id={profile_id}', '', '', 'warehouse', '', 2147483647, 1, 0, 0),
+
+('trigger_group_view_submenu', 'bx_resources', 'resources-context', '_bx_resources_menu_item_title_system_view_entries_in_context', '_bx_resources_menu_item_title_view_entries_in_context', 'page.php?i=resources-context&profile_id={profile_id}', '', '', 'warehouse col-green2', '', 2147483647, 1, 0, 0),
+('trigger_group_view_actions', 'bx_resources', 'resources-manage', '_bx_resources_menu_item_title_system_entries_manage', '_bx_resources_menu_item_title_entries_manage', 'page.php?i=resources-manage&profile_id={profile_id}', '', '', 'warehouse', '', 2147483647, 1, 0, 0);
 
 
 
 
 -- PRIVACY 
 -- PRIVACY 
@@ -264,8 +267,8 @@ 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_resources_administration', 'Sql', 'SELECT `tt`.*, `tp`.`id` AS `context_id`, `tp`.`type` AS `context_module` FROM `bx_resources_entries` AS `tt` INNER JOIN `sys_profiles` AS `tp` ON ABS(`tt`.`allow_view_to`)=`tp`.`id` WHERE 1 ', 'bx_resources_entries', 'id', 'added', 'status_admin', '', 20, NULL, 'start', '', 'tt`.`title,tt`.`text', '', 'like', 'reports', '', 192, 'BxResourcesGridAdministration', 'modules/boonex/resources/classes/BxResourcesGridAdministration.php'),
-('bx_resources_common', 'Sql', 'SELECT `tt`.*, `tp`.`id` AS `context_id`, `tp`.`type` AS `context_module` FROM `bx_resources_entries` AS `tt` INNER JOIN `sys_profiles` AS `tp` ON ABS(`tt`.`allow_view_to`)=`tp`.`id` WHERE 1 ', 'bx_resources_entries', 'id', 'added', 'status', '', 20, NULL, 'start', '', 'tt`.`title,tt`.`text', '', 'like', '', '', 2147483647, 'BxResourcesGridCommon', 'modules/boonex/resources/classes/BxResourcesGridCommon.php');
+('bx_resources_administration', 'Sql', 'SELECT * FROM `bx_resources_entries` WHERE 1 ', 'bx_resources_entries', 'id', 'added', 'status_admin', '', 20, NULL, 'start', '', 'title,text', '', 'like', 'reports', '', 192, 'BxResourcesGridAdministration', 'modules/boonex/resources/classes/BxResourcesGridAdministration.php'),
+('bx_resources_common', 'Sql', 'SELECT * FROM `bx_resources_entries` WHERE 1 ', 'bx_resources_entries', 'id', 'added', 'status', '', 20, NULL, 'start', '', 'title,text', '', 'like', '', '', 2147483647, 'BxResourcesGridCommon', 'modules/boonex/resources/classes/BxResourcesGridCommon.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_resources_administration', 'checkbox', '_sys_select', '2%', 0, 0, '', 1),
 ('bx_resources_administration', 'checkbox', '_sys_select', '2%', 0, 0, '', 1),
@@ -278,8 +281,8 @@ INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable
 
 
 ('bx_resources_common', 'checkbox', '_sys_select', '2%', 0, 0, '', 1),
 ('bx_resources_common', 'checkbox', '_sys_select', '2%', 0, 0, '', 1),
 ('bx_resources_common', 'switcher', '_bx_resources_grid_column_title_adm_active', '8%', 0, 0, '', 2),
 ('bx_resources_common', 'switcher', '_bx_resources_grid_column_title_adm_active', '8%', 0, 0, '', 2),
-('bx_resources_common', 'title', '_bx_resources_grid_column_title_adm_title', '30%', 0, 35, '', 3),
-('bx_resources_common', 'cat', '_bx_resources_grid_column_title_adm_cat', '15%', 0, 0, '', 4),
+('bx_resources_common', 'title', '_bx_resources_grid_column_title_adm_title', '15%', 0, 16, '', 3),
+('bx_resources_common', 'link', '_bx_resources_grid_column_title_adm_link', '30%', 0, 32, '', 4),
 ('bx_resources_common', 'added', '_bx_resources_grid_column_title_adm_added', '10%', 1, 25, '', 5),
 ('bx_resources_common', 'added', '_bx_resources_grid_column_title_adm_added', '10%', 1, 25, '', 5),
 ('bx_resources_common', 'status_admin', '_bx_resources_grid_column_title_adm_status_admin', '15%', 0, 16, '', 6),
 ('bx_resources_common', 'status_admin', '_bx_resources_grid_column_title_adm_status_admin', '15%', 0, 16, '', 6),
 ('bx_resources_common', 'actions', '', '20%', 0, 0, '', 7);
 ('bx_resources_common', 'actions', '', '20%', 0, 0, '', 7);
@@ -294,6 +297,7 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon
 ('bx_resources_administration', 'single', 'audit_content', '_bx_resources_grid_action_title_adm_audit_content', 'search', 1, 0, 4),
 ('bx_resources_administration', 'single', 'audit_content', '_bx_resources_grid_action_title_adm_audit_content', 'search', 1, 0, 4),
 ('bx_resources_administration', 'single', 'clear_reports', '_bx_resources_grid_action_title_adm_clear_reports', 'eraser', 1, 0, 5),
 ('bx_resources_administration', 'single', 'clear_reports', '_bx_resources_grid_action_title_adm_clear_reports', 'eraser', 1, 0, 5),
 
 
+('bx_resources_common', 'independent', 'add', '_bx_resources_grid_action_title_adm_add', '', 0, 0, 1),
 ('bx_resources_common', 'bulk', 'delete', '_bx_resources_grid_action_title_adm_delete', '', 0, 1, 1),
 ('bx_resources_common', 'bulk', 'delete', '_bx_resources_grid_action_title_adm_delete', '', 0, 1, 1),
 ('bx_resources_common', 'single', 'edit', '_bx_resources_grid_action_title_adm_edit', 'pencil-alt', 1, 0, 1),
 ('bx_resources_common', 'single', 'edit', '_bx_resources_grid_action_title_adm_edit', 'pencil-alt', 1, 0, 1),
 ('bx_resources_common', 'single', 'delete', '_bx_resources_grid_action_title_adm_delete', 'remove', 1, 1, 2),
 ('bx_resources_common', 'single', 'delete', '_bx_resources_grid_action_title_adm_delete', 'remove', 1, 1, 2),

+ 6 - 1
modules/boonex/resources/template/popup_form.html

@@ -9,7 +9,12 @@
                         bx_loading($("#__form_id__"), true);
                         bx_loading($("#__form_id__"), true);
                     },
                     },
                     success: function (data) {
                     success: function (data) {
-                        processJsonData(data);
+                        if(glGrids && glGrids.__object__ != undefined) {
+                            $(".bx-popup-applied:visible").dolPopupHide();
+                            glGrids.__object__.processJson(data, '__action__');
+                        }
+                        else
+                            processJsonData(data);
                     }
                     }
                 });
                 });
             });
             });

+ 8 - 5
modules/boonex/russian/data/langs/bx_resources/ru.xml

@@ -122,10 +122,10 @@
     <string name="_bx_resources_page_block_title_browse_cmts"><![CDATA[Ресурсы - Комментарии]]></string>
     <string name="_bx_resources_page_block_title_browse_cmts"><![CDATA[Ресурсы - Комментарии]]></string>
     <string name="_bx_resources_page_title_sys_manage"><![CDATA[Управление собственными ресурсами]]></string>
     <string name="_bx_resources_page_title_sys_manage"><![CDATA[Управление собственными ресурсами]]></string>
     <string name="_bx_resources_page_title_sys_manage_administration"><![CDATA[Управление всеми ресурсами]]></string>
     <string name="_bx_resources_page_title_sys_manage_administration"><![CDATA[Управление всеми ресурсами]]></string>
-    <string name="_bx_resources_page_title_manage"><![CDATA[Управление]]></string>
+    <string name="_bx_resources_page_title_manage"><![CDATA[Управление ресурсами]]></string>
     <string name="_bx_resources_page_block_title_system_manage"><![CDATA[Управление собственными ресурсами]]></string>
     <string name="_bx_resources_page_block_title_system_manage"><![CDATA[Управление собственными ресурсами]]></string>
     <string name="_bx_resources_page_block_title_system_manage_administration"><![CDATA[Управление всеми ресурсами]]></string>
     <string name="_bx_resources_page_block_title_system_manage_administration"><![CDATA[Управление всеми ресурсами]]></string>
-    <string name="_bx_resources_page_block_title_manage"><![CDATA[Управление]]></string>
+    <string name="_bx_resources_page_block_title_manage"><![CDATA[Управление ресурсами]]></string>
     <string name="_bx_resources_page_block_title_popular_keywords"><![CDATA[Популярные хэштеги]]></string>
     <string name="_bx_resources_page_block_title_popular_keywords"><![CDATA[Популярные хэштеги]]></string>
     <string name="_bx_resources_page_block_title_cats"><![CDATA[Ресурсы - Категории]]></string>
     <string name="_bx_resources_page_block_title_cats"><![CDATA[Ресурсы - Категории]]></string>
     <string name="_bx_resources_page_block_title_entry_info"><![CDATA[Инфо]]></string>
     <string name="_bx_resources_page_block_title_entry_info"><![CDATA[Инфо]]></string>
@@ -147,8 +147,8 @@
     <string name="_bx_resources_menu_item_title_system_view_entry"><![CDATA[Просмотреть ресурс]]></string>
     <string name="_bx_resources_menu_item_title_system_view_entry"><![CDATA[Просмотреть ресурс]]></string>
     <string name="_bx_resources_menu_item_title_system_entries_home"><![CDATA[Ресурсы]]></string>
     <string name="_bx_resources_menu_item_title_system_entries_home"><![CDATA[Ресурсы]]></string>
     <string name="_bx_resources_menu_item_title_entries_home"><![CDATA[Ресурсы]]></string>
     <string name="_bx_resources_menu_item_title_entries_home"><![CDATA[Ресурсы]]></string>
-    <string name="_bx_resources_menu_item_title_system_entries_manage"><![CDATA[Управление]]></string>
-    <string name="_bx_resources_menu_item_title_entries_manage"><![CDATA[Управление]]></string>
+    <string name="_bx_resources_menu_item_title_system_entries_manage"><![CDATA[Управление ресурсами]]></string>
+    <string name="_bx_resources_menu_item_title_entries_manage"><![CDATA[Управление ресурсами]]></string>
     <string name="_bx_resources_menu_item_title_system_entries_search"><![CDATA[Поиск]]></string>
     <string name="_bx_resources_menu_item_title_system_entries_search"><![CDATA[Поиск]]></string>
     <string name="_bx_resources_menu_item_title_entries_search"><![CDATA[Поиск]]></string>
     <string name="_bx_resources_menu_item_title_entries_search"><![CDATA[Поиск]]></string>
     <string name="_bx_resources_menu_title_view_entry_submenu"><![CDATA[Просмотреть ресурс - Подменю]]></string>
     <string name="_bx_resources_menu_title_view_entry_submenu"><![CDATA[Просмотреть ресурс - Подменю]]></string>
@@ -180,16 +180,19 @@
     <string name="_bx_resources_grid_filter_item_title_adm_hidden"><![CDATA[Спрятанные]]></string>
     <string name="_bx_resources_grid_filter_item_title_adm_hidden"><![CDATA[Спрятанные]]></string>
     <string name="_bx_resources_grid_filter_item_title_adm_pending"><![CDATA[В ожидании]]></string>
     <string name="_bx_resources_grid_filter_item_title_adm_pending"><![CDATA[В ожидании]]></string>
     <string name="_bx_resources_grid_column_title_adm_active"><![CDATA[Активные]]></string>
     <string name="_bx_resources_grid_column_title_adm_active"><![CDATA[Активные]]></string>
+    <string name="_bx_resources_grid_column_title_adm_link"><![CDATA[Ссылка]]></string>
     <string name="_bx_resources_grid_column_title_adm_title"><![CDATA[Заголовок]]></string>
     <string name="_bx_resources_grid_column_title_adm_title"><![CDATA[Заголовок]]></string>
-    <string name="_bx_resources_grid_column_title_adm_cat"><![CDATA[Категория]]></string>
     <string name="_bx_resources_grid_column_title_adm_added"><![CDATA[Добавленные]]></string>
     <string name="_bx_resources_grid_column_title_adm_added"><![CDATA[Добавленные]]></string>
     <string name="_bx_resources_grid_column_title_adm_author"><![CDATA[Автор]]></string>
     <string name="_bx_resources_grid_column_title_adm_author"><![CDATA[Автор]]></string>
     <string name="_bx_resources_grid_column_title_adm_status_admin"><![CDATA[Модерация]]></string>
     <string name="_bx_resources_grid_column_title_adm_status_admin"><![CDATA[Модерация]]></string>
+    <string name="_bx_resources_grid_action_title_adm_add"><![CDATA[Добавить]]></string>
     <string name="_bx_resources_grid_action_title_adm_audit_content"><![CDATA[Аудит действий]]></string>
     <string name="_bx_resources_grid_action_title_adm_audit_content"><![CDATA[Аудит действий]]></string>
     <string name="_bx_resources_grid_action_title_adm_clear_reports"><![CDATA[Очистить жалобы]]></string>
     <string name="_bx_resources_grid_action_title_adm_clear_reports"><![CDATA[Очистить жалобы]]></string>
     <string name="_bx_resources_grid_action_title_adm_edit"><![CDATA[Редактировать]]></string>
     <string name="_bx_resources_grid_action_title_adm_edit"><![CDATA[Редактировать]]></string>
     <string name="_bx_resources_grid_action_title_adm_delete"><![CDATA[Удалить]]></string>
     <string name="_bx_resources_grid_action_title_adm_delete"><![CDATA[Удалить]]></string>
     <string name="_bx_resources_grid_action_title_adm_more_actions"><![CDATA[Дополнительные действия]]></string>
     <string name="_bx_resources_grid_action_title_adm_more_actions"><![CDATA[Дополнительные действия]]></string>
+    <string name="_bx_resources_grid_popup_title_adm_add"><![CDATA[Добавить ресурс]]></string>
+    <string name="_bx_resources_grid_popup_title_adm_edit"><![CDATA[Редактировать ресурс]]></string>
     <string name="_bx_resources_grid_action_err_delete"><![CDATA[Невозможно удалить выбранную(ные) публикацию(ции).]]></string>
     <string name="_bx_resources_grid_action_err_delete"><![CDATA[Невозможно удалить выбранную(ные) публикацию(ции).]]></string>
     <string name="_bx_resources_grid_txt_account_manager"><![CDATA[Перенаправить в Управление аккаунтом.]]></string>
     <string name="_bx_resources_grid_txt_account_manager"><![CDATA[Перенаправить в Управление аккаунтом.]]></string>