#!/usr/athena/bin/perl
# Top-level HDML File generator
# $Id: i.hdml,v 1.2 2000/02/26 16:46:07 fubob Exp $
# Rex Min   Dec. 99


### Send HDML code to wireless phones with UP.Browser
$hdml= ($ENV{'HTTP_USER_AGENT'} =~ /UP\.Link/);

if ($hdml) {
  print("Content-Type: text/x-hdml\n\n");
} else {
  print("Content-Type: text/html\n\n");
}


  if ($hdml) {
	print <<"end_msg";    ########## HDML CODE ##############
<HDML VERSION=3.0 PUBLIC=TRUE MARKABLE=TRUE>
  <CHOICE TITLE="MIT HDML Demos" BOOKMARK="http://www.mit.edu/cgi/i.hdml" KEY=w>
     <ACTION TYPE=ACCEPT LABEL=OK TASK=GOSUB DEST=\$w>
     <ACTION TYPE=SOFT1 LABEL=Info TASK=GOSUB DEST=#i>
     <CENTER> MIT Web Demo
     <CE VALUE="zl"> Zlocate
     <CE VALUE="zw"> Zwrite
     <CE VALUE="mitdir"> MIT Directory
     <CE TASK=GO DEST=#p> (Finger/Ping)
     <CE TASK=GO DEST=#m> (Sendmail)
  </CHOICE>

  <DISPLAY NAME=i>
     <CENTER> MIT/SIPB PCS Demo <BR>
     Welcome to our PCS Services Demo! These pages are under 
     development by Rex Min for SIPB. Our goal is to provide useful, 
     MIT-related information services to those in the MIT community who wield 
     Web-browsing cellular phones. Services in parens denote gateways
     to non-MIT HDML services.
  </DISPLAY>

   <CHOICE NAME="m" KEY=w>
      <ACTION TYPE=ACCEPT TASK=GO LABEL=Edit DEST=#\$w>
      <ACTION TYPE=SOFT1 LABEL=Send! TASK=GO METHOD=POST
             DEST="//webcab.de/cgi-bin/sendmail.cgi?n=1"
             POSTDATA=send=1\&f=\$(f:E)\&t=\$(t:E)\&c=\$(c:E)\&s=\$(s:E)\&b=\$(b:E)>
      <CENTER> SendMail  <BR>
      <CENTER> (webcab.de)
      <CE VALUE="et"> To: [\$t]
      <CE VALUE="es"> Su: [\$s]
      <CE VALUE="eb"> Bd: [\$b]
      <CE VALUE="ec"> Cc: [\$c]
      <CE VALUE="ef"> Fr: [\$f]
      <CE TASK=GO LABEL=Clr DEST=#m
          VARS=t=&s=&b=&c=&f=> Clear
   </CHOICE>

   <ENTRY NAME="et" KEY=t> To: </ENTRY>
   <ENTRY NAME="es" KEY=s> Subject: </ENTRY>
   <ENTRY NAME="eb" KEY=b> Body: </ENTRY>
   <ENTRY NAME="ec" KEY=c> Cc: </ENTRY>
   <ENTRY NAME="ef" KEY=f> From: </ENTRY>

   <CHOICE NAME="p" KEY=w>
      <ACTION TYPE=ACCEPT LABEL=Edit TASK=GO DEST=#\$w>
      <CENTER> Finger/Ping  <BR>
      <CENTER> (hdmlworld)
      <CE VALUE="u"> Usr: [\$u]
      <CE VALUE="h"> Hst: [\$h]
      <CE TASK=GO LABEL=Ping DEST=//www.hdmlworld.com/Z/hdml-bin/ping2?pinghost=\$h> Ping...
      <CE TASK=GO LABEL=Fingr DEST=//www.hdmlworld.com/Z/hdml-bin/finger2?f=\$u@\$h> Finger...
   </CHOICE>
   <ENTRY NAME="u" KEY=u> Username: </ENTRY>
   <ENTRY NAME="h" KEY=h> Host name/IP: </ENTRY>
</HDML>
end_msg
      } else {     ########## HTML CODE #########
	print <<"end_msg";
<html><head><title>Zlocate (information)</title></head><body>
<h1>MIT/SIPB HDML Demo Services</h1>

<p>You appear not to be using an HDML-capable browser.  This is the
home page for HDML wireless phone services from www.mit.edu.  If you
have a wireless phone which can read HDML web pages, please point the
phone's browser to this site, <I>http://www.mit.edu/cgi/i.hdml</I>,
and enjoy a sneak preview of what HDML can offer the MIT community!
</p>

<p>This page is of very little use when viewed with a standard web browser.
When viewed on an appropriate wireless phone, this page offers the following services: </p>
<ul>
  <li> Zlocating a user via the SIPB zlocate gateway
  <li> Zwriting a user via the SIPB zephyr gateway
  <li> Queries to the MIT directory, with an enhanced interface for phones
  <li> Gateways to external services for sendmail, finger, and ping
</ul>
<p> Please feel free to send comments and suggestions to 
    <a href="mailto:webmaster\@mit.edu">webmaster\@mit.edu</a>. Enjoy the demo! </p>
</body></html>
end_msg
 }

1;
