AntonLV 5 лет назад
Родитель
Сommit
df4b460d67

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

@@ -25,6 +25,10 @@
     <string name="_bx_timeline_option_rss_length"><![CDATA[Количество элементов в RSS-ленте]]></string>
     <string name="_bx_timeline_option_events_hide"><![CDATA[Показывать события]]></string>
     <string name="_bx_timeline_option_enable_brief_cards"><![CDATA[Включить лаконичные карточки]]></string>
+    <string name="_bx_timeline_option_videos_preload"><![CDATA[Предварительная загрузка для видео роликов]]></string>
+    <string name="_bx_timeline_option_videos_preload_auto"><![CDATA[Автоматически]]></string>
+    <string name="_bx_timeline_option_videos_preload_metadata"><![CDATA[Метаданные]]></string>
+    <string name="_bx_timeline_option_videos_preload_none"><![CDATA[Отключено]]></string>
     <string name="_bx_timeline_option_videos_autoplay"><![CDATA[Автоматически проигрывать видео ролики (доступно только для Ленты)]]></string>
     <string name="_bx_timeline_option_videos_autoplay_off"><![CDATA[Отключено]]></string>
     <string name="_bx_timeline_option_videos_autoplay_on_mute"><![CDATA[Включено (без звука)]]></string>

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

@@ -37,6 +37,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
 
     protected $_bBriefCards;
     protected $_aBriefCardsTags;
+    protected $_sVideosPreload;
     protected $_sVideosAutoplay;
     protected $_iPreloadComments;
     protected $_iPreloadCommentsMax;
@@ -160,6 +161,9 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
                 'grid_action_err_delete' => '_bx_timeline_grid_action_err_delete', 
                 'grid_txt_account_manager' => '_bx_timeline_grid_txt_account_manager',
                 'form_input_title_object_privacy_view' => '_bx_timeline_form_post_input_object_privacy_view',
+                'option_vp_auto' => '_bx_timeline_option_videos_preload_auto',
+                'option_vp_metadata' => '_bx_timeline_option_videos_preload_metadata',
+                'option_vp_none' => '_bx_timeline_option_videos_preload_none',
                 'option_vap_off' => '_bx_timeline_option_videos_autoplay_off',
                 'option_vap_on_mute' => '_bx_timeline_option_videos_autoplay_on_mute',
                 'option_vap_on' => '_bx_timeline_option_videos_autoplay_on',
@@ -369,6 +373,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
 
         $this->_bBriefCards = getParam($sOptionPrefix . 'enable_brief_cards') == 'on';
 
+        $this->_sVideosPreload = getParam($sOptionPrefix . 'videos_preload');
         $this->_sVideosAutoplay = getParam($sOptionPrefix . 'videos_autoplay');
 
         $this->_iPreloadCommentsMax = 7;
@@ -635,6 +640,11 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
         return !$bAsString ? $this->_aBriefCardsTags : '<' . implode('><', $this->_aBriefCardsTags) . '>';
     }
 
+    public function getVideosPreload()
+    {
+        return $this->_sVideosPreload;
+    }
+
     public function getVideosAutoplay()
     {
         return $this->_sVideosAutoplay;

+ 33 - 0
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -2490,6 +2490,39 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
         return 'BxTimelineFormCheckerHelper';
     }
 
+    /**
+     * @page service Service Calls
+     * @section bx_timeline Timeline
+     * @subsection bx_timeline-other Other
+     * @subsubsection bx_timeline-get_options_videos_preload get_options_videos_preload
+     * 
+     * @code bx_srv('bx_timeline', 'get_options_videos_preload', [...]); @endcode
+     * 
+     * Get an array with available options for 'Videos preload in Timeline' setting.
+     *
+     * @return an array with available options represented as key => value pairs.
+     * 
+     * @see BxTimelineModule::serviceGetOptionsVideosPreload
+     */
+    /** 
+     * @ref bx_timeline-get_options_videos_preload "get_options_videos_preload"
+     */
+    public function serviceGetOptionsVideosPreload()
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        $aOptions = array('auto', 'metadata', 'none');
+
+        $aResult = array();
+        foreach($aOptions as $sOption)
+            $aResult[] = array(
+                'key' => $sOption,
+                'value' => _t($CNF['T']['option_vp_' . $sOption])
+            );
+
+        return $aResult;
+    }
+
     /**
      * @page service Service Calls
      * @section bx_timeline Timeline

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

@@ -2507,7 +2507,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
                         'style_prefix' => $sStylePrefix,
                         'class' => '',
                         'item' => BxTemplFunctions::getInstance()->videoPlayer($aVideo['src_poster'], $aVideo['src_mp4'], $aVideo['src_mp4_hd'], array(
-                            'preload' => 'auto'
+                            'preload' => $this->_oConfig->getVideosPreload(),
                         ), '', $aBrowseParams['dynamic_mode'])
                     );
                 else {

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

@@ -25,6 +25,10 @@
     <string name="_bx_timeline_option_rss_length"><![CDATA[The length of RSS feed]]></string>
     <string name="_bx_timeline_option_events_hide"><![CDATA[Show events]]></string>
     <string name="_bx_timeline_option_enable_brief_cards"><![CDATA[Enable brief cards]]></string>
+    <string name="_bx_timeline_option_videos_preload"><![CDATA[Videos preload]]></string>
+    <string name="_bx_timeline_option_videos_preload_auto"><![CDATA[Auto]]></string>
+    <string name="_bx_timeline_option_videos_preload_metadata"><![CDATA[Metadata]]></string>
+    <string name="_bx_timeline_option_videos_preload_none"><![CDATA[Disabled]]></string>
     <string name="_bx_timeline_option_videos_autoplay"><![CDATA[Videos autoplay (for Timeline view only)]]></string>
     <string name="_bx_timeline_option_videos_autoplay_off"><![CDATA[Disabled]]></string>
     <string name="_bx_timeline_option_videos_autoplay_on_mute"><![CDATA[Enabled without sound]]></string>

+ 2 - 1
modules/boonex/timeline/install/sql/enable.sql

@@ -290,7 +290,8 @@ SET @iCategId = LAST_INSERT_ID();
 
 INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `check`, `check_params`, `check_error`, `extra`, `order`) VALUES
 ('bx_timeline_enable_brief_cards', '', @iCategId, '_bx_timeline_option_enable_brief_cards', 'checkbox', '', '', '', '', 2),
-('bx_timeline_videos_autoplay', 'off', @iCategId, '_bx_timeline_option_videos_autoplay', 'select', '', '', '', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:27:"get_options_videos_autoplay";}', 10),
+('bx_timeline_videos_preload', 'auto', @iCategId, '_bx_timeline_option_videos_preload', 'select', '', '', '', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:26:"get_options_videos_preload";}', 10),
+('bx_timeline_videos_autoplay', 'off', @iCategId, '_bx_timeline_option_videos_autoplay', 'select', '', '', '', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:27:"get_options_videos_autoplay";}', 11),
 ('bx_timeline_preload_comments', '0', @iCategId, '_bx_timeline_option_preload_comments', 'digit', '', '', '', '', 20),
 ('bx_timeline_attachments_layout', 'gallery', @iCategId, '_bx_timeline_option_attachments_layout', 'select', '', '', '', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:30:"get_options_attachments_layout";}', 30);