Changeset 3010
- Timestamp:
- Dec 8, 2006, 11:58:59 AM (16 years ago)
- Location:
- branches/2.1.2/www
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.1.2/www/filemanager/files/list_files.jsp
r2753 r3010 148 148 { 149 149 var cmd = fileId ? 'UploadFile' : 'UploadNewFile'; 150 Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&directory_id=<%=directoryId%>&item_id='+fileId, 'UploadFile', 540, 400);150 Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&directory_id=<%=directoryId%>&item_id='+fileId, 'UploadFile', 640, 480); 151 151 } 152 152 function viewFile(fileId) -
branches/2.1.2/www/filemanager/files/view_file.jsp
r2753 r3010 101 101 function uploadFile() 102 102 { 103 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=UploadFile&item_id=<%=itemId%>', 'UploadFile', 540, 400);103 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=UploadFile&item_id=<%=itemId%>', 'UploadFile', 640, 480); 104 104 } 105 105 </script> -
branches/2.1.2/www/filemanager/manager.jsp
r2753 r3010 67 67 if (directories) directories.style.height = (iframeElement.height-1)+'px'; 68 68 var joust = iframe.frames['directories'].document.getElementById('joust'); 69 if (joust) joust.style.height = (iframeElement.height- 1-30)+'px';69 if (joust) joust.style.height = (iframeElement.height-5-30)+'px'; 70 70 var files = iframe.frames['files'].document.getElementById('main'); 71 71 if (files) files.style.height = iframeElement.height+'px'; -
branches/2.1.2/www/filemanager/upload/index.jsp
r3008 r3010 58 58 <base:page type="frameset" title="Upload file"> 59 59 <base:head /> 60 <frameset rows="*,0,0" frameborder=" yes" border="1">60 <frameset rows="*,0,0" frameborder="no" border="0"> 61 61 <frame name="select" src="select.jsp?ID=<%=ID%>&directory_id=<%=directoryId%>&file_id=<%=fileId%>" 62 62 scrolling="no" frameborder="0"> -
branches/2.1.2/www/filemanager/upload/progress.jsp
r3008 r3010 50 50 final String ID = sc.getId(); 51 51 final boolean abort = Values.getBoolean(request.getParameter("abort")); 52 final boolean ajax = Values.getBoolean(request.getParameter("ajax")); 52 53 final FileUploadProgress progress = (FileUploadProgress)sc.getSessionSetting("FileUploadProgress"); 53 54 final SimpleAbsoluteProgressReporter unpackProgress = (SimpleAbsoluteProgressReporter)sc.getSessionSetting("UnpackProgress"); … … 55 56 boolean aborted = false; 56 57 boolean transferIsComplete = false; 58 boolean failed = false; 57 59 long total = 0; 58 60 long transferred = 0; … … 65 67 if (progress != null) 66 68 { 69 failed = progress.getException() != null; 67 70 if (abort) progress.setAbort(); 68 71 currentFileName = progress.getCurrentFilename(); … … 74 77 remain = transferRate != 0 ? (total-transferred)/transferRate : 0; 75 78 percent = (total==0 ? 0 : 100 * transferred / total); 76 aborted = progress.getException() != null || abort;77 79 } 78 80 if (unpackProgress != null) … … 92 94 onload = "uploadAborted()"; 93 95 } 96 else if (failed) 97 { 98 onload = ""; 99 } 94 100 else if (progress != null) 95 101 { … … 100 106 onload = "setTimeout('location.reload()', 1500)"; 101 107 } 108 if (ajax) 109 { 110 %><%=currentFileName%>:<%=transferred%>:<%=total%>:<%=seconds%>:<%=remain%>:<%=unpackMessage == null ? "" : unpackMessage%><% 111 } 112 else 113 { 114 %> 115 <html> 116 <head> 117 </head> 118 <body onload="<%=onload%>"> 119 <script language="javascript"> 120 function displayProgress(isComplete) 121 { 122 var fileName = '<%=HTML.javaScriptEncode(currentFileName)%>'; 123 //var percentDone = '<%=percent%>'; 124 var transferredBytes = <%=transferred%>; 125 var totalBytes = <%=total%>; 126 var transferTime = <%=seconds%>; 127 //var transferRate = '<%=Values.formatBytes(transferRate)%>/s'; 128 var remainTime = <%=remain%>; 129 var unpackMessage = '<%=HTML.javaScriptEncode(unpackMessage)%>'; 130 window.top.frames['select'].displayProgress(fileName, transferredBytes, totalBytes, transferTime, remainTime, unpackMessage); 131 if (!isComplete) 132 { 133 setTimeout('location.reload()', 1500); 134 } 135 } 136 function displayException() 137 { 138 window.top.frames['select'].location = 'show_exception.jsp?ID=<%=ID%>'; 139 } 140 function uploadAborted() 141 { 142 window.top.location = '../../common/close_popup.jsp?refresh_opener=1&message=<%=HTML.urlEncode("The upload was aborted before it was completed.")%>'; 143 } 144 </script> 145 </body> 146 </html> 147 <% 148 } 102 149 %> 103 <html>104 <head>105 </head>106 <body onload="<%=onload%>">107 <script language="javascript">108 function displayProgress(isComplete)109 {110 var fileName = '<%=HTML.javaScriptEncode(currentFileName)%>';111 var percentDone = '<%=percent%>';112 var transferredBytes = '<%=Values.formatBytes(transferred)%>';113 var totalBytes = '<%=Values.formatBytes(total)%>';114 var transferTime = '<%=Values.formatTime(seconds)%>';115 var transferRate = '<%=Values.formatBytes(transferRate)%>/s';116 var remainTime = '<%=Values.formatTime(remain)%>';117 var unpackMessage = '<%=HTML.javaScriptEncode(unpackMessage)%>';118 window.top.frames['select'].displayProgress(fileName, percentDone, transferredBytes, totalBytes, transferTime, transferRate, remainTime, unpackMessage);119 if (!isComplete)120 {121 setTimeout('location.reload()', 1500);122 }123 }124 function displayException()125 {126 window.top.frames['select'].location = 'show_exception.jsp?ID=<%=ID%>';127 }128 function uploadAborted()129 {130 window.top.location = '../../common/close_popup.jsp?refresh_opener=1&message=<%=HTML.urlEncode("The upload was aborted before it was completed.")%>';131 }132 </script>133 </body>134 </html> -
branches/2.1.2/www/filemanager/upload/select.jsp
r3008 r3010 116 116 final String requiredClazz = "class=\"text required\""; 117 117 %> 118 119 118 <base:page type="popup" title="<%=title%>"> 120 <base:head scripts="tabcontrol.js " styles="tabcontrol.css,progressbar.css">119 <base:head scripts="tabcontrol.js,ajax.js" styles="tabcontrol.css,progressbar.css"> 121 120 <script language="JavaScript"> 122 121 // Validate the "File" tab … … 149 148 150 149 frm.submit(); 151 window.top.frames['progress'].location.href = 'progress.jsp?ID=<%=ID%>';152 150 Main.hide('selectForm'); 153 151 Main.show('progressForm'); 154 } 152 if (!sendProgressUpdateWithAjax()) 153 { 154 window.top.frames['progress'].location.href = 'progress.jsp?ID=<%=ID%>'; 155 } 156 } 157 } 158 159 function sendProgressUpdateWithAjax() 160 { 161 var request = Ajax.getXmlHttpRequest(); 162 if (request != null) 163 { 164 var url = 'progress.jsp?ID=<%=ID%>&ajax=1&'+Math.random(); 165 request.open("GET", url, true); 166 Ajax.setReadyStateHandler(request, updateProgressWithAjax); 167 request.send(null); 168 } 169 return request != null; 170 } 171 172 function updateProgressWithAjax(request) 173 { 174 var response = request.responseText.split(':'); 175 //alert(response[0]+':'+response[1]+':'+response[2]+':'+response[3]+':'+response[4]+':'+response[5]); 176 displayProgress(response[0],response[1],response[2],response[3],response[4],response.slice(5).join(':')); 177 setTimeout('sendProgressUpdateWithAjax()', 1500); 155 178 } 156 179 … … 212 235 } 213 236 214 function displayProgress(fileName, percentDone, transferredBytes, totalBytes, transferTime, transferRate, remainTime, unpackMessage) 215 { 237 function displayProgress(fileName, transferredBytes, totalBytes, transferTime, remainTime, unpackMessage) 238 { 239 // File name 216 240 document.getElementById('fileName').innerHTML = 'Uploading ' + fileName + '...'; 241 242 // Percent done 243 var percentDone = totalBytes == 0 ? 0 : Math.round(100 * transferredBytes / totalBytes); 217 244 document.getElementById('percent').innerHTML = ' ' + percentDone+'%'; 218 245 var doneElement = document.getElementById('percentDone'); … … 221 248 remainElement.style.width = (100-percentDone)+'%'; 222 249 if (percentDone == 100) Main.hide('percentRemain'); 223 document.getElementById('transferredBytes').innerHTML = transferredBytes; 224 document.getElementById('totalBytes').innerHTML = totalBytes; 225 document.getElementById('transferTime').innerHTML = transferTime; 226 document.getElementById('transferRate').innerHTML = '(' + transferRate + ')'; 227 document.getElementById('remainTime').innerHTML = remainTime + ' (estimated)'; 228 document.getElementById('unpackMessage').innerHTML = unpackMessage.replace(/(.*):(.*)/, '<b>$1:</b> $2'); 250 251 // Bytes 252 document.getElementById('transferredBytes').innerHTML = Numbers.formatBytes(transferredBytes); 253 document.getElementById('totalBytes').innerHTML = Numbers.formatBytes(totalBytes); 254 255 // Times and rate 256 var transferRate = transferTime == 0 ? 0 : transferredBytes / transferTime; 257 document.getElementById('transferTime').innerHTML = Numbers.formatSeconds(transferTime); 258 document.getElementById('transferRate').innerHTML = '(' + Numbers.formatBytes(transferRate) + '/s)'; 259 document.getElementById('remainTime').innerHTML = Numbers.formatSeconds(remainTime) + ' (estimated)'; 260 261 // Message 262 if (unpackMessage) 263 { 264 document.getElementById('unpackMessage').innerHTML = unpackMessage.replace(/(.*):(.*)/, '<b>$1:</b> $2'); 265 } 229 266 } 230 267 … … 293 330 294 331 <h3 class="docked"><%=title%></h3> 295 <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale* 280)+"px;"%>"332 <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*340)+"px;"%>" 296 333 position="bottom" remember="false"> 297 334 <t:tab id="info" title="File" validate="validateFile()"> -
branches/2.1.2/www/include/scripts/main.js
r2765 r3010 744 744 return charCode <= 31 || (charCode >= 48 && charCode <= 57) || charCode == 45 || charCode == 46; 745 745 } 746 747 /* 748 Format a number with the specified number of decimals 749 */ 750 this.formatNumber = function(value, numDecimals, unit) 751 { 752 if (!value) return ''; 753 var result = ''; 754 if (value < 0) 755 { 756 result += "-"; 757 value = -value; 758 } 759 if (numDecimals < 0) 760 { 761 result += value; 762 } 763 else if (numDecimals == 0) 764 { 765 result += Math.round(value); 766 } 767 else 768 { 769 var intPart = Math.floor(value); 770 var decimals = Math.round((value - intPart) * Math.pow(10, numDecimals)); 771 result += intPart + '.' + decimals; 772 } 773 if (unit) result += unit; 774 return result; 775 } 776 777 this.GB = 1073741824; 778 this.MB = 1048576; 779 this.kB = 1024; 780 781 this.formatBytes = function(value) 782 { 783 if (!value) return ''; 784 if (value > this.GB) 785 { 786 return this.formatNumber(value / this.GB, 1, ' GB'); 787 } 788 else if (value > this.MB) 789 { 790 return this.formatNumber(value / this.MB, 1, ' MB'); 791 } 792 else if (value > this.kB) 793 { 794 return this.formatNumber(value / this.kB, 1, ' kB'); 795 } 796 else 797 { 798 return value + ' bytes'; 799 } 800 } 801 802 this.formatSeconds = function(seconds) 803 { 804 if (!seconds) return ''; 805 var result = ''; 806 var mustAppend = false; 807 if (seconds >= 86400) 808 { 809 var days = Math.floor(seconds / 86400); 810 seconds = seconds - 86400*days; 811 result += days; 812 result += days == 1 ? " day " : " days "; 813 mustAppend = true; 814 } 815 if (seconds >= 3600 || mustAppend) 816 { 817 var hours = Math.floor(seconds / 3600); 818 seconds = seconds - 3600*hours; 819 result += hours; 820 result += hours == 1 ? " hour " : " hours "; 821 mustAppend = true; 822 } 823 if (seconds >= 60 || mustAppend) 824 { 825 var minutes = Math.floor(seconds / 60); 826 seconds = seconds - 60*minutes; 827 result += minutes; 828 result += minutes == 1 ? " minute " : " minutes "; 829 mustAppend = true; 830 } 831 result += seconds; 832 result += seconds == 1 ? " second" : " seconds"; 833 return result; 834 } 835 746 836 } 747 837
Note: See TracChangeset
for help on using the changeset viewer.