Przeglądaj źródła

Ticket #3695 - Various fixes in the Files module.

Alexander 4 lat temu
rodzic
commit
4d03d2744a

+ 1 - 0
modules/boonex/files/classes/BxFilesModule.php

@@ -470,6 +470,7 @@ class BxFilesModule extends BxBaseModTextModule
                 bx_set('attachments', $aFilesIDs, 'post');
                 bx_set('attachments', $aFilesIDs, 'post');
                 bx_set('profile_id', $iAuthorProfile, 'post');
                 bx_set('profile_id', $iAuthorProfile, 'post');
                 bx_set('allow_view_to', !$iContext ? BX_DOL_PG_ALL : -$iContext, 'post');
                 bx_set('allow_view_to', !$iContext ? BX_DOL_PG_ALL : -$iContext, 'post');
+                bx_set('cf', 1, 'post');
 
 
                 $oForm = BxDolForm::getObjectInstance($this->_oConfig->CNF['OBJECT_FORM_ENTRY_UPLOAD'], $this->_oConfig->CNF['OBJECT_FORM_ENTRY_DISPLAY_UPLOAD']);
                 $oForm = BxDolForm::getObjectInstance($this->_oConfig->CNF['OBJECT_FORM_ENTRY_UPLOAD'], $this->_oConfig->CNF['OBJECT_FORM_ENTRY_DISPLAY_UPLOAD']);
                 $aFiles = $oForm->insert();
                 $aFiles = $oForm->insert();

+ 5 - 0
modules/boonex/files/classes/BxFilesSearchResult.php

@@ -178,6 +178,11 @@ class BxFilesSearchResult extends BxBaseModTextSearchResult
         $this->addConditionsForPrivateContent($CNF, $oProfileAuthor);
         $this->addConditionsForPrivateContent($CNF, $oProfileAuthor);
         $this->addCustomConditions($CNF, $oProfileAuthor, $sMode, $aParams);
         $this->addCustomConditions($CNF, $oProfileAuthor, $sMode, $aParams);
 
 
+
+        //show to a profile author all of his files regardless of CF
+        if ($sMode == 'author' && $oProfileAuthor && bx_get_logged_profile_id() == $oProfileAuthor->id())
+            unset($this->aCurrent['restriction']['cf_viewer']);
+
         if ($this->bFileManagerMode) {
         if ($this->bFileManagerMode) {
             $this->addContainerClass('bx-files-with-toolbar');
             $this->addContainerClass('bx-files-with-toolbar');
 
 

+ 9 - 2
modules/boonex/files/template/files_browser_toolbar.html

@@ -8,13 +8,20 @@
     <div class="bx-files-toolbar-controls-group">
     <div class="bx-files-toolbar-controls-group">
         __uploader_code__
         __uploader_code__
         <script>
         <script>
-            $(document).ready(function(){
-                //catch onUploadCompleted call here
+            function bx_files_inject_onupload_handler() {
+                if (typeof __uploader_js_object__ == 'undefined') {
+                    setTimeout(bx_files_inject_onupload_handler, 200);
+                    return;
+                }
                 __uploader_js_object__.onUploadCompletedDefault = __uploader_js_object__.onUploadCompleted;
                 __uploader_js_object__.onUploadCompletedDefault = __uploader_js_object__.onUploadCompleted;
                 __uploader_js_object__.onUploadCompleted = function (sErrorMsg) {
                 __uploader_js_object__.onUploadCompleted = function (sErrorMsg) {
                     __uploader_js_object__.onUploadCompletedDefault(sErrorMsg);
                     __uploader_js_object__.onUploadCompletedDefault(sErrorMsg);
                     __js_object__.onAfterUpload();
                     __js_object__.onAfterUpload();
                 }
                 }
+            }
+            $(document).ready(function(){
+                //catch onUploadCompleted call here
+                setTimeout(bx_files_inject_onupload_handler, 200);
             });
             });
         </script>
         </script>
         <button class="bx-btn" onclick="__js_object__.onBeforeUpload(); __uploader_js_object__.showUploaderForm();"><i class="sys-icon upload"></i>&nbsp;<bx_text:_bx_files_txt_upload /></button>
         <button class="bx-btn" onclick="__js_object__.onBeforeUpload(); __uploader_js_object__.showUploaderForm();"><i class="sys-icon upload"></i>&nbsp;<bx_text:_bx_files_txt_upload /></button>