var InitialState = 2; // 1 or 2 = hidden or visible var showDetails = 1; // 1 or 2 = hidden or visible var showFileList = 1; // 1 or 2 = hidden or visible var MeterWidth = 500; // Must be multiple of 100 pixels var HideForm = 2; // Colapse form when submitted ? 1 : 2 var DisableBtn = 1; // Disable Submit Button onsubmit ? 1 : 2 var Row1BG = "#72B8F5"; // File stat table's first row background color var Row2BG = "#E0F0FF"; // 2nd and 4th row's background colors var Row3BG = "#EAFAFF"; // 3rd row's background color var CurRowBG = "#87CEEB"; // current file row's background color var FinRowBG = "#FFD700"; // finished file row's background color var borderClr = "#000000"; // color of border for both info tables var borderWidth = 1; // pixel width of border for both info tables var ProgBarBG = "#F5F5F5"; // Progress bar's background color var ProgBarFG = "#00aa00"; // Progress bar's completed color var FontSze = 13; // font size in pixels var FontFamily = "Arial"; // font name var FontClr = "#000000"; // font color var UseKBytes = 1; // 1 or 2 = kb or mb var JSdebugging = 2; // 1 or 2 = kb or mb var req = 0; var JSargs = ""; var ScriptURL = ""; var ScriptCmd1 = ""; var ScriptCmd2 = "progress"; var UID = new Date(); UID = UID.getTime(); var types = new Array(); types[0] = "htm"; types[1] = "html"; types[2] = "txt"; types[3] = "jpeg"; types[4] = "jpg"; types[5] = "gif"; function printProgressMeter(){ var UMMeter = ""; BS = UseKBytes == 1 ? 'KB' : 'MB'; divVis = InitialState == 1 ? 'block' : 'none'; MeterWidth = MeterWidth % 100 == 0 ? MeterWidth : 300; MeterWidth = MeterWidth < 100 ? 100 : MeterWidth > 1000 ? 1000 : MeterWidth; MeterFactr = MeterWidth / 100; UMMeter += '\n'; UMMeter += '
'; UMMeter += '
\n\n'; UMMeter += '
\n'; UMMeter += '
\n\n'; if(showDetails == 1 || JSdebugging == 1){ UMMeter += '\n'; UMMeter += '\n'; UMMeter += '\n'; UMMeter += '\n'; UMMeter += '\n'; UMMeter += '\n'; UMMeter += '\n'; UMMeter += '\n'; UMMeter += '\n'; UMMeter += '\n'; UMMeter += '\n'; UMMeter += '\n'; UMMeter += '\n'; UMMeter += '
CompletedTransferred (' + BS + ')Rate (KB/S)Time Left
    

\n'; } if(showFileList == 1 || JSdebugging == 1){ UMMeter += '
'; UMMeter += ''; UMMeter += ''; UMMeter += ''; UMMeter += ''; UMMeter += ''; UMMeter += ''; UMMeter += '
File NameStatus
 
'; } if(JSdebugging == 1){ UMMeter += '
= 0){ msg = 'File transfer complete.... please wait....
'; if(JSdebugging == 1){ msg += '
' + req.responseText + ''; } document.getElementById('progscreen').innerHTML = msg; return; } else if(req.responseText.search(/^NoLog/i) >= 0){ msg = 'Querying.... please wait....
'; if(JSdebugging == 1){ msg += '
' + req.responseText + ''; } document.getElementById('progscreen').innerHTML = msg; return; } filePrgss = filePrgss.substr(0, filePrgss.length - 2); fsD = new Array(); fsD = filePrgss.split('++'); filesDone = fsD.length - 1; // skip current file bytesDone = bytesDone < 1 ? 1 : bytesDone; percentDone = Math.floor((bytesDone / totalSize) * 100); percentDone = percentDone < 1 ? 1 : percentDone; progressPxW = percentDone * MeterFactr; progressPxW = parseInt(progressPxW); progressPxS = progressPxW.toString(); if(progressPxS.search(/^\d+$/) < 0){progressPxW = 1} secsReqed = parseInt((secsLapsed * 100) / percentDone); transRate = convertBits(bytesDone / secsLapsed); percentHT = percentDone + '%'; if(JSdebugging == 1){ msg = '\n'; msg += '\n'; msg += '\n'; msg += '\n'; msg += ''; msg += '
totalFiles' + totalFiles + '
percentDone' + percentDone + '
progressPxW' + progressPxW + '
fileNames' + fileNames + '
RawString' + req.responseText + '
\n'; document.getElementById('showdata').innerHTML = msg; } if(showDetails == 1 || JSdebugging == 1){ secsLeft = convertSecs(secsReqed - secsLapsed); totalSize = convertBits(totalSize); bytesDone = convertBits(bytesDone); document.getElementById('fDone').innerHTML = filesDone + ' of ' + totalFiles; document.getElementById('dDone').innerHTML = bytesDone + ' of ' + totalSize; document.getElementById('tRate').innerHTML = transRate; document.getElementById('lTime').innerHTML = secsLeft; } if(showFileList == 1 || JSdebugging == 1){ allFiles = new Array(); allFiles = fileNames.split('++'); dneFiles = new Array(); dneFiles = filePrgss.split('++'); fListMsg = '\n'; fListMsg += '\n'; fListMsg += '\n'; fListMsg += '\n'; fListMsg += '\n'; for(a = 0; a < allFiles.length; a++){ bg = a % 2 == 0 ? Row2BG : Row3BG; if(a < dneFiles.length - 1){ fileStatus = 'Finished'; bg = FinRowBG; } else if(a == dneFiles.length - 1){ thisFile = new Array(); thisFile = dneFiles[a].split('='); if(thisFile[1] == 'undefined' || !thisFile[1]){ thisFile = '0.00'; } else { thisFile = convertBits(thisFile[1]); } fileStatus = thisFile + '' + BS; bg = CurRowBG; } else { fileStatus = 'Pending'; } fListMsg += '\n'; fListMsg += '\n'; fListMsg += '\n'; fListMsg += '\n'; } fListMsg += '
File NameStatus
' + allFiles[a] + '' + fileStatus + '
\n'; document.getElementById('fListDiv').innerHTML = fListMsg; } } document.getElementById('progtext').style.top = '-19px'; document.getElementById('progtext').innerHTML = percentHT; document.getElementById('progstat').style.width = progressPxW + 'px'; window.setTimeout("sendRqst(ScriptURL + '?' + ScriptCmd2 + '=' + JSargs)", 1000); } else { alert('Progress request failed. Data transfer has terminated .... ' + req.status); } } } function transInit(b){ if(arguments.length > 1 && arguments[1] == false){ return; } f = b.form; ScriptURL = f.action; totalFiles = 0; fileName = ""; fileNames = ""; typeOK = 0; same1 = 0; same2 = 0; same3 = 0; ScriptCmd1 = ScriptURL.indexOf("?"); ScriptCmd1 = ScriptURL.substr(ScriptCmd1 + 1); ScriptURL = ScriptURL.replace(/\?.*/ig, ""); for(a = 0; a < f.elements.length; a++){ if(f.elements[a].name.search(/^FILE\d+$/) >= 0){ if(f.elements[a].value.length > 1){ totalFiles++; typeOK = 0; same1 = 0; same2 = 0; same3 = 0; f.elements[a].style.color = "#000000"; fileName = f.elements[a].value; fileName = fileName.replace(/^.*(\\|\/)/ig, ""); fileNames += fileName + '++'; ext = f.elements[a].value.lastIndexOf("."); ext = f.elements[a].value.substr(ext + 1); ext = ext.toLowerCase(); for(c = 0; c < types.length; c++){ if(ext == types[c] || types[c] == "all"){ typeOK++; } } if(!typeOK){ msg = "Illegal file type.\n\nWe do not allow " + ext + " "; msg += "file uploads.\n\nPlease change or remove the selected "; msg += "file from the hilighted field."; alert(msg); f.elements[a].style.color = "#00aa00"; return; } typeOK = 0; } for(aa = a + 1; aa < f.elements.length - 1; aa++){ nextF = f.elements[aa].value; if(f.elements[a].value == nextF && nextF.length > 0){ same1++; same2 = a; same3 = aa; } if(same1){ msg = "Duplicate file name.\n\nTwo or more fields contain "; msg += "identical file names\n\nPlease change or remove the "; msg += "Duplicate file."; alert(msg); f.elements[same2].style.color = "#00aa00"; f.elements[same3].style.color = "#00aa00"; return; } } } } fileNames = fileNames.substr(0, fileNames.length - 2); JSargs = f.id.value + '=' + UID; f.action = ScriptURL + '?' + ScriptCmd1 + '=' + JSargs; f.submit(); if(totalFiles){ if(HideForm == 1){f.style.display = 'none';}if(DisableBtn == 1){b.disabled = true;} document.getElementById('progscreen').style.display = 'block'; window.setTimeout("sendRqst(ScriptURL + '?' + ScriptCmd2 + '=' + JSargs)", 1000); } else { document.getElementById('progscreen').style.display = 'none'; } } function convertBits(bytes){ bytes = bytes / 1024; if(UseKBytes == 2){ bytes = bytes / 1024;} bytes = Math.floor(100 * bytes) / 100; bytes = String(bytes); ena = bytes.length - 2; dio = bytes.length - 3; deci = bytes.substr(ena,1) == "." ? "0" : bytes.substr(dio,1) == "." ? "" : ".00"; bytes += deci; return bytes; } function convertSecs(secs){ remsecs = 0; remmins = 0; remhrs = 0; if(secs >= 3600){ remsecs = secs % 60; remmins = secs / 60; remhrs = secs / 3600; } else if(secs >= 60){ remsecs = secs % 60; remmins = secs / 60; } else { remsecs = secs % 60; } remsecs = parseInt(remsecs); remmins = parseInt(remmins); remhrs = parseInt(remhrs); remsecs = remsecs < 10 ? '0' + remsecs : remsecs; remmins = remmins < 10 ? '0' + remmins : remmins; remhrs = remhrs < 10 ? '0' + remhrs : remhrs ; secs = remhrs + ':' + remmins + ':' + remsecs; return secs; } printProgressMeter();