Apparently no longer looking for `agents'.
[www.jankratochvil.net.git] / product / hotelgate / Order.pm
1 # $Id$
2 # Ordering form of 'My::Project::hotelgate'
3 # Copyright (C) 2005 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
4
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; exactly version 2 of June 1991 is required
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
18
19 package product::hotelgate::Order;
20 require 5.6.0;  # at least 'use warnings;' but we need some 5.6.0+ modules anyway
21 our $VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
22 our $CVS_ID=q$Id$;
23 use strict;
24 use warnings;
25
26 use My::Web;
27 use Hash::Util qw(lock_hash);
28
29
30 my %error=(
31         "email_missing"=>"Your e-mail address is required, please fill it in.",
32         "type_missing"=>"Please fill in the {Device casing type} field.",
33         "ok"=>"Order has been accepted. Please wait to be contacted.",
34         );
35 lock_hash(%error);
36 sub error($$)
37 {
38 my($self,$keyword)=@_;
39
40         my $trash=$error{$keyword};     # existence check;
41         return $keyword;
42 }
43
44 sub handler
45 {
46 Wrequire 'product::hotelgate::Lib';
47 my $W=product::hotelgate::Lib->init(
48                 "title"=>"HotelGate: Order Form",
49                 "css_push"=>"./Order.css",
50                 "js_push"=>"./Order.js",
51                 );
52
53
54 my $COLS=50;
55
56 print <<"HERE";
57 <h1>HotelGate Order</h1>
58
59 <p>Price offer will be provided according to your order specification.
60 You may also contact us directly at the e-mail address:
61 @{[ a_href 'mailto:hotelgate@jankratochvil.net' ]}</p>
62 HERE
63
64 if (my $error=$W->{"args"}{"error"}) {
65         print <<"HERE";
66 <p align="center" class="error" id="error">@{[ $error{$error} ]}</p>
67 HERE
68         }
69
70 print <<"HERE";
71 <form action="OrderSubmit.pm" @{[ form_method "post" ]} onsubmit="return Order_validate(this);">
72         <table border="1" class="order">
73                 <tr><td>
74                         Your e-mail contact address (required).
75                         <br />
76                         <input type="text" size="@{[ $COLS ]}" name="email" value="@{[ escapeHTML($W->{"args"}{"email"}||"") ]}" />
77                 </td></tr>
78                 <tr><td>
79                         Contact person, shipping address.
80                         <br />
81                         <input type="text" size="@{[ $COLS ]}" name="address" value="@{[ escapeHTML($W->{"args"}{"address"}||"") ]}" />
82                 </td></tr>
83                 <tr><td>
84                         Installation location - leave empty if you install the device on your own.<br />
85                         European facility installations provided by @{[ a_href 'http://www.jklabs.cz/','JK&nbsp;Labs' ]}.
86                         <br />
87                         <input type="text" size="@{[ $COLS ]}" name="location" value="@{[ escapeHTML($W->{"args"}{"location"}||"") ]}" />
88                 </td></tr>
89                 <tr><td>
90                         Device casing type and available ports:
91 HERE
92
93 for (
94         { "case"=>"1U","internal"=>1 },
95         { "case"=>"4U","internal"=>1 },
96         { "case"=>"4U","internal"=>2 },
97         { "case"=>"4U","internal"=>3 },
98         { "case"=>"4U","internal"=>4 },
99         ) {
100         print <<"HERE";
101         <br />
102         <input type="radio" name="type" value="@{[ $_->{"case"} ]}-1+@{[ $_->{"internal"} ]}"
103                         @{[ ($W->{"args"}{"type"}||"") ne $_->{"case"} ? '' : 'checked="checked"' ]}
104                         />
105                         Rack mountable @{[ $_->{"case"} ]}; ethernet ports: 1 external + @{[ $_->{"internal"} ]} internal
106 HERE
107         }
108
109 print <<"HERE";
110                 </td></tr>
111                 <tr><td>
112                         Required internal network port(s).<br />
113                         Please specify any WiFi 802.11b or 802.11g access points to bundle with.
114                         <br />
115                         <textarea rows="4" cols="@{[ $COLS ]}" name="downlink">@{[ escapeHTML($W->{"args"}{"downlink"}||"") ]}</textarea>
116                 </td></tr>
117                 <tr><td>
118                         Available type of the uplink (public Internet) connection:
119                         <br />
120                         <textarea rows="2" cols="@{[ $COLS ]}" name="uplink">@{[ escapeHTML($W->{"args"}{"uplink"}||"") ]}</textarea>
121                 </td></tr>
122                 <tr><td>
123                         Additional notes:
124                         <br />
125                         <textarea rows="8" cols="@{[ $COLS ]}" name="comment">@{[ escapeHTML($W->{"args"}{"comment"}||"") ]}</textarea>
126                 </td></tr>
127                 <tr><td align="center"><input type="submit" value="Send Order" /></td></tr>
128         </table>
129 </form>
130 HERE
131
132
133 exit;
134 }
135 1;