Procházet zdrojové kódy

#24 - Get rid of different posting forms and post types. Related changes and fixes in Timeline module and some system features.

AntonLV před 13 roky
rodič
revize
1bc0d1e2c4
32 změnil soubory, kde provedl 333 přidání a 542 odebrání
  1. 9 11
      inc/classes/BxDolUploader.php
  2. 15 1
      inc/js/jquery.dolPopup.js
  3. 0 1
      modules/boonex/notes/classes/BxNotesModule.php
  4. 1 1
      modules/boonex/notes/template/form_ghost_template.html
  5. 10 10
      modules/boonex/timeline/classes/BxTimelineConfig.php
  6. 1 1
      modules/boonex/timeline/classes/BxTimelineDb.php
  7. 0 62
      modules/boonex/timeline/classes/BxTimelineMenuPost.php
  8. 70 157
      modules/boonex/timeline/classes/BxTimelineModule.php
  9. 53 95
      modules/boonex/timeline/classes/BxTimelineTemplate.php
  10. 36 0
      modules/boonex/timeline/classes/BxTimelineUploaderSimple.php
  11. 16 55
      modules/boonex/timeline/install/langs/en.xml
  12. 7 16
      modules/boonex/timeline/install/sql/enable.sql
  13. 33 54
      modules/boonex/timeline/install/sql/install.sql
  14. 2 1
      modules/boonex/timeline/install/sql/uninstall.sql
  15. 14 36
      modules/boonex/timeline/js/post.js
  16. 1 1
      modules/boonex/timeline/js/share.js
  17. 4 0
      modules/boonex/timeline/template/block_post.html
  18. 0 0
      modules/boonex/timeline/template/block_view.html
  19. 31 17
      modules/boonex/timeline/template/css/post.css
  20. 4 0
      modules/boonex/timeline/template/css/view.css
  21. 0 1
      modules/boonex/timeline/template/link.html
  22. 0 1
      modules/boonex/timeline/template/photo.html
  23. 0 13
      modules/boonex/timeline/template/post.html
  24. 0 0
      modules/boonex/timeline/template/type_post.html
  25. 0 0
      modules/boonex/timeline/template/type_share.html
  26. 9 0
      modules/boonex/timeline/template/uploader_bs.html
  27. 9 0
      modules/boonex/timeline/template/uploader_nfw.html
  28. 1 1
      studio/classes/BxDolStudioStore.php
  29. 1 1
      template/comments_uploader_nfw.html
  30. 3 0
      template/css/cmts.css
  31. 2 4
      template/scripts/BxBaseUploaderHTML5.php
  32. 1 2
      template/scripts/BxBaseUploaderSimple.php

+ 9 - 11
inc/classes/BxDolUploader.php

@@ -102,6 +102,7 @@ bx_import('BxDolUploaderQuery');
  *
  *
  */
  */
 abstract class BxDolUploader extends BxDol {
 abstract class BxDolUploader extends BxDol {
+	protected $_oTemplate;
 
 
     protected $_aObject; ///< object properties
     protected $_aObject; ///< object properties
     protected $_sStorageObject; ///< storage object name    
     protected $_sStorageObject; ///< storage object name    
@@ -121,6 +122,8 @@ abstract class BxDolUploader extends BxDol {
      */
      */
     protected function __construct($aObject, $sStorageObject, $sUniqId) {
     protected function __construct($aObject, $sStorageObject, $sUniqId) {
         parent::__construct();
         parent::__construct();
+        $this->_oTemplate = BxDolTemplate::getInstance();
+
         $this->_aObject = $aObject;
         $this->_aObject = $aObject;
         $this->_sStorageObject = $sStorageObject;          
         $this->_sStorageObject = $sStorageObject;          
      
      
@@ -231,13 +234,11 @@ abstract class BxDolUploader extends BxDol {
      * Show uploader button.
      * Show uploader button.
      * @return HTML string 
      * @return HTML string 
      */
      */
-    public function getUploaderButton($mixedGhostTemplate, $isMultiple = true, $aParams = array()) { 
-        $oTemplate = BxDolTemplate::getInstance();
-
-        $oTemplate->addCss('uploaders.css');
+    public function getUploaderButton($mixedGhostTemplate, $isMultiple = true, $aParams = array()) {
+        $this->_oTemplate->addCss('uploaders.css');
 
 
-        $oTemplate->addJs('BxDolUploader.js');
-        $oTemplate->addJsTranslation(array(
+        $this->_oTemplate->addJs('BxDolUploader.js');
+        $this->_oTemplate->addJsTranslation(array(
             '_sys_uploader_confirm_leaving_page',
             '_sys_uploader_confirm_leaving_page',
             '_sys_uploader_confirm_close_popup',
             '_sys_uploader_confirm_close_popup',
             '_sys_uploader_upload_canceled',
             '_sys_uploader_upload_canceled',
@@ -264,7 +265,7 @@ abstract class BxDolUploader extends BxDol {
             'multiple' => $isMultiple ? 1 : 0,
             'multiple' => $isMultiple ? 1 : 0,
         );
         );
         $aParams = array_merge($aParamsDefault, $aParams);
         $aParams = array_merge($aParamsDefault, $aParams);
-        return $oTemplate->parseHtmlByName($this->_sButtonTemplate, $aParams);
+        return $this->_oTemplate->parseHtmlByName($this->_sButtonTemplate, $aParams);
     }
     }
 
 
     /**
     /**
@@ -287,9 +288,6 @@ abstract class BxDolUploader extends BxDol {
      * @return HTML or JSON string
      * @return HTML or JSON string
      */
      */
     public function getGhosts($iProfileId, $sFormat, $sImagesTranscoder = false, $iContentId = false) {
     public function getGhosts($iProfileId, $sFormat, $sImagesTranscoder = false, $iContentId = false) {
-
-        $oTemplate = BxDolTemplate::getInstance();
-
         bx_import('BxDolStorage');
         bx_import('BxDolStorage');
         $oStorage = BxDolStorage::getObjectInstance($this->_sStorageObject);
         $oStorage = BxDolStorage::getObjectInstance($this->_sStorageObject);
 
 
@@ -302,7 +300,7 @@ abstract class BxDolUploader extends BxDol {
         $a = '';
         $a = '';
         $aGhosts = $oStorage->getGhosts($iProfileId, $iContentId);
         $aGhosts = $oStorage->getGhosts($iProfileId, $iContentId);
         foreach ($aGhosts as $aFile) {
         foreach ($aGhosts as $aFile) {
-            $sFileIcon = $oImagesTranscoder && 0 == strncmp($aFile['mime_type'], 'image/', 6) ? $oImagesTranscoder->getImageUrl($aFile['id']) : $oTemplate->getIconUrl($oStorage->getIconNameByFileName($aFile['file_name']));
+            $sFileIcon = $oImagesTranscoder && 0 == strncmp($aFile['mime_type'], 'image/', 6) ? $oImagesTranscoder->getImageUrl($aFile['id']) : $this->_oTemplate->getIconUrl($oStorage->getIconNameByFileName($aFile['file_name']));
             $a[$aFile['id']] = array (
             $a[$aFile['id']] = array (
                 'file_id' => $aFile['id'],
                 'file_id' => $aFile['id'],
                 'file_name' => $aFile['file_name'],
                 'file_name' => $aFile['file_name'],

+ 15 - 1
inc/js/jquery.dolPopup.js

@@ -198,13 +198,27 @@
             var e = $(this);
             var e = $(this);
             var id;
             var id;
 
 
-            // get id
+            /*
+             * TODO: Remove commented if modified version is working properly. Old version was commented because it doesn't work 
+             * for different identical popups with different content which are applied to Window, because the first call sets 
+             * attribute "bx-popup-id" with its ID to Window and then everytime the first popup is displayed without loading 
+             * the other popups even if another ID and URL were passed via Options.
+             * 
             if ('undefined' == typeof(e.attr('bx-popup-id'))) {
             if ('undefined' == typeof(e.attr('bx-popup-id'))) {
                 id = ('undefined' == typeof(options.id) ? parseInt(2147483647 * Math.random()) : options.id);
                 id = ('undefined' == typeof(options.id) ? parseInt(2147483647 * Math.random()) : options.id);
                 e.attr('bx-popup-id', id);
                 e.attr('bx-popup-id', id);
             } else {
             } else {
                 id = e.attr('bx-popup-id');
                 id = e.attr('bx-popup-id');
             }
             }
+            */
+
+            // get id
+            if(typeof(e.attr('bx-popup-id')) != 'undefined')
+            	id = e.attr('bx-popup-id');
+            else if(typeof(options.id) != 'undefined')
+            	id = options.id;
+            else
+            	parseInt(2147483647 * Math.random());
 
 
             if ($("#bx-popup-ajax-wrapper-" + id + ":visible").length) { // if popup exists and is shown - hide it
             if ($("#bx-popup-ajax-wrapper-" + id + ":visible").length) { // if popup exists and is shown - hide it
                 
                 

+ 0 - 1
modules/boonex/notes/classes/BxNotesModule.php

@@ -274,7 +274,6 @@ class BxNotesModule extends BxDolModule {
 
 
     	return array(
     	return array(
     		'owner_id' => $aContentInfo[BxNotesConfig::$FIELD_AUTHOR],
     		'owner_id' => $aContentInfo[BxNotesConfig::$FIELD_AUTHOR],
-    		'content_type' => !empty($sImage) ? 'photo' : 'text', //how to parse content, 'text' by default.
     		'content' => array(
     		'content' => array(
     			'sample' => _t('_bx_notes_txt_sample_single'),
     			'sample' => _t('_bx_notes_txt_sample_single'),
     			'url' => $sUrl,
     			'url' => $sUrl,

+ 1 - 1
modules/boonex/notes/template/form_ghost_template.html

@@ -1,7 +1,7 @@
 <div id="bx-uploader-file-{file_id}" class="bx-uploader-ghost bx-def-margin-sec-top">
 <div id="bx-uploader-file-{file_id}" class="bx-uploader-ghost bx-def-margin-sec-top">
     <input type="hidden" name="__name__" value="{file_id}" />
     <input type="hidden" name="__name__" value="{file_id}" />
     <div class="bx-notes-icon-wrapper bx-def-margin-sec-right">
     <div class="bx-notes-icon-wrapper bx-def-margin-sec-right">
-        <img src="{file_icon}" class="bx-def-thumb bx-notes-icon bx-notes-icon-{file_id}" />
+        <img src="{file_icon}" class="bx-def-round-corners bx-notes-icon bx-notes-icon-{file_id}" />
     </div>
     </div>
     <span class="bx-notes-uploader-ghost">
     <span class="bx-notes-uploader-ghost">
         <b><bx_text:_bx_notes_form_note_input_picture_txt_pic_url /></b> 
         <b><bx_text:_bx_notes_form_note_input_picture_txt_pic_url /></b> 

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

@@ -32,11 +32,11 @@ class BxTimelineConfig extends BxDolModuleConfig
 
 
     protected $_sStorageObject;
     protected $_sStorageObject;
     protected $_sTranscoderObjectPreview;
     protected $_sTranscoderObjectPreview;
+    protected $_sTranscoderObjectView;
     protected $_aImageUploaders;
     protected $_aImageUploaders;
 
 
 	protected $_sConnObjSubscriptions;
 	protected $_sConnObjSubscriptions;
 
 
-	protected $_sMenuPost;
 	protected $_sMenuItemManage;
 	protected $_sMenuItemManage;
 	protected $_sMenuItemActions;
 	protected $_sMenuItemActions;
 
 
@@ -68,15 +68,15 @@ class BxTimelineConfig extends BxDolModuleConfig
         $this->_aHandlersHidden = array();
         $this->_aHandlersHidden = array();
         $this->_aHandlers = array();
         $this->_aHandlers = array();
 
 
-        $this->_sStorageObject = 'bx_timeline_photos';
-        $this->_sTranscoderObjectPreview = 'bx_timeline_photos_preview';
-        $this->_aImageUploaders = array('bx_timeline_simple');        
+        $this->_sStorageObject = $this->_sName . '_photos';
+        $this->_sTranscoderObjectPreview = $this->_sName . '_photos_preview';
+        $this->_sTranscoderObjectView = $this->_sName . '_photos_view';
+        $this->_aImageUploaders = array($this->_sName . '_simple');        
 
 
 		$this->_sConnObjSubscriptions = 'sys_profiles_subscriptions';
 		$this->_sConnObjSubscriptions = 'sys_profiles_subscriptions';
 
 
-		$this->_sMenuPost = 'bx_timeline_menu_post';
-		$this->_sMenuItemManage = 'bx_timeline_menu_item_manage';
-		$this->_sMenuItemActions = 'bx_timeline_menu_item_actions';
+		$this->_sMenuItemManage = $this->_sName . '_menu_item_manage';
+		$this->_sMenuItemActions = $this->_sName . '_menu_item_actions';
 
 
         $this->_bJsMode = false;
         $this->_bJsMode = false;
         $this->_aJsClass = array(
         $this->_aJsClass = array(
@@ -199,12 +199,12 @@ class BxTimelineConfig extends BxDolModuleConfig
     		case 'transcoder_preview':
     		case 'transcoder_preview':
     			$sResult = $this->_sTranscoderObjectPreview;
     			$sResult = $this->_sTranscoderObjectPreview;
     			break;
     			break;
+    		case 'transcoder_view':
+    			$sResult = $this->_sTranscoderObjectView;
+    			break;
     		case 'conn_subscriptions':
     		case 'conn_subscriptions':
     			$sResult = $this->_sConnObjSubscriptions;
     			$sResult = $this->_sConnObjSubscriptions;
     			break;
     			break;
-    		case 'menu_post':
-    			$sResult = $this->_sMenuPost;
-    			break;
     		case 'menu_item_manage':
     		case 'menu_item_manage':
     			$sResult = $this->_sMenuItemManage;
     			$sResult = $this->_sMenuItemManage;
     			break;
     			break;

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

@@ -329,7 +329,7 @@ class BxTimelineDb extends BxDolModuleDb
     }
     }
 
 
 	//--- Photo uploader related methods ---//
 	//--- Photo uploader related methods ---//
-	public function savePhoto($iEventId, $iPhId, $sPhTitle, $sPhText)
+	public function savePhoto($iEventId, $iPhId, $sPhTitle = '', $sPhText = '')
 	{
 	{
 		$sQuery = $this->prepare("INSERT INTO `" . $this->_sPrefix . "photos2events` SET `event_id`=?, `photo_id`=?, `title`=?, `text`=?", $iEventId, $iPhId, $sPhTitle, $sPhText);
 		$sQuery = $this->prepare("INSERT INTO `" . $this->_sPrefix . "photos2events` SET `event_id`=?, `photo_id`=?, `title`=?, `text`=?", $iEventId, $iPhId, $sPhTitle, $sPhText);
 		return (int)$this->query($sQuery) > 0;
 		return (int)$this->query($sQuery) > 0;

+ 0 - 62
modules/boonex/timeline/classes/BxTimelineMenuPost.php

@@ -1,62 +0,0 @@
-<?php defined('BX_DOL') or die('hack attempt');
-/**
- * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
- * CC-BY License - http://creativecommons.org/licenses/by/3.0/
- *
- * @defgroup    Persons Persons
- * @ingroup     DolphinModules
- *
- * @{
- */
-
-bx_import('BxTemplMenuInteractive');
-
-/**
- * 'Item' menu.
- */
-class BxTimelineMenuPost extends BxTemplMenuInteractive {
-    protected $_oModule;
-
-    public function __construct($aObject, $oTemplate = false) {
-        parent::__construct($aObject, $oTemplate);
-
-        $this->_oModule = BxDolModule::getInstance('bx_timeline');
-
-        $this->addMarkers(array(
-        	'js_object_post' => $this->_oModule->_oConfig->getJsObject('post'),
-        ));
-    }
-
-    public function setMenuId($sMenuId)
-    {
-    	$this->_aObject['menu_id'] = $sMenuId;
-    }
-
-    /**
-     * Check if menu items is visible.
-     * @param $a menu item array
-     * @return boolean
-     */ 
-    protected function _isVisible ($a) {
-        if(!parent::_isVisible($a))
-        	return false;
-
-		$sCheckFuncName = '';
-        $aCheckFuncParams = array();
-        switch ($a['name']) {
-            case 'post-text':
-            case 'post-link':
-            case 'post-photo':
-                $sCheckFuncName = 'isAllowedPost';
-                break;
-        }
-
-        if(!$sCheckFuncName || !method_exists($this->_oModule, $sCheckFuncName))
-			return true;
-
-		return call_user_func_array(array($this->_oModule, $sCheckFuncName), $aCheckFuncParams);
-    }
-
-}
-
-/** @} */

+ 70 - 157
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -29,8 +29,10 @@ define('BX_TIMELINE_FILTER_OTHER', 'other');
 define('BX_TIMELINE_PARSE_TYPE_TEXT', 'text');
 define('BX_TIMELINE_PARSE_TYPE_TEXT', 'text');
 define('BX_TIMELINE_PARSE_TYPE_LINK', 'link');
 define('BX_TIMELINE_PARSE_TYPE_LINK', 'link');
 define('BX_TIMELINE_PARSE_TYPE_PHOTO', 'photo');
 define('BX_TIMELINE_PARSE_TYPE_PHOTO', 'photo');
+
+define('BX_TIMELINE_PARSE_TYPE_POST', 'post');
 define('BX_TIMELINE_PARSE_TYPE_SHARE', 'share');
 define('BX_TIMELINE_PARSE_TYPE_SHARE', 'share');
-define('BX_TIMELINE_PARSE_TYPE_DEFAULT', BX_TIMELINE_PARSE_TYPE_TEXT);
+define('BX_TIMELINE_PARSE_TYPE_DEFAULT', BX_TIMELINE_PARSE_TYPE_POST);
 
 
 
 
 class BxTimelineModule extends BxDolModule
 class BxTimelineModule extends BxDolModule
@@ -169,18 +171,18 @@ class BxTimelineModule extends BxDolModule
 		$this->_echoResultJson(array('items' => $sItems, 'load_more' => $sLoadMore, 'back' => $sBack));
 		$this->_echoResultJson(array('items' => $sItems, 'load_more' => $sLoadMore, 'back' => $sBack));
     }
     }
 
 
-    public function actionGetPostForm($sType)
+	public function actionGetPostForm($sType)
     {
     {
-    	$this->_iOwnerId = bx_process_input(bx_get('owner_id'), BX_DATA_INT);
+        $this->_iOwnerId = bx_process_input(bx_get('owner_id'), BX_DATA_INT);
 
 
-    	$sMethod = 'getForm' . ucfirst($sType);
-		if(!method_exists($this, $sMethod)) {
-			$this->_echoResultJson(array());
-        	return;
-		}
-    	$aResult = $this->$sMethod();
+        $sMethod = 'getForm' . ucfirst($sType);
+        if(!method_exists($this, $sMethod)) {
+            $this->_echoResultJson(array());
+            return;
+        }
+        $aResult = $this->$sMethod();
 
 
-    	$this->_echoResultJson($aResult);
+        $this->_echoResultJson($aResult);
     }
     }
 
 
     public function actionGetComments()
     public function actionGetComments()
@@ -294,7 +296,7 @@ class BxTimelineModule extends BxDolModule
             	$iProfileId = $oProfile->id();
             	$iProfileId = $oProfile->id();
 		}
 		}
 
 
-        if (!$iProfileId)
+        if(!$iProfileId)
             return array();
             return array();
 
 
 		$this->_iOwnerId = $iProfileId;
 		$this->_iOwnerId = $iProfileId;
@@ -303,13 +305,9 @@ class BxTimelineModule extends BxDolModule
         if($this->isAllowedPost() !== true)
         if($this->isAllowedPost() !== true)
             return array();
             return array();
 
 
-		bx_import('BxDolMenu');
-		$oMenu = BxDolMenu::getObjectInstance($this->_oConfig->getObject('menu_post'));
-		$oMenu->setMenuId('timeline-post-menu');
-		$oMenu->setSelected($this->getName(), 'post-text');
-
-        $sContent = $this->_oTemplate->getPostBlock($this->_iOwnerId);
-        return array('content' => $sContent, 'menu' => $oMenu);
+        return array(
+        	'content' => $this->_oTemplate->getPostBlock($this->_iOwnerId)
+        );
 	}
 	}
 
 
 	public function serviceGetBlockView($iProfileId = 0)
 	public function serviceGetBlockView($iProfileId = 0)
@@ -397,52 +395,31 @@ class BxTimelineModule extends BxDolModule
     /*
     /*
      * COMMON METHODS 
      * COMMON METHODS 
      */
      */
-	public function getFormText()
+	public function getFormPost()
     {
     {
     	bx_import('BxDolForm');
     	bx_import('BxDolForm');
-        $oForm = BxDolForm::getObjectInstance('mod_tml_text', 'mod_tml_text_add');
+        $oForm = BxDolForm::getObjectInstance('mod_tml_post', 'mod_tml_post_add');
         $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'post/';
         $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'post/';
         $oForm->aInputs['owner_id']['value'] = $this->_iOwnerId;
         $oForm->aInputs['owner_id']['value'] = $this->_iOwnerId;
 
 
-        $oForm->initChecker();
-        if($oForm->isSubmittedAndValid()) {
-        	$iUserId = $this->getUserId();
-        	list($sUserName) = $this->getUserInfo($iUserId);
-
-        	$sType = $oForm->getCleanValue('type');
-        	$sType = $this->_oConfig->getPrefix('common_post') . $sType;
-        	BxDolForm::setSubmittedValue('type', $sType, $oForm->aFormAttrs['method']);
-
-        	$sContent = $sDescription = $oForm->getCleanValue('content');
-        	$sContent = serialize(array('text' => $sContent));
-        	BxDolForm::setSubmittedValue('content', $sContent, $oForm->aFormAttrs['method']);
-
-        	$iId = $oForm->insert(array(
-        		'object_id' => $iUserId,
-        		'object_privacy_view' => $this->_oConfig->getPrivacyViewDefault(),
-				'title' => bx_process_input($sUserName . ' ' . _t('_bx_timeline_txt_wrote')),
-				'description' => $sDescription,
-        		'date' => time()
-			));
-
-			if(!empty($iId)) {
-				$this->onPost($iId);
-
-                return array('id' => $iId);
-			}
-
-			return array('msg' => _t('_bx_timeline_txt_err_cannot_perform_action'));
-        }
-
-        return array('form' => $oForm->getCode(), 'form_id' => $oForm->id);
-    }
+	    if(isset($oForm->aInputs['photo'])) {
+	    	$aFormNested = array(
+	        	'params' =>array(
+	        		'nested_form_template' => 'uploader_nfw.html'
+	        	),
+		        'inputs' => array(),
+		    );
 
 
-	public function getFormLink()
-    {
-        bx_import('BxDolForm');
-        $oForm = BxDolForm::getObjectInstance('mod_tml_link', 'mod_tml_link_add');
-        $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'post/';
-        $oForm->aInputs['owner_id']['value'] = $this->_iOwnerId;
+		    bx_import('BxDolFormNested');
+		    $oFormNested = new BxDolFormNested('photo', $aFormNested, 'do_submit', $this->_oTemplate);
+	
+	        $oForm->aInputs['photo']['storage_object'] = $this->_oConfig->getObject('storage');
+	        $oForm->aInputs['photo']['images_transcoder'] = $this->_oConfig->getObject('transcoder_preview');
+	        $oForm->aInputs['photo']['uploaders'] = $this->_oConfig->getUploaders('image');
+	        $oForm->aInputs['photo']['upload_buttons_titles'] = array('Simple' => 'camera');
+	        $oForm->aInputs['photo']['multiple'] = false;
+	        $oForm->aInputs['photo']['ghost_template'] = $oFormNested;
+	    }
 
 
         $oForm->initChecker();
         $oForm->initChecker();
         if($oForm->isSubmittedAndValid()) {
         if($oForm->isSubmittedAndValid()) {
@@ -453,124 +430,60 @@ class BxTimelineModule extends BxDolModule
         	$sType = $this->_oConfig->getPrefix('common_post') . $sType;
         	$sType = $this->_oConfig->getPrefix('common_post') . $sType;
         	BxDolForm::setSubmittedValue('type', $sType, $oForm->aFormAttrs['method']);
         	BxDolForm::setSubmittedValue('type', $sType, $oForm->aFormAttrs['method']);
 
 
-        	$sUrl = $oForm->getCleanValue('content');
-        	$sContent = bx_file_get_contents($sUrl);
+        	$aContent = array();
 
 
-	        preg_match("/<title>(.*)<\/title>/", $sContent, $aMatch);
-	        $sTitle = $aMatch ? $aMatch[1] : '';
-	
-	        preg_match("/<meta.*name[='\" ]+description['\"].*content[='\" ]+(.*)['\"].*><\/meta>/", $sContent, $aMatch);
-	        $sDescription = $aMatch ? $aMatch[1] : '';
+        	//--- Process Text ---//
+        	$sText = $oForm->getCleanValue('text');
+        	unset($oForm->aInputs['text']);
 
 
-	        $sContent = serialize(array(
-				'url' => strpos($sUrl, 'http://') === false && strpos($sUrl, 'https://') === false ? 'http://' . $sUrl : $sUrl,
-	        	'title' => $sTitle,
-				'text' => $sDescription
-			));
-	        BxDolForm::setSubmittedValue('content', $sContent, $oForm->aFormAttrs['method']);
+        	$aContent['text'] = $sText;
 
 
-        	$iId = $oForm->insert(array(
-        		'object_id' => $iUserId,
-        		'object_privacy_view' => $this->_oConfig->getPrivacyViewDefault(),
-				'title' => bx_process_input($sUserName . ' ' . _t('_bx_timeline_txt_shared_link')),
-				'description' => bx_process_input($sUrl . ' - ' . $sTitle),
-        		'date' => time()
-			));
+        	//--- Process Link ---//
+			$sLink = $oForm->getCleanValue('link');
+			unset($oForm->aInputs['link']);
 
 
-			if(!empty($iId)) {
-				$this->onPost($iId);
-
-                return array('id' => $iId);
+			if(!empty($sLink)) {
+	        	$sLinkContent = bx_file_get_contents($sLink);
+	
+	        	$aMatch = array();
+		        preg_match("/<title>(.*)<\/title>/", $sLinkContent, $aMatch);
+		        $sLinkTitle = $aMatch ? $aMatch[1] : '';
+		
+		        preg_match("/<meta.*name[='\" ]+description['\"].*content[='\" ]+(.*)['\"].*><\/meta>/", $sLinkContent, $aMatch);
+		        $sLinkDescription = $aMatch ? $aMatch[1] : '';
+	
+		        $aContent['url'] = strpos($sLink, 'http://') === false && strpos($sLink, 'https://') === false ? 'http://' . $sLink : $sLink;
+		        $aContent['title'] = $sLinkTitle;
+		        if(empty($aContent['text']) && !empty($sLinkDescription))
+					$aContent['text'] = $sLinkDescription;
 			}
 			}
 
 
-			return array('msg' => _t('_bx_timeline_txt_err_cannot_perform_action'));
-        }
-
-        return array('form' => $oForm->getCode(), 'form_id' => $oForm->id);
-    }
+			//--- Process Photos ---//
+			$aPhIds = $oForm->getCleanValue('photo');
+        	unset($oForm->aInputs['photo']);
 
 
-    public function getFormPhoto()
-    {
-    	$aFormNested = array(
-			'inputs' => array(
-		    	'file_title' => array(
-		        	'type' => 'text',
-		            'name' => 'file_title[]',
-		            'value' => '{file_title}',
-		            'caption' => _t('_bx_timeline_form_photo_input_title'),
-		            'required' => true,
-		            'checker' => array(
-		            	'func' => 'length',
-		                'params' => array(1, 150),
-		                'error' => _t('_bx_timeline_form_photo_input_err_title')
-					),
-					'db' => array (
- 						'pass' => 'Xss',
- 					),
-				),
-
-				'file_text' => array(
-		        	'type' => 'textarea',
-		            'name' => 'file_text[]',
-		            'caption' => _t('_bx_timeline_form_photo_input_description'),
-		            'required' => true,
-		            'checker' => array(
-		            	'func' => 'length',
-		                'params' => array(10, 5000),
-		                'error' => _t('_bx_timeline_form_photo_input_err_description')
-					),
-					'db' => array (
- 						'pass' => 'Xss',
- 					),
-				),
-			),
-		);
-
-    	bx_import('BxDolForm');
-        $oForm = BxDolForm::getObjectInstance('mod_tml_photo', 'mod_tml_photo_add');
-        $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'post/';
-        $oForm->aInputs['owner_id']['value'] = $this->_iOwnerId;
-
-	    bx_import('BxDolFormNested');
-	    $oFormNested = new BxDolFormNested('content', $aFormNested, 'do_submit');
-
-        $oForm->aInputs['content']['storage_object'] = $this->_oConfig->getObject('storage');
-        $oForm->aInputs['content']['images_transcoder'] = $this->_oConfig->getObject('transcoder_preview');
-        $oForm->aInputs['content']['uploaders'] = $this->_oConfig->getUploaders('image');
-        $oForm->aInputs['content']['multiple'] = false;
-        $oForm->aInputs['content']['ghost_template'] = $oFormNested;
-
-        $oForm->initChecker();
-        if($oForm->isSubmittedAndValid()) {
-        	$iUserId = $this->getUserId();
-        	list($sUserName) = $this->getUserInfo($iUserId);
-
-        	$sType = $oForm->getCleanValue('type');
-        	$sType = $this->_oConfig->getPrefix('common_post') . $sType;
-        	BxDolForm::setSubmittedValue('type', $sType, $oForm->aFormAttrs['method']);
-
-        	$aPhIds = $oForm->getCleanValue('content');
-        	BxDolForm::setSubmittedValue('content', serialize(array()), $oForm->aFormAttrs['method']);
-        	$iPhIds = count($aPhIds);
+        	$sTitle = _t('_bx_timeline_txt_user_added_sample', $sUserName, _t('_bx_timeline_txt_sample'));
+			$sDescription = $aContent['text'];
+			if(empty($sDescription) && !empty($aContent['link_text']))
+				$sDescription = $aContent['link_text'];
 
 
         	$iId = $oForm->insert(array(
         	$iId = $oForm->insert(array(
         		'object_id' => $iUserId,
         		'object_id' => $iUserId,
         		'object_privacy_view' => $this->_oConfig->getPrivacyViewDefault(),
         		'object_privacy_view' => $this->_oConfig->getPrivacyViewDefault(),
-				'title' => bx_process_input($sUserName . ' ' . _t('_bx_timeline_txt_added_photo' . ($iPhIds > 1 ? 's' : ''))),
-				'description' => '',
+        		'content' => serialize($aContent),
+				'title' => $sTitle,
+				'description' => $sDescription,
         		'date' => time()
         		'date' => time()
 			));
 			));
 
 
 			if(!empty($iId)) {
 			if(!empty($iId)) {
-				if($iPhIds > 0) {
-					$aPhTitles = $oForm->getCleanValue('file_title');
-					$aPhTexts = $oForm->getCleanValue('file_text');
-
+				if(!empty($aPhIds) && is_array($aPhIds)) {
 					bx_import('BxDolStorage');
 					bx_import('BxDolStorage');
 					$oStorage = BxDolStorage::getObjectInstance($this->_oConfig->getObject('storage'));
 					$oStorage = BxDolStorage::getObjectInstance($this->_oConfig->getObject('storage'));
 
 
+					$iPhIds = count($aPhIds);
 					for($i = 0; $i < $iPhIds; $i++) 
 					for($i = 0; $i < $iPhIds; $i++) 
-						if($this->_oDb->savePhoto($iId, $aPhIds[$i], $aPhTitles[$i], $aPhTexts[$i]))
+						if($this->_oDb->savePhoto($iId, $aPhIds[$i]))
 							$oStorage->afterUploadCleanup($aPhIds[$i], $iUserId);
 							$oStorage->afterUploadCleanup($aPhIds[$i], $iUserId);
 				}
 				}
 
 

+ 53 - 95
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -27,7 +27,7 @@ class BxTimelineTemplate extends BxDolModuleTemplate
 	public function getCssJs()
 	public function getCssJs()
     {
     {
     	$this->addCss(array('plugins/jquery/themes/|jquery-ui.css', 'view.css', 'view-media-tablet.css', 'view-media-desktop.css', 'post.css', 'share.css'));
     	$this->addCss(array('plugins/jquery/themes/|jquery-ui.css', 'view.css', 'view-media-tablet.css', 'view-media-desktop.css', 'post.css', 'share.css'));
-        $this->addJs(array('jquery.ui.all.min.js', 'jquery.resize.js', 'plugins/|masonry.pkgd.min.js', 'common_anim.js', 'main.js', 'view.js', 'post.js', 'share.js'));
+        $this->addJs(array('jquery.ui.all.min.js', 'jquery.form.js', 'jquery.resize.js', 'plugins/|masonry.pkgd.min.js', 'common_anim.js', 'main.js', 'view.js', 'post.js', 'share.js'));
     }
     }
 
 
     public function getJsCode($sType, $aRequestParams = array(), $bWrap = true)
     public function getJsCode($sType, $aRequestParams = array(), $bWrap = true)
@@ -55,27 +55,21 @@ class BxTimelineTemplate extends BxDolModuleTemplate
 <?php
 <?php
 		$sContent = ob_get_clean();
 		$sContent = ob_get_clean();
 
 
+		$this->getCssJs();
         return !$bWrap ? $sContent : $this->_wrapInTagJsCode($sContent);
         return !$bWrap ? $sContent : $this->_wrapInTagJsCode($sContent);
     }
     }
 
 
     public function getPostBlock($iOwnerId)
     public function getPostBlock($iOwnerId)
     {
     {
-    	$oModule = $this->getModule();
-    	$aFormText = $oModule->getFormText();
-    	$aFormLink = $oModule->getFormLink();
-    	$aFormPhoto = $oModule->getFormPhoto();
+    	$aForm = $this->getModule()->getFormPost();
 
 
-        return $this->parseHtmlByName('post.html', array (
+        return $this->parseHtmlByName('block_post.html', array (
+        	'style_prefix' => $this->_oConfig->getPrefix('style'),
             'js_object' => $this->_oConfig->getJsObject('post'),
             'js_object' => $this->_oConfig->getJsObject('post'),
         	'js_content' => $this->getJsCode('post', array(
         	'js_content' => $this->getJsCode('post', array(
             	'owner_id' => $iOwnerId 
             	'owner_id' => $iOwnerId 
         	)),
         	)),
-            'text_form' => $aFormText['form'],
-            'link_form' => $aFormLink['form'],
-            'photo_form' => $aFormPhoto['form'],
-        	
-        	'music_form' => '',
-            'video_form' => '',
+            'form' => $aForm['form']
         ));        
         ));        
     }
     }
 
 
@@ -83,8 +77,7 @@ class BxTimelineTemplate extends BxDolModuleTemplate
     {
     {
 		list($sContent, $sLoadMore, $sBack) = $this->getPosts($aParams);
 		list($sContent, $sLoadMore, $sBack) = $this->getPosts($aParams);
 
 
-    	$this->getCssJs();
-    	return $this->parseHtmlByName('view.html', array(
+    	return $this->parseHtmlByName('block_view.html', array(
     		'style_prefix' => $this->_oConfig->getPrefix('style'),
     		'style_prefix' => $this->_oConfig->getPrefix('style'),
     		'back' => $sBack,
     		'back' => $sBack,
             'content' => $sContent,
             'content' => $sContent,
@@ -109,8 +102,6 @@ class BxTimelineTemplate extends BxDolModuleTemplate
 
 
     	$sContent = $this->getJsCode('view');
     	$sContent = $this->getJsCode('view');
     	$sContent .= $this->getPost($aEvent, array('type' => BX_TIMELINE_TYPE_ITEM));
     	$sContent .= $this->getPost($aEvent, array('type' => BX_TIMELINE_TYPE_ITEM));
-
-		$this->getCssJs();
     	return $sContent;
     	return $sContent;
     }
     }
 
 
@@ -459,14 +450,14 @@ class BxTimelineTemplate extends BxDolModuleTemplate
         return $this->parseHtmlByName('item.html', $aTmplVars);
         return $this->parseHtmlByName('item.html', $aTmplVars);
     }
     }
 
 
-    protected function _getContent($sType, $aContent)
+    protected function _getContent($sType, $aContent, $aBrowseParams = array())
     {
     {
     	$sMethod = '_getTmplVarsContent' . ucfirst($sType);
     	$sMethod = '_getTmplVarsContent' . ucfirst($sType);
         if(!method_exists($this, $sMethod)) 
         if(!method_exists($this, $sMethod)) 
         	return '';
         	return '';
 
 
        	$aTmplVars = $this->$sMethod($aContent);
        	$aTmplVars = $this->$sMethod($aContent);
-       	return $this->parseHtmlByName($sType . '.html', $aTmplVars);
+       	return $this->parseHtmlByName('type_' . $sType . '.html', $aTmplVars);
     }
     }
 
 
 	protected function _getComments($aComments)
 	protected function _getComments($aComments)
@@ -549,11 +540,12 @@ class BxTimelineTemplate extends BxDolModuleTemplate
         return $aTmplVarsTimelineOwner;
         return $aTmplVarsTimelineOwner;
     }
     }
 
 
-	protected function _getTmplVarsContentText($aContent)
+	protected function _getTmplVarsContentPost($aContent)
     {
     {
     	$sStylePrefix = $this->_oConfig->getPrefix('style');
     	$sStylePrefix = $this->_oConfig->getPrefix('style');
 		$sJsObject = $this->_oConfig->getJsObject('view');
 		$sJsObject = $this->_oConfig->getJsObject('view');
 
 
+		//--- Process Text and Links ---// 
 		$sUrl = isset($aContent['url']) ? $aContent['url'] : '';
 		$sUrl = isset($aContent['url']) ? $aContent['url'] : '';
 		$sTitle = isset($aContent['title']) ? bx_process_input(strip_tags($aContent['title'])) : '';
 		$sTitle = isset($aContent['title']) ? bx_process_input(strip_tags($aContent['title'])) : '';
 		if(!empty($sUrl) && !empty($sTitle))
 		if(!empty($sUrl) && !empty($sTitle))
@@ -566,7 +558,7 @@ class BxTimelineTemplate extends BxDolModuleTemplate
 				'content' => $sTitle
 				'content' => $sTitle
 			));
 			));
 
 
-    	$sText = isset($aContent['text']) ? bx_process_input(strip_tags($aContent['text'])) : '';
+		$sText = isset($aContent['text']) ? bx_process_input(strip_tags($aContent['text'])) : '';
 		$sTextMore = '';
 		$sTextMore = '';
 
 
 		$iMaxLength = $this->_oConfig->getCharsDisplayMax();
 		$iMaxLength = $this->_oConfig->getCharsDisplayMax();
@@ -580,11 +572,45 @@ class BxTimelineTemplate extends BxDolModuleTemplate
 		$sText = $this->_prepareTextForOutput($sText);
 		$sText = $this->_prepareTextForOutput($sText);
 		$sTextMore = $this->_prepareTextForOutput($sTextMore);
 		$sTextMore = $this->_prepareTextForOutput($sTextMore);
 
 
+		//--- Process Photos ---//
+		$aTmplVarsImages = array();
+		if(!empty($aContent['images']))
+			foreach($aContent['images'] as $aImage) {
+				$sImage = '';
+				if(isset($aImage['src']) && !empty($aImage['src']))
+					$sImage = $this->parseHtmlByName('bx_img.html', array(
+						'src' => $aImage['src'],
+						'bx_repeat:attrs' => array(
+							array('key' => 'class', 'value' => $sStylePrefix . '-item-image')
+						)
+					));
+	
+				if(!empty($sImage) && (isset($aImage['url']) || isset($aImage['onclick']))) {
+					$aAttrs = array();
+					if(isset($aImage['onclick']))
+						$aAttrs[] = array('key' => 'onclick', 'value' => $aImage['onclick']);
+	
+					$sImage = $this->parseHtmlByName('bx_a.html', array(
+						'href' => isset($aImage['url']) ? $aImage['url'] : 'javascript:void(0)',
+						'title' => '',
+						'bx_repeat:attrs' => $aAttrs,
+						'content' => $sImage
+					));
+				}
+	
+				$aTmplVarsImages[] = array(
+					'style_prefix' => $sStylePrefix,
+					'image' => $sImage
+				);
+			}
+
 		return array(
 		return array(
 			'style_prefix' => $sStylePrefix,
 			'style_prefix' => $sStylePrefix,
 			'bx_if:show_images' => array(
 			'bx_if:show_images' => array(
-				'condition' => false,
-            	'content' => array()
+				'condition' => !empty($aTmplVarsImages),
+            	'content' => array(
+    				'bx_repeat:images' => $aTmplVarsImages
+    			)
 			),
 			),
         	'bx_if:show_title' => array(
         	'bx_if:show_title' => array(
 		    	'condition' => !empty($sTitle),
 		    	'condition' => !empty($sTitle),
@@ -611,63 +637,6 @@ class BxTimelineTemplate extends BxDolModuleTemplate
 		);
 		);
     }
     }
 
 
-	protected function _getTmplVarsContentLink($aContent)
-    {
-    	return $this->_getTmplVarsContentText($aContent);
-    }
-
-    protected function _getTmplVarsContentPhoto($aContent)
-    {
-    	$aTmplVarsContent = $this->_getTmplVarsContentText($aContent);
-    	if(!isset($aContent['images']) || empty($aContent['images']))
-    		return $aTmplVarsContent;
-
-		$sStylePrefix = $this->_oConfig->getPrefix('style');
-		$sTitleDefault = isset($aContent['title']) && !empty($aContent['title']) ? $aContent['title'] : "";
-
-		$aTmplVarsImages = array();
-		foreach($aContent['images'] as $aImage) {
-			$sTitle = isset($aImage['title']) && !empty($aImage['title']) ? $aImage['title'] : $sTitleDefault;
-
-			$sImage = '';
-			if(isset($aImage['src']) && !empty($aImage['src']))
-				$sImage = $this->parseHtmlByName('bx_img.html', array(
-					'src' => $aImage['src'],
-					'bx_repeat:attrs' => array(
-						array('key' => 'class', 'value' => $sStylePrefix . '-item-image'),
-						array('key' => 'title', 'value' => $sTitle)
-					)
-				));
-
-			if(!empty($sImage) && (isset($aImage['url']) || isset($aImage['onclick']))) {
-				$aAttrs = array();
-				if(isset($aImage['onclick']))
-					$aAttrs[] = array('key' => 'onclick', 'value' => $aImage['onclick']);
-
-				$sImage = $this->parseHtmlByName('bx_a.html', array(
-					'href' => isset($aImage['url']) ? $aImage['url'] : 'javascript:void(0)',
-					'title' => $sTitle,
-					'bx_repeat:attrs' => $aAttrs,
-					'content' => $sImage
-				));
-			}
-
-			$aTmplVarsImages[] = array(
-				'style_prefix' => $sStylePrefix,
-				'image' => $sImage
-			);
-		}
-
-    	return array_merge($aTmplVarsContent, array(
-    		'bx_if:show_images' => array(
-				'condition' => !empty($aTmplVarsImages),
-            	'content' => array(
-    				'bx_repeat:images' => $aTmplVarsImages
-    			)
-			)
-    	));
-    }
-
 	protected function _getTmplVarsContentShare($aContent)
 	protected function _getTmplVarsContentShare($aContent)
     {
     {
     	$sStylePrefix = $this->_oConfig->getPrefix('style');
     	$sStylePrefix = $this->_oConfig->getPrefix('style');
@@ -754,27 +723,16 @@ class BxTimelineTemplate extends BxDolModuleTemplate
     	);
     	);
 
 
 		switch($sType) {
 		switch($sType) {
-			case BX_TIMELINE_PARSE_TYPE_TEXT:
-			case BX_TIMELINE_PARSE_TYPE_LINK:
-				if(empty($aEvent['content']))
-					break;
+			case BX_TIMELINE_PARSE_TYPE_POST:
+				if(!empty($aEvent['content']))
+					$aResult['content'] = array_merge($aResult['content'], unserialize($aEvent['content']));
 
 
-				$aResult['content'] = array_merge($aResult['content'], unserialize($aEvent['content']));
-				break;
-
-			case BX_TIMELINE_PARSE_TYPE_PHOTO:
 				$aPhotos = $this->_oDb->getPhotos($aEvent['id']);
 				$aPhotos = $this->_oDb->getPhotos($aEvent['id']);
 				if(!is_array($aPhotos) || empty($aPhotos))
 				if(!is_array($aPhotos) || empty($aPhotos))
 					break;
 					break;
 
 
-	        	$aFirst = current($aPhotos);
-	        	if($aFirst !== false) {
-	        		$aResult['content']['title'] = isset($aFirst['title']) ? $aFirst['title'] : '';
-	        		$aResult['content']['text'] = isset($aFirst['text']) ? $aFirst['text'] : '';
-	        	}
-
 				bx_import('BxDolImageTranscoder');
 				bx_import('BxDolImageTranscoder');
-	        	$oTranscoder = BxDolImageTranscoder::getObjectInstance($this->_oConfig->getObject('transcoder_preview'));
+	        	$oTranscoder = BxDolImageTranscoder::getObjectInstance($this->_oConfig->getObject('transcoder_view'));
 
 
 				foreach($aPhotos as $aPhoto)
 				foreach($aPhotos as $aPhoto)
 					$aResult['content']['images'][] = array(
 					$aResult['content']['images'][] = array(
@@ -797,7 +755,7 @@ class BxTimelineTemplate extends BxDolModuleTemplate
 					$aShared = $this->_getSystemData($aContent); 
 					$aShared = $this->_getSystemData($aContent); 
 
 
 				$aResult['content'] = array_merge($aContent, $aShared['content']);
 				$aResult['content'] = array_merge($aContent, $aShared['content']);
-				$aResult['content']['parse_type'] = $aShared['content_type'];
+				$aResult['content']['parse_type'] = !empty($aShared['content_type']) ? $aShared['content_type'] : BX_TIMELINE_PARSE_TYPE_DEFAULT;
 				$aResult['content']['owner_id'] = $aShared['owner_id'];
 				$aResult['content']['owner_id'] = $aShared['owner_id'];
 				list($aResult['content']['owner_name'], $aResult['content']['owner_url']) = $oModule->getUserInfo($aShared['owner_id']);
 				list($aResult['content']['owner_name'], $aResult['content']['owner_url']) = $oModule->getUserInfo($aShared['owner_id']);
 
 

+ 36 - 0
modules/boonex/timeline/classes/BxTimelineUploaderSimple.php

@@ -0,0 +1,36 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    DolphinCore Dolphin Core
+ * @{
+ */
+
+bx_import ('BxTemplUploaderSimple');
+
+/**
+ * Upload files using standard HTML forms.
+ * @see BxBaseUploaderSimple, BxDolUploader
+ */
+class BxTimelineUploaderSimple extends BxTemplUploaderSimple {
+    public function __construct ($aObject, $sStorageObject, $sUniqId) {
+        parent::__construct($aObject, $sStorageObject, $sUniqId);
+
+        bx_import('BxDolModule');
+        $oModule = BxDolModule::getInstance('bx_timeline');
+
+        $this->_oTemplate = $oModule->_oTemplate;
+        $this->_sButtonTemplate = 'uploader_bs.html';
+    }
+
+    public function getUploaderButton($mixedGhostTemplate, $isMultiple = true, $aParams = array()) {
+    	$sResult = parent::getUploaderButton($mixedGhostTemplate, $isMultiple, $aParams);
+
+    	return $this->_oTemplate->parseHtmlByContent($sResult, array(
+			'js_object' => $this->_oTemplate->_oConfig->getJsObject('post'),
+    	));
+    }
+}
+
+/** @} */

+ 16 - 55
modules/boonex/timeline/install/langs/en.xml

@@ -3,50 +3,19 @@
 
 
 	<string name="_bx_timeline"><![CDATA[Timeline]]></string>
 	<string name="_bx_timeline"><![CDATA[Timeline]]></string>
 
 
-	<!--
-	<string name="_bx_timeline_form_XXX"><![CDATA[]]></string>
-	<string name="_bx_timeline_form_XXX_display_XXX"><![CDATA[]]></string>
-	<string name="_bx_timeline_form_XXX_input_sys_do_submit"><![CDATA[Submit]]></string>
-	<string name="_bx_timeline_form_XXX_input_do_submit"><![CDATA[Submit]]></string>
-	-->
-
-	<string name="_bx_timeline_form_text"><![CDATA[Write Post]]></string>
-	<string name="_bx_timeline_form_text_display_add"><![CDATA[Write Post]]></string>
-	<string name="_bx_timeline_form_text_input_sys_owner_id"><![CDATA[Owner ID]]></string>
-	<string name="_bx_timeline_form_text_input_sys_action"><![CDATA[Action]]></string>
-	<string name="_bx_timeline_form_text_input_sys_type"><![CDATA[Type]]></string>
-	<string name="_bx_timeline_form_text_input_sys_content"><![CDATA[Content]]></string>
-	<string name="_bx_timeline_form_text_input_content"><![CDATA[]]></string>
-	<string name="_bx_timeline_form_text_input_err_content"><![CDATA[The message to be posted is empty]]></string>
-	<string name="_bx_timeline_form_text_input_sys_do_submit"><![CDATA[Post]]></string>
-	<string name="_bx_timeline_form_text_input_do_submit"><![CDATA[Post]]></string>
-
-	<string name="_bx_timeline_form_link"><![CDATA[Share a Link]]></string>
-	<string name="_bx_timeline_form_link_display_add"><![CDATA[Share a Link]]></string>
-	<string name="_bx_timeline_form_link_input_sys_owner_id"><![CDATA[Owner ID]]></string>
-	<string name="_bx_timeline_form_link_input_sys_action"><![CDATA[Action]]></string>
-	<string name="_bx_timeline_form_link_input_sys_type"><![CDATA[Type]]></string>
-	<string name="_bx_timeline_form_link_input_sys_content"><![CDATA[Content]]></string>
-	<string name="_bx_timeline_form_link_input_content"><![CDATA[]]></string>
-	<string name="_bx_timeline_form_link_input_err_content"><![CDATA[The link to be posted is empty]]></string>
-	<string name="_bx_timeline_form_link_input_sys_do_submit"><![CDATA[Post]]></string>
-	<string name="_bx_timeline_form_link_input_do_submit"><![CDATA[Post]]></string>
-
-	<string name="_bx_timeline_form_photo"><![CDATA[Post an Image]]></string>
-	<string name="_bx_timeline_form_photo_display_add"><![CDATA[Post an Image]]></string>
-	<string name="_bx_timeline_form_photo_input_sys_owner_id"><![CDATA[Owner ID]]></string>
-	<string name="_bx_timeline_form_photo_input_sys_action"><![CDATA[Action]]></string>
-	<string name="_bx_timeline_form_photo_input_sys_type"><![CDATA[Type]]></string>
-	<string name="_bx_timeline_form_photo_input_sys_content"><![CDATA[Content]]></string>
-	<string name="_bx_timeline_form_photo_input_content"><![CDATA[]]></string>
-	<string name="_bx_timeline_form_photo_input_sys_do_submit"><![CDATA[Post]]></string>
-	<string name="_bx_timeline_form_photo_input_do_submit"><![CDATA[Post]]></string>
-	<string name="_bx_timeline_form_photo_input_title"><![CDATA[Title]]></string>
-	<string name="_bx_timeline_form_photo_input_err_title"><![CDATA[Title is required.]]></string>
-	<string name="_bx_timeline_form_photo_input_title"><![CDATA[Title]]></string>
-	<string name="_bx_timeline_form_photo_input_err_title"><![CDATA[Title is required.]]></string>
-	<string name="_bx_timeline_form_photo_input_description"><![CDATA[Description]]></string>
-	<string name="_bx_timeline_form_photo_input_err_description"><![CDATA[Description is required.]]></string>
+	<string name="_bx_timeline_form_post"><![CDATA[Post]]></string>
+	<string name="_bx_timeline_form_post_display_add"><![CDATA[Write Post]]></string>
+	<string name="_bx_timeline_form_post_input_sys_owner_id"><![CDATA[Owner ID]]></string>
+	<string name="_bx_timeline_form_post_input_sys_action"><![CDATA[Action]]></string>
+	<string name="_bx_timeline_form_post_input_sys_type"><![CDATA[Type]]></string>
+	<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_link"><![CDATA[Link]]></string>
+	<string name="_bx_timeline_form_post_input_link"><![CDATA[]]></string>
+	<string name="_bx_timeline_form_post_input_sys_photo"><![CDATA[Content]]></string>
+	<string name="_bx_timeline_form_post_input_photo"><![CDATA[]]></string>
+	<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_acl_action_post"><![CDATA[Post]]></string>
 	<string name="_bx_timeline_acl_action_post"><![CDATA[Post]]></string>
 	<string name="_bx_timeline_acl_action_delete"><![CDATA[Delete]]></string>
 	<string name="_bx_timeline_acl_action_delete"><![CDATA[Delete]]></string>
@@ -108,24 +77,16 @@
 	<string name="_bx_timeline_txt_jump_to_n_year"><![CDATA[Jump to {0} year]]></string>
 	<string name="_bx_timeline_txt_jump_to_n_year"><![CDATA[Jump to {0} year]]></string>
 	<string name="_bx_timeline_txt_jump_to_recent"><![CDATA[Jump to recent posts]]></string>
 	<string name="_bx_timeline_txt_jump_to_recent"><![CDATA[Jump to recent posts]]></string>
 
 
-	<string name="_bx_timeline_txt_wrote"><![CDATA[wrote]]></string>
-	<string name="_bx_timeline_txt_shared_link"><![CDATA[shared a link]]></string>
-	<string name="_bx_timeline_txt_added_photo"><![CDATA[added a photo]]></string>
-	<string name="_bx_timeline_txt_added_photos"><![CDATA[added photos]]></string>
-	<string name="_bx_timeline_txt_common_text"><![CDATA[post]]></string>
-	<string name="_bx_timeline_txt_common_link"><![CDATA[link]]></string>
-	<string name="_bx_timeline_txt_common_photo"><![CDATA[photo]]></string>
-
 	<string name="_bx_timeline_txt_rss_caption"><![CDATA[{0}'s timeline]]></string>
 	<string name="_bx_timeline_txt_rss_caption"><![CDATA[{0}'s timeline]]></string>
 	<string name="_bx_timeline_txt_user_added_sample"><![CDATA[{0} added {1}]]></string>
 	<string name="_bx_timeline_txt_user_added_sample"><![CDATA[{0} added {1}]]></string>
 	<string name="_bx_timeline_txt_user_shared_sample"><![CDATA[{0} shared {1}'s {2}]]></string>
 	<string name="_bx_timeline_txt_user_shared_sample"><![CDATA[{0} shared {1}'s {2}]]></string>
-	<string name="_bx_timeline_txt_sample"><![CDATA[item]]></string>
+	<string name="_bx_timeline_txt_sample"><![CDATA[post]]></string>
 
 
 	<string name="_bx_timeline_txt_do_share"><![CDATA[Share]]></string>
 	<string name="_bx_timeline_txt_do_share"><![CDATA[Share]]></string>
 	<string name="_bx_timeline_txt_shared"><![CDATA[Shared {0}'s {1}.]]></string>
 	<string name="_bx_timeline_txt_shared"><![CDATA[Shared {0}'s {1}.]]></string>
 	<string name="_bx_timeline_txt_err_cannot_share"><![CDATA[Cannot share. Please report.]]></string>
 	<string name="_bx_timeline_txt_err_cannot_share"><![CDATA[Cannot share. Please report.]]></string>
-	<string name="_bx_timeline_txt_msg_success_share"><![CDATA[Shared successfully.]]></string>
+	<string name="_bx_timeline_txt_msg_success_share"><![CDATA[]]></string>
 
 
 	<string name="_bx_timeline_txt_plus"><![CDATA[Plus]]></string>
 	<string name="_bx_timeline_txt_plus"><![CDATA[Plus]]></string>
 	
 	
-</resources>
+</resources>

+ 7 - 16
modules/boonex/timeline/install/sql/enable.sql

@@ -22,18 +22,6 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designb
 
 
 -- MENUS
 -- MENUS
 
 
--- MENU: Post Item (Text, Link, Photo)
-INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
-('bx_timeline_menu_post', '_bx_timeline_menu_title_post', 'bx_timeline_menu_post', 'bx_timeline', 11, 0, 1, 'BxTimelineMenuPost', 'modules/boonex/timeline/classes/BxTimelineMenuPost.php');
-
-INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
-('bx_timeline_menu_post', 'bx_timeline', '_bx_timeline_menu_set_title_post', 0);
-
-INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
-('bx_timeline_menu_post', 'bx_timeline', 'post-text', '_bx_timeline_menu_item_title_system_post_text', '_bx_timeline_menu_item_title_post_text', 'javascript:void(0)', 'javascript:{js_object_post}.changePostType(this, ''text'')', '_self', '', '', 2147483647, 1, 0, 0),
-('bx_timeline_menu_post', 'bx_timeline', 'post-link', '_bx_timeline_menu_item_title_system_post_link', '_bx_timeline_menu_item_title_post_link', 'javascript:void(0)', 'javascript:{js_object_post}.changePostType(this, ''link'')', '_self', '', '', 2147483647, 1, 0, 0),
-('bx_timeline_menu_post', 'bx_timeline', 'post-photo', '_bx_timeline_menu_item_title_system_post_photo', '_bx_timeline_menu_item_title_post_photo', 'javascript:void(0)', 'javascript:{js_object_post}.changePostType(this, ''photo'')', '_self', '', '', 2147483647, 1, 0, 0);
-
 -- MENU: Item Manage (Delete)
 -- MENU: Item Manage (Delete)
 INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
 INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_timeline_menu_item_manage', '_bx_timeline_menu_title_item_manage', 'bx_timeline_menu_item_manage', 'bx_timeline', 6, 0, 1, 'BxTimelineMenuItem', 'modules/boonex/timeline/classes/BxTimelineMenuItem.php');
 ('bx_timeline_menu_item_manage', '_bx_timeline_menu_title_item_manage', 'bx_timeline_menu_item_manage', 'bx_timeline', 6, 0, 1, 'BxTimelineMenuItem', 'modules/boonex/timeline/classes/BxTimelineMenuItem.php');
@@ -83,17 +71,20 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `c
 
 
 -- UPLOADERS
 -- UPLOADERS
 INSERT INTO `sys_objects_uploader` (`object`, `active`, `override_class_name`, `override_class_file`) VALUES
 INSERT INTO `sys_objects_uploader` (`object`, `active`, `override_class_name`, `override_class_file`) VALUES
-('bx_timeline_simple', 1, 'BxTemplUploaderSimple', '');
+('bx_timeline_simple', 1, 'BxTimelineUploaderSimple', 'modules/boonex/timeline/classes/BxTimelineUploaderSimple.php');
 
 
 INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
 INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
 ('bx_timeline_photos', 'Local', '', 360, 2592000, 3, 'bx_timeline_photos', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
 ('bx_timeline_photos', 'Local', '', 360, 2592000, 3, 'bx_timeline_photos', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
-('bx_timeline_photos_preview', 'Local', '', 360, 2592000, 3, 'bx_timeline_photos_preview', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
+('bx_timeline_photos_preview', 'Local', '', 360, 2592000, 3, 'bx_timeline_photos_preview', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
+('bx_timeline_photos_view', 'Local', '', 360, 2592000, 3, 'bx_timeline_photos_view', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
 
 
 INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES
 INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES
-('bx_timeline_photos_preview', 'bx_timeline_photos_preview', 'Storage', 'a:1:{s:6:"object";s:18:"bx_timeline_photos";}', 'no', '1', '2592000', '0');
+('bx_timeline_photos_preview', 'bx_timeline_photos_preview', 'Storage', 'a:1:{s:6:"object";s:18:"bx_timeline_photos";}', 'no', '1', '2592000', '0'),
+('bx_timeline_photos_view', 'bx_timeline_photos_view', 'Storage', 'a:1:{s:6:"object";s:18:"bx_timeline_photos";}', 'no', '1', '2592000', '0');
 
 
 INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES
 INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES
-('bx_timeline_photos_preview', 'Resize', 'a:4:{s:1:"w";s:3:"319";s:1:"h";s:3:"319";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
+('bx_timeline_photos_preview', 'Resize', 'a:4:{s:1:"w";s:3:"100";s:1:"h";s:3:"100";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
+('bx_timeline_photos_view', 'Resize', 'a:4:{s:1:"w";s:3:"318";s:1:"h";s:3:"318";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
 
 
 
 
 -- ACL
 -- ACL

+ 33 - 54
modules/boonex/timeline/install/sql/install.sql

@@ -70,6 +70,22 @@ CREATE TABLE IF NOT EXISTS `bx_timeline_photos_preview` (
   UNIQUE KEY `remote_id` (`remote_id`)
   UNIQUE KEY `remote_id` (`remote_id`)
 );
 );
 
 
+CREATE TABLE IF NOT EXISTS `bx_timeline_photos_view` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `profile_id` int(10) unsigned NOT NULL,
+  `remote_id` varchar(255) NOT NULL,
+  `path` varchar(255) NOT NULL,
+  `file_name` varchar(255) NOT NULL,
+  `mime_type` varchar(128) NOT NULL,
+  `ext` varchar(32) NOT NULL,
+  `size` int(11) NOT NULL,
+  `added` int(11) NOT NULL,
+  `modified` int(11) NOT NULL,
+  `private` int(11) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `remote_id` (`remote_id`)
+);
+
 CREATE TABLE IF NOT EXISTS `bx_timeline_photos2events` (
 CREATE TABLE IF NOT EXISTS `bx_timeline_photos2events` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `event_id` int(11) NOT NULL DEFAULT '0',
   `event_id` int(11) NOT NULL DEFAULT '0',
@@ -124,68 +140,31 @@ CREATE TABLE IF NOT EXISTS `bx_timeline_votes_track` (
 ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
 ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
 
 
 
 
--- Forms -> Text
+-- Forms -> Post
 INSERT INTO `sys_objects_form` (`object`, `module`, `title`, `action`, `form_attrs`, `submit_name`, `table`, `key`, `uri`, `uri_title`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
 INSERT INTO `sys_objects_form` (`object`, `module`, `title`, `action`, `form_attrs`, `submit_name`, `table`, `key`, `uri`, `uri_title`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
-('mod_tml_text', @sName, '_bx_timeline_form_text', '', '', 'do_submit', 'bx_timeline_events', 'id', '', '', '', 0, 1, '', '');
+('mod_tml_post', @sName, '_bx_timeline_form_post', '', '', 'do_submit', 'bx_timeline_events', 'id', '', '', '', 0, 1, '', '');
 
 
 INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
 INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
-('mod_tml_text_add', @sName, 'mod_tml_text', '_bx_timeline_form_text_display_add', 0);
+('mod_tml_post_add', @sName, 'mod_tml_post', '_bx_timeline_form_post_display_add', 0);
 
 
 INSERT INTO `sys_form_inputs` (`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES
 INSERT INTO `sys_form_inputs` (`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES
-('mod_tml_text', @sName, 'type', 'text', '', 0, 'hidden', '_bx_timeline_form_text_input_sys_type', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
-('mod_tml_text', @sName, 'action', '', '', 0, 'hidden', '_bx_timeline_form_text_input_sys_action', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
-('mod_tml_text', @sName, 'owner_id', '0', '', 0, 'hidden', '_bx_timeline_form_text_input_sys_owner_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 0, 0),
-('mod_tml_text', @sName, 'content', '', '', 0, 'textarea', '_bx_timeline_form_text_input_sys_content', '_bx_timeline_form_text_input_content', '', 0, 0, 0, '', '', '', 'Avail', '', '_bx_timeline_form_text_input_err_content', 'Xss', '', 0, 0),
-('mod_tml_text', @sName, 'do_submit', '_bx_timeline_form_text_input_do_submit', '', 0, 'submit', '_bx_timeline_form_text_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
+('mod_tml_post', @sName, 'type', 'post', '', 0, 'hidden', '_bx_timeline_form_post_input_sys_type', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
+('mod_tml_post', @sName, 'action', '', '', 0, 'hidden', '_bx_timeline_form_post_input_sys_action', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
+('mod_tml_post', @sName, 'owner_id', '0', '', 0, 'hidden', '_bx_timeline_form_post_input_sys_owner_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 0, 0),
+('mod_tml_post', @sName, 'text', '', '', 0, 'textarea', '_bx_timeline_form_post_input_sys_text', '_bx_timeline_form_post_input_text', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
+('mod_tml_post', @sName, 'link', '', '', 0, 'text', '_bx_timeline_form_post_input_sys_link', '_bx_timeline_form_post_input_link', '', 0, 0, 0, '', 'a:1:{s:5:"style";s:12:"display:none";}', '', '', '', '', 'Xss', '', 0, 0),
+('mod_tml_post', @sName, 'photo', '', '', 0, 'files', '_bx_timeline_form_post_input_sys_photo', '_bx_timeline_form_post_input_photo', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
+('mod_tml_post', @sName, 'do_submit', '_bx_timeline_form_post_input_do_submit', '', 0, 'submit', '_bx_timeline_form_post_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
 
 
 INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
 INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
-('mod_tml_text_add', 'type', 2147483647, 1, 1),
-('mod_tml_text_add', 'action', 2147483647, 1, 2),
-('mod_tml_text_add', 'owner_id', 2147483647, 1, 3),
-('mod_tml_text_add', 'content', 2147483647, 1, 4),
-('mod_tml_text_add', 'do_submit', 2147483647, 1, 5);
+('mod_tml_post_add', 'type', 2147483647, 1, 1),
+('mod_tml_post_add', 'action', 2147483647, 1, 2),
+('mod_tml_post_add', 'owner_id', 2147483647, 1, 3),
+('mod_tml_post_add', 'text', 2147483647, 1, 4),
+('mod_tml_post_add', 'link', 2147483647, 1, 5),
+('mod_tml_post_add', 'photo', 2147483647, 1, 6),
+('mod_tml_post_add', 'do_submit', 2147483647, 1, 7);
 
 
--- Forms -> Link
-INSERT INTO `sys_objects_form` (`object`, `module`, `title`, `action`, `form_attrs`, `submit_name`, `table`, `key`, `uri`, `uri_title`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
-('mod_tml_link', @sName, '_bx_timeline_form_link', '', '', 'do_submit', 'bx_timeline_events', 'id', '', '', '', 0, 1, '', '');
-
-INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
-('mod_tml_link_add', @sName, 'mod_tml_link', '_bx_timeline_form_link_display_add', 0);
-
-INSERT INTO `sys_form_inputs` (`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES
-('mod_tml_link', @sName, 'type', 'link', '', 0, 'hidden', '_bx_timeline_form_link_input_sys_type', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
-('mod_tml_link', @sName, 'action', '', '', 0, 'hidden', '_bx_timeline_form_link_input_sys_action', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
-('mod_tml_link', @sName, 'owner_id', '0', '', 0, 'hidden', '_bx_timeline_form_link_input_sys_owner_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 0, 0),
-('mod_tml_link', @sName, 'content', '', '', 0, 'text', '_bx_timeline_form_link_input_sys_content', '_bx_timeline_form_link_input_content', '', 0, 0, 0, '', '', '', 'Avail', '', '_bx_timeline_form_link_input_err_content', 'Xss', '', 0, 0),
-('mod_tml_link', @sName, 'do_submit', '_bx_timeline_form_link_input_do_submit', '', 0, 'submit', '_bx_timeline_form_link_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
-
-INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
-('mod_tml_link_add', 'type', 2147483647, 1, 1),
-('mod_tml_link_add', 'action', 2147483647, 1, 2),
-('mod_tml_link_add', 'owner_id', 2147483647, 1, 3),
-('mod_tml_link_add', 'content', 2147483647, 1, 4),
-('mod_tml_link_add', 'do_submit', 2147483647, 1, 5);
-
--- Forms -> Photo
-INSERT INTO `sys_objects_form` (`object`, `module`, `title`, `action`, `form_attrs`, `submit_name`, `table`, `key`, `uri`, `uri_title`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
-('mod_tml_photo', @sName, '_bx_timeline_form_photo', '', '', 'do_submit', 'bx_timeline_events', 'id', '', '', '', 0, 1, '', '');
-
-INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
-('mod_tml_photo_add', @sName, 'mod_tml_photo', '_bx_timeline_form_photo_display_add', 0);
-
-INSERT INTO `sys_form_inputs` (`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES
-('mod_tml_photo', @sName, 'type', 'photo', '', 0, 'hidden', '_bx_timeline_form_photo_input_sys_type', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
-('mod_tml_photo', @sName, 'action', '', '', 0, 'hidden', '_bx_timeline_form_photo_input_sys_action', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
-('mod_tml_photo', @sName, 'owner_id', '0', '', 0, 'hidden', '_bx_timeline_form_photo_input_sys_owner_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 0, 0),
-('mod_tml_photo', @sName, 'content', '', '', 0, 'files', '_bx_timeline_form_photo_input_sys_content', '_bx_timeline_form_photo_input_content', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
-('mod_tml_photo', @sName, 'do_submit', '_bx_timeline_form_photo_input_do_submit', '', 0, 'submit', '_bx_timeline_form_photo_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
-
-INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
-('mod_tml_photo_add', 'type', 2147483647, 1, 1),
-('mod_tml_photo_add', 'action', 2147483647, 1, 2),
-('mod_tml_photo_add', 'owner_id', 2147483647, 1, 3),
-('mod_tml_photo_add', 'content', 2147483647, 1, 4),
-('mod_tml_photo_add', 'do_submit', 2147483647, 1, 5);
 
 
 -- STUDIO PAGE & WIDGET
 -- STUDIO PAGE & WIDGET
 INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
 INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES

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

@@ -5,12 +5,13 @@ DROP TABLE IF EXISTS `bx_timeline_handlers`;
 
 
 DROP TABLE IF EXISTS `bx_timeline_photos`;
 DROP TABLE IF EXISTS `bx_timeline_photos`;
 DROP TABLE IF EXISTS `bx_timeline_photos_preview`;
 DROP TABLE IF EXISTS `bx_timeline_photos_preview`;
+DROP TABLE IF EXISTS `bx_timeline_photos_view`;
 DROP TABLE IF EXISTS `bx_timeline_photos2events`;
 DROP TABLE IF EXISTS `bx_timeline_photos2events`;
 
 
 DROP TABLE IF EXISTS `bx_timeline_comments`;
 DROP TABLE IF EXISTS `bx_timeline_comments`;
 
 
 DROP TABLE IF EXISTS `bx_timeline_votes`;
 DROP TABLE IF EXISTS `bx_timeline_votes`;
-DROP TABLE IF EXISTS `bx_timeline_votes_track`
+DROP TABLE IF EXISTS `bx_timeline_votes_track`;
 
 
 -- Forms All
 -- Forms All
 DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN  (SELECT `display_name` FROM `sys_form_displays` WHERE `module` = @sName);
 DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN  (SELECT `display_name` FROM `sys_form_displays` WHERE `module` = @sName);

+ 14 - 36
modules/boonex/timeline/js/post.js

@@ -66,47 +66,25 @@ BxTimelinePost.prototype.afterFormPostSubmit = function (oForm, oData)
 	}
 	}
 };
 };
 
 
-BxTimelinePost.prototype.changePostType = function(oLink, sType) {    
-    var $this = this;
-
-    var oContent = $('#timeline-ptype-cnt-' + sType);
-    if(oContent.html() != '') {
-    	$('.timeline-ptype-cnt:visible').bx_anim('hide', this._sAnimationEffect, this._iAnimationSpeed, function() {
-    		oContent.bx_anim('show', $this._sAnimationEffect, $this._iAnimationSpeed);
-    	});
-    	return;
-    }
-
-    if(sType == 'music' || sType == 'video') {
-        jQuery.post (
-            $this._sActionsUrl + 'get_' + sType + '_uploaders/' + this._iOwnerId,
-            {},
-            function(sResult) {
-            	if($.trim(sResult).length) {
-            		oContent.filter(':visible').find('iframe[name=upload_file_frame]').remove();
-            		oContent.filter('.wall_' + sType).html(sResult);            	   
-            		$this._animContent(oLink, sType);
-            	}
-            }
-        );
-    }    
+BxTimelinePost.prototype.showLinkField = function(oElement) {
+	$(oElement).parents('form:first').find('#bx-form-element-link').bx_anim('toggle', this._sAnimationEffect, this._iAnimationSpeed);
 };
 };
 
 
 BxTimelinePost.prototype._getForm = function(oElement, sType) {
 BxTimelinePost.prototype._getForm = function(oElement, sType) {
-	var $this = this;
+    var $this = this;
     var oData = this._getDefaultData();
     var oData = this._getDefaultData();
 
 
-	jQuery.post (
-        this._sActionsUrl + 'get_post_form/' + sType + '/',
-        oData,
-        function(oData) {
-        	if(oData && oData.form != undefined && oData.form_id != undefined) {
-	        	$('#' + oData.form_id).replaceWith(oData.form);
-	        	$this.initFormPost(oData.form_id);
-        	}
-        },
-        'json'
-    );
+    jQuery.post (
+    this._sActionsUrl + 'get_post_form/' + sType + '/',
+    oData,
+    function(oData) {
+            if(oData && oData.form != undefined && oData.form_id != undefined) {
+                    $('#' + oData.form_id).replaceWith(oData.form);
+                    $this.initFormPost(oData.form_id);
+            }
+    },
+    'json'
+);
 };
 };
 
 
 BxTimelinePost.prototype._getPost = function(oElement, iPostId) {
 BxTimelinePost.prototype._getPost = function(oElement, iPostId) {

+ 1 - 1
modules/boonex/timeline/js/share.js

@@ -30,7 +30,7 @@ BxTimelineShare.prototype.shareItem = function(oLink, iOwnerId, sType, sAction,
         function(oData) {
         function(oData) {
         	$this.loadingInItem(oLink, false);
         	$this.loadingInItem(oLink, false);
 
 
-        	if(oData && oData.msg != undefined)
+        	if(oData && oData.msg != undefined && oData.msg.length > 0)
                 alert(oData.msg);
                 alert(oData.msg);
 
 
         	if(oData && oData.counter != undefined) {
         	if(oData && oData.counter != undefined) {

+ 4 - 0
modules/boonex/timeline/template/block_post.html

@@ -0,0 +1,4 @@
+<div id="bx-timeline-post" class="__style_prefix__-post bx-def-bc-margin">
+    <div class="__style_prefix__-post-cnt">__form__</div>
+	__js_content__
+</div>

+ 0 - 0
modules/boonex/timeline/template/view.html → modules/boonex/timeline/template/block_view.html


+ 31 - 17
modules/boonex/timeline/template/css/post.css

@@ -1,26 +1,40 @@
-div.timeline-post {
+div.bx-tl-post {
     position: relative;
     position: relative;
 }
 }
-
-div.timeline-ptype-cnt {
+div.bx-tl-post-cnt {
     position: relative;
     position: relative;
     display: block;
     display: block;
 }
 }
-div.timeline-text,
-div.timeline-link,
-div.timeline-photo,
-div.timeline-video,
-div.timeline-music {
-    padding: 0px;
-    display: none;
-    border: 0px;
-}
 
 
-/*--- Post Type TEXT Styles ---*/
-div.timeline-text {
-    display: block;    
-}
-div.timeline-text div.input_wrapper_textarea {
+/*--- Post Form Styles ---*/
+div#bx-timeline-post div.input_wrapper_textarea {
     width: auto;
     width: auto;
     float: none;
     float: none;
+}
+div#bx-timeline-post div#bx-form-element-photo,
+div#bx-timeline-post .bx-form-input-files-uploaders {
+	margin-top: 0px;
+}
+div.bx-tl-uploader-buttons {
+	position: absolute;
+	right: 0px;
+}
+a.bx-tl-uploader-button {
+	text-decoration: none;
+}
+div.bx-tl-uploader-file {
+	position: relative;
+	float: left;
+}
+div.bx-tl-uploader-file-preview {
+	overflow: hidden;
+}
+div.bx-tl-uploader-file-preview,
+div.bx-tl-uploader-file-preview img {
+	width: 100px;
+	height: 100px;
+}
+div.bx-tl-uploader-file-preview img {
+	background-position: center center;
+	background-repeat: no-repeat;
 }
 }

+ 4 - 0
modules/boonex/timeline/template/css/view.css

@@ -13,6 +13,9 @@ div.bx-tl-items {
 .bx-tl-grid-sizer {
 .bx-tl-grid-sizer {
 	width: 100%;
 	width: 100%;
 }
 }
+.bx-tl-view-sizer {
+	max-width: 30rem;
+}
 .bx-tl-view-sizer div.bx-tl-item-ind {
 .bx-tl-view-sizer div.bx-tl-item-ind {
 	padding: 0px;
 	padding: 0px;
 }
 }
@@ -37,6 +40,7 @@ div.bx-tl-item-ind {
 }
 }
 div.bx-tl-item-cnt {
 div.bx-tl-item-cnt {
 	position: relative;
 	position: relative;
+	overflow: hidden;
 }
 }
 /*+++ Item Menu +++*/
 /*+++ Item Menu +++*/
 div.bx-tl-item-menu {
 div.bx-tl-item-menu {

+ 0 - 1
modules/boonex/timeline/template/link.html

@@ -1 +0,0 @@
-<bx_include_auto:text.html />

+ 0 - 1
modules/boonex/timeline/template/photo.html

@@ -1 +0,0 @@
-<bx_include_auto:text.html />

+ 0 - 13
modules/boonex/timeline/template/post.html

@@ -1,13 +0,0 @@
-<div id="bx-timeline-post" class="timeline-post bx-def-bc-margin">    
-    <!-- Post Text -->
-    <div id="timeline-ptype-cnt-text" class="timeline-ptype-cnt timeline-text">__text_form__</div>
-    <!-- Post Link -->
-    <div id="timeline-ptype-cnt-link" class="timeline-ptype-cnt timeline-link">__link_form__</div>
-    <!-- Post Photo -->
-    <div id="timeline-ptype-cnt-photo" class="timeline-ptype-cnt timeline-photo">__photo_form__</div>
-    <!-- Post Music -->
-    <div id="timeline-ptype-cnt-music" class="timeline-ptype-cnt timeline-music">__music_form__</div>
-    <!-- Post Video -->
-    <div id="timeline-ptype-cnt-video" class="timeline-ptype-cnt timeline-video">__video_form__</div>
-	__js_content__
-</div>

+ 0 - 0
modules/boonex/timeline/template/text.html → modules/boonex/timeline/template/type_post.html


+ 0 - 0
modules/boonex/timeline/template/share.html → modules/boonex/timeline/template/type_share.html


+ 9 - 0
modules/boonex/timeline/template/uploader_bs.html

@@ -0,0 +1,9 @@
+<div class="bx-tl-uploader-buttons">
+	<a href="javascript:void(0);" onclick="__js_object__.showLinkField(this);" class="bx-btn bx-def-margin-top bx-def-margin-sec-left-auto bx-tl-uploader-button">
+	    <i class="sys-icon link"></i>
+	</a>
+	<a href="javascript:void(0);" onclick="__uploader_instance_name__.showUploaderForm();" class="bx-btn bx-def-margin-top bx-def-margin-sec-left-auto bx-tl-uploader-button">
+	    <i class="sys-icon __button_title__"></i>
+	</a>
+</div>
+<bx_include_auto:uploader_button_simple_js.html />

+ 9 - 0
modules/boonex/timeline/template/uploader_nfw.html

@@ -0,0 +1,9 @@
+<div id="bx-uploader-file-{file_id}" class="bx-tl-uploader-file bx-def-margin-sec-top bx-def-margin-sec-left-auto">
+    <div class="bx-tl-uploader-file-preview bx-def-round-corners">
+    	<img src="<bx_image_url:spacer.gif />" style="background-image:url({file_icon})" />
+    </div>
+    <div class="bx-tl-uploader-file-actions bx-def-margin-thd-top bx-clearfix">
+    	<a class="bx-btn bx-btn-small" href="javascript:void(0);" onclick="{js_instance_name}.deleteGhost('{file_id}')"><bx_text:_Delete /></a>
+    	__nested_form__
+    </div>
+</div>

+ 1 - 1
studio/classes/BxDolStudioStore.php

@@ -11,7 +11,7 @@ defined('BX_DOL') or die('hack attempt');
 bx_import('BxTemplStudioPage');
 bx_import('BxTemplStudioPage');
 bx_import('BxDolStudioStoreQuery');
 bx_import('BxDolStudioStoreQuery');
 
 
-define('BX_DOL_STUDIO_STR_TYPE_DEFAULT', 'goodies');
+define('BX_DOL_STUDIO_STR_TYPE_DEFAULT', 'downloaded');
 
 
 class BxDolStudioStore extends BxTemplStudioPage {
 class BxDolStudioStore extends BxTemplStudioPage {
     protected $sPage;
     protected $sPage;

+ 1 - 1
template/comments_uploader_nfw.html

@@ -1,5 +1,5 @@
 <div id="bx-uploader-file-{file_id}" class="cmts-uploader-file bx-def-margin-sec-top bx-def-margin-sec-left-auto">
 <div id="bx-uploader-file-{file_id}" class="cmts-uploader-file bx-def-margin-sec-top bx-def-margin-sec-left-auto">
-    <div class="cmts-uploader-file-preview bx-def-thumb">
+    <div class="cmts-uploader-file-preview bx-def-round-corners">
     	<img src="<bx_image_url:spacer.gif />" style="background-image:url({file_icon})" />
     	<img src="<bx_image_url:spacer.gif />" style="background-image:url({file_icon})" />
     </div>
     </div>
     <div class="cmts-uploader-file-actions bx-def-margin-thd-top bx-clearfix">
     <div class="cmts-uploader-file-actions bx-def-margin-thd-top bx-clearfix">

+ 3 - 0
template/css/cmts.css

@@ -219,6 +219,9 @@
 		position: relative;
 		position: relative;
     	float: left;
     	float: left;
     }
     }
+    div.cmts-uploader-file-preview {
+		overflow: hidden;
+    }
     div.cmts-uploader-file-preview,
     div.cmts-uploader-file-preview,
     div.cmts-uploader-file-preview img {
     div.cmts-uploader-file-preview img {
 		width: 100px;
 		width: 100px;

+ 2 - 4
template/scripts/BxBaseUploaderHTML5.php

@@ -32,8 +32,7 @@ class BxBaseUploaderHTML5 extends BxDolUploader {
     public function getUploaderButton($sGhostTemplate, $isMultiple = true, $aParams = array()) {
     public function getUploaderButton($sGhostTemplate, $isMultiple = true, $aParams = array()) {
         $s = parent::getUploaderButton($sGhostTemplate, $isMultiple, $aParams);
         $s = parent::getUploaderButton($sGhostTemplate, $isMultiple, $aParams);
 
 
-        $oTemplate = BxDolTemplate::getInstance();
-        $oTemplate->addJs(BX_DOL_URL_PLUGINS . 'fileuploader.js');
+        $this->_oTemplate->addJs(BX_DOL_URL_PLUGINS . 'fileuploader.js');
 
 
         return $s;
         return $s;
     }
     }
@@ -57,8 +56,7 @@ class BxBaseUploaderHTML5 extends BxDolUploader {
     public function getUploaderForm($isMultiple = true, $iContentId = false) {
     public function getUploaderForm($isMultiple = true, $iContentId = false) {
         parent::getUploaderForm($isMultiple, $iContentId);
         parent::getUploaderForm($isMultiple, $iContentId);
 
 
-        $oTemplate = BxDolTemplate::getInstance();
-        $sForm = $oTemplate->parseHtmlByName('uploader_form_html5.html', array(
+        $sForm = $this->_oTemplate->parseHtmlByName('uploader_form_html5.html', array(
             'form_container_id' => $this->_sFormContainerId,
             'form_container_id' => $this->_sFormContainerId,
             'errors_container_id' => $this->_sErrorsContainerId,
             'errors_container_id' => $this->_sErrorsContainerId,
             'uploader_instance_name' => $this->getNameJsInstanceUploader(),
             'uploader_instance_name' => $this->getNameJsInstanceUploader(),

+ 1 - 2
template/scripts/BxBaseUploaderSimple.php

@@ -42,8 +42,7 @@ class BxBaseUploaderSimple extends BxDolUploader {
     public function getUploaderForm($isMultiple = true, $iContentId = false) {
     public function getUploaderForm($isMultiple = true, $iContentId = false) {
         parent::getUploaderForm($isMultiple, $iContentId);
         parent::getUploaderForm($isMultiple, $iContentId);
 
 
-        $oTemplate = BxDolTemplate::getInstance();
-        $sForm = $oTemplate->parseHtmlByName('uploader_form_simple.html', array(
+        $sForm = $this->_oTemplate->parseHtmlByName('uploader_form_simple.html', array(
             'form_container_id' => $this->_sFormContainerId,
             'form_container_id' => $this->_sFormContainerId,
             'errors_container_id' => $this->_sErrorsContainerId,
             'errors_container_id' => $this->_sErrorsContainerId,
             'uploader_instance_name' => $this->getNameJsInstanceUploader(),
             'uploader_instance_name' => $this->getNameJsInstanceUploader(),