Browse Source

#4558 - Build-in API support (Cmts + Switch profile)

roman.lesnikov@gmail.com 2 years ago
parent
commit
78d53dc99c

+ 1 - 0
install/sql/system.sql

@@ -756,6 +756,7 @@ SET @iCategoryId = LAST_INSERT_ID();
 INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES
 (@iCategoryId, 'sys_api_menu_top', '_adm_stg_cpt_option_sys_api_menu_top', '', 'select', 'a:3:{s:6:"module";s:6:"system";s:6:"method";s:24:"get_options_api_menu_top";s:5:"class";s:13:"TemplServices";}', '', '', 1),
 (@iCategoryId, 'sys_api_comments_flat', '_adm_stg_cpt_option_sys_api_comments_flat', '', 'checkbox', '', '', '', 10),
+(@iCategoryId, 'sys_api_comments_modal', '_adm_stg_cpt_option_sys_api_comments_modal', '', 'checkbox', '', '', '', 15),
 (@iCategoryId, 'sys_api_search_sections', '_adm_stg_cpt_option_sys_api_search_sections', 'bx_posts,bx_persons,bx_groups', 'digit', '', '', '', 20),
 (@iCategoryId, 'sys_api_extended_units', '_adm_stg_cpt_option_sys_api_extended_units', '', 'checkbox', '', '', '', 30),
 (@iCategoryId, 'sys_api_conn_in_prof_units', '_adm_stg_cpt_option_sys_api_conn_in_prof_units', '', 'checkbox', '', '', '', 31);

+ 4 - 0
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -1989,6 +1989,10 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
 
             $aEvent['cmts'] = $aCmts;
             $aEvent['cmts']['count'] = $aEvent['comments']['count'];
+            
+            if (getParam('sys_api_comments_modal') == 'on'){
+                $aEvent['cmts_list'] = bx_srv('system', 'get_data_api', [['module' => $aEvent['comments']['system'], 'object_id' =>  $aEvent['comments']['object_id']]], 'TemplCmtsServices');
+            }
         }
 
         return $aEvent;

+ 3 - 0
template/scripts/BxBaseServiceAccount.php

@@ -691,6 +691,9 @@ class BxBaseServiceAccount extends BxDol
         }
 
         checkActionModule($iViewerProfileId, 'switch to any profile', 'system', true);
+        if (bx_is_api()){
+            return BxDolProfile::getDataForPage($iSwitchToProfileId);
+        }
         return true;
     }