Novell Home

Cool Tip: How to add the Quota Display in WebAccess

Novell Cool Solutions: Feature
By Brian Anderson

Digg This - Slashdot This

Posted: 14 Oct 2004
 

Updated: We have received some suggestions with enhancements for Brian's tip and a new TID. Check them out below.

Other Suggestions:

Brian Anderson

If you have implemented quotas, here is a way to make your WebAccess users happy. By modifying the default templates, you can have WebAccess display how much of their quota is currently in use. The display will appear to the right of the Help/Options/Exit buttons.

Adding quota display to WebAccess:

File to edit - caption.htt
Location - \tomcat\33\webapps\ROOT\WEB-INF\classes\com\novell\webaccess\templates\frames
( will vary if using tomcat4, linux, etc )

  1. In body section, approx line 44, add the following:
#quota        { position: absolute; z-index: 5; top: 14px; left: 600px;
width: 240px; height: 24px; visibility: visible }
    This adds a div class to use for display.

  1. After {!----- TimeZone Description -----}, approximately line 421, add the following:

 {!----- Quota Display -----}
         <div id="quota">
         <SCRIPT language="javascript">
         <!--
         var diskspace = {VAR User.Disk.limit }
         var inuse = {VAR GWAP.Disk.inUse }
         var quota_p = inuse/diskspace
         document.write( Math.round(quota_p*100) + '% of quota in use');
         //-->
         </SCRIPT>  <a
href="javascript:window.location.reload(true)"
style="color:#c82727"><FONT size=-2 >Update</FONT></a>
         </div>
    The update link is necessary because the caption area of the workspace does not get refreshed with each action.

  1. Save caption.htt then reload tomcat { java -exit; tomcat33 }
Phil Henderson

Using the current scripts, if the User Limit is greater than 2047 then a negative number is returned for the diskspace variable. This script builds on the others but does a different calculation to get the appropriate value for the negative value.

By the way, it works on both GW6 and 6.5.

{!----- Quota Display -----}
  <div id="quota">
  <SCRIPT language="javascript">
  <!--
  var diskspace = {VAR User.Disk.limit }
  
  if (diskspace==0)
  {
  document.write('Mailbox quota: None Assigned');
  }
  else
  {
  var inuse = {VAR GWAP.Disk.inUse }
  var quota_mb = Math.round(100*diskspace/1024/1024)/100
  var inuse_mb = Math.round(100*inuse/1024/1024)/100
  if (diskspace<0)
  {
  var quota_mb = 4096 + (Math.round(100*diskspace/1024/1024)/100)
  }
  else
  {
  var quota_mb = Math.round(100*diskspace/1024/1024)/100
  }
  var avail_mb = Math.round((quota_mb - inuse_mb)*100)/100
  
  document.write('Mailbox quota: ' + quota_mb + 'MB ');
  document.write('<a href=\"javascript:window.location.reload(true)\"');
  document.write('style=\"color:#c82727\">Update Stats</FONT></a>');		 
  document.write('<br>');
  document.write('Used: ' + inuse_mb + 'MB');
  document.write(' ');
  document.write('Available: ' + avail_mb + 'MB  ');
  }
  
   //-->
   </SCRIPT> 
   
   </div>
TID10094627: Problem started after modifying WebAccess template per this Cool Tip

Problem:

Problem started after modifying WebAccess template per this Cool Tip: How to add the Quota Display in WebAccess

Fix:

This problem is fixed with the 8-20-2004 build of GroupWise 6.5 SP3 WebAccess

Be aware that to use this quota display feature you will need to set disk space limits for the GroupWise users in Consoleone: Managing Database Disk Space - Disk Space Management User Limits

TID10094627: Problem started after modifying WebAccess template as per this Cool Tip

Wayne Bruzzese

If the users disk quota is set to something greater than 2GB (maybe just greater than 1GB) the User.Disk.limit variable becomes a negative number that does not represent the mail quota set for the user. Also, the tip only showed a % of use. I have enhanced the script to show the quota, space in use, and space available. In addition, I made an exception if the User.Disk.limit produces a negative number.

The example below is the same as previously published, produces a more informative solution to the end users and accounts for the problem of high quotas.

 {!----- Quota Display -----}
         <div id="quota">
         <SCRIPT language="javascript">
         <!--
         var diskspace = {VAR User.Disk.limit }
         var inuse = {VAR GWAP.Disk.inUse }
         var quota_mb = Math.round(100*diskspace/1024/1024)/100
         var inuse_mb = Math.round(100*inuse/1024/1024)/100
         var avail_mb = Math.round(100*(diskspace-inuse)/1024/1024)/100

         if (diskspace>0)
         {
         document.write('Mailbox Quota: ' + quota_mb + 'MB ');
         document.write('<a href=\"javascript:window.location.reload(true)\"');
         document.write('style=\"color:#c82727\">Update Stats</FONT></a>');
         
         document.write('<br>');
         document.write('Used: ' + inuse_mb + 'MB');
	 document.write('&nbsp;');
         document.write('Available: ' + avail_mb + 'MB  ');
         }
         else
         {
         document.write('Mailbox Quota is Unknown! ');
         document.write('<a href=\"javascript:window.location.reload(true)\"');
         document.write('style=\"color:#c82727\">Update Stats</FONT></a>');
         
         document.write('<br>');
         document.write('Used: ' + inuse_mb + 'MB');
	 document.write('&nbsp;');
         document.write('Available: Unknown! ');
         }


         //-->
         </SCRIPT> 
         
         </div>
Michael Mollard

I modified the code so that the 'quota' and 'non-quota' accounts can be tweaked separately. See example below:

{!----- Quota Display -----}
         <div id="quota">
    	 {IF User.Disk.limit > 0}
	         <SCRIPT language="javascript">
	         <!--
	         var diskspace = {VAR User.Disk.limit }
	         var inuse = {VAR GWAP.Disk.inUse }
	         var quota_p = inuse/diskspace

	 	 document.write( Math.round(quota_p*100) + '% of quota in use - ');
		 document.write( 'Mailbox using ' + inuse + 'KB');
	         //-->
         	 </SCRIPT> &nbsp; <a href="javascript:window.location.reload(true)"
		style="color:#c82727"><FONT size=-2 >Update</FONT></a>
	 {ELSE}
	         <SCRIPT language="javascript">
	         <!--
	         var diskspace = {VAR User.Disk.limit }
	         var inuse = {VAR GWAP.Disk.inUse }

		 document.write( 'Mailbox using '+ inuse + 'KB');
	         //-->
         	 </SCRIPT> &nbsp; <a href="javascript:window.location.reload(true)"
		style="color:#c82727"><FONT size=-2 >Update</FONT></a>
	 {ENDIF}
         </div>

For more tips see:

submit a tip

Here's a chance to share your experiences using GroupWise. Just send us a tip about using (or installing, deploying, troubleshooting, etc.) GroupWise, and if it looks like something we can use, we'll send you a Novell t-shirt, post your tip, and make you famous beyond your tamest dreams. Submit your tip here: http://www.novell.com/coolsolutions/forms/submit_a_tip.html


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell