Skip to content

Commit

Permalink
The functionality of the maximum size of the uploaded file has been r…
Browse files Browse the repository at this point in the history
…ebuilt
  • Loading branch information
mariuszkrzaczkowski committed May 5, 2022
1 parent aed41de commit ddb29d4
Show file tree
Hide file tree
Showing 15 changed files with 6 additions and 19 deletions.
1 change: 1 addition & 0 deletions app/Controller/View/Base.php
Expand Up @@ -483,6 +483,7 @@ public function loadJsConfig(\App\Request $request)
// Modifying this file or functions that affect the footer appearance will violate the license terms!!!
'disableBranding' => \App\YetiForce\Shop::check('YetiForceDisableBranding'),
'globalSearchDefaultOperator' => \App\RecordSearch::OPERATORS[$userModel->getDetail('default_search_operator')],
'maxUploadLimit' => \App\Config::getMaxUploadSize(),
];
}
foreach ($jsEnv as $key => $value) {
Expand Down
4 changes: 2 additions & 2 deletions config/version.php
@@ -1,7 +1,7 @@
<?php

return [
'appVersion' => '6.3.219',
'patchVersion' => '2022.05.04',
'appVersion' => '6.3.220',
'patchVersion' => '2022.05.05',
'lib_roundcube' => '0.2.12',
];
1 change: 0 additions & 1 deletion layouts/basic/modules/Calendar/Calendar/EventForm.tpl
Expand Up @@ -19,7 +19,6 @@
{/if}
<input type="hidden" id="preSaveValidation" value="{!empty(\App\EventHandler::getByType(\App\EventHandler::EDIT_VIEW_PRE_SAVE, $MODULE_NAME))}" />
<input type="hidden" class="js-change-value-event" value="{\App\EventHandler::getVarsByType(\App\EventHandler::EDIT_VIEW_CHANGE_VALUE, $MODULE_NAME, [$RECORD, $FROM_VIEW])}" />
<input type="hidden" class="js-max-upload-size" value="{$MAX_UPLOAD_LIMIT}" />
{if !empty($PICKIST_DEPENDENCY_DATASOURCE)}
<input type="hidden" name="picklistDependency" value='{\App\Purifier::encodeHtml($PICKIST_DEPENDENCY_DATASOURCE)}' />
{/if}
Expand Down
1 change: 0 additions & 1 deletion layouts/basic/modules/OSSPasswords/EditViewBlocks.tpl
Expand Up @@ -28,7 +28,6 @@
{/if}
<input type="hidden" id="preSaveValidation" value="{!empty(\App\EventHandler::getByType(\App\EventHandler::EDIT_VIEW_PRE_SAVE, $MODULE_NAME))}" />
<input type="hidden" class="js-change-value-event" value="{\App\EventHandler::getVarsByType(\App\EventHandler::EDIT_VIEW_CHANGE_VALUE, $MODULE_NAME, [$RECORD, $FROM_VIEW])}" />
<input type="hidden" class="js-max-upload-size" value="{$MAX_UPLOAD_LIMIT}" />
{if !empty($PICKIST_DEPENDENCY_DATASOURCE)}
<input type="hidden" name="picklistDependency" value='{\App\Purifier::encodeHtml($PICKIST_DEPENDENCY_DATASOURCE)}' />
{/if}
Expand Down
1 change: 0 additions & 1 deletion layouts/basic/modules/Vtiger/Calendar/EventForm.tpl
Expand Up @@ -18,7 +18,6 @@
{/if}
<input type="hidden" id="preSaveValidation" value="{!empty(\App\EventHandler::getByType(\App\EventHandler::EDIT_VIEW_PRE_SAVE, $MODULE_NAME))}" />
<input type="hidden" class="js-change-value-event" value="{\App\EventHandler::getVarsByType(\App\EventHandler::EDIT_VIEW_CHANGE_VALUE, $MODULE_NAME, [$RECORD, $FROM_VIEW])}" />
<input type="hidden" class="js-max-upload-size" value="{$MAX_UPLOAD_LIMIT}" />
{if !empty($PICKIST_DEPENDENCY_DATASOURCE)}
<input type="hidden" name="picklistDependency" value='{\App\Purifier::encodeHtml($PICKIST_DEPENDENCY_DATASOURCE)}' />
{/if}
Expand Down
1 change: 0 additions & 1 deletion layouts/basic/modules/Vtiger/DetailViewHeader.tpl
Expand Up @@ -40,7 +40,6 @@
<input type="hidden" name="picklistDependency" value="{\App\Purifier::encodeHtml($PICKLIST_DEPENDENCY_DATASOURCE)}">
{/if}
<input type="hidden" id="preSaveValidation" value="{!empty(\App\EventHandler::getByType(\App\EventHandler::EDIT_VIEW_PRE_SAVE, $MODULE_NAME))}" />
<input type="hidden" class="js-max-upload-size" value="{$MAX_UPLOAD_LIMIT}" />
{if $RECORD->getId() && !empty($RECORD_ACTIVITY_NOTIFIER)}
<input type="hidden" id="recordActivityNotifier" data-interval="{App\Config::performance('recordActivityNotifierInterval', 10)}" data-record="{$RECORD->getId()}" data-module="{$MODULE_NAME}" />
{/if}
Expand Down
Expand Up @@ -49,7 +49,7 @@
{/if}
</div>
<div class="uploadFileSizeLimit redColor">
{\App\Language::translate('LBL_MAX_UPLOAD_SIZE',$MODULE)}&nbsp;{$MAX_UPLOAD_LIMIT_MB}{\App\Language::translate('MB',$MODULE)}
{\App\Language::translate('LBL_MAX_UPLOAD_SIZE',$MODULE)}&nbsp;{App\Config::getMaxUploadSize(true, true)}{\App\Language::translate('MB',$MODULE)}
</div>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion layouts/basic/modules/Vtiger/EditViewBlocks.tpl
Expand Up @@ -41,7 +41,6 @@
{/if}
<input type="hidden" id="preSaveValidation" value="{!empty(\App\EventHandler::getByType(\App\EventHandler::EDIT_VIEW_PRE_SAVE, $MODULE_NAME))}" />
<input type="hidden" class="js-change-value-event" value="{\App\EventHandler::getVarsByType(\App\EventHandler::EDIT_VIEW_CHANGE_VALUE, $MODULE_NAME, [$RECORD, $FROM_VIEW])}" />
<input type="hidden" class="js-max-upload-size" value="{$MAX_UPLOAD_LIMIT}" />
{if !empty($PICKIST_DEPENDENCY_DATASOURCE)}
<input type="hidden" name="picklistDependency" value='{\App\Purifier::encodeHtml($PICKIST_DEPENDENCY_DATASOURCE)}' />
{/if}
Expand Down
1 change: 0 additions & 1 deletion layouts/basic/modules/Vtiger/Modals/QuickEdit.tpl
Expand Up @@ -10,7 +10,6 @@
{/if}
<input type="hidden" id="preSaveValidation" value="{!empty(\App\EventHandler::getByType(\App\EventHandler::EDIT_VIEW_PRE_SAVE, $MODULE_NAME))}" />
<input type="hidden" class="js-change-value-event" value="{\App\EventHandler::getVarsByType(\App\EventHandler::EDIT_VIEW_CHANGE_VALUE, $MODULE_NAME, [$RECORD, 'QuickEdit'])}" />
<input type="hidden" class="js-max-upload-size" value="{$MAX_UPLOAD_LIMIT}" />
{if !empty($PICKIST_DEPENDENCY_DATASOURCE)}
<input type="hidden" name="picklistDependency" value='{\App\Purifier::encodeHtml($PICKIST_DEPENDENCY_DATASOURCE)}' />
{/if}
Expand Down
1 change: 0 additions & 1 deletion layouts/basic/modules/Vtiger/QuickCreate.tpl
Expand Up @@ -23,7 +23,6 @@
<input type="hidden" name="fromView" value="{$FROM_VIEW}" />
<input type="hidden" id="preSaveValidation" value="{!empty(\App\EventHandler::getByType(\App\EventHandler::EDIT_VIEW_PRE_SAVE, $MODULE_NAME))}" />
<input type="hidden" class="js-change-value-event" value="{\App\EventHandler::getVarsByType(\App\EventHandler::EDIT_VIEW_CHANGE_VALUE, $MODULE_NAME, [$RECORD, $FROM_VIEW])}" />
<input type="hidden" class="js-max-upload-size" value="{$MAX_UPLOAD_LIMIT}" />
{if !empty($IS_RELATION_OPERATION) && !empty($SOURCE_MODULE) && !empty($SOURCE_RECORD)}
<input type="hidden" name="sourceModule" value="{$SOURCE_MODULE}" />
<input type="hidden" name="sourceRecord" value="{$SOURCE_RECORD}" />
Expand Down
2 changes: 0 additions & 2 deletions modules/Vtiger/views/Detail.php
Expand Up @@ -175,8 +175,6 @@ public function preProcess(App\Request $request, $display = true)
'MODULE' => $moduleName,
'ACTION' => $request->getByType('view', 1),
]));
$viewer->assign('MAX_UPLOAD_LIMIT_MB', App\Config::getMaxUploadSize(true, true));
$viewer->assign('MAX_UPLOAD_LIMIT', App\Config::getMaxUploadSize());
$viewer->assign('DEFAULT_RECORD_VIEW', $currentUserModel->get('default_record_view'));
$viewer->assign('PICKLIST_DEPENDENCY_DATASOURCE', \App\Json::encode(\App\Fields\Picklist::getPicklistDependencyDatasource($moduleName)));
$viewer->assign('IS_READ_ONLY', $request->getBoolean('isReadOnly') || $this->record->getRecord()->isReadOnly());
Expand Down
2 changes: 0 additions & 2 deletions modules/Vtiger/views/Edit.php
Expand Up @@ -160,8 +160,6 @@ public function process(App\Request $request)
$viewer->assign('BLOCK_LIST', $moduleModel->getBlocks());
$viewer->assign('CURRENTDATE', date('Y-n-j'));
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('MAX_UPLOAD_LIMIT_MB', App\Config::getMaxUploadSize(true, true));
$viewer->assign('MAX_UPLOAD_LIMIT', App\Config::getMaxUploadSize());
$viewer->assign('RECORD_ACTIVITY_NOTIFIER', $recordId && \App\Config::performance('recordActivityNotifier', false) && $moduleModel->isTrackingEnabled() && $moduleModel->isPermitted('RecordActivityNotifier'));
$viewer->view('EditView.tpl', $moduleName);
}
Expand Down
2 changes: 0 additions & 2 deletions modules/Vtiger/views/QuickCreateAjax.php
Expand Up @@ -116,8 +116,6 @@ public function process(App\Request $request)
$viewer->assign('HIDDEN_INPUT', $this->hiddenInput);
$viewer->assign('FROM_VIEW', $this->fromView);
$viewer->assign('SCRIPTS', $this->getFooterScripts($request));
$viewer->assign('MAX_UPLOAD_LIMIT_MB', App\Config::getMaxUploadSize(true, true));
$viewer->assign('MAX_UPLOAD_LIMIT', App\Config::getMaxUploadSize());
}

/**
Expand Down
2 changes: 0 additions & 2 deletions modules/Vtiger/views/QuickEditModal.php
Expand Up @@ -127,8 +127,6 @@ public function process(App\Request $request)
$viewer->assign('MODULE_MODEL', $moduleModel);
$viewer->assign('VIEW', $request->getByType('view', 1));
$viewer->assign('MODE', 'edit');
$viewer->assign('MAX_UPLOAD_LIMIT_MB', App\Config::getMaxUploadSize(true, true));
$viewer->assign('MAX_UPLOAD_LIMIT', App\Config::getMaxUploadSize());
$viewer->assign('RECORD_ACTIVITY_NOTIFIER', $record && \App\Config::performance('recordActivityNotifier', false) && $moduleModel->isTrackingEnabled() && $moduleModel->isPermitted('RecordActivityNotifier'));
$viewer->view('Modals/QuickEdit.tpl', $request->getModule());
}
Expand Down
Expand Up @@ -88,6 +88,7 @@ Vtiger_Edit_Js(

registerFileChangeEvent: function (container) {
var thisInstance = this;

container.on('change', 'input[name="filename"]', function (e) {
if (e.target.type === 'text') {
return false;
Expand All @@ -99,7 +100,7 @@ Vtiger_Edit_Js(
}
let uploadFileSizeHolder = element.closest('.fileUploadContainer').find('.uploadedFileSize');
let fileSize = element.get(0).files[0].size;
if (fileSize > container.find('.js-max-upload-size').val()) {
if (fileSize > CONFIG['maxUploadLimit']) {
app.showAlert(app.vtranslate('JS_UPLOADED_FILE_SIZE_EXCEEDS'));
element.val('');
uploadFileSizeHolder.text('');
Expand Down

0 comments on commit ddb29d4

Please sign in to comment.