/**
 * Sample Java WebMacro Servlet
 * Name: IntranetWMPage.java
 * Purpose: Sets up and displays Camtech Intranet front page.
 * @author: brunoa
 * Date created:  26 April 2000 09:45
 * Last modified: 26 April 2000 10:30
 */

import org.webmacro.util.*;
import org.webmacro.servlet.*;
import org.webmacro.engine.*;
import org.webmacro.resource.*;
import intranet.*;


public class IntranetWMPage extends WMServlet
{
   private static Log log = new Log("intranet", "IntranetWMPage");

   public Template handle(WebContext context)
      throws HandlerException
   {
      Object output = new Object();
      String templateName = "intranet.wm";
      // get current time information and store into context
      CurrentDateTime currentDateTime = new CurrentDateTime();
      context.put("AdelaideDateTime", currentDateTime.getAdelaideDateTime());
      context.put("PerthDateTime", currentDateTime.getPerthDateTime());
      context.put("KualaLumpurDateTime", currentDateTime.getKualaLumpurDateTime());
      context.put("SanFranciscoDateTime", currentDateTime.getSanFranciscoDateTime());
      // get birthday notices and store into context
      BirthdayNotices birthdayNotices = new BirthdayNotices();
      context.put("BirthdayMessage", birthdayNotices.getBirthdayMessage());

      // return the template
      try
      {
         return (Template) context.getBroker().getValue(TemplateProvider.TYPE,
              templateName);
      }
      catch (Exception e)
      {
         throw new HandlerException("Could not locate template: " 
                                    + templateName);
      }
   }

}  // IntranetWMPage

