Skip to content

Commit

Permalink
Ticket #4370 - Placeholder for empty block. Core changes and usage in…
Browse files Browse the repository at this point in the history
… Connections pages.
  • Loading branch information
AntonLV committed Aug 7, 2023
1 parent cbf9b19 commit 26e0ec9
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 17 deletions.
15 changes: 8 additions & 7 deletions install/sql/system.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5707,6 +5707,7 @@ CREATE TABLE IF NOT EXISTS `sys_pages_blocks` (
`hidden_on` varchar(255) NOT NULL DEFAULT '',
`type` enum('raw','html','lang','image','rss','menu','custom','service','wiki') NOT NULL DEFAULT 'raw',
`content` text NOT NULL,
`content_empty` varchar(255) NOT NULL DEFAULT '',
`text` mediumtext NOT NULL,
`text_updated` int(11) NOT NULL,
`help` varchar(255) NOT NULL,
Expand Down Expand Up @@ -5836,15 +5837,15 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `
('sys_sub_wiki_pages_list', 1, 'system', '', '_sys_page_block_title_wiki_pages_list', 0, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:10:"pages_list";s:6:"params";a:0:{}s:5:"class";s:16:"TemplServiceWiki";}', 0, 1, 1, 1),
('sys_sub_wiki_page_contents', 1, 'system', '', '_sys_page_block_title_wiki_page_contents', 0, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:13:"page_contents";s:6:"params";a:0:{}s:5:"class";s:16:"TemplServiceWiki";}', 0, 1, 1, 1),

('sys_con_friends', 1, 'system', '', '_sys_page_block_title_con_friends', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:14:"browse_friends";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;a:1:{s:13:"empty_message";b:1;}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1),
('sys_con_friend_requests', 1, 'system', '', '_sys_page_block_title_con_friend_requests', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:22:"browse_friend_requests";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;a:1:{s:13:"empty_message";b:1;}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1),
('sys_con_friend_requested', 1, 'system', '', '_sys_page_block_title_con_friend_requested', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:23:"browse_friend_requested";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;a:1:{s:13:"empty_message";b:1;}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1),
('sys_con_friends', 1, 'system', '', '_sys_page_block_title_con_friends', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:14:"browse_friends";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;a:2:{s:13:"empty_message";b:1;s:18:"empty_message_text";s:15:"{content_empty}";}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1),
('sys_con_friend_requests', 1, 'system', '', '_sys_page_block_title_con_friend_requests', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:22:"browse_friend_requests";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;a:2:{s:13:"empty_message";b:1;s:18:"empty_message_text";s:15:"{content_empty}";}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1),
('sys_con_friend_requested', 1, 'system', '', '_sys_page_block_title_con_friend_requested', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:23:"browse_friend_requested";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;a:2:{s:13:"empty_message";b:1;s:18:"empty_message_text";s:15:"{content_empty}";}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1),

('sys_con_following', 1, 'system', '', '_sys_page_block_title_con_following', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:20:"browse_subscriptions";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;a:1:{s:13:"empty_message";b:1;}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1),
('sys_con_followers', 1, 'system', '', '_sys_page_block_title_con_followers', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:20:"browse_subscribed_me";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;a:1:{s:13:"empty_message";b:1;}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1),
('sys_con_following', 1, 'system', '', '_sys_page_block_title_con_following', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:20:"browse_subscriptions";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;a:2:{s:13:"empty_message";b:1;s:18:"empty_message_text";s:15:"{content_empty}";}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1),
('sys_con_followers', 1, 'system', '', '_sys_page_block_title_con_followers', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:20:"browse_subscribed_me";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;a:2:{s:13:"empty_message";b:1;s:18:"empty_message_text";s:15:"{content_empty}";}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1),

('sys_recom_friends', 1, 'system', '', '_sys_page_block_title_recom_friends', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:30:"browse_recommendations_friends";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;a:1:{s:13:"empty_message";b:1;}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1),
('sys_recom_subscriptions', 1, 'system', '', '_sys_page_block_title_recom_subscriptions', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:36:"browse_recommendations_subscriptions";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;a:1:{s:13:"empty_message";b:1;}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1),
('sys_recom_friends', 1, 'system', '', '_sys_page_block_title_recom_friends', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:30:"browse_recommendations_friends";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;a:2:{s:13:"empty_message";b:1;s:18:"empty_message_text";s:15:"{content_empty}";}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1),
('sys_recom_subscriptions', 1, 'system', '', '_sys_page_block_title_recom_subscriptions', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:36:"browse_recommendations_subscriptions";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;a:2:{s:13:"empty_message";b:1;s:18:"empty_message_text";s:15:"{content_empty}";}}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 1),


-- studio dashboard blocks
Expand Down
2 changes: 2 additions & 0 deletions modules/boonex/english/data/langs/system/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@
<string name="_adm_bp_dsc_block_content_raw"><![CDATA[Enter HTML content here]]></string>
<string name="_adm_bp_dsc_block_content_rss_length"><![CDATA[Enter a number of displayed items here]]></string>
<string name="_adm_bp_dsc_block_content_rss_url"><![CDATA[Enter URL to RSS resource here]]></string>
<string name="_adm_bp_dsc_block_content_empty"><![CDATA[Leave empty to use default one]]></string>
<string name="_adm_bp_dsc_block_title"><![CDATA[Short name for the block, visible in block header.]]></string>
<string name="_adm_bp_dsc_block_visible_for_levels"><![CDATA[Select user levels that can see this block]]></string>
<string name="_adm_bp_dsc_page_cache_lifetime"><![CDATA[Store page in cache for this number of seconds]]></string>
Expand Down Expand Up @@ -550,6 +551,7 @@
<string name="_adm_bp_txt_block_content_rss_url"><![CDATA[URL]]></string>
<string name="_adm_bp_txt_block_content_service_method"><![CDATA[Method]]></string>
<string name="_adm_bp_txt_block_content_service_module"><![CDATA[Module]]></string>
<string name="_adm_bp_txt_block_content_empty"><![CDATA[Placeholder text for empty block]]></string>
<string name="_adm_bp_txt_block_designbox"><![CDATA[Block Layout]]></string>
<string name="_adm_bp_txt_block_designbox_empty"><![CDATA[Select layout...]]></string>
<string name="_adm_bp_txt_block_class"><![CDATA[CSS Class]]></string>
Expand Down
2 changes: 2 additions & 0 deletions modules/boonex/russian/data/langs/system/ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@
<string name="_adm_bp_dsc_block_content_raw"><![CDATA[Введите здесь HTML-содержимое]]></string>
<string name="_adm_bp_dsc_block_content_rss_length"><![CDATA[Введите здесь количество отображаемых элементов]]></string>
<string name="_adm_bp_dsc_block_content_rss_url"><![CDATA[Введите здесь URL RSS-ресурса]]></string>
<string name="_adm_bp_dsc_block_content_empty"><![CDATA[Оставьте пустым, чтобы использовать значение по умолчанию.]]></string>
<string name="_adm_bp_dsc_block_title"><![CDATA[Короткое название для блока, отображаемое в заголовке блока.]]></string>
<string name="_adm_bp_dsc_block_visible_for_levels"><![CDATA[Выбрать уровни пользователей, которые могут видеть этот блок]]></string>
<string name="_adm_bp_dsc_page_cache_lifetime"><![CDATA[Сохранять страницу в кэше в течение данного количества секунд]]></string>
Expand Down Expand Up @@ -550,6 +551,7 @@
<string name="_adm_bp_txt_block_content_rss_url"><![CDATA[URL]]></string>
<string name="_adm_bp_txt_block_content_service_method"><![CDATA[Метод]]></string>
<string name="_adm_bp_txt_block_content_service_module"><![CDATA[Модуль]]></string>
<string name="_adm_bp_txt_block_content_empty"><![CDATA[Текст-заполнитель для пустого блока]]></string>
<string name="_adm_bp_txt_block_designbox"><![CDATA[Отображение блока]]></string>
<string name="_adm_bp_txt_block_designbox_empty"><![CDATA[Выбрать отображение...]]></string>
<string name="_adm_bp_txt_block_class"><![CDATA[CSS класс]]></string>
Expand Down
1 change: 1 addition & 0 deletions studio/classes/BxDolStudioBuilderPageQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ function getBlocks($aParams, &$aItems, $bReturnCount = true)
`tpb`.`visible_for_levels` AS `visible_for_levels`,
`tpb`.`type` AS `type`,
`tpb`.`content` AS `content`,
`tpb`.`content_empty` AS `content_empty`,
`tpb`.`help` AS `help`,
`tpb`.`deletable` AS `deletable`,
`tpb`.`copyable` AS `copyable`,
Expand Down
10 changes: 10 additions & 0 deletions studio/template/scripts/BxBaseStudioBuilderPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,16 @@ protected function actionBlockEdit()
'pass' => 'Int',
)
),
'content_empty' => array(
'type' => 'text_translatable',
'name' => 'content_empty',
'caption' => _t('_adm_bp_txt_block_content_empty'),
'info' => _t('_adm_bp_dsc_block_content_empty'),
'value' => $aBlock['content_empty'],
'db' => array (
'pass' => 'Xss',
),
),
'help' => array(
'type' => 'textarea_translatable',
'name' => 'help',
Expand Down
7 changes: 6 additions & 1 deletion template/scripts/BxBasePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,12 @@ protected function _getBlockMenu ($aBlock)
*/
protected function _getBlockService ($aBlock)
{
return BxDolService::callSerialized($aBlock['content'], $this->_aMarkers);
$aMarkers = array_merge($this->_aMarkers, [
'block_id' => $aBlock['id'],
'content_empty' => $aBlock['content_empty']
]);

return BxDolService::callSerialized($aBlock['content'], $aMarkers);
}

/**
Expand Down
67 changes: 58 additions & 9 deletions template/scripts/BxBaseServiceProfiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,14 @@ public function serviceBrowseFriends ($iProfileId = 0, $aParams = [])
if(!empty($aParams['params']) && is_array($aParams['params']))
$aParamsBrowse = array_merge($aParamsBrowse, $aParams['params']);

return $this->_serviceBrowseConnections('friends', $aParamsBrowse, $aParams['design_box'], $aParams['empty_message'], $aParams['ajax_paginate']);
$sEmpty = !empty($aParams['empty_message_text']) ? _t($aParams['empty_message_text']) : '';
$bEmpty = (bool)$aParams['empty_message'];

$mixedResult = $this->_serviceBrowseConnections('friends', $aParamsBrowse, $aParams['design_box'], empty($sEmpty) ? $bEmpty : false, $aParams['ajax_paginate']);
if(empty($mixedResult) && $bEmpty)
$mixedResult = MsgBox($sEmpty);

return $mixedResult;
}

public function serviceBrowseFriendRequests ($iProfileId = 0, $aParams = [])
Expand All @@ -519,7 +526,14 @@ public function serviceBrowseFriendRequests ($iProfileId = 0, $aParams = [])
if(!empty($aParams['params']) && is_array($aParams['params']))
$aParamsBrowse = array_merge($aParamsBrowse, $aParams['params']);

return $this->_serviceBrowseConnections('friend_requests', $aParamsBrowse, $aParams['design_box'], $aParams['empty_message'], $aParams['ajax_paginate']);
$sEmpty = !empty($aParams['empty_message_text']) ? _t($aParams['empty_message_text']) : '';
$bEmpty = (bool)$aParams['empty_message'];

$mixedResult = $this->_serviceBrowseConnections('friend_requests', $aParamsBrowse, $aParams['design_box'], empty($sEmpty) ? $bEmpty : false, $aParams['ajax_paginate']);
if(empty($mixedResult) && $bEmpty)
$mixedResult = MsgBox($sEmpty);

return $mixedResult;
}

public function serviceBrowseFriendRequested ($iProfileId = 0, $aParams = [])
Expand All @@ -543,7 +557,14 @@ public function serviceBrowseFriendRequested ($iProfileId = 0, $aParams = [])
if(!empty($aParams['params']) && is_array($aParams['params']))
$aParamsBrowse = array_merge($aParamsBrowse, $aParams['params']);

return $this->_serviceBrowseConnections('friend_requested', $aParamsBrowse, $aParams['design_box'], $aParams['empty_message'], $aParams['ajax_paginate']);
$sEmpty = !empty($aParams['empty_message_text']) ? _t($aParams['empty_message_text']) : '';
$bEmpty = (bool)$aParams['empty_message'];

$mixedResult = $this->_serviceBrowseConnections('friend_requested', $aParamsBrowse, $aParams['design_box'], empty($sEmpty) ? $bEmpty : false, $aParams['ajax_paginate']);
if(empty($mixedResult) && $bEmpty)
$mixedResult = MsgBox($sEmpty);

return $mixedResult;
}

public function serviceBrowseSubscriptions ($iProfileId = 0, $aParams = [])
Expand All @@ -567,7 +588,14 @@ public function serviceBrowseSubscriptions ($iProfileId = 0, $aParams = [])
if(!empty($aParams['params']) && is_array($aParams['params']))
$aParamsBrowse = array_merge($aParamsBrowse, $aParams['params']);

return $this->_serviceBrowseConnections('subscriptions', $aParamsBrowse, $aParams['design_box'], $aParams['empty_message'], $aParams['ajax_paginate']);
$sEmpty = !empty($aParams['empty_message_text']) ? _t($aParams['empty_message_text']) : '';
$bEmpty = (bool)$aParams['empty_message'];

$mixedResult = $this->_serviceBrowseConnections('subscriptions', $aParamsBrowse, $aParams['design_box'], empty($sEmpty) ? $bEmpty : false, $aParams['ajax_paginate']);
if(empty($mixedResult) && $bEmpty)
$mixedResult = MsgBox($sEmpty);

return $mixedResult;
}

public function serviceBrowseSubscribedMe ($iProfileId = 0, $aParams = [])
Expand All @@ -591,7 +619,14 @@ public function serviceBrowseSubscribedMe ($iProfileId = 0, $aParams = [])
if(!empty($aParams['params']) && is_array($aParams['params']))
$aParamsBrowse = array_merge($aParamsBrowse, $aParams['params']);

return $this->_serviceBrowseConnections('subscribed_me', $aParamsBrowse, $aParams['design_box'], $aParams['empty_message'], $aParams['ajax_paginate']);
$sEmpty = !empty($aParams['empty_message_text']) ? _t($aParams['empty_message_text']) : '';
$bEmpty = (bool)$aParams['empty_message'];

$mixedResult = $this->_serviceBrowseConnections('subscribed_me', $aParamsBrowse, $aParams['design_box'], empty($sEmpty) ? $bEmpty : false, $aParams['ajax_paginate']);
if(empty($mixedResult) && $bEmpty)
$mixedResult = MsgBox($sEmpty);

return $mixedResult;
}

public function serviceBrowseMembers($iProfileId, $sObject, $aParams = [])
Expand All @@ -618,7 +653,14 @@ public function serviceBrowseMembers($iProfileId, $sObject, $aParams = [])
if(!empty($aParams['params']) && is_array($aParams['params']))
$aParamsBrowse = array_merge($aParamsBrowse, $aParams['params']);

return $this->_serviceBrowseConnections('members', $aParamsBrowse, $aParams['design_box'], $aParams['empty_message'], $aParams['ajax_paginate']);
$sEmpty = !empty($aParams['empty_message_text']) ? _t($aParams['empty_message_text']) : '';
$bEmpty = (bool)$aParams['empty_message'];

$mixedResult = $this->_serviceBrowseConnections('members', $aParamsBrowse, $aParams['design_box'], empty($sEmpty) ? $bEmpty : false, $aParams['ajax_paginate']);
if(empty($mixedResult) && $bEmpty)
$mixedResult = MsgBox($sEmpty);

return $mixedResult;
}

public function serviceBrowseConnections ($iProfileId = 0, $aParams = [])
Expand Down Expand Up @@ -648,7 +690,14 @@ public function serviceBrowseConnections ($iProfileId = 0, $aParams = [])
if(!empty($aParams['params']) && is_array($aParams['params']))
$aParamsBrowse = array_merge($aParamsBrowse, $aParams['params']);

return $this->_serviceBrowseConnections('connections', $aParamsBrowse, $aParams['design_box'], $aParams['empty_message'], $aParams['ajax_paginate']);
$sEmpty = !empty($aParams['empty_message_text']) ? _t($aParams['empty_message_text']) : '';
$bEmpty = (bool)$aParams['empty_message'];

$mixedResult = $this->_serviceBrowseConnections('connections', $aParamsBrowse, $aParams['design_box'], empty($sEmpty) ? $bEmpty : false, $aParams['ajax_paginate']);
if(empty($mixedResult) && $bEmpty)
$mixedResult = MsgBox($sEmpty);

return $mixedResult;
}

public function serviceBrowseRecommendationsFriends ($iProfileId = 0, $aParams = [])
Expand Down Expand Up @@ -690,7 +739,7 @@ public function serviceBrowseRecommendationsFriends ($iProfileId = 0, $aParams =

$sCode = $oRecommendation->getCode($iProfileId, $aParams['start'], $aParams['per_page']);
if(!$sCode && $aParams['empty_message'])
$sCode = MsgBox(_t('_Empty'));
$sCode = MsgBox(_t(!empty($aParams['empty_message_text']) ? $aParams['empty_message_text'] : '_Empty'));

return $sCode;
}
Expand Down Expand Up @@ -734,7 +783,7 @@ public function serviceBrowseRecommendationsSubscriptions ($iProfileId = 0, $aPa

$sCode = $oRecommendation->getCode($iProfileId, $aParams['start'], $aParams['per_page']);
if(!$sCode && $aParams['empty_message'])
$sCode = MsgBox(_t('_Empty'));
$sCode = MsgBox(_t(!empty($aParams['empty_message_text']) ? $aParams['empty_message_text'] : '_Empty'));

return $sCode;
}
Expand Down

0 comments on commit 26e0ec9

Please sign in to comment.