OpenNTF.org - Download Time Estimator for th
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
Download Time Estimator for the Web 
Rating:
Not Rated Yet 
Contributor:
Chris Crompton 
Category:
Lotus Formula 
Type:
Webdevelopment 
Notes Version:
R6.x 
Last Modified:
07 Oct 2005 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
REM {Input the connection speeds and names};

CONNECTIONS:= 56 : 500;
CONNECTIONNAMES:="56K" : "Broadband";

REM {Add up the length of all the attachments which aren't images};
leng:=0;
anames:=@AttachmentNames;
alengths:=@AttachmentLengths;
AttachmentTypesToCount:= "doc": "xls": "ppt": "pdf": "wmv";
@For(i:=1; i <= @Attachments; i := i + 1;
aname:=@LowerCase(@RightBack(anames[i]; "."));
leng:=leng + @If(@IsMember(aname; AttachmentTypesToCount); aLengths[i]; 0)
);
howmanyKbits:=leng * 8 / 1000;
allrows:="";

REM {Compute the download times based on the file size and Create the table to house the results};
@For(i:=1; i <= @Count(connections); i:=i+1;
secondsK:= howmanyKbits / connections[i];
minutesK:=@Text(@Integer(secondsK / 60));
minutesK := @If(minutesK = "0"; ""; minutesK + " minutes, ");
secondsK:=@Text(@Modulo(secondsK ; 60)) + " seconds";
thisrow:="<tr><td><b>" + connectionnames[i] + "</b></td><td>&nbsp;</td><td>" + minutesK + secondsK + "</td></tr>";
allrows:=allrows + thisrow
);

REM {Create the CSS style for the results};
style:="<STYLE>
.downloadheading{font-family: Verdana; font-size: small; font-weight:bold}
#downloadtime td{font-family: Verdana; font-size: x-small;}
</STYLE>";

REM {Output the result};
style +"<span class=\"downloadheading\">Estimated Download Times:</span><br>" + "<div id=\"downloadtime\"><table>" + allrows + "</table></div>"

Usage / Example
Use this formula in a pass-thru html computed text field on the web.
 Comments

No documents found

 Add your comment!