From 78f95262df10b5bdfdf81141a2ae34be5abfcc90 Mon Sep 17 00:00:00 2001 From: Vishnu Date: Wed, 8 Jan 2020 08:20:55 +0530 Subject: [PATCH] NICPS-707: Progress bar during the upload in briefcase. --- .../share/view/dialog/ZmUploadDialog.js | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/WebRoot/js/zimbraMail/share/view/dialog/ZmUploadDialog.js b/WebRoot/js/zimbraMail/share/view/dialog/ZmUploadDialog.js index 1dd6bfa022..6fab313691 100644 --- a/WebRoot/js/zimbraMail/share/view/dialog/ZmUploadDialog.js +++ b/WebRoot/js/zimbraMail/share/view/dialog/ZmUploadDialog.js @@ -64,6 +64,7 @@ ZmUploadDialog.prototype._uploadFolder; ZmUploadDialog.prototype._uploadCallback; ZmUploadDialog.prototype._extensions; +var uploadedFileObj = []; // Public methods /** @@ -267,6 +268,14 @@ ZmUploadDialog.prototype._upload = function(){ var errorFilenames; var newError; this.setFileExtensions(); + + try { + var briefcaseProgressDiv= document.getElementById("briefcase_progress_div"); + if(briefcaseProgressDiv) { + briefcaseProgressDiv.style.display = ""; + briefcaseProgressDiv.innerHTML = ""; + } + } catch(err) {} var setLinkTitleText = (function(){ if (this._showLinkTitleText) { @@ -362,7 +371,10 @@ ZmUploadDialog.prototype._upload = function(){ errors.push(newError); } else { uploadFiles.push({ name: file.name, fullname: file.name, notes: notes }); - } + try { + this._initBriefProgressSpan(file.name, uploadedFileObj); + } catch(err) {} + } if (((j + 1) === files.length)) { setLinkTitleText(); } @@ -393,6 +405,26 @@ ZmUploadDialog.prototype._upload = function(){ } }; +ZmUploadDialog.prototype._initBriefProgressSpan = + function(fileName, uploadedFileObj) { + try { + var briefcaseProgressDiv= document.getElementById("briefcase_progress_div"); + if(briefcaseProgressDiv) { + var firstBubble = briefcaseProgressDiv.getElementsByTagName("span")[0]; + if (firstBubble) { + var tempBubbleWrapper = document.createElement("span"); + tempBubbleWrapper.innerHTML = AjxTemplate.expand("mail.Message#MailAttachmentBubble", {fileName: fileName}); + var newBubble = tempBubbleWrapper.firstChild; + firstBubble.parentNode.insertBefore(newBubble, firstBubble); + } else { + briefcaseProgressDiv.innerHTML = AjxTemplate.expand("mail.Message#UploadProgressContainer", {fileName: fileName}); + } + this._loadingSpan = briefcaseProgressDiv.getElementsByTagName("span")[0]; + uploadedFileObj.push(this._loadingSpan); + } + } catch(err) {} + }; + ZmUploadDialog.prototype._uploadFileProgress = function(uploadButton, params, progress) { if (!uploadButton || !params || !progress.lengthComputable || !params.totalSize) return; @@ -413,6 +445,13 @@ ZmUploadDialog.prototype._uploadFileProgress = var tooltip = AjxMessageFormat.format(ZmMsg.uploadPercentComplete, [ Math.round(fractionUploaded * 100) ] ) uploadButton.setToolTipContent(tooltip, true); + + try { + for(var cnt=0; cnt