Browse Source

Ticket #1630 - Attach Files.

AntonLV 7 years ago
parent
commit
c203f8cedc

+ 4 - 4
modules/base/general/classes/BxBaseModGeneralTemplate.php

@@ -204,7 +204,7 @@ class BxBaseModGeneralTemplate extends BxDolModuleTemplate
         ));
     }
 
-    protected function getAttachmentsImagesTranscoders ()
+    protected function getAttachmentsImagesTranscoders ($sStorage = '')
     {
         $CNF = &$this->getModule()->_oConfig->CNF;
 
@@ -214,7 +214,7 @@ class BxBaseModGeneralTemplate extends BxDolModuleTemplate
         return array($oTranscoder, $oTranscoderPreview);
     }
 
-    protected function getAttachmentsVideoTranscoders ()
+    protected function getAttachmentsVideoTranscoders ($sStorage = '')
     {
         $CNF = &$this->getModule()->_oConfig->CNF;
 
@@ -234,8 +234,8 @@ class BxBaseModGeneralTemplate extends BxDolModuleTemplate
 
         $oStorage = BxDolStorage::getObjectInstance($sStorage);
 
-        list($oTranscoder, $oTranscoderPreview) = $this->getAttachmentsImagesTranscoders();
-        $aTranscodersVideo = $this->getAttachmentsVideoTranscoders();
+        list($oTranscoder, $oTranscoderPreview) = $this->getAttachmentsImagesTranscoders($sStorage);
+        $aTranscodersVideo = $this->getAttachmentsVideoTranscoders($sStorage);
 
         $aGhostFiles = $oStorage->getGhosts ($this->getModule()->serviceGetContentOwnerProfileId($aData[$CNF['FIELD_ID']]), $aData[$CNF['FIELD_ID']]);
         if (!$aGhostFiles)

+ 9 - 6
modules/base/general/template/css/main.css

@@ -87,18 +87,21 @@
 }
 
 /* attachments */
-.bx-base-general-attachments .bx-base-general-attachment video,
-.bx-base-general-attachments .bx-base-general-attachment {
-    width:18.75rem;
-    height:12.5rem;
-}
-
 .bx-base-general-attachments {
     margin:-1px;
 }
 .bx-base-general-attachment {
     margin:1px;
 }
+.bx-base-general-attachments .bx-base-general-attachment video,
+.bx-base-general-attachments .bx-base-general-attachment {
+    width:18.75rem;
+    height:12.5rem;
+}
+.bx-base-general-attachment a div {
+    text-overflow: ellipsis;
+    overflow: hidden;
+}
 
 /* comments item */
 div.bx-base-general-comments div.bx-base-general-comments-element-holder,

+ 30 - 0
modules/base/text/classes/BxBaseModTextFormEntry.php

@@ -15,6 +15,7 @@
 class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
 {
     protected $_sGhostTemplateVideo = 'form_ghost_template_video.html';
+    protected $_sGhostTemplateFile = 'form_ghost_template_file.html';
 
     public function __construct($aInfo, $oTemplate = false)
     {
@@ -54,6 +55,13 @@ class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
             $this->aInputs[$CNF['FIELD_VIDEO']]['ghost_template'] = $this->_oModule->_oTemplate->parseHtmlByName($this->_sGhostTemplateVideo, $this->_getVideoGhostTmplVars($aContentInfo));
         }
 
+        if (isset($CNF['FIELD_FILE']) && isset($this->aInputs[$CNF['FIELD_FILE']])) {
+            if ($bValues)
+                $this->aInputs[$CNF['FIELD_FILE']]['content_id'] = $aValues['id'];
+
+            $this->aInputs[$CNF['FIELD_FILE']]['ghost_template'] = $this->_oModule->_oTemplate->parseHtmlByName($this->_sGhostTemplateFile, $this->_getFileGhostTmplVars($aContentInfo));
+        }
+
         if (isset($CNF['FIELD_POLL']) && isset($this->aInputs[$CNF['FIELD_POLL']])) {
             if ($bValues)
                 $this->aInputs[$CNF['FIELD_POLL']]['content_id'] = $aValues['id'];
@@ -102,6 +110,17 @@ class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
         return true;
     }
 
+    protected function _getPhotoGhostTmplVars($aContentInfo = array())
+    {
+    	$CNF = &$this->_oModule->_oConfig->CNF;
+
+    	return array (
+            'name' => $this->aInputs[$CNF['FIELD_PHOTO']]['name'],
+            'content_id' => (int)$this->aInputs[$CNF['FIELD_PHOTO']]['content_id'],
+            'editor_id' => isset($CNF['FIELD_TEXT_ID']) ? $CNF['FIELD_TEXT_ID'] : ''
+    	);
+    }
+
     protected function _getVideoGhostTmplVars($aContentInfo = array())
     {
     	$CNF = &$this->_oModule->_oConfig->CNF;
@@ -112,6 +131,17 @@ class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
             'editor_id' => isset($CNF['FIELD_TEXT_ID']) ? $CNF['FIELD_TEXT_ID'] : ''
     	);
     }
+
+    protected function _getFileGhostTmplVars($aContentInfo = array())
+    {
+    	$CNF = &$this->_oModule->_oConfig->CNF;
+
+    	return array (
+            'name' => $this->aInputs[$CNF['FIELD_FILE']]['name'],
+            'content_id' => (int)$this->aInputs[$CNF['FIELD_FILE']]['content_id'],
+            'editor_id' => isset($CNF['FIELD_TEXT_ID']) ? $CNF['FIELD_TEXT_ID'] : ''
+    	);
+    }
 }
 
 /** @} */

+ 6 - 0
modules/base/text/classes/BxBaseModTextFormsEntryHelper.php

@@ -72,6 +72,9 @@ class BxBaseModTextFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
         if (isset($CNF['FIELD_VIDEO']))
             $oForm->processFiles($CNF['FIELD_VIDEO'], $iContentId, false);
 
+        if (isset($CNF['FIELD_FILE']))
+            $oForm->processFiles($CNF['FIELD_FILE'], $iContentId, false);
+
         if (isset($CNF['FIELD_POLL']))
             $oForm->processPolls($CNF['FIELD_POLL'], $iContentId);
 
@@ -99,6 +102,9 @@ class BxBaseModTextFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
             if (isset($CNF['FIELD_VIDEO']))
                 $oForm->processFiles($CNF['FIELD_VIDEO'], $iContentId, true);
 
+            if (isset($CNF['FIELD_FILE']))
+                $oForm->processFiles($CNF['FIELD_FILE'], $iContentId, true);
+
             if (isset($CNF['FIELD_POLL']))
                 $oForm->processPolls($CNF['FIELD_POLL'], $iContentId);
         }

+ 17 - 7
modules/base/text/classes/BxBaseModTextTemplate.php

@@ -45,7 +45,7 @@ class BxBaseModTextTemplate extends BxBaseModGeneralTemplate
     {
         $CNF = &$this->getModule()->_oConfig->CNF;
 
-        $aStoragesKeys = array('OBJECT_STORAGE_PHOTOS', 'OBJECT_STORAGE_VIDEOS');
+        $aStoragesKeys = array('OBJECT_STORAGE_PHOTOS', 'OBJECT_STORAGE_VIDEOS', 'OBJECT_STORAGE_FILES');
 
         $aStorages = array();
         foreach($aStoragesKeys as $sKey)
@@ -567,17 +567,27 @@ class BxBaseModTextTemplate extends BxBaseModGeneralTemplate
         return  strmaxtextlen($sText, (int)getParam($CNF['PARAM_CHARS_SUMMARY']), $sLinkMore);
     }
 
-    protected function getAttachmentsImagesTranscoders ()
+    protected function getAttachmentsImagesTranscoders ($sStorage = '')
     {
         $CNF = &$this->getModule()->_oConfig->CNF;
 
         $oTranscoder = null;
-        if(!empty($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS']))
-            $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS']);
+        $oTranscoderView = null;
+        switch($sStorage) {
+            case $CNF['OBJECT_STORAGE_PHOTOS']:
+                if(!empty($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS']))
+                    $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS']);
+                if(!empty($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY_PHOTOS']))
+                    $oTranscoderView = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY_PHOTOS']);
+                break;
 
-        $oTranscoderView = null; 
-        if(!empty($CNF['OBJECT_IMAGES_TRANSCODER_PICTURE_PHOTOS']))
-            $oTranscoderView = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PICTURE_PHOTOS']);
+            case $CNF['OBJECT_STORAGE_FILES']:
+                if(!empty($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_FILES']))
+                    $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_FILES']);
+                if(!empty($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY_FILES']))
+                    $oTranscoderView = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY_FILES']);
+                break;
+        }
 
         return array($oTranscoder, $oTranscoderView);
     }

+ 5 - 1
modules/boonex/posts/classes/BxPostsConfig.php

@@ -43,6 +43,7 @@ class BxPostsConfig extends BxBaseModTextConfig
             'FIELD_COVER' => 'covers',
             'FIELD_PHOTO' => 'pictures',
             'FIELD_VIDEO' => 'videos',
+            'FIELD_FILE' => 'files',
             'FIELD_POLL' => 'polls',
             'FIELD_THUMB' => 'thumb',
             'FIELD_ATTACHMENTS' => 'attachments',
@@ -79,12 +80,15 @@ class BxPostsConfig extends BxBaseModTextConfig
             
 
             // objects
-            'OBJECT_STORAGE' => 'bx_posts_files',
+            'OBJECT_STORAGE' => 'bx_posts_covers',
+            'OBJECT_STORAGE_FILES' => 'bx_posts_files',
             'OBJECT_STORAGE_PHOTOS' => 'bx_posts_photos',
             'OBJECT_STORAGE_VIDEOS' => 'bx_posts_videos',
             'OBJECT_IMAGES_TRANSCODER_PREVIEW' => 'bx_posts_preview',
             'OBJECT_IMAGES_TRANSCODER_GALLERY' => 'bx_posts_gallery',
             'OBJECT_IMAGES_TRANSCODER_COVER' => 'bx_posts_cover',
+            'OBJECT_IMAGES_TRANSCODER_PREVIEW_FILES' => 'bx_posts_preview_files',
+            'OBJECT_IMAGES_TRANSCODER_GALLERY_FILES' => 'bx_posts_gallery_files',
             'OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS' => 'bx_posts_preview_photos',
             'OBJECT_IMAGES_TRANSCODER_GALLERY_PHOTOS' => 'bx_posts_gallery_photos',
             'OBJECT_VIDEOS_TRANSCODERS' => array(

+ 11 - 11
modules/boonex/posts/classes/BxPostsFormEntry.php

@@ -59,6 +59,17 @@ class BxPostsFormEntry extends BxBaseModTextFormEntry
             $this->aInputs[$CNF['FIELD_VIDEO']]['tr_attrs'] = array('class'=> 'bx-base-text-attachment-item');
         }
 
+        if (isset($CNF['FIELD_FILE']) && isset($this->aInputs[$CNF['FIELD_FILE']])) {
+            $this->aInputs[$CNF['FIELD_FILE']]['storage_object'] = $CNF['OBJECT_STORAGE_FILES'];
+            $this->aInputs[$CNF['FIELD_FILE']]['uploaders'] = !empty($this->aInputs[$CNF['FIELD_FILE']]['value']) ? unserialize($this->aInputs[$CNF['FIELD_FILE']]['value']) : $CNF['OBJECT_UPLOADERS'];
+            $this->aInputs[$CNF['FIELD_FILE']]['images_transcoder'] = $CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_FILES'];
+            $this->aInputs[$CNF['FIELD_FILE']]['storage_private'] = 0;
+            $this->aInputs[$CNF['FIELD_FILE']]['multiple'] = true;
+            $this->aInputs[$CNF['FIELD_FILE']]['content_id'] = 0;
+            $this->aInputs[$CNF['FIELD_FILE']]['ghost_template'] = '';
+            $this->aInputs[$CNF['FIELD_FILE']]['tr_attrs'] = array('class'=> 'bx-base-text-attachment-item');
+        }
+
         if(isset($this->aInputs[$CNF['FIELD_POLL']])) {
             $this->aInputs[$CNF['FIELD_POLL']]['tr_attrs'] = array('class'=> 'bx-base-text-attachment-item');
         }
@@ -157,17 +168,6 @@ class BxPostsFormEntry extends BxBaseModTextFormEntry
             ),
         );
     }
-
-    protected function _getPhotoGhostTmplVars($aContentInfo = array())
-    {
-    	$CNF = &$this->_oModule->_oConfig->CNF;
-
-    	return array (
-            'name' => $this->aInputs[$CNF['FIELD_PHOTO']]['name'],
-            'content_id' => (int)$this->aInputs[$CNF['FIELD_PHOTO']]['content_id'],
-            'editor_id' => isset($CNF['FIELD_TEXT_ID']) ? $CNF['FIELD_TEXT_ID'] : ''
-    	);
-    }
 }
 
 /** @} */

+ 6 - 0
modules/boonex/posts/install/langs/en.xml

@@ -42,6 +42,8 @@
     <string name="_bx_posts_form_entry_input_pictures"><![CDATA[]]></string>
     <string name="_bx_posts_form_entry_input_sys_videos"><![CDATA[Videos]]></string>
     <string name="_bx_posts_form_entry_input_videos"><![CDATA[]]></string>
+    <string name="_bx_posts_form_entry_input_sys_files"><![CDATA[Files]]></string>
+    <string name="_bx_posts_form_entry_input_files"><![CDATA[]]></string>
     <string name="_bx_posts_form_entry_input_sys_polls"><![CDATA[Polls]]></string>
     <string name="_bx_posts_form_entry_input_sys_allow_view_to"><![CDATA[Visibility]]></string>
     <string name="_bx_posts_form_entry_input_allow_view_to"><![CDATA[Visibility]]></string>
@@ -166,6 +168,10 @@
     <string name="_bx_posts_menu_item_title_cpa_video_simple"><![CDATA[Add Video]]></string>
     <string name="_bx_posts_menu_item_title_system_cpa_video_html5"><![CDATA[Add Video (html5)]]></string>
     <string name="_bx_posts_menu_item_title_cpa_video_html5"><![CDATA[Add Videos]]></string>
+    <string name="_bx_posts_menu_item_title_system_cpa_file_simple"><![CDATA[Add File (simple)]]></string>
+    <string name="_bx_posts_menu_item_title_cpa_file_simple"><![CDATA[Add File]]></string>
+    <string name="_bx_posts_menu_item_title_system_cpa_file_html5"><![CDATA[Add File (html5)]]></string>
+    <string name="_bx_posts_menu_item_title_cpa_file_html5"><![CDATA[Add Files]]></string>
     <string name="_bx_posts_menu_item_title_system_cpa_poll"><![CDATA[Add Poll]]></string>
     <string name="_bx_posts_menu_item_title_cpa_poll"><![CDATA[Add Poll]]></string>
 

+ 6 - 2
modules/boonex/posts/install/sql/enable.sql

@@ -207,7 +207,9 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_posts_entry_attachments', 'bx_posts', 'photo_html5', '_bx_posts_menu_item_title_system_cpa_photo_html5', '_bx_posts_menu_item_title_cpa_photo_html5', 'javascript:void(0)', 'javascript:{js_object_uploader_photos_html5}.showUploaderForm();', '_self', 'camera', '', '', 2147483647, '', 1, 0, 1, 2),
 ('bx_posts_entry_attachments', 'bx_posts', 'video_simple', '_bx_posts_menu_item_title_system_cpa_video_simple', '_bx_posts_menu_item_title_cpa_video_simple', 'javascript:void(0)', 'javascript:{js_object_uploader_videos_simple}.showUploaderForm();', '_self', 'video', '', '', 2147483647, '', 0, 0, 1, 3),
 ('bx_posts_entry_attachments', 'bx_posts', 'video_html5', '_bx_posts_menu_item_title_system_cpa_video_html5', '_bx_posts_menu_item_title_cpa_video_html5', 'javascript:void(0)', 'javascript:{js_object_uploader_videos_html5}.showUploaderForm();', '_self', 'video', '', '', 2147483647, '', 1, 0, 1, 4),
-('bx_posts_entry_attachments', 'bx_posts', 'poll', '_bx_posts_menu_item_title_system_cpa_poll', '_bx_posts_menu_item_title_cpa_poll', 'javascript:void(0)', 'javascript:{js_object}.showPollForm(this);', '_self', 'tasks', '', '', 2147483647, '', 1, 0, 1, 5);
+('bx_posts_entry_attachments', 'bx_posts', 'file_simple', '_bx_posts_menu_item_title_system_cpa_file_simple', '_bx_posts_menu_item_title_cpa_file_simple', 'javascript:void(0)', 'javascript:{js_object_uploader_files_simple}.showUploaderForm();', '_self', 'file', '', '', 2147483647, '', 0, 0, 1, 5),
+('bx_posts_entry_attachments', 'bx_posts', 'file_html5', '_bx_posts_menu_item_title_system_cpa_file_html5', '_bx_posts_menu_item_title_cpa_file_html5', 'javascript:void(0)', 'javascript:{js_object_uploader_files_html5}.showUploaderForm();', '_self', 'file', '', '', 2147483647, '', 1, 0, 1, 6),
+('bx_posts_entry_attachments', 'bx_posts', 'poll', '_bx_posts_menu_item_title_system_cpa_poll', '_bx_posts_menu_item_title_cpa_poll', 'javascript:void(0)', 'javascript:{js_object}.showPollForm(this);', '_self', 'tasks', '', '', 2147483647, '', 1, 0, 1, 7);
 
 -- MENU: actions menu for view entry 
 
@@ -463,7 +465,9 @@ INSERT INTO `sys_objects_uploader` (`object`, `active`, `override_class_name`, `
 ('bx_posts_photos_simple', 1, 'BxPostsUploaderSimpleAttach', 'modules/boonex/posts/classes/BxPostsUploaderSimpleAttach.php'),
 ('bx_posts_photos_html5', 1, 'BxPostsUploaderHTML5Attach', 'modules/boonex/posts/classes/BxPostsUploaderHTML5Attach.php'),
 ('bx_posts_videos_simple', 1, 'BxPostsUploaderSimpleAttach', 'modules/boonex/posts/classes/BxPostsUploaderSimpleAttach.php'),
-('bx_posts_videos_html5', 1, 'BxPostsUploaderHTML5Attach', 'modules/boonex/posts/classes/BxPostsUploaderHTML5Attach.php');
+('bx_posts_videos_html5', 1, 'BxPostsUploaderHTML5Attach', 'modules/boonex/posts/classes/BxPostsUploaderHTML5Attach.php'),
+('bx_posts_files_simple', 1, 'BxPostsUploaderSimpleAttach', 'modules/boonex/posts/classes/BxPostsUploaderSimpleAttach.php'),
+('bx_posts_files_html5', 1, 'BxPostsUploaderHTML5Attach', 'modules/boonex/posts/classes/BxPostsUploaderHTML5Attach.php');
 
 -- ALERTS
 

+ 46 - 19
modules/boonex/posts/install/sql/install.sql

@@ -27,6 +27,22 @@ CREATE TABLE IF NOT EXISTS `bx_posts_posts` (
 );
 
 -- TABLE: storages & transcoders
+CREATE TABLE IF NOT EXISTS `bx_posts_covers` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `profile_id` int(10) unsigned NOT NULL,
+  `remote_id` varchar(128) 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_posts_files` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `profile_id` int(10) unsigned NOT NULL,
@@ -272,18 +288,20 @@ CREATE TABLE IF NOT EXISTS `bx_posts_polls_answers_votes_track` (
 SET @sStorageEngine = (SELECT `value` FROM `sys_options` WHERE `name` = 'sys_storage_default');
 
 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_posts_files', @sStorageEngine, '', 360, 2592000, 3, 'bx_posts_files', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
+('bx_posts_covers', @sStorageEngine, '', 360, 2592000, 3, 'bx_posts_covers', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
 
 ('bx_posts_photos', @sStorageEngine, '', 360, 2592000, 3, 'bx_posts_photos', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
 ('bx_posts_photos_resized', @sStorageEngine, '', 360, 2592000, 3, 'bx_posts_photos_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
 
 ('bx_posts_videos', @sStorageEngine, '', 360, 2592000, 3, 'bx_posts_videos', 'allow-deny', 'avi,flv,mpg,mpeg,wmv,mp4,m4v,mov,qt,divx,xvid,3gp,3g2,webm,mkv,ogv,ogg,rm,rmvb,asf,drc', '', 0, 0, 0, 0, 0, 0),
-('bx_posts_videos_resized', @sStorageEngine, '', 360, 2592000, 3, 'bx_posts_videos_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png,avi,flv,mpg,mpeg,wmv,mp4,m4v,mov,qt,divx,xvid,3gp,3g2,webm,mkv,ogv,ogg,rm,rmvb,asf,drc', '', 0, 0, 0, 0, 0, 0);
+('bx_posts_videos_resized', @sStorageEngine, '', 360, 2592000, 3, 'bx_posts_videos_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png,avi,flv,mpg,mpeg,wmv,mp4,m4v,mov,qt,divx,xvid,3gp,3g2,webm,mkv,ogv,ogg,rm,rmvb,asf,drc', '', 0, 0, 0, 0, 0, 0),
+
+('bx_posts_files', @sStorageEngine, '', 360, 2592000, 3, 'bx_posts_files', 'deny-allow', '', 'action,apk,app,bat,bin,cmd,com,command,cpl,csh,exe,gadget,inf,ins,inx,ipa,isu,job,jse,ksh,lnk,msc,msi,msp,mst,osx,out,paf,pif,prg,ps1,reg,rgs,run,sct,shb,shs,u3p,vb,vbe,vbs,vbscript,workflow,ws,wsf', 0, 0, 0, 0, 0, 0);
 
 INSERT INTO `sys_objects_transcoder` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`, `override_class_name`, `override_class_file`) VALUES 
-('bx_posts_preview', 'bx_posts_photos_resized', 'Storage', 'a:1:{s:6:"object";s:14:"bx_posts_files";}', 'no', '1', '2592000', '0', '', ''),
-('bx_posts_gallery', 'bx_posts_photos_resized', 'Storage', 'a:1:{s:6:"object";s:14:"bx_posts_files";}', 'no', '1', '2592000', '0', '', ''),
-('bx_posts_cover', 'bx_posts_photos_resized', 'Storage', 'a:1:{s:6:"object";s:14:"bx_posts_files";}', 'no', '1', '2592000', '0', '', ''),
+('bx_posts_preview', 'bx_posts_photos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_posts_covers";}', 'no', '1', '2592000', '0', '', ''),
+('bx_posts_gallery', 'bx_posts_photos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_posts_covers";}', 'no', '1', '2592000', '0', '', ''),
+('bx_posts_cover', 'bx_posts_photos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_posts_covers";}', 'no', '1', '2592000', '0', '', ''),
 
 ('bx_posts_preview_photos', 'bx_posts_photos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_posts_photos";}', 'no', '1', '2592000', '0', '', ''),
 ('bx_posts_gallery_photos', 'bx_posts_photos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_posts_photos";}', 'no', '1', '2592000', '0', '', ''),
@@ -291,7 +309,10 @@ INSERT INTO `sys_objects_transcoder` (`object`, `storage_object`, `source_type`,
 ('bx_posts_videos_poster', 'bx_posts_videos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_posts_videos";}', 'no', '0', '0', '0', 'BxDolTranscoderVideo', ''),
 ('bx_posts_videos_poster_preview', 'bx_posts_videos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_posts_videos";}', 'no', '0', '0', '0', 'BxDolTranscoderVideo', ''),
 ('bx_posts_videos_mp4', 'bx_posts_videos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_posts_videos";}', 'no', '0', '0', '0', 'BxDolTranscoderVideo', ''),
-('bx_posts_videos_webm', 'bx_posts_videos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_posts_videos";}', 'no', '0', '0', '0', 'BxDolTranscoderVideo', '');
+('bx_posts_videos_webm', 'bx_posts_videos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_posts_videos";}', 'no', '0', '0', '0', 'BxDolTranscoderVideo', ''),
+
+('bx_posts_preview_files', 'bx_posts_photos_resized', 'Storage', 'a:1:{s:6:"object";s:14:"bx_posts_files";}', 'no', '1', '2592000', '0', '', ''),
+('bx_posts_gallery_files', 'bx_posts_photos_resized', 'Storage', 'a:1:{s:6:"object";s:14:"bx_posts_files";}', 'no', '1', '2592000', '0', '', '');
 
 INSERT INTO `sys_transcoder_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES 
 ('bx_posts_preview', 'Resize', 'a:3:{s:1:"w";s:3:"300";s:1:"h";s:3:"200";s:11:"crop_resize";s:1:"1";}', '0'),
@@ -305,7 +326,10 @@ INSERT INTO `sys_transcoder_filters` (`transcoder_object`, `filter`, `filter_par
 ('bx_posts_videos_poster_preview', 'Poster', 'a:2:{s:1:"h";s:3:"480";s:10:"force_type";s:3:"jpg";}', 0),
 ('bx_posts_videos_poster', 'Poster', 'a:2:{s:1:"h";s:3:"318";s:10:"force_type";s:3:"jpg";}', 0),
 ('bx_posts_videos_mp4', 'Mp4', 'a:2:{s:1:"h";s:3:"318";s:10:"force_type";s:3:"mp4";}', 0),
-('bx_posts_videos_webm', 'Webm', 'a:2:{s:1:"h";s:3:"318";s:10:"force_type";s:4:"webm";}', 0);
+('bx_posts_videos_webm', 'Webm', 'a:2:{s:1:"h";s:3:"318";s:10:"force_type";s:4:"webm";}', 0),
+
+('bx_posts_preview_files', 'Resize', 'a:3:{s:1:"w";s:3:"300";s:1:"h";s:3:"200";s:11:"crop_resize";s:1:"1";}', '0'),
+('bx_posts_gallery_files', 'Resize', 'a:1:{s:1:"w";s:3:"500";}', '0');
 
 
 -- FORMS: entry (post)
@@ -327,6 +351,7 @@ INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `ch
 ('bx_posts', 'bx_posts', 'covers', 'a:1:{i:0;s:14:"bx_posts_html5";}', 'a:2:{s:15:"bx_posts_simple";s:26:"_sys_uploader_simple_title";s:14:"bx_posts_html5";s:25:"_sys_uploader_html5_title";}', 0, 'files', '_bx_posts_form_entry_input_sys_covers', '_bx_posts_form_entry_input_covers', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_posts', 'bx_posts', 'pictures', 'a:1:{i:0;s:21:"bx_posts_photos_html5";}', 'a:2:{s:22:"bx_posts_photos_simple";s:26:"_sys_uploader_simple_title";s:21:"bx_posts_photos_html5";s:25:"_sys_uploader_html5_title";}', 0, 'files', '_bx_posts_form_entry_input_sys_pictures', '_bx_posts_form_entry_input_pictures', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_posts', 'bx_posts', 'videos', 'a:1:{i:0;s:21:"bx_posts_videos_html5";}', 'a:2:{s:22:"bx_posts_videos_simple";s:26:"_sys_uploader_simple_title";s:21:"bx_posts_videos_html5";s:25:"_sys_uploader_html5_title";}', 0, 'files', '_bx_posts_form_entry_input_sys_videos', '_bx_posts_form_entry_input_videos', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_posts', 'bx_posts', 'files', 'a:1:{i:0;s:20:"bx_posts_files_html5";}', 'a:2:{s:21:"bx_posts_files_simple";s:26:"_sys_uploader_simple_title";s:20:"bx_posts_files_html5";s:25:"_sys_uploader_html5_title";}', 0, 'files', '_bx_posts_form_entry_input_sys_files', '_bx_posts_form_entry_input_files', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_posts', 'bx_posts', 'polls', '', '', 0, 'custom', '_bx_posts_form_entry_input_sys_polls', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_posts', 'bx_posts', 'text', '', '', 0, 'textarea', '_bx_posts_form_entry_input_sys_text', '_bx_posts_form_entry_input_text', '', 1, 0, 2, '', '', '', 'Avail', '', '_bx_posts_form_entry_input_text_err', 'XssHtml', '', 1, 0),
 ('bx_posts', 'bx_posts', 'title', '', '', 0, 'text', '_bx_posts_form_entry_input_sys_title', '_bx_posts_form_entry_input_title', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_posts_form_entry_input_title_err', 'Xss', '', 1, 0),
@@ -347,12 +372,13 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_posts_entry_add', 'attachments', 2147483647, 1, 5),
 ('bx_posts_entry_add', 'pictures', 2147483647, 1, 6),
 ('bx_posts_entry_add', 'videos', 2147483647, 1, 7),
-('bx_posts_entry_add', 'polls', 2147483647, 1, 8),
-('bx_posts_entry_add', 'covers', 2147483647, 1, 9),
-('bx_posts_entry_add', 'allow_view_to', 2147483647, 1, 10),
-('bx_posts_entry_add', 'location', 2147483647, 1, 11),
-('bx_posts_entry_add', 'published', 192, 1, 12),
-('bx_posts_entry_add', 'do_publish', 2147483647, 1, 13),
+('bx_posts_entry_add', 'files', 2147483647, 1, 8),
+('bx_posts_entry_add', 'polls', 2147483647, 1, 9),
+('bx_posts_entry_add', 'covers', 2147483647, 1, 10),
+('bx_posts_entry_add', 'allow_view_to', 2147483647, 1, 11),
+('bx_posts_entry_add', 'location', 2147483647, 1, 12),
+('bx_posts_entry_add', 'published', 192, 1, 13),
+('bx_posts_entry_add', 'do_publish', 2147483647, 1, 14),
 
 ('bx_posts_entry_delete', 'delete_confirm', 2147483647, 1, 1),
 ('bx_posts_entry_delete', 'do_submit', 2147483647, 1, 2),
@@ -365,12 +391,13 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_posts_entry_edit', 'attachments', 2147483647, 1, 6),
 ('bx_posts_entry_edit', 'pictures', 2147483647, 1, 7),
 ('bx_posts_entry_edit', 'videos', 2147483647, 1, 8),
-('bx_posts_entry_edit', 'polls', 2147483647, 1, 9),
-('bx_posts_entry_edit', 'covers', 2147483647, 1, 10),
-('bx_posts_entry_edit', 'allow_view_to', 2147483647, 1, 11),
-('bx_posts_entry_edit', 'location', 2147483647, 1, 12),
-('bx_posts_entry_edit', 'published', 192, 1, 13),
-('bx_posts_entry_edit', 'do_submit', 2147483647, 1, 14),
+('bx_posts_entry_edit', 'files', 2147483647, 1, 9),
+('bx_posts_entry_edit', 'polls', 2147483647, 1, 10),
+('bx_posts_entry_edit', 'covers', 2147483647, 1, 11),
+('bx_posts_entry_edit', 'allow_view_to', 2147483647, 1, 12),
+('bx_posts_entry_edit', 'location', 2147483647, 1, 13),
+('bx_posts_entry_edit', 'published', 192, 1, 14),
+('bx_posts_entry_edit', 'do_submit', 2147483647, 1, 15),
 
 ('bx_posts_entry_view', 'cat', 2147483647, 1, 1),
 ('bx_posts_entry_view', 'added', 2147483647, 1, 2),

+ 1 - 1
modules/boonex/posts/install/sql/uninstall.sql

@@ -1,6 +1,6 @@
 
 -- TABLES
-DROP TABLE IF EXISTS `bx_posts_posts`, `bx_posts_files`, `bx_posts_photos`, `bx_posts_photos_resized`, `bx_posts_videos`, `bx_posts_videos_resized`, `bx_posts_cmts`, `bx_posts_votes`, `bx_posts_votes_track`, `bx_posts_views_track`, `bx_posts_meta_keywords`, `bx_posts_meta_locations`, `bx_posts_meta_mentions`, `bx_posts_reports`, `bx_posts_reports_track`, `bx_posts_favorites_track`, `bx_posts_scores`, `bx_posts_scores_track`, `bx_posts_polls`, `bx_posts_polls_answers`, `bx_posts_polls_answers_votes`, `bx_posts_polls_answers_votes_track`;
+DROP TABLE IF EXISTS `bx_posts_posts`, `bx_posts_covers` `bx_posts_files`, `bx_posts_photos`, `bx_posts_photos_resized`, `bx_posts_videos`, `bx_posts_videos_resized`, `bx_posts_cmts`, `bx_posts_votes`, `bx_posts_votes_track`, `bx_posts_views_track`, `bx_posts_meta_keywords`, `bx_posts_meta_locations`, `bx_posts_meta_mentions`, `bx_posts_reports`, `bx_posts_reports_track`, `bx_posts_favorites_track`, `bx_posts_scores`, `bx_posts_scores_track`, `bx_posts_polls`, `bx_posts_polls_answers`, `bx_posts_polls_answers_votes`, `bx_posts_polls_answers_votes_track`;
 
 -- STORAGES & TRANSCODERS
 DELETE FROM `sys_objects_storage` WHERE `object` LIKE 'bx_posts_%';

+ 22 - 0
modules/boonex/posts/template/form_ghost_template_file.html

@@ -0,0 +1,22 @@
+<div id="bx-uploader-file-{storage_object}-{file_id}" class="bx-uploader-ghost bx-def-margin-sec-top bx-clearfix">
+    <input type="hidden" name="__name__[]" value="{file_id}" />
+    <div class="bx-base-general-icon-wrapper bx-def-margin-sec-right">
+        <img src="{file_icon}" class="bx-def-round-corners bx-base-general-icon bx-base-general-icon-{file_id}" />
+    </div>
+    <span class="bx-base-general-uploader-ghost">
+        <b><bx_text:_sys_txt_form_entry_input_picture_pic_url /></b><br />
+        <input class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom" type="text" value="{file_url}" readonly="1" /> <br />
+        <span id="bx-base-general-intert-to-post-link-{file_id}" style="display:none;">
+            <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_insert_to_post('{file_id}', '{file_url}', '__editor_id__');"><bx_text:_sys_txt_form_entry_input_picture_insert /></a>
+        </span>
+        <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
+    </span>
+</div>
+<script>
+    $('#bx-base-general-intert-to-post-link-{file_id}').show();
+
+    // disable images drag&drop, because resized images address can be reset after some time
+    $(".bx-base-general-icon-{file_id}").bind('dragstart', function(){
+        return false; 
+    });
+</script>

+ 14 - 4
modules/boonex/russian/data/langs/bx_posts/ru.xml

@@ -42,6 +42,8 @@
     <string name="_bx_posts_form_entry_input_pictures"><![CDATA[]]></string>
     <string name="_bx_posts_form_entry_input_sys_videos"><![CDATA[Видео]]></string>
     <string name="_bx_posts_form_entry_input_videos"><![CDATA[]]></string>
+    <string name="_bx_posts_form_entry_input_sys_files"><![CDATA[Файлы]]></string>
+    <string name="_bx_posts_form_entry_input_files"><![CDATA[]]></string>
     <string name="_bx_posts_form_entry_input_sys_polls"><![CDATA[Голосования]]></string>
     <string name="_bx_posts_form_entry_input_sys_allow_view_to"><![CDATA[Видимость]]></string>
     <string name="_bx_posts_form_entry_input_allow_view_to"><![CDATA[Видимость]]></string>
@@ -158,10 +160,18 @@
 
     <string name="_bx_posts_menu_title_entry_attachments"><![CDATA[Форма - Прикрепления]]></string>
     <string name="_bx_posts_menu_set_title_entry_attachments"><![CDATA[Форма - Прикрепления]]></string>
-    <string name="_bx_posts_menu_item_title_system_cpa_photo"><![CDATA[Добавить фото]]></string>
-    <string name="_bx_posts_menu_item_title_cpa_photo"><![CDATA[Добавить фото]]></string>
-    <string name="_bx_posts_menu_item_title_system_cpa_video"><![CDATA[Добавить видео]]></string>
-    <string name="_bx_posts_menu_item_title_cpa_video"><![CDATA[Добавить видео]]></string>
+    <string name="_bx_posts_menu_item_title_system_cpa_photo_simple"><![CDATA[Добавить фото (один)]]></string>
+    <string name="_bx_posts_menu_item_title_cpa_photo_simple"><![CDATA[Добавить фото]]></string>
+    <string name="_bx_posts_menu_item_title_system_cpa_photo_html5"><![CDATA[Добавить фото (много)]]></string>
+    <string name="_bx_posts_menu_item_title_cpa_photo_html5"><![CDATA[Добавить фото]]></string>
+    <string name="_bx_posts_menu_item_title_system_cpa_video_simple"><![CDATA[Добавить видео (один)]]></string>
+    <string name="_bx_posts_menu_item_title_cpa_video_simple"><![CDATA[Добавить видео]]></string>
+    <string name="_bx_posts_menu_item_title_system_cpa_video_html5"><![CDATA[Добавить видео (много)]]></string>
+    <string name="_bx_posts_menu_item_title_cpa_video_html5"><![CDATA[Добавить видео]]></string>
+    <string name="_bx_posts_menu_item_title_system_cpa_file_simple"><![CDATA[Добавить файл (один)]]></string>
+    <string name="_bx_posts_menu_item_title_cpa_file_simple"><![CDATA[Добавить файл]]></string>
+    <string name="_bx_posts_menu_item_title_system_cpa_file_html5"><![CDATA[Добавить файл (много)]]></string>
+    <string name="_bx_posts_menu_item_title_cpa_file_html5"><![CDATA[Добавить файл]]></string>
     <string name="_bx_posts_menu_item_title_system_cpa_poll"><![CDATA[Добавить голосование]]></string>
     <string name="_bx_posts_menu_item_title_cpa_poll"><![CDATA[Добавить голосование]]></string>