1
0
Эх сурвалжийг харах

Ticket #623 - Notifications for Timeline post.

AntonLV 9 жил өмнө
parent
commit
5faee5d565

+ 2 - 0
modules/boonex/russian/data/langs/bx_timeline/ru.xml

@@ -146,6 +146,8 @@
 	<string name="_bx_timeline_txt_sample_ext"><![CDATA[сообщение в ленте]]></string>
 	<string name="_bx_timeline_txt_sample_comment_single"><![CDATA[комментарий к сообщению в ленте]]></string>
 	<string name="_bx_timeline_txt_sample_vote_single"><![CDATA[голос за сообщение в ленте]]></string>
+	<string name="_bx_timeline_ntfs_txt_object_added"><![CDATA[<a class="bx-ntfs-content-profile" href="{owner_link}">{owner_name}</a> добавил <a href="{entry_url}">новое {entry_sample}{entry_caption}</a>]]></string>
+	<string name="_bx_timeline_ntfs_txt_object_caption"> '{0}'</string>
     <string name="_bx_timeline_txt_today"><![CDATA[Сегодня]]></string>
 
 	<string name="_bx_timeline_txt_do_repost"><![CDATA[Сделать репост]]></string>

+ 7 - 0
modules/boonex/timeline/classes/BxTimelineConfig.php

@@ -17,6 +17,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
 
     protected $_iRssLength;
     protected $_iCharsDisplayMax;
+    protected $_iCharsDisplayMaxSnippet;
 
     protected $_sStorageObject;
     protected $_sTranscoderObjectPreview;
@@ -180,6 +181,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
 
         $this->_iRssLength = (int)getParam($sOptionPrefix . 'rss_length');
         $this->_iCharsDisplayMax = (int)getParam($sOptionPrefix . 'chars_display_max');
+        $this->_iCharsDisplayMaxSnippet = 20;
     }
 
     public function isAllowDelete()
@@ -213,6 +215,11 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
         return $this->_iCharsDisplayMax;
     }
 
+    public function getCharsDisplayMaxSnippet()
+    {
+        return $this->_iCharsDisplayMaxSnippet;
+    }
+
     public function getRepostDefaults()
     {
         return $this->_aRepostDefaults;

+ 5 - 3
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -474,14 +474,16 @@ class BxTimelineModule extends BxBaseModNotificationsModule
         if(empty($aContent) || !is_array($aContent))
             return array();
 
-        $sEntryCaption = !empty($aContent['title']) ? $aContent['title'] : strmaxtextlen($aContent['description'], 20, '...');
+        $sEntryCaption = !empty($aContent['description']) ? strmaxtextlen($aContent['description'], $this->_oConfig->getCharsDisplayMaxSnippet(), '...') : '';
+        if(!empty($sEntryCaption))
+            $sEntryCaption = _t('_bx_timeline_ntfs_txt_object_caption', $sEntryCaption);
 
 		return array(
 			'entry_sample' => $CNF['T']['txt_sample_single_ext'],
 			'entry_url' => $this->_oConfig->getItemViewUrl($aContent),
 			'entry_caption' => $sEntryCaption,
 			'entry_author' => $aContent['owner_id'],
-			'lang_key' => '', //may be empty or not specified. In this case the default one from Notification module will be used.
+			'lang_key' => '_bx_timeline_ntfs_txt_object_added', //may be empty or not specified. In this case the default one from Notification module will be used.
 		);
     }
 
@@ -700,7 +702,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule
             if(!$bText && !$bLinkIds && !$bPhotoIds && !$bVideoIds)
             	return array('msg' => _t('_bx_timeline_txt_err_empty_post'));
 
-            $sTitle = _t('_bx_timeline_txt_user_added_sample', $sUserName, _t('_bx_timeline_txt_sample'));
+            $sTitle = _t('_bx_timeline_txt_user_added_sample', $sUserName, _t('_bx_timeline_txt_sample_with_article'));
             $sDescription = $bText ? $sText : '';
 
             $iId = $oForm->insert(array(

+ 2 - 2
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -1100,8 +1100,8 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
             'votes' => '',
             'reports' => '',
             'comments' => '',
-            'title' => '', //may be empty.
-            'description' => '' //may be empty.
+            'title' => $aEvent['title'], //may be empty.
+            'description' => $aEvent['description'] //may be empty.
         );
 
         switch($sType) {

+ 2 - 0
modules/boonex/timeline/install/langs/en.xml

@@ -146,6 +146,8 @@
 	<string name="_bx_timeline_txt_sample_ext"><![CDATA[timeline post]]></string>
 	<string name="_bx_timeline_txt_sample_comment_single"><![CDATA[timeline post's comment]]></string>
     <string name="_bx_timeline_txt_sample_vote_single"><![CDATA[timeline post's vote]]></string>
+    <string name="_bx_timeline_ntfs_txt_object_added"><![CDATA[<a class="bx-ntfs-content-profile" href="{owner_link}">{owner_name}</a> added <a href="{entry_url}">a new {entry_sample}{entry_caption}</a>]]></string>
+    <string name="_bx_timeline_ntfs_txt_object_caption"> '{0}'</string>
     <string name="_bx_timeline_txt_today"><![CDATA[Today]]></string>
 
 	<string name="_bx_timeline_txt_do_repost"><![CDATA[Repost]]></string>