Răsfoiți Sursa

#4145 - Uploader's enhancement (fix)

roman.lesnikov@gmail.com 3 ani în urmă
părinte
comite
c223f8c9cc

+ 0 - 1
inc/js/classes/BxDolUploader.js

@@ -244,7 +244,6 @@ BxDolUploaderBase.prototype._clearErrors = function () {
 }
 
 BxDolUploaderBase.prototype._showError = function (s, bAppend) {
-    console.log('#' + this._sPopupContainerId + ' #' + this._sErrorsContainerId);
     if (s == undefined || !s.length)
         return;
     if (!bAppend)

+ 1 - 4
modules/base/general/template/image_tweak.html

@@ -8,10 +8,7 @@
 <div class="hidden">
     <div id="bx-form-input-files-__unique_id__-upload-result"></div>
 </div>
-
 __uploader_js__
 <script> 
-    $( document).ready(function() {
-        oBxDolImageTweak__unique_id__ = new BxDolImageTweak('__unique_id__', '__action_url__', '__id__', '__field__', '__js_object__', __allow_tweak__);
-    });
+    oBxDolImageTweak__unique_id__ = new BxDolImageTweak('__unique_id__', '__action_url__', '__id__', '__field__', '__js_object__', __allow_tweak__);
 </script>

+ 0 - 2
modules/base/groups/template/cover_block.html

@@ -38,7 +38,5 @@
             </div>
         </div>
     </div>
-    __cover_popup__
-    __picture_popup__
 </div>
 __additional_code__

+ 0 - 2
modules/base/profile/template/cover_block.html

@@ -42,7 +42,5 @@
             </div>
         </div>
     </div>
-    __cover_popup__
-    __picture_popup__
 </div>
 __additional_code__

+ 1 - 1
modules/base/text/classes/BxBaseModTextTemplate.php

@@ -645,7 +645,7 @@ class BxBaseModTextTemplate extends BxBaseModGeneralTemplate
 
         $sImageTweak = '';
         $sUniqIdImage = genRndPwd (8, false);
-        if ($bIsAllowEditPicture && empty($sAddCode)){
+        if ($bIsAllowEditPicture && empty($sAddCode) && isset($CNF['FIELD_THUMB_POSITION'])){
             $sImageTweak = $this->_prepareImage($aData, $sUniqIdImage, $CNF['OBJECT_UPLOADERS'], $CNF['OBJECT_STORAGE'], $CNF['FIELD_THUMB'], true);
         }
 

+ 0 - 2
modules/boonex/artificer/data/template/mod_profile/cover_block.html

@@ -50,7 +50,5 @@
             </div>
         </div>
     </div>
-    __cover_popup__
-    __picture_popup__
 </div>
 __additional_code__

+ 1 - 0
modules/boonex/forum/classes/BxForumConfig.php

@@ -62,6 +62,7 @@ class BxForumConfig extends BxBaseModTextConfig
             'FIELD_FILE' => 'files',
             'FIELD_POLL' => 'polls',
             'FIELD_THUMB' => 'thumb',
+            'FIELD_THUMB_POSITION' => 'thumb_data',
             'FIELD_ATTACHMENTS' => 'attachments',
             'FIELD_LINK' => 'link',
             'FIELD_VIEWS' => 'views',

+ 1 - 0
modules/boonex/forum/install/sql/install.sql

@@ -7,6 +7,7 @@ CREATE TABLE IF NOT EXISTS `bx_forum_discussions` (
   `added` int(11) NOT NULL,
   `changed` int(11) NOT NULL,
   `thumb` int(11) NOT NULL,
+  `thumb_data` varchar(50) NOT NULL,  
   `title` varchar(255) NOT NULL,
   `cat` int(11) NOT NULL,
   `multicat` text NOT NULL,

+ 1 - 1
modules/boonex/videos/classes/BxVideosFormEntry.php

@@ -287,7 +287,7 @@ class BxVideosFormEntry extends BxBaseModTextFormEntry
         if ($aInput['name'] == 'video_source' && $aInput['type'] == 'radio_set') {
             if (!is_array($aInput['attrs']))
                 $aInput['attrs'] = [];
-            $aInput['attrs']['onchange'] = $this->_oModule->_oConfig->getJsObject('embeds').'.changeVideoSource(this.value);';
+            $aInput['attrs']['onchange'] = $this->_oModule->_oConfig->getJsObject('embeds').'.changeVideoSource(this);';
             $sJsCode = '';
             if ($this->_bDynamicMode) {
                 $sJsCode .= $this->_oModule->_oTemplate->addJs('embeds.js', true);

+ 6 - 5
modules/boonex/videos/js/embeds.js

@@ -22,13 +22,14 @@ function BxVideosEmbeds(oOptions) {
     this._sLastCodeChecked = '';
 }
 
-BxVideosEmbeds.prototype.changeVideoSource = function(sSource) {
+BxVideosEmbeds.prototype.changeVideoSource = function(oObj) {
+    sSource = $(oObj).val();
 	if (sSource == 'upload') {
-        $('#bx-form-element-videos').show();
-        $('#bx-form-element-video_embed').hide();
+        $(oObj).parents('form').find('#bx-form-element-videos').show();
+        $(oObj).parents('form').find('#bx-form-element-video_embed').hide();
     } else {
-	    $('#bx-form-element-videos').hide();
-        $('#bx-form-element-video_embed').show();
+	    $(oObj).parents('form').find('#bx-form-element-videos').hide();
+        $(oObj).parents('form').find('#bx-form-element-video_embed').show();
     }
 };