Skip to content
Snippets Groups Projects
Commit 3c57a453 authored by Prasad's avatar Prasad
Browse files

Fixes #674: Tunned disclaimer selection and import file order.

parent cab19006
No related branches found
No related tags found
No related merge requests found
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<div> <div>
<input type="checkbox" name="acceptDisclaimer" /> &nbsp;&nbsp;<b>{vtranslate('LBL_ACCEPT_WITH_THE_DISCLAIMER', $QUALIFIED_MODULE)}</b> <input type="checkbox" name="acceptDisclaimer" /> &nbsp;&nbsp;<b>{vtranslate('LBL_ACCEPT_WITH_THE_DISCLAIMER', $QUALIFIED_MODULE)}</b>
</div> </div>
<div style="margin-top: 15px;"> <div style="margin-top: 15px; display: none;">
<span name="proceedInstallation" class="fileUploadBtn btn btn-primary"> <span name="proceedInstallation" class="fileUploadBtn btn btn-primary">
<span><i class="fa fa-laptop"></i> {vtranslate('Select from My Computer', $MODULE)}</span> <span><i class="fa fa-laptop"></i> {vtranslate('Select from My Computer', $MODULE)}</span>
<input type="file" name="moduleZip" id="moduleZip" size="80px" data-validation-engine="validate[required, funcCall[Vtiger_Base_Validator_Js.invokeValidation]]" <input type="file" name="moduleZip" id="moduleZip" size="80px" data-validation-engine="validate[required, funcCall[Vtiger_Base_Validator_Js.invokeValidation]]"
... ...
......
...@@ -42,29 +42,35 @@ Vtiger_Index_Js('Settings_ModuleManager_List_Js', { ...@@ -42,29 +42,35 @@ Vtiger_Index_Js('Settings_ModuleManager_List_Js', {
return aDeferred.promise(); return aDeferred.promise();
}, },
registerEventsForImportFromZip: function (container) { registerEventsForImportFromZip: function (container) {
// Forcefully disable file-input and submit
var fileuploadWrap = container.find('.fileUploadBtn').parent();
var importFromZip = container.find('[name="importFromZip"]');
var moduleZip = container.find('[name="moduleZip"]');
var fileDetails = jQuery('#moduleFileDetails');
fileuploadWrap.hide();
importFromZip.attr('disabled', 'disabled');
container.on('change', '[name="acceptDisclaimer"]', function (e) { container.on('change', '[name="acceptDisclaimer"]', function (e) {
var element = jQuery(e.currentTarget); var element = jQuery(e.currentTarget);
var importFromZip = container.find('[name="importFromZip"]'); if (element.is(':checked')) {
var uploadedFile = jQuery('#moduleZip').val(); fileuploadWrap.show();
if (uploadedFile) {
jQuery('#moduleFileDetails').attr('title', uploadedFile).html(uploadedFile);
}
var disabledStatus = importFromZip.attr('disabled');
if ((element.is(':checked')) && (uploadedFile != '')) {
if (typeof disabledStatus != "undefined") {
importFromZip.removeAttr('disabled');
}
} else { } else {
if (typeof disabledStatus == "undefined") { fileuploadWrap.hide();
importFromZip.attr('disabled', "disabled"); importFromZip.attr('disabled', 'disabled');
} fileDetails.removeAttr('title').html('');
moduleZip.val('');
} }
}); });
container.on('change', '[name="moduleZip"]', function (e) { container.on('change', '[name="moduleZip"]', function (e) {
var uploadedFile = moduleZip.val();
if (uploadedFile) {
jQuery('#moduleFileDetails').attr('title', uploadedFile).html(uploadedFile);
}
var acceptDisclaimer = container.find('[name="acceptDisclaimer"]'); var acceptDisclaimer = container.find('[name="acceptDisclaimer"]');
if (!acceptDisclaimer.is(':checked')) { if (acceptDisclaimer.is(':checked') && uploadedFile) {
acceptDisclaimer.trigger('click'); importFromZip.removeAttr('disabled');
} }
}); });
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment