Przeglądaj źródła

Ticket #4388 - In "Create post" form in Context, add variable to block title.

AntonLV 1 rok temu
rodzic
commit
bac7c4ff00

+ 1 - 1
modules/boonex/english/data/langs/system/en.xml

@@ -3569,7 +3569,7 @@ If it is not enabled then please consider implement this optimization, since it
     <string name="_sys_page_block_title_sys_create_post"><![CDATA[Create Post]]></string>
     <string name="_sys_page_block_title_create_post"><![CDATA[Add new...]]></string>
     <string name="_sys_page_block_title_sys_create_post_context"><![CDATA[Create Post (Context)]]></string>
-    <string name="_sys_page_block_title_create_post_context"><![CDATA[Add new...]]></string>
+    <string name="_sys_page_block_title_create_post_context"><![CDATA[Post to {display_name}]]></string>
     <string name="_sys_page_block_title_sys_create_post_public"><![CDATA[Create Post (Public)]]></string>
     <string name="_sys_page_block_title_create_post_public"><![CDATA[Add new...]]></string>
     <string name="_sys_page_block_title_dashboard"><![CDATA[Dashboard]]></string>

+ 1 - 1
modules/boonex/russian/data/langs/system/ru.xml

@@ -3530,7 +3530,7 @@
         <string name="_sys_page_block_title_sys_create_post"><![CDATA[Создать публикацию]]></string>
 	<string name="_sys_page_block_title_create_post"><![CDATA[Добавить...]]></string>
 	<string name="_sys_page_block_title_sys_create_post_context"><![CDATA[Создать публикацию (в контекст)]]></string>
-	<string name="_sys_page_block_title_create_post_context"><![CDATA[Добавить...]]></string>
+	<string name="_sys_page_block_title_create_post_context"><![CDATA[Опубликовать в контексте: {display_name}]]></string>
 	<string name="_sys_page_block_title_sys_create_post_public"><![CDATA[Создать публикацию (публично)]]></string>
 	<string name="_sys_page_block_title_create_post_public"><![CDATA[Добавить...]]></string>
 	<string name="_sys_page_block_title_dashboard"><![CDATA[Панель]]></string>

+ 16 - 3
template/scripts/BxBaseServices.php

@@ -697,12 +697,25 @@ class BxBaseServices extends BxDol implements iBxDolProfileService
     	}
     	$oMenu->setSelected($sDefault, $sDefault);
 
+        $oContext = false;
         $bContext = $mixedContextId !== false;
-        if($bContext && ($aContextInfo = BxDolProfileQuery::getInstance()->getInfoById(abs($mixedContextId))))
-            if(bx_srv($aContextInfo['type'], 'check_allowed_post_in_profile', [$aContextInfo['content_id'], $sDefault]) !== CHECK_ACTION_RESULT_ALLOWED)
+        if($bContext && ($oContext = BxDolProfile::getInstance(abs($mixedContextId))) !== false)
+            if(bx_srv($oContext->getModule(), 'check_allowed_post_in_profile', [$oContext->getContentId(), $sDefault]) !== CHECK_ACTION_RESULT_ALLOWED)
                 return '';
 
-        $sTitle = _t('_sys_page_block_title_create_post' . (!$bContext ? '_public' : ($mixedContextId < 0 ? '_context' : '')));
+        $sTitle = '_sys_page_block_title_create_post';
+        if(!$bContext)
+            $sTitle = _t($sTitle . '_public');
+        else if($mixedContextId < 0) {
+            $sTitle = _t($sTitle . '_context');
+            if($oContext)
+                $sTitle = bx_replace_markers($sTitle, [
+                    'display_name' => $oContext->getDisplayName()
+                ]);
+        }
+        else
+            $sTitle = _t($sTitle);
+
         $sPlaceholder = _t('_sys_txt_create_post_placeholder', $oProfile->getDisplayName());
 
         $oDbModules = BxDolModuleQuery::getInstance();