Răsfoiți Sursa

Ticket #3954 - Timeline: Add possibility to use 'Repost With' and 'Repost To' actions on view content pages.

AntonLV 4 ani în urmă
părinte
comite
a5f0d7f0fc

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

@@ -370,6 +370,8 @@
     <string name="_bx_timeline_txt_new_content"><![CDATA[Новый контент]]></string>
 
     <string name="_bx_timeline_txt_do_repost"><![CDATA[Сделать репост]]></string>
+    <string name="_bx_timeline_txt_do_repost_with"><![CDATA[Сделать репост с текстом]]></string>
+    <string name="_bx_timeline_txt_do_repost_to"><![CDATA[Сделать репост в контекст]]></string>
     <string name="_bx_timeline_txt_repost_counter"><![CDATA[{0}]]></string>
     <string name="_bx_timeline_txt_reposted"><![CDATA[Сделал репост {0} {1}.]]></string>
     <string name="_bx_timeline_txt_reposted_by"><![CDATA[Сделал репост]]></string>

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

@@ -334,6 +334,8 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
         );
 
         $this->_aRepostDefaults = array(
+            'do' => 'repost',
+
             'show_do_repost_as_button' => false,
             'show_do_repost_as_button_small' => false,
             'show_do_repost_image' => false,
@@ -350,12 +352,18 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
 
             //--- Images
             'image_do_repost' => '',
+            'image_do_repost_with' => '',
+            'image_do_repost_to' => '',
 
             //--- Icons
             'icon_do_repost' => 'sync-alt',
+            'icon_do_repost_with' => 'sync-alt',
+            'icon_do_repost_to' => 'sync-alt',
 
             //--- Texts
             'text_do_repost' => '_bx_timeline_txt_do_repost',
+            'text_do_repost_with' => '_bx_timeline_txt_do_repost_with',
+            'text_do_repost_to' => '_bx_timeline_txt_do_repost_to',
 
             //--- Templates
             'template_do_repost_label' => '',

+ 12 - 7
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -1012,7 +1012,8 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
         $sStylePrefix = $this->_oConfig->getPrefix('style');
         $sStylePrefixRepost = $sStylePrefix . '-repost-';
 
-        $bDynamicMode = isset($aParams['dynamic_mode']) && $aParams['dynamic_mode'] === true;
+        $sDo = isset($aParams['do']) ? $aParams['do'] : 'repost';
+        $bDynamicMode = isset($aParams['dynamic_mode']) && $aParams['dynamic_mode'] === true;       
 
         $bShowDoRepostAsButtonSmall = isset($aParams['show_do_repost_as_button_small']) && $aParams['show_do_repost_as_button_small'] == true;
         $bShowDoRepostAsButton = !$bShowDoRepostAsButtonSmall && isset($aParams['show_do_repost_as_button']) && $aParams['show_do_repost_as_button'] == true;
@@ -1031,20 +1032,24 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
 
         $sOnClick = '';
         if(!$bDisabled) {
+            $sMethod = '_get' . bx_gen_method_name($sDo) . 'JsClick';
+            if(!method_exists($this, $sMethod))
+                $sMethod = '_getRepostJsClick';
+
             $sCommonPrefix = $this->_oConfig->getPrefix('common_post');
             if(str_replace($sCommonPrefix, '', $sType) == BX_TIMELINE_PARSE_TYPE_REPOST) {
                 $aRepostedData = unserialize($aReposted['content']);
 
-                $sOnClick = $this->_getRepostJsClick($iOwnerId, $aRepostedData['type'], $aRepostedData['action'], $aRepostedData['object_id']);
+                $sOnClick = $this->$sMethod($iOwnerId, $aRepostedData['type'], $aRepostedData['action'], $aRepostedData['object_id']);
             }
             else
-                $sOnClick = $this->_getRepostJsClick($iOwnerId, $sType, $sAction, $iObjectId);
+                $sOnClick = $this->$sMethod($iOwnerId, $sType, $sAction, $iObjectId);
         }
         else
             $sClass .= $bShowDoRepostAsButton || $bShowDoRepostAsButtonSmall ? ' bx-btn-disabled' : ' ' . $sStylePrefixRepost . 'disabled';
 
         $aOnClickAttrs = array(
-            'title' => _t('_bx_timeline_txt_do_repost')
+            'title' => _t('_bx_timeline_txt_do_' . $sDo)
         );
         if(!empty($sClass))
             $aOnClickAttrs['class'] = $sClass;
@@ -1069,21 +1074,21 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
                 'condition' => $bShowDoRepostImage,
                 'content' => array(
                     'style_prefix' => $sStylePrefix,
-                    'src' => $this->getIconUrl($aParams['image_do_repost'])
+                    'src' => $this->getIconUrl($aParams['image_do_' . $sDo])
                 )
             ),
             'bx_if:show_icon' => array(
                 'condition' => $bShowDoRepostIcon,
                 'content' => array(
                     'style_prefix' => $sStylePrefix,
-                    'name' => $aParams['icon_do_repost']
+                    'name' => $aParams['icon_do_' . $sDo]
                 )
             ),
             'bx_if:show_text' => array(
                 'condition' => $bShowDoRepostText,
                 'content' => array(
                     'style_prefix' => $sStylePrefix,
-                    'text' => _t($aParams['text_do_repost'])
+                    'text' => _t($aParams['text_do_' . $sDo])
                 )
             )
         ));

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

@@ -386,6 +386,8 @@
     <string name="_bx_timeline_txt_filters"><![CDATA[Filters]]></string>
 
     <string name="_bx_timeline_txt_do_repost"><![CDATA[Repost]]></string>
+    <string name="_bx_timeline_txt_do_repost_with"><![CDATA[Repost with Text]]></string>
+    <string name="_bx_timeline_txt_do_repost_to"><![CDATA[Repost to Context]]></string>
     <string name="_bx_timeline_txt_repost_counter"><![CDATA[{0}]]></string>
     <string name="_bx_timeline_txt_reposted"><![CDATA[Reposted {0}'s {1}.]]></string>
     <string name="_bx_timeline_txt_reposted_by"><![CDATA[Reposted by]]></string>