I used this trick in the R5 mail template to change the color of the DiskSpace display (top left corner of the mail db in R5). Background is red if your over your quota, magenta if you are 10% near your quota, green (default notes green color) if otherwise.
The PostOpen event of the DiskUsage form has LotusScript to set a text variable by the name bgColor to "red" if user is over his disk quota, and to "magenta" if user is 10% near his quota. Default value for bgColor is "" (empty).
Note: If bgColor is set to "" then the form background color is not changed and remains what it currently is set to.
Do not forget to make the table color transparent and remove the borders so the form's background color shows thru.
I am sure there is no equivalent of this code in LotusScript or formula language.
This concept and variations of this idea can be used in lots of Notes applications to improve cosmetics (It works both in the Notes Client and from the Web).
document.bgColor = document.forms.bgColor.value; postopen event has the code below.
Dim session As New notessession
Dim db As notesdatabase
Dim doc As notesdocument Set db = session.currentdatabase
Set doc = source.document ManagerFound = False
Forall Names In db.Managers
If (Instr(Names,session.CommonUserName) <> 0) Then
ManagerFound = True
End Forall If (ManagerFound) Then
dbsize = (db.size)/1024
dbmax = db.sizequota
If dbmax = 0 Then
percent = 0
percent = (dbsize/dbmax)
used% = (percent*100)
dbQuota = dbmax/1024
dbFileSize = dbsize/1024 doc.Used = "Used: " & Cint(used%) & "%"
doc.Free = "Free : " & Cint(100 - used%) & "%"
doc.Quota = "Quota: " & Format((dbQuota), "Fixed") & "MB"
doc.FileSize = "Size : " & Format((dbFileSize) , "Fixed") & "MB" ' Set Background Color depending on quota and size ratio
dbDifference = dbQuota - dbFileSize
If dbDifference < 0 Then
doc.bgColor = "red"
' Set background color to RED indicating that you are over your quota
Elseif (dbDifference < (dbQuota/10) ) Then
doc.bgColor = "magenta"
' Set background color to MAGENTA indicating that you are 10% close to quota
doc.Used = "MAIL"