+HotelGate product.
[www.jankratochvil.net.git] / product / hotelgate / Order.pm
diff --git a/product/hotelgate/Order.pm b/product/hotelgate/Order.pm
new file mode 100644 (file)
index 0000000..965b81d
--- /dev/null
@@ -0,0 +1,135 @@
+# $Id$
+# Ordering form of 'My::Project::hotelgate'
+# Copyright (C) 2005 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+package product::hotelgate::Order;
+require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
+our $VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+our $CVS_ID=q$Id$;
+use strict;
+use warnings;
+
+use My::Web;
+use Hash::Util qw(lock_hash);
+
+
+my %error=(
+       "email_missing"=>"Your e-mail address is required, please fill it in.",
+       "type_missing"=>"Please fill in the {Device casing type} field.",
+       "ok"=>"Order has been accepted. Please wait to be contacted.",
+       );
+lock_hash(%error);
+sub error($$)
+{
+my($self,$keyword)=@_;
+
+       my $trash=$error{$keyword};     # existence check;
+       return $keyword;
+}
+
+sub handler
+{
+Wrequire 'product::hotelgate::Lib';
+my $W=product::hotelgate::Lib->init(
+               "title"=>"HotelGate: Order Form",
+               "css_push"=>"./Order.css",
+               "js_push"=>"./Order.js",
+               );
+
+
+my $COLS=50;
+
+print <<"HERE";
+<h1>HotelGate Order</h1>
+
+<p>Price offer will be provided according to your order specification.
+You may also contact us directly at the e-mail address:
+@{[ a_href 'mailto:hotelgate@jankratochvil.net' ]}</p>
+HERE
+
+if (my $error=$W->{"args"}{"error"}) {
+       print <<"HERE";
+<p align="center" class="error" id="error">@{[ $error{$error} ]}</p>
+HERE
+       }
+
+print <<"HERE";
+<form action="OrderSubmit.pm" @{[ form_method "post" ]} onsubmit="return Order_validate(this);">
+       <table border="1" class="order">
+               <tr><td>
+                       Your e-mail contact address (required).
+                       <br />
+                       <input type="text" size="@{[ $COLS ]}" name="email" value="@{[ escapeHTML($W->{"args"}{"email"}||"") ]}" />
+               </td></tr>
+               <tr><td>
+                       Contact person, shipping address.
+                       <br />
+                       <input type="text" size="@{[ $COLS ]}" name="address" value="@{[ escapeHTML($W->{"args"}{"address"}||"") ]}" />
+               </td></tr>
+               <tr><td>
+                       Installation location - leave empty if you install the device on your own.<br />
+                       European facility installations provided by @{[ a_href 'http://www.jklabs.cz/','JK&nbsp;Labs' ]}.
+                       <br />
+                       <input type="text" size="@{[ $COLS ]}" name="location" value="@{[ escapeHTML($W->{"args"}{"location"}||"") ]}" />
+               </td></tr>
+               <tr><td>
+                       Device casing type and available ports:
+HERE
+
+for (
+       { "case"=>"1U","internal"=>1 },
+       { "case"=>"4U","internal"=>1 },
+       { "case"=>"4U","internal"=>2 },
+       { "case"=>"4U","internal"=>3 },
+       { "case"=>"4U","internal"=>4 },
+       ) {
+       print <<"HERE";
+       <br />
+       <input type="radio" name="type" value="@{[ $_->{"case"} ]}-1+@{[ $_->{"internal"} ]}"
+                       @{[ ($W->{"args"}{"type"}||"") ne $_->{"case"} ? '' : 'checked="checked"' ]}
+                       />
+                       Rack mountable @{[ $_->{"case"} ]}; ethernet ports: 1 external + @{[ $_->{"internal"} ]} internal
+HERE
+       }
+
+print <<"HERE";
+               </td></tr>
+               <tr><td>
+                       Required internal network port(s).<br />
+                       Please specify any WiFi 802.11b or 802.11g access points to bundle with.
+                       <br />
+                       <textarea rows="4" cols="@{[ $COLS ]}" name="downlink">@{[ escapeHTML($W->{"args"}{"downlink"}||"") ]}</textarea>
+               </td></tr>
+               <tr><td>
+                       Available type of the uplink (public Internet) connection:
+                       <br />
+                       <textarea rows="2" cols="@{[ $COLS ]}" name="uplink">@{[ escapeHTML($W->{"args"}{"uplink"}||"") ]}</textarea>
+               </td></tr>
+               <tr><td>
+                       Additional notes:
+                       <br />
+                       <textarea rows="8" cols="@{[ $COLS ]}" name="comment">@{[ escapeHTML($W->{"args"}{"comment"}||"") ]}</textarea>
+               </td></tr>
+               <tr><td align="center"><input type="submit" value="Send Order" /></td></tr>
+       </table>
+</form>
+HERE
+
+
+exit;
+}
+1;