Explorar el Código

Ticket #2128 - Note #2 and the rest.

AntonLV hace 7 años
padre
commit
2ed00f179b
Se han modificado 29 ficheros con 323 adiciones y 165 borrados
  1. 55 1
      modules/base/general/classes/BxBaseModGeneralAlertsResponse.php
  2. 31 0
      modules/base/general/classes/BxBaseModGeneralDb.php
  3. 12 0
      modules/base/general/classes/BxBaseModGeneralFormEntry.php
  4. 2 4
      modules/base/text/classes/BxBaseModTextAlertsResponse.php
  5. 5 1
      modules/base/text/classes/BxBaseModTextFormsEntryHelper.php
  6. 17 1
      modules/base/text/classes/BxBaseModTextModule.php
  7. 5 0
      modules/boonex/albums/classes/BxAlbumsAlertsResponse.php
  8. 1 0
      modules/boonex/albums/classes/BxAlbumsConfig.php
  9. 4 1
      modules/boonex/albums/install/sql/enable.sql
  10. 1 1
      modules/boonex/albums/install/sql/install.sql
  11. 3 2
      modules/boonex/posts/classes/BxPostsConfig.php
  12. 7 9
      modules/boonex/posts/classes/BxPostsCronPublishing.php
  13. 0 17
      modules/boonex/posts/classes/BxPostsDb.php
  14. 0 19
      modules/boonex/posts/classes/BxPostsFormsEntryHelper.php
  15. 6 23
      modules/boonex/posts/classes/BxPostsModule.php
  16. 4 1
      modules/boonex/posts/install/sql/enable.sql
  17. 9 7
      modules/boonex/russian/data/langs/bx_timeline/ru.xml
  18. 13 5
      modules/boonex/timeline/classes/BxTimelineConfig.php
  19. 2 2
      modules/boonex/timeline/classes/BxTimelineCronPublishing.php
  20. 10 17
      modules/boonex/timeline/classes/BxTimelineDb.php
  21. 41 9
      modules/boonex/timeline/classes/BxTimelineFormPost.php
  22. 22 31
      modules/boonex/timeline/classes/BxTimelineModule.php
  23. 48 0
      modules/boonex/timeline/classes/BxTimelineResponse.php
  24. 7 5
      modules/boonex/timeline/install/langs/en.xml
  25. 4 1
      modules/boonex/timeline/install/sql/enable.sql
  26. 8 6
      modules/boonex/timeline/install/sql/install.sql
  27. 1 0
      modules/boonex/videos/classes/BxVideosConfig.php
  28. 4 1
      modules/boonex/videos/install/sql/enable.sql
  29. 1 1
      modules/boonex/videos/install/sql/install.sql

+ 55 - 1
modules/base/general/classes/BxBaseModGeneralAlertsResponse.php

@@ -25,7 +25,61 @@ class BxBaseModGeneralAlertsResponse extends BxDolAlertsResponse
         $CNF = $this->_oModule->_oConfig->CNF;
 
         if('system' == $oAlert->sUnit && 'save_setting' == $oAlert->sAction && isset($CNF['PARAM_SEARCHABLE_FIELDS']) && $CNF['PARAM_SEARCHABLE_FIELDS'] == $oAlert->aExtras['option'])
-            $this->_oModule->_oDb->alterFulltextIndex();
+            return $this->_oModule->_oDb->alterFulltextIndex();
+
+        $sKey = 'OBJECT_VIDEOS_TRANSCODERS';
+        if(!empty($CNF[$sKey]) && is_array($CNF[$sKey]) && in_array($oAlert->sUnit, $CNF[$sKey])  && $oAlert->sAction == 'transcoded')
+            return $this->_onVideoTranscoded($oAlert->iObject);
+    }
+
+    protected function _onVideoTranscoded($iGhostId, $aParams = array())
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        if(!isset($CNF['FIELD_STATUS']))
+            return;
+
+        $sStorage = ''; 
+        if(!empty($aParams['storage'])) 
+            $sStorage = $aParams['storage']; 
+        else if(!empty($CNF['OBJECT_STORAGE_VIDEOS']))
+            $sStorage = $CNF['OBJECT_STORAGE_VIDEOS'];
+        else
+            return;
+
+        $oStorage = BxDolStorage::getObjectInstance($sStorage);
+        if(!$oStorage)
+            return;
+
+        $aGhost = $oStorage->getGhost($iGhostId);
+        if(empty($aGhost) || !is_array($aGhost))
+            return;
+
+        $iContentId = (int)$aGhost['content_id'];
+        $aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
+        if(empty($aContentInfo) || !is_array($aContentInfo))
+            return;
+
+        if(!isset($aContentInfo[$CNF['FIELD_STATUS']]) || $aContentInfo[$CNF['FIELD_STATUS']] != 'awaiting')
+            return;
+        
+        $iNow = time();
+        if(isset($CNF['FIELD_PUBLISHED']) && isset($aContentInfo[$CNF['FIELD_PUBLISHED']]) && $aContentInfo[$CNF['FIELD_PUBLISHED']] > $iNow)
+            return;
+
+        $aTranscoders = array();
+        foreach($CNF['OBJECT_VIDEOS_TRANSCODERS'] as $sKey => $sTranscoder)
+            if(in_array($sKey, array('mp4', 'mp4_hd')))
+                $aTranscoders[$sTranscoder] = BxDolTranscoder::getObjectInstance($sTranscoder);
+
+        $aGhostsToCheck = $oStorage->getGhosts($aGhost['profile_id'], $iContentId);
+        foreach($aGhostsToCheck as $aGhostToCheck)
+            foreach($aTranscoders as $sTranscoder => $oTranscoder)
+                if(!$oTranscoder->isFileReady($aGhostToCheck['id']))
+                    return;
+
+        if((int)$this->_oModule->_oDb->updateEntriesBy(array($CNF['FIELD_STATUS'] => 'active'), array($CNF['FIELD_ID'] => $iContentId)) > 0)
+            $this->_oModule->onPublished($iContentId);
     }
 }
 

+ 31 - 0
modules/base/general/classes/BxBaseModGeneralDb.php

@@ -94,6 +94,37 @@ class BxBaseModGeneralDb extends BxDolModuleDb
         $sQuery = $this->prepare ("SELECT COUNT(*) FROM `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` WHERE `" . $this->_oConfig->CNF['FIELD_AUTHOR'] . "` = ?", $iProfileId);
         return $this->getOne($sQuery);
     }
+    
+    public function updateEntriesBy($aParamsSet, $aParamsWhere)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        if(empty($CNF['TABLE_ENTRIES']) || empty($aParamsSet) || empty($aParamsWhere))
+            return false;
+
+        return $this->query("UPDATE `" . $CNF['TABLE_ENTRIES'] . "` SET " . $this->arrayToSQL($aParamsSet) . " WHERE " . $this->arrayToSQL($aParamsWhere, " AND "));
+    }
+
+    public function publishEntries()
+    {
+        $CNF = $this->_oConfig->CNF;
+
+        $aEntries = $this->getAll("SELECT `id`, `" . $CNF['FIELD_PUBLISHED'] . "`, FROM_UNIXTIME(`" . $CNF['FIELD_PUBLISHED'] . "`)  FROM `" . $CNF['TABLE_ENTRIES'] . "` WHERE `" . $CNF['FIELD_PUBLISHED'] . "` > `" . $CNF['FIELD_ADDED'] . "` AND `" . $CNF['FIELD_STATUS'] . "` = 'awaiting'");
+        if(empty($aEntries) || !is_array($aEntries))
+            return false;
+
+        $iNow = time();
+        $aResult = array();
+        foreach($aEntries as $aEntry)
+            if($aEntry[$CNF['FIELD_PUBLISHED']] <= $iNow) 
+                $aResult[] = $aEntry[$CNF['FIELD_ID']];
+
+        $sSet = "`" . $CNF['FIELD_ADDED'] . "`=`" . $CNF['FIELD_PUBLISHED'] . "`, `" . $CNF['FIELD_STATUS'] . "` = 'active'";
+        if(isset($CNF['FIELD_CHANGED']))
+            $sSet .= ", `" . $CNF['FIELD_CHANGED'] . "`=`" . $CNF['FIELD_PUBLISHED'] . "`";
+
+        return count($aResult) == (int)$this->query("UPDATE `" . $CNF['TABLE_ENTRIES'] . "` SET " . $sSet . " WHERE `id` IN (" . $this->implode_escape($aResult) . ")") ? $aResult : false;
+    }
 
     public function alterFulltextIndex ()
     {

+ 12 - 0
modules/base/general/classes/BxBaseModGeneralFormEntry.php

@@ -130,6 +130,18 @@ class BxBaseModGeneralFormEntry extends BxTemplFormView
                 $aValsToAdd[$CNF['FIELD_THUMB']] = $iFileThumb;
         }
         
+        if(isset($CNF['FIELD_STATUS']) && !empty($CNF['FIELDS_DELAYED_PROCESSING'])) {
+            $aFields = $CNF['FIELDS_DELAYED_PROCESSING'];
+            if(is_string($aFields))
+                $aFields = explode(',', $aFields);
+
+            foreach($aFields as $sField) {
+                $mixedFieldValues = $this->getCleanValue($sField);
+                if(!empty($mixedFieldValues))
+                    $aValsToAdd[$CNF['FIELD_STATUS']] = 'awaiting';
+            }
+        }
+
         return parent::insert ($aValsToAdd, $isIgnore);
     }
 

+ 2 - 4
modules/base/text/classes/BxBaseModTextAlertsResponse.php

@@ -15,10 +15,8 @@ class BxBaseModTextAlertsResponse extends BxBaseModGeneralAlertsResponse
     {
         parent::response($oAlert);
 
-        if ('profile' != $oAlert->sUnit || 'delete' != $oAlert->sAction || !isset($oAlert->aExtras['delete_with_content']) || !$oAlert->aExtras['delete_with_content'])
-            return;
-
-        BxDolService::call($this->MODULE, 'delete_entities_by_author', array($oAlert->iObject));
+        if($oAlert->sUnit == 'profile' && $oAlert->sAction == 'delete' && !empty($oAlert->aExtras['delete_with_content']))
+            return BxDolService::call($this->MODULE, 'delete_entities_by_author', array($oAlert->iObject));
     }
 }
 

+ 5 - 1
modules/base/text/classes/BxBaseModTextFormsEntryHelper.php

@@ -142,7 +142,11 @@ class BxBaseModTextFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
                 'field' => 'owner_id'
             );
 
-        bx_alert($this->_oModule->getName(), 'added', $iId, false, $aParams);
+        $sAction = 'added';
+        if(isset($CNF['FIELD_STATUS']) && isset($aContentInfo[$CNF['FIELD_STATUS']]) && $aContentInfo[$CNF['FIELD_STATUS']] == 'awaiting')
+            $sAction = 'scheduled';
+
+        bx_alert($this->_oModule->getName(), $sAction, $iId, $iAuthorId, $aParams);
     }
 
     protected function _alertAfterEdit($aContentInfo)

+ 17 - 1
modules/base/text/classes/BxBaseModTextModule.php

@@ -266,7 +266,23 @@ class BxBaseModTextModule extends BxBaseModGeneralModule implements iBxDolConten
     }
 
     // ====== COMMON METHODS
-    
+    public function onPublished($iContentId)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
+        if(!$aContentInfo)
+            return MsgBox(_t('_sys_txt_error_occured'));
+
+        $aParams = array('object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]);
+        if(isset($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]))
+            $aParams['privacy_view'] = $aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']];
+
+        bx_alert($this->getName(), 'added', $iContentId, $aContentInfo[$CNF['FIELD_AUTHOR']], $aParams);
+
+        return '';
+    }
+
     public function isEntryActive($aContentInfo)
     {
         $CNF = &$this->_oConfig->CNF;

+ 5 - 0
modules/boonex/albums/classes/BxAlbumsAlertsResponse.php

@@ -24,6 +24,11 @@ class BxAlbumsAlertsResponse extends BxBaseModTextAlertsResponse
 
         parent::response($oAlert);
     }
+
+    protected function _onVideoTranscoded($iGhostId, $aParams = array())
+    {
+        return parent::_onVideoTranscoded($iGhostId, array('storage' => $this->_oModule->_oConfig->CNF['OBJECT_STORAGE']));
+    }
 }
 
 /** @} */

+ 1 - 0
modules/boonex/albums/classes/BxAlbumsConfig.php

@@ -50,6 +50,7 @@ class BxAlbumsConfig extends BxBaseModTextConfig
             'FIELD_LOCATION_PREFIX' => 'location',
             'FIELD_LABELS' => 'labels',
             'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
+            'FIELDS_DELAYED_PROCESSING' => 'pictures', // can be array of fields or comma separated string of field names
 
             // page URIs
             'URI_VIEW_ENTRY' => 'view-album',

+ 4 - 1
modules/boonex/albums/install/sql/enable.sql

@@ -504,5 +504,8 @@ SET @iHandler := LAST_INSERT_ID();
 
 INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 ('system', 'save_setting', @iHandler),
+('profile', 'delete', @iHandler),
+
 ('bx_albums_files', 'file_deleted', @iHandler),
-('profile', 'delete', @iHandler);
+('bx_albums_video_mp4', 'transcoded', @iHandler),
+('bx_albums_video_mp4_hd', 'transcoded', @iHandler);

+ 1 - 1
modules/boonex/albums/install/sql/install.sql

@@ -21,7 +21,7 @@ CREATE TABLE IF NOT EXISTS `bx_albums_albums` (
   `reports` int(11) NOT NULL default '0',
   `featured` int(11) NOT NULL default '0',
   `allow_view_to` varchar(16) NOT NULL DEFAULT '3',
-  `status` enum('active','hidden') NOT NULL DEFAULT 'active',
+  `status` enum('active','awaiting','hidden') NOT NULL DEFAULT 'active',
   `status_admin` enum('active','hidden') NOT NULL DEFAULT 'active',
   PRIMARY KEY (`id`),
   FULLTEXT KEY `title_text` (`title`,`text`)

+ 3 - 2
modules/boonex/posts/classes/BxPostsConfig.php

@@ -54,9 +54,10 @@ class BxPostsConfig extends BxBaseModTextConfig
             'FIELD_LOCATION_PREFIX' => 'location',
             'FIELD_LABELS' => 'labels',
             'FIELD_ANONYMOUS' => 'anonymous',
-            'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
             'FIELD_DISABLE_COMMENTS' => 'disable_comments',
-            
+            'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
+            'FIELDS_DELAYED_PROCESSING' => 'videos', // can be array of fields or comma separated string of field names
+
             // page URIs
             'URI_VIEW_ENTRY' => 'view-post',
             'URI_AUTHOR_ENTRIES' => 'posts-author',

+ 7 - 9
modules/boonex/posts/classes/BxPostsCronPublishing.php

@@ -9,14 +9,12 @@
  * @{
  */
 
-require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
-
 class BxPostsCronPublishing extends BxDolCron
 {
-	protected $_sModule;
-	protected $_oModule;
+    protected $_sModule;
+    protected $_oModule;
 
-	public function __construct()
+    public function __construct()
     {
         parent::__construct();
 
@@ -26,12 +24,12 @@ class BxPostsCronPublishing extends BxDolCron
 
     function processing()
     {
-        $mixedIds = $this->_oModule->_oDb->publish();
+        $mixedIds = $this->_oModule->_oDb->publishEntries();
         if($mixedIds === false)
-        	return;
+            return;
 
-		foreach($mixedIds as $iId)
-        	$this->_oModule->onPublished($iId);
+        foreach($mixedIds as $iId)
+            $this->_oModule->onPublished($iId);
     }
 }
 

+ 0 - 17
modules/boonex/posts/classes/BxPostsDb.php

@@ -18,23 +18,6 @@ class BxPostsDb extends BxBaseModTextDb
     {
         parent::__construct($oConfig);
     }
-
-    public function publish()
-    {
-        $CNF = $this->_oConfig->CNF;
-
-        $aEntries = $this->getAll("SELECT `id`, `" . $CNF['FIELD_PUBLISHED'] . "`, from_unixtime(`" . $CNF['FIELD_PUBLISHED'] . "`)  FROM `" . $CNF['TABLE_ENTRIES'] . "` WHERE `" . $CNF['FIELD_STATUS'] . "` = 'awaiting'");
-        if(empty($aEntries) || !is_array($aEntries))
-            return false;
-
-        $iNow = time();
-        $aResult = array();
-        foreach($aEntries as $aEntry)
-            if($aEntry[$CNF['FIELD_PUBLISHED']] <= $iNow) 
-                $aResult[] = $aEntry[$CNF['FIELD_ID']];
-
-        return count($aResult) == (int)$this->query("UPDATE `" . $CNF['TABLE_ENTRIES'] . "` SET `" . $CNF['FIELD_ADDED'] . "`=`" . $CNF['FIELD_PUBLISHED'] . "`, `" . $CNF['FIELD_CHANGED'] . "`=`" . $CNF['FIELD_PUBLISHED'] . "`, `" . $CNF['FIELD_STATUS'] . "` = 'active' WHERE `id` IN (" . $this->implode_escape($aResult) . ")") ? $aResult : false;
-    }
 }
 
 /** @} */

+ 0 - 19
modules/boonex/posts/classes/BxPostsFormsEntryHelper.php

@@ -18,25 +18,6 @@ class BxPostsFormsEntryHelper extends BxBaseModTextFormsEntryHelper
     {
         parent::__construct($oModule);
     }
-
-    protected function _alertAfterAdd($aContentInfo)
-    {
-        $CNF = &$this->_oModule->_oConfig->CNF;
-
-        $iId = (int)$aContentInfo[$CNF['FIELD_ID']];
-        $iAuthorId = (int)$aContentInfo[$CNF['FIELD_AUTHOR']];
-
-        $aParams = array('object_author_id' => $iAuthorId);
-        if(isset($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]))
-            $aParams['privacy_view'] = $aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']];
-        if(!empty($CNF['OBJECT_METATAGS']))
-            $aParams['timeline_group'] = array(
-                'by' => $this->_oModule->_oConfig->getName() . '_' . $iAuthorId . '_' . $iId,
-                'field' => 'owner_id'
-            );
-
-        bx_alert($this->_oModule->getName(), ($aContentInfo[$CNF['FIELD_STATUS']] == 'awaiting' ? 'scheduled' : 'added'), $iId, $iAuthorId, $aParams);
-    }
 }
 
 /** @} */

+ 6 - 23
modules/boonex/posts/classes/BxPostsModule.php

@@ -42,29 +42,12 @@ class BxPostsModule extends BxBaseModTextModule
         return $aResult;
     }
 
-    public function onPublished($iContentId)
+    public function serviceCheckAllowedCommentsPost($iContentId, $sObjectComments) 
     {
         $CNF = &$this->_oConfig->CNF;
-
         $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
-        if(!$aContentInfo)
-            return MsgBox(_t('_sys_txt_error_occured'));
-
-        $aParams = array('object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]);
-        if(isset($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]))
-            $aParams['privacy_view'] = $aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']];
-
-        bx_alert($this->getName(), 'added', $iContentId, $aContentInfo[$CNF['FIELD_AUTHOR']], $aParams);
-
-        return '';
-    }
-    
-    public function serviceCheckAllowedCommentsPost($iContentId, $sObjectComments) 
-    {
-		$CNF = &$this->_oConfig->CNF;
-		$aContentInfo = $this->_oDb->getContentInfoById($iContentId);
-		if ($aContentInfo[$CNF['FIELD_DISABLE_COMMENTS']] == 1)
-			return false;
+        if ($aContentInfo[$CNF['FIELD_DISABLE_COMMENTS']] == 1)
+            return false;
 
         return parent::serviceCheckAllowedCommentsPost($iContentId, $sObjectComments);
     }
@@ -72,9 +55,9 @@ class BxPostsModule extends BxBaseModTextModule
 	public function serviceCheckAllowedCommentsView($iContentId, $sObjectComments) 
     {
         $CNF = &$this->_oConfig->CNF;
-		$aContentInfo = $this->_oDb->getContentInfoById($iContentId);
-		if ($aContentInfo[$CNF['FIELD_DISABLE_COMMENTS']] == 1)
-			return false;
+        $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
+        if ($aContentInfo[$CNF['FIELD_DISABLE_COMMENTS']] == 1)
+            return false;
 
         return parent::serviceCheckAllowedCommentsView($iContentId, $sObjectComments);
     }

+ 4 - 1
modules/boonex/posts/install/sql/enable.sql

@@ -476,7 +476,10 @@ SET @iHandler := LAST_INSERT_ID();
 
 INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 ('system', 'save_setting', @iHandler),
-('profile', 'delete', @iHandler);
+('profile', 'delete', @iHandler),
+
+('bx_posts_videos_mp4', 'transcoded', @iHandler),
+('bx_posts_videos_mp4_hd', 'transcoded', @iHandler);
 
 
 -- CRON

+ 9 - 7
modules/boonex/russian/data/langs/bx_timeline/ru.xml

@@ -34,16 +34,18 @@
 	<string name="_bx_timeline_form_post_display_edit"><![CDATA[Изменить сообщение]]></string>
 	<string name="_bx_timeline_form_post_input_sys_owner_id"><![CDATA[ID владельца]]></string>
 	<string name="_bx_timeline_form_post_input_owner_id_own"><![CDATA[Собственный профиль]]></string>
-    <string name="_bx_timeline_form_post_input_owner_id_following_group"><![CDATA[{0}]]></string>
+        <string name="_bx_timeline_form_post_input_owner_id_following_group"><![CDATA[{0}]]></string>
 	<string name="_bx_timeline_form_post_input_sys_action"><![CDATA[Действие]]></string>
 	<string name="_bx_timeline_form_post_input_sys_type"><![CDATA[Тип]]></string>
 	<string name="_bx_timeline_form_post_input_sys_text"><![CDATA[Содержимое]]></string>
 	<string name="_bx_timeline_form_post_input_text"><![CDATA[]]></string>
-    <string name="_bx_timeline_form_post_input_sys_object_privacy_view"><![CDATA[Видимость]]></string>
-    <string name="_bx_timeline_form_post_input_object_privacy_view"><![CDATA[Видимость]]></string>
-    <string name="_bx_timeline_form_post_input_sys_date"><![CDATA[Опубликовать]]></string>
-    <string name="_bx_timeline_form_post_input_date"><![CDATA[Опубликовать]]></string>
-    <string name="_bx_timeline_form_post_input_date_info"><![CDATA[Оставьте пустым, чтобы опубликовать немедленно.]]></string>
+        <string name="_bx_timeline_form_post_input_sys_object_privacy_view"><![CDATA[Видимость]]></string>
+        <string name="_bx_timeline_form_post_input_object_privacy_view"><![CDATA[Видимость]]></string>
+        <string name="_bx_timeline_form_post_input_sys_date"><![CDATA[Создано]]></string>
+        <string name="_bx_timeline_form_post_input_date"><![CDATA[Создано]]></string>
+        <string name="_bx_timeline_form_post_input_sys_date_published"><![CDATA[Опубликовать]]></string>
+        <string name="_bx_timeline_form_post_input_date_published"><![CDATA[Опубликовать]]></string>
+        <string name="_bx_timeline_form_post_input_date_published_info"><![CDATA[Оставьте пустым, чтобы опубликовать немедленно.]]></string>
 	<string name="_bx_timeline_form_post_input_sys_link"><![CDATA[Ссылка]]></string>
 	<string name="_bx_timeline_form_post_input_link_alt"><![CDATA[Добавить ссылку]]></string>
 	<string name="_bx_timeline_form_post_input_link_err_delete"><![CDATA[Невозможно удалить ссылку. Пожалуйста, оповестите нас о проблеме.]]></string>
@@ -57,7 +59,7 @@
 	<string name="_bx_timeline_form_post_input_sys_do_submit"><![CDATA[Создать]]></string>
 	<string name="_bx_timeline_form_post_input_do_submit"><![CDATA[Создать]]></string>
 	<string name="_bx_timeline_form_post_input_sys_do_cancel"><![CDATA[Отмена]]></string>
-    <string name="_bx_timeline_form_post_input_do_cancel"><![CDATA[Отмена]]></string>
+        <string name="_bx_timeline_form_post_input_do_cancel"><![CDATA[Отмена]]></string>
 
 	<string name="_bx_timeline_form_attach_link"><![CDATA[Прикрепить ссылку]]></string>
 	<string name="_bx_timeline_form_attach_link_display_add"><![CDATA[Прикрепить ссылку]]></string>

+ 13 - 5
modules/boonex/timeline/classes/BxTimelineConfig.php

@@ -72,6 +72,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
             'FIELD_OBJECT_ID' => 'object_id', //Note. For 'Direct Timeline Posts' this field contains post's author profile ID.
             'FIELD_OBJECT_PRIVACY_VIEW' => 'object_privacy_view',
             'FIELD_ADDED' => 'date',
+            'FIELD_PUBLISHED' => 'published',
             'FIELD_TITLE' => 'title',
             'FIELD_TEXT' => 'description',
             'FIELD_STATUS' => 'status',
@@ -79,6 +80,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
             'FIELD_ANONYMOUS' => 'anonymous',
             'FIELD_CONTROLS' => 'controls',
             'FIELD_LOCATION_PREFIX' => 'location',
+            'FIELDS_DELAYED_PROCESSING' => 'video', // can be array of fields or comma separated string of field names
 
             // page URIs
             'URI_VIEW_LIST' => 'timeline-view',
@@ -88,8 +90,14 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
 
             // objects
             'OBJECT_STORAGE' => $this->_sName . '_photos',
-            'OBJECT_GRID_ADMINISTRATION' => $this->_sName . '_administration',
+            'OBJECT_STORAGE_VIDEOS' => $this->_sName . '_videos',
             'OBJECT_IMAGES_TRANSCODER_PREVIEW' => $this->_sName . '_photos_preview',
+            'OBJECT_VIDEOS_TRANSCODERS' => array(
+                'poster' => 'bx_timeline_videos_poster', 
+            	'mp4' => 'bx_timeline_videos_mp4', 
+            	'mp4_hd' => 'bx_timeline_videos_mp4_hd'
+            ),
+            'OBJECT_GRID_ADMINISTRATION' => $this->_sName . '_administration',
             'OBJECT_MENU_ENTRY_ATTACHMENTS' => $this->_sName . '_menu_post_attachments',
             'OBJECT_METATAGS' => $this->_sName,
             'OBJECT_COMMENTS' => $this->_sName,
@@ -137,14 +145,14 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
             'metatags' => $this->_sName,
 
             'storage_photos' => $this->CNF['OBJECT_STORAGE'],
-            'storage_videos' => $this->_sName . '_videos',
+            'storage_videos' => $this->CNF['OBJECT_STORAGE_VIDEOS'],
             'transcoder_photos_preview' => $this->CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW'],
             'transcoder_photos_view' => $this->_sName . '_photos_view',
             'transcoder_photos_medium' => $this->_sName . '_photos_medium',
             'transcoder_photos_big' => $this->_sName . '_photos_big',
-            'transcoder_videos_poster' => $this->_sName . '_videos_poster',
-            'transcoder_videos_mp4' => $this->_sName . '_videos_mp4',
-            'transcoder_videos_mp4_hd' => $this->_sName . '_videos_mp4_hd',
+            'transcoder_videos_poster' => $this->CNF['OBJECT_VIDEOS_TRANSCODERS']['poster'],
+            'transcoder_videos_mp4' => $this->CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4'],
+            'transcoder_videos_mp4_hd' => $this->CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4_hd'],
 
             'page_item_brief' => $this->_sName . '_item_brief',
 

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

@@ -24,12 +24,12 @@ class BxTimelineCronPublishing extends BxDolCron
 
     function processing()
     {
-        $mixedIds = $this->_oModule->_oDb->publish();
+        $mixedIds = $this->_oModule->_oDb->publishEntries();
         if($mixedIds === false)
             return;
 
         foreach($mixedIds as $iId)
-            $this->_oModule->onPost($iId);
+            $this->_oModule->onPublished($iId);
     }
 }
 

+ 10 - 17
modules/boonex/timeline/classes/BxTimelineDb.php

@@ -204,6 +204,16 @@ class BxTimelineDb extends BxBaseModNotificationsDb
         return $this->getColumn($sQuery);
     }
 
+    public function getMediaById($sType, $iMediaId)
+    {
+        $sTableMedia = $this->_aTablesMedia[$sType];
+    	$sTableMedia2Events = $this->_aTablesMedia2Events[$sType];
+
+        return $this->getRow("SELECT `tm`.*, `tme`.`event_id` AS `event_id` FROM `" . $sTableMedia2Events . "` AS `tme` LEFT JOIN `" . $sTableMedia . "` AS `tm` ON `tme`.`media_id`=`tm`.`id` WHERE `tme`.`media_id`=:media_id LIMIT 1", array(
+            'media_id' => $iMediaId
+        ));
+    }
+
     //--- Link attach related methods ---//
     public function getUnusedLinks($iUserId, $iLinkId = 0)
     {
@@ -458,23 +468,6 @@ class BxTimelineDb extends BxBaseModNotificationsDb
         return call_user_func_array(array($this, $aMethod['name']), $aMethod['params']);
     }
 
-    public function publish()
-    {
-        $CNF = $this->_oConfig->CNF;
-
-        $aEvents = $this->getAll("SELECT `" . $CNF['FIELD_ID'] . "`, `" . $CNF['FIELD_DATE'] . "`  FROM `" . $this->_sTable . "` WHERE `" . $CNF['FIELD_STATUS'] . "`='" . BX_TIMELINE_STATUS_AWAITING . "'");
-        if(empty($aEvents) || !is_array($aEvents))
-            return false;
-
-        $iNow = time();
-        $aResult = array();
-        foreach($aEvents as $aEvent)
-            if($aEvent[$CNF['FIELD_DATE']] <= $iNow) 
-                $aResult[] = $aEvent[$CNF['FIELD_ID']];
-
-        return count($aResult) == (int)$this->query("UPDATE `" . $this->_sTable . "` SET `" . $CNF['FIELD_STATUS'] . "`='" . BX_TIMELINE_STATUS_ACTIVE . "' WHERE `id` IN (" . $this->implode_escape($aResult) . ")") ? $aResult : false;
-    }
-
     protected function _getFilterAddon($iOwnerId, $sFilter)
     {
         switch($sFilter) {

+ 41 - 9
modules/boonex/timeline/classes/BxTimelineFormPost.php

@@ -46,9 +46,9 @@ class BxTimelineFormPost extends BxBaseModGeneralFormEntry
     {
         $CNF = &$this->_oModule->_oConfig->CNF;
 
-        if($this->aParams['display'] == $this->_oModule->_oConfig->getObject('form_display_post_edit') && isset($CNF['FIELD_DATE']) && isset($this->aInputs[$CNF['FIELD_DATE']]))
+        if($this->aParams['display'] == $this->_oModule->_oConfig->getObject('form_display_post_edit') && isset($CNF['FIELD_PUBLISHED']) && isset($this->aInputs[$CNF['FIELD_PUBLISHED']]))
             if(isset($aValues[$CNF['FIELD_STATUS']]) && in_array($aValues[$CNF['FIELD_STATUS']], array(BX_TIMELINE_STATUS_ACTIVE, BX_TIMELINE_STATUS_HIDDEN)))
-                unset($this->aInputs[$CNF['FIELD_DATE']]);
+                unset($this->aInputs[$CNF['FIELD_PUBLISHED']]);
 
         if(isset($CNF['FIELD_ANONYMOUS']) && isset($this->aInputs[$CNF['FIELD_ANONYMOUS']]) && isset($aValues[$CNF['FIELD_OBJECT_ID']]))
             $this->aInputs[$CNF['FIELD_ANONYMOUS']]['checked'] = $aValues[$CNF['FIELD_OBJECT_ID']] < 0;
@@ -62,6 +62,30 @@ class BxTimelineFormPost extends BxBaseModGeneralFormEntry
 
         $aValsToAdd[$CNF['FIELD_OBJECT_ID']] *= isset($CNF['FIELD_ANONYMOUS']) && isset($this->aInputs[$CNF['FIELD_ANONYMOUS']]) && $this->getCleanValue($CNF['FIELD_ANONYMOUS']) ? -1 : 1;
 
+        if(isset($CNF['FIELD_ADDED']) && empty($aValsToAdd[$CNF['FIELD_ADDED']])) {
+            $iAdded = 0;
+            if(isset($this->aInputs[$CNF['FIELD_ADDED']]))
+                $iAdded = $this->getCleanValue($CNF['FIELD_ADDED']);
+            
+            if(empty($iAdded))
+                 $iAdded = time();
+
+            $aValsToAdd[$CNF['FIELD_ADDED']] = $iAdded;
+        }
+
+        if(empty($aValsToAdd[$CNF['FIELD_PUBLISHED']])) {
+            $iPublished = 0;
+            if(isset($this->aInputs[$CNF['FIELD_PUBLISHED']]))
+                $iPublished = $this->getCleanValue($CNF['FIELD_PUBLISHED']);
+                
+             if(empty($iPublished))
+                 $iPublished = time();
+
+             $aValsToAdd[$CNF['FIELD_PUBLISHED']] = $iPublished;
+        }
+
+        $aValsToAdd[$CNF['FIELD_STATUS']] = $aValsToAdd[$CNF['FIELD_PUBLISHED']] > $aValsToAdd[$CNF['FIELD_ADDED']] ? BX_TIMELINE_STATUS_AWAITING : BX_TIMELINE_STATUS_ACTIVE;
+
         return parent::insert ($aValsToAdd, $isIgnore);
     }
 
@@ -75,6 +99,14 @@ class BxTimelineFormPost extends BxBaseModGeneralFormEntry
             $aValsToAdd[$CNF['FIELD_OBJECT_ID']] = ($this->getCleanValue($CNF['FIELD_ANONYMOUS']) ? -1 : 1) * abs($aContentInfo[$CNF['FIELD_OBJECT_ID']]);
         }
 
+        if(empty($aValsToAdd[$CNF['FIELD_PUBLISHED']]) && isset($this->aInputs[$CNF['FIELD_PUBLISHED']])) {
+            $iPublished = $this->getCleanValue($CNF['FIELD_PUBLISHED']);
+            if(empty($iPublished))
+                $iPublished = time();
+
+            $aValsToAdd[$CNF['FIELD_PUBLISHED']] = $iPublished;
+        }
+
         return parent::update($iContentId, $aValsToAdd, $aTrackTextFieldsChanges);
     }
 
@@ -197,15 +229,15 @@ class BxTimelineFormPost extends BxBaseModGeneralFormEntry
 
         if($this->_bPublicMode || $this->_bProfileMode)
             foreach($aInput['values'] as $iKey => $aValue) {
-                    //--- Show 'Public' privacy group only in Public post form. 
-                    if($this->_bPublicMode && isset($aValue['key']) && $aValue['key'] == BX_DOL_PG_ALL)
-                            continue;
+                //--- Show 'Public' privacy group only in Public post form. 
+                if($this->_bPublicMode && isset($aValue['key']) && $aValue['key'] == BX_DOL_PG_ALL)
+                    continue;
 
-                    //--- Show a default privacy groups in Profile (for Owner) post form.
-                    if($this->_bProfileMode && $iOwnerId == $iUserId && isset($aValue['key']) && (int)$aValue['key'] >= 0)
-                            continue;
+                //--- Show a default privacy groups in Profile (for Owner) post form.
+                if($this->_bProfileMode && $iOwnerId == $iUserId && isset($aValue['key']) && (int)$aValue['key'] >= 0)
+                    continue;
 
-                    unset($aInput['values'][$iKey]);
+                unset($aInput['values'][$iKey]);
             }
 
         return $aInput;

+ 22 - 31
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -2151,19 +2151,6 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
             $sTitle = $bText ? $this->_oConfig->getTitle($sText) : $this->_oConfig->getTitleDefault($bLinkIds, $bPhotoIds, $bVideoIds);
             $sDescription = _t('_bx_timeline_txt_user_added_sample', '{profile_name}', _t('_bx_timeline_txt_sample_with_article'));
 
-            //--- Process Date ---//
-            $iNow = time();
-            $iDate = 0;
-            if(isset($oForm->aInputs['date']))
-                $iDate = $oForm->getCleanValue('date');
-            if(empty($iDate))
-                $iDate = $iNow;
-            
-            //--- Process Status ---//
-            $sStatus = BX_TIMELINE_STATUS_ACTIVE;
-            if($iDate > $iNow)
-                $sStatus = BX_TIMELINE_STATUS_AWAITING;
-
             /**
              * Unset 'text' input because its data was already processed 
              * and will be saved via additional values which were passed 
@@ -2177,9 +2164,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
                 'object_privacy_view' => $iObjectPrivacyView,
                 'content' => serialize($aContent),
                 'title' => $sTitle,
-                'description' => $sDescription,
-                'date' => $iDate,
-                'status' => $sStatus
+                'description' => $sDescription
             ));
 
             if(!empty($iId)) {
@@ -2193,17 +2178,17 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
                     foreach($aLinkIds as $iLinkId)
                         $this->_oDb->saveLink($iId, $iLinkId);
 
-				//--- Process Media ---//
-				if($bPhotoIds) 
-					$this->_saveMedia(BX_TIMELINE_MEDIA_PHOTO, $iId, $aPhotoIds);
+                //--- Process Media ---//
+                if($bPhotoIds) 
+                    $this->_saveMedia(BX_TIMELINE_MEDIA_PHOTO, $iId, $aPhotoIds);
 
-				if($bVideoIds)
-					$this->_saveMedia(BX_TIMELINE_MEDIA_VIDEO, $iId, $aVideoIds);
+                if($bVideoIds)
+                    $this->_saveMedia(BX_TIMELINE_MEDIA_VIDEO, $iId, $aVideoIds);
 
                 $this->onPost($iId);
 
                 return $this->_prepareResponse(array('id' => $iId), $bAjaxMode, array(
-                	'redirect' => $this->_oConfig->getItemViewUrl(array('id' => $iId))
+                    'redirect' => $this->_oConfig->getItemViewUrl(array('id' => $iId))
                 ));
             }
 
@@ -2276,15 +2261,6 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
                     'object_privacy_view' => $iObjectPrivacyViewDefault
                 ));
 
-            //--- Process Date ---//
-            if(isset($oForm->aInputs['date'])) {
-                $iDate = $oForm->getCleanValue('date');
-                if(empty($iDate))
-                    $iDate = time();
-
-                $aValsToAdd['date'] = $iDate;
-            }
-
             if(!$oForm->update($iId, $aValsToAdd))
                 return array('message' => _t('_bx_timeline_txt_err_cannot_perform_action'));
 
@@ -2782,6 +2758,21 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
         //--- Event -> Post for Alerts Engine ---//
     }
 
+    public function onPublished($iContentId)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        $aEvent = $this->_oDb->getEvents(array('browse' => 'id', 'value' => $iContentId));
+
+        //--- Clear Item cache
+        $this->getCacheItemObject()->removeAllByPrefix($this->_oConfig->getPrefix('cache_item') . $iContentId);
+        
+        //--- Clear Feed cache
+        $this->_oDb->deleteCache(array('context_id' => $aEvent[$CNF['FIELD_OWNER_ID']])); //--- Delete cache for old context
+
+        $this->onPost($iContentId);
+    }
+
     public function onRepost($iId, $aReposted = array())
     {
         $aEvent = $this->_oDb->getEvents(array('browse' => 'id', 'value' => $iId));

+ 48 - 0
modules/boonex/timeline/classes/BxTimelineResponse.php

@@ -136,6 +136,54 @@ class BxTimelineResponse extends BxBaseModNotificationsResponse
         $this->_oModule->_oDb->clearCache();
                 
     }
+
+    protected function _processBxTimelineVideosMp4Transcoded($oAlert)
+    {
+        $this->_onVideoTranscoded($oAlert->iObject);
+    }
+
+    protected function _processBxTimelineVideosMp4HdTranscoded($oAlert)
+    {
+        $this->_onVideoTranscoded($oAlert->iObject);
+    }
+
+    protected function _onVideoTranscoded($iMediaId, $aParams = array())
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        if(!isset($CNF['FIELD_STATUS']))
+            return;
+
+        $aMedia = $this->_oModule->_oDb->getMediaById(BX_TIMELINE_MEDIA_VIDEO, $iMediaId);
+        if(empty($aMedia) || !is_array($aMedia))
+            return;
+
+        $iContentId = (int)$aMedia['event_id'];
+        $aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
+        if(empty($aContentInfo) || !is_array($aContentInfo))
+            return;
+
+        if(!isset($aContentInfo[$CNF['FIELD_STATUS']]) || $aContentInfo[$CNF['FIELD_STATUS']] != 'awaiting')
+            return;
+        
+        $iNow = time();
+        if(isset($CNF['FIELD_PUBLISHED']) && isset($aContentInfo[$CNF['FIELD_PUBLISHED']]) && $aContentInfo[$CNF['FIELD_PUBLISHED']] > $iNow)
+            return;
+
+        $aTranscoders = array();
+        foreach($CNF['OBJECT_VIDEOS_TRANSCODERS'] as $sKey => $sTranscoder)
+            if(in_array($sKey, array('mp4', 'mp4_hd')))
+                $aTranscoders[$sTranscoder] = BxDolTranscoder::getObjectInstance($sTranscoder);
+
+        $aMediasToCheck = $this->_oModule->_oDb->getMedia(BX_TIMELINE_MEDIA_VIDEO, $iContentId);
+        foreach($aMediasToCheck as $iMediaToCheck)
+            foreach($aTranscoders as $sTranscoder => $oTranscoder)
+                if(!$oTranscoder->isFileReady($iMediaToCheck))
+                    return;
+
+        if((int)$this->_oModule->_oDb->updateEntriesBy(array($CNF['FIELD_STATUS'] => 'active'), array($CNF['FIELD_ID'] => $iContentId)) > 0)
+            $this->_oModule->onPublished($iContentId);
+    }
 }
 
 /** @} */

+ 7 - 5
modules/boonex/timeline/install/langs/en.xml

@@ -40,10 +40,12 @@
 	<string name="_bx_timeline_form_post_input_sys_text"><![CDATA[Content]]></string>
 	<string name="_bx_timeline_form_post_input_text"><![CDATA[]]></string>
 	<string name="_bx_timeline_form_post_input_sys_object_privacy_view"><![CDATA[Visibility]]></string>
-    <string name="_bx_timeline_form_post_input_object_privacy_view"><![CDATA[Visibility]]></string>
-    <string name="_bx_timeline_form_post_input_sys_date"><![CDATA[Publish at]]></string>
-    <string name="_bx_timeline_form_post_input_date"><![CDATA[Publish at]]></string>
-    <string name="_bx_timeline_form_post_input_date_info"><![CDATA[Leave empty to publish immediately.]]></string>
+        <string name="_bx_timeline_form_post_input_object_privacy_view"><![CDATA[Visibility]]></string>
+        <string name="_bx_timeline_form_post_input_sys_date"><![CDATA[Created at]]></string>
+        <string name="_bx_timeline_form_post_input_date"><![CDATA[Created at]]></string>
+        <string name="_bx_timeline_form_post_input_sys_date_published"><![CDATA[Publish at]]></string>
+        <string name="_bx_timeline_form_post_input_date_published"><![CDATA[Publish at]]></string>
+        <string name="_bx_timeline_form_post_input_date_published_info"><![CDATA[Leave empty to publish immediately.]]></string>
 	<string name="_bx_timeline_form_post_input_sys_link"><![CDATA[Link]]></string>
 	<string name="_bx_timeline_form_post_input_link_alt"><![CDATA[Add Link]]></string>
 	<string name="_bx_timeline_form_post_input_link_err_delete"><![CDATA[Cannot remove the link. Please report.]]></string>
@@ -57,7 +59,7 @@
 	<string name="_bx_timeline_form_post_input_sys_do_submit"><![CDATA[Post]]></string>
 	<string name="_bx_timeline_form_post_input_do_submit"><![CDATA[Post]]></string>
 	<string name="_bx_timeline_form_post_input_sys_do_cancel"><![CDATA[Cancel]]></string>
-    <string name="_bx_timeline_form_post_input_do_cancel"><![CDATA[Cancel]]></string>
+        <string name="_bx_timeline_form_post_input_do_cancel"><![CDATA[Cancel]]></string>
 
 	<string name="_bx_timeline_form_attach_link"><![CDATA[Attach Link]]></string>
 	<string name="_bx_timeline_form_attach_link_display_add"><![CDATA[Attach Link]]></string>

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

@@ -290,7 +290,10 @@ SET @iHandler := LAST_INSERT_ID();
 
 INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 ('system', 'clear_cache', @iHandler),
-('profile', 'delete', @iHandler);
+('profile', 'delete', @iHandler),
+
+('bx_timeline_videos_mp4', 'transcoded', @iHandler),
+('bx_timeline_videos_mp4_hd', 'transcoded', @iHandler);
 
 
 -- SEARCH

+ 8 - 6
modules/boonex/timeline/install/sql/install.sql

@@ -21,6 +21,7 @@ CREATE TABLE IF NOT EXISTS `bx_timeline_events` (
   `reports` int(11) unsigned NOT NULL default '0',
   `reposts` int(11) unsigned NOT NULL default '0',
   `date` int(11) NOT NULL default '0',
+  `published` int(11) NOT NULL default '0',
   `status` enum ('active', 'awaiting', 'hidden', 'deleted') NOT NULL DEFAULT 'active',
   `active` int(11) NOT NULL default '1',
   `pinned` int(11) NOT NULL default '0',
@@ -326,7 +327,7 @@ INSERT INTO `sys_transcoder_filters` (`transcoder_object`, `filter`, `filter_par
 
 ('bx_timeline_videos_poster', 'Poster', 'a:2:{s:1:"h";s:3:"318";s:10:"force_type";s:3:"jpg";}', 0),
 ('bx_timeline_videos_mp4', 'Mp4', 'a:2:{s:1:"h";s:3:"318";s:10:"force_type";s:3:"mp4";}', 0),
-('bx_timeline_videos_mp4_hd', 'Mp4', 'a:2:{s:1:"h";s:3:"720";s:10:"force_type";s:4:"mp4";}', 0);
+('bx_timeline_videos_mp4_hd', 'Mp4', 'a:2:{s:1:"h";s:3:"720";s:10:"force_type";s:3:"mp4";}', 0);
 
 
 -- Forms -> Post
@@ -346,7 +347,8 @@ INSERT INTO `sys_form_inputs` (`object`, `module`, `name`, `value`, `values`, `c
 ('bx_timeline_post', @sName, 'owner_id', '0', '', 0, 'hidden', '_bx_timeline_form_post_input_sys_owner_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
 ('bx_timeline_post', @sName, 'text', '', '', 0, 'textarea', '_bx_timeline_form_post_input_sys_text', '_bx_timeline_form_post_input_text', '', 0, 0, 3, 'a:1:{s:12:"autocomplete";s:3:"off";}', '', '', '', '', '', 'XssHtml', '', 1, 0),
 ('bx_timeline_post', @sName, 'anonymous', '', '', 0, 'switcher', '_sys_form_input_sys_anonymous', '_sys_form_input_anonymous', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
-('bx_timeline_post', @sName, 'date', '', '', 0, 'datetime', '_bx_timeline_form_post_input_sys_date', '_bx_timeline_form_post_input_date', '_bx_timeline_form_post_input_date_info', 0, 0, 0, '', '', '', '', '', '', 'DateTimeUtc', '', 1, 0),
+('bx_timeline_post', @sName, 'date', '', '', 0, 'datetime', '_bx_timeline_form_post_input_sys_date', '_bx_timeline_form_post_input_date', '', 0, 0, 0, '', '', '', '', '', '', 'DateTimeUtc', '', 1, 0),
+('bx_timeline_post', @sName, 'published', '', '', 0, 'datetime', '_bx_timeline_form_post_input_sys_date_published', '_bx_timeline_form_post_input_date_published', '_bx_timeline_form_post_input_date_published_info', 0, 0, 0, '', '', '', '', '', '', 'DateTimeUtc', '', 1, 0),
 ('bx_timeline_post', @sName, 'object_privacy_view', '', '', 0, 'custom', '_bx_timeline_form_post_input_sys_object_privacy_view', '_bx_timeline_form_post_input_object_privacy_view', '', 1, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
 ('bx_timeline_post', @sName, 'location', '', '', 0, 'location', '_sys_form_input_sys_location', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_timeline_post', @sName, 'link', '', '', 0, 'custom', '_bx_timeline_form_post_input_sys_link', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
@@ -364,7 +366,7 @@ INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_fo
 ('bx_timeline_post_add', 'attachments', 2147483647, 1, 3),
 ('bx_timeline_post_add', 'owner_id', 2147483647, 1, 4),
 ('bx_timeline_post_add', 'object_privacy_view', 2147483647, 1, 5),
-('bx_timeline_post_add', 'date', 192, 1, 6),
+('bx_timeline_post_add', 'published', 192, 1, 13),
 ('bx_timeline_post_add', 'location', 2147483647, 1, 7),
 ('bx_timeline_post_add', 'link', 2147483647, 1, 8),
 ('bx_timeline_post_add', 'photo', 2147483647, 1, 9),
@@ -377,7 +379,7 @@ INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_fo
 ('bx_timeline_post_add_public', 'text', 2147483647, 1, 3),
 ('bx_timeline_post_add_public', 'attachments', 2147483647, 1, 4),
 ('bx_timeline_post_add_public', 'object_privacy_view', 2147483647, 1, 5),
-('bx_timeline_post_add_public', 'date', 192, 1, 6),
+('bx_timeline_post_add_public', 'published', 192, 1, 6),
 ('bx_timeline_post_add_public', 'location', 2147483647, 1, 7),
 ('bx_timeline_post_add_public', 'link', 2147483647, 1, 8),
 ('bx_timeline_post_add_public', 'photo', 2147483647, 1, 9),
@@ -390,7 +392,7 @@ INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_fo
 ('bx_timeline_post_add_profile', 'text', 2147483647, 1, 3),
 ('bx_timeline_post_add_profile', 'attachments', 2147483647, 1, 4),
 ('bx_timeline_post_add_profile', 'object_privacy_view', 2147483647, 1, 5),
-('bx_timeline_post_add_profile', 'date', 192, 1, 6),
+('bx_timeline_post_add_profile', 'published', 192, 1, 6),
 ('bx_timeline_post_add_profile', 'location', 2147483647, 1, 7),
 ('bx_timeline_post_add_profile', 'link', 2147483647, 1, 8),
 ('bx_timeline_post_add_profile', 'photo', 2147483647, 1, 9),
@@ -401,7 +403,7 @@ INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_fo
 ('bx_timeline_post_edit', 'action', 2147483647, 1, 2),
 ('bx_timeline_post_edit', 'owner_id', 2147483647, 1, 3),
 ('bx_timeline_post_edit', 'text', 2147483647, 1, 4),
-('bx_timeline_post_edit', 'date', 192, 1, 5),
+('bx_timeline_post_edit', 'published', 192, 1, 5),
 ('bx_timeline_post_edit', 'location', 2147483647, 1, 6),
 ('bx_timeline_post_edit', 'controls', 2147483647, 1, 7),
 ('bx_timeline_post_edit', 'tlb_do_submit', 2147483647, 1, 8),

+ 1 - 0
modules/boonex/videos/classes/BxVideosConfig.php

@@ -53,6 +53,7 @@ class BxVideosConfig extends BxBaseModTextConfig
             'FIELD_LABELS' => 'labels',
             'FIELD_LOCATION_PREFIX' => 'location',
             'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
+            'FIELDS_DELAYED_PROCESSING' => 'videos', // can be array of fields or comma separated string of field names
 
             // page URIs
             'URI_VIEW_ENTRY' => 'view-video',

+ 4 - 1
modules/boonex/videos/install/sql/enable.sql

@@ -424,4 +424,7 @@ SET @iHandler := LAST_INSERT_ID();
 
 INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 ('system', 'save_setting', @iHandler),
-('profile', 'delete', @iHandler);
+('profile', 'delete', @iHandler),
+
+('bx_videos_video_mp4', 'transcoded', @iHandler),
+('bx_videos_video_mp4_hd', 'transcoded', @iHandler);

+ 1 - 1
modules/boonex/videos/install/sql/install.sql

@@ -24,7 +24,7 @@ CREATE TABLE IF NOT EXISTS `bx_videos_entries` (
   `reports` int(11) NOT NULL default '0',
   `featured` int(11) NOT NULL default '0',
   `allow_view_to` varchar(16) NOT NULL DEFAULT '3',
-  `status` enum('active','hidden') NOT NULL DEFAULT 'active',
+  `status` enum('active','awaiting','hidden') NOT NULL DEFAULT 'active',
   `status_admin` enum('active','hidden') NOT NULL DEFAULT 'active',
   PRIMARY KEY (`id`),
   FULLTEXT KEY `title_text` (`title`,`text`)