Implement reverse file list (explained in the next commit).
[openssl-web.git] / openssl.wml
1 ##
2 ##  openssl.wml -- WML Template for the www.openssl.org website
3 ##  Written by Ralf S. Engelschall <rse@engelschall.com>
4 ##
5 ##  Usage: #use wml::openssl area=<area_name> [page=<page_name>]
6 ##
7
8 #use wml::std::tags
9 #use wml::std::info
10 #use wml::des::navbar
11 #use wml::des::space
12
13 ##
14 ##  The Global Page Layout
15 ##
16
17 #   start of page header
18 [PAGE_HEAD:\
19 <html>
20 <head>
21
22 #   insert information about the webpage
23 <info style=comment domainname="openssl.org"
24       copyright="1998-2000 The OpenSSL Project, http://www.openssl.org/">
25 <info style=meta domainname="openssl.org"
26       copyright="1998-2000 The OpenSSL Project, http://www.openssl.org/">
27
28 #   insert overideable title container
29 <title*>OpenSSL: <<PAGE_TITLE>></title*>
30 #   predefine it to show errors
31 ..PAGE_TITLE!>>Error: Undefined Title !!<<..
32 #   define override tag
33 <define-container title>
34 ..PAGE_TITLE>>%body<<..
35 </define-container>
36
37 #   define a style-sheet for adjusting some HTML layouting things
38 #   to conform to some typographically stronger conventions.
39 <style type="text/css"><!--
40 BODY      { position: absolute; left: 0px; top: 0px; background: #666699; }
41 A:link    { color: #6666cc; }
42 A:active  { color: #6666cc; }
43 A:visited { color: #6666cc; }
44 \#red { color: #cc3333; }
45 \#sf  { font-family: arial,helvetica; font-variant: normal; font-style: normal; }
46 \#sfl { font-weight: bold; font-family: arial,helvetica; font-size: 16pt; \
47         line-height: 16pt; font-variant: normal; font-style: normal; }
48 H1    { font-weight: bold; font-size: 18pt; line-height: 18pt; \
49         font-family: arial,helvetica; font-variant: normal; font-style: normal; }
50 H2    { font-weight: bold; font-size: 14pt; line-height: 14pt; \
51         font-family: arial,helvetica; font-variant: normal; font-style: normal; }
52 H3    { font-weight: bold; font-size: 12pt; line-height: 12pt; \
53         font-family: arial,helvetica; font-variant: normal; font-style: normal; }
54 --></style>
55
56 #   end of header and start of physical body
57 #   (use additionally use colors here for older browsers)
58 </head>
59 <body link="#6666cc" alink="#6666cc" vlink="#6666cc" bgcolor="#666699" text="#000000">
60
61 #   now define the page layout by a nested table 
62 #   structure consisting of a 5x5 cell grid.
63 <table width=100% cellspacing=0 cellpadding=0 border=0>
64   #   visually: the top line of the page
65   <tr>\
66     <td align=left width=100 bgcolor="#666699"><img src="$(IMG)/page-head-tl.jpg" alt="OpenSSL"></td>\
67     <td align=left colspan=2 width=600 bgcolor="#666699"><img src="$(IMG)/page-head-tm.jpg" alt=""></td>\
68     <td align=right width=20 bgcolor="#666699">&nbsp;&nbsp;&nbsp;</td>\
69     <td align=right width=50 bgcolor="#666699">&nbsp;</td>\
70   </tr>
71   #   visually: the top of the white body with the subnavbar
72   <tr>\
73     <td align=left width=100><img src="$(IMG)/page-head-bl.jpg"></td>\
74     <td align=left width=20><img src="$(IMG)/page-head-bm.jpg"></td>\
75     <td align=left width=100% bgcolor="#ffffff">\
76         <<PAGE_SUBNAVBAR>>\
77     </td>\
78     <td align=right width=20><img src="$(IMG)/page-corner-tr.gif"></td>\
79     <td align=right width=50 bgcolor="#666699">&nbsp;</td>\
80   </tr>
81   #   visually: the left main navigation bar and the white body
82   <tr>\
83     <td align=left valign=top width=100 bgcolor="#666699"><<PAGE_NAVBAR>></td>\
84     <td align=left valign=top width=20  bgcolor="#ffffff">&nbsp;</td>\
85     <td align=left valign=top bgcolor="#ffffff">\
86         <br>
87         :PAGE_HEAD][PAGE_BODY:
88         <<PAGE_BODY>>
89         :PAGE_BODY][PAGE_FOOT:\
90     </td>\
91     <td align=right width=20 bgcolor="#ffffff">&nbsp;&nbsp;&nbsp;</td>\
92     <td align=right width=50 bgcolor="#666699">&nbsp;</td>\
93   </tr>
94   #   visually: the bottom of the white body
95   <tr>\
96     <td align=left valign=top width=100 bgcolor="#666699">&nbsp;</td>\
97     <td align=left width=20><img src="$(IMG)/page-corner-bl.gif"></td>\
98     <td align=left valign=top bgcolor="#ffffff">&nbsp;</td>\
99     <td align=right width=20><img src="$(IMG)/page-corner-br.gif"></td>\
100     <td align=right width=50 bgcolor="#666699">&nbsp;</td>\
101   </tr>
102   #   visually: the bottom of the page (only for esthetical
103   #   reasons, i.e. the page doesn't end with the white body)
104   <tr>\
105     <td colspan=5 bgcolor="#666699">&nbsp;</td>\
106   </tr>
107 </table>
108
109 #   the physical end of the body
110 </body>
111 </html>
112 :PAGE_FOOT]
113
114 ##
115 ##  The main Navigation Bar [left, vertically]
116 ##
117
118 #   define the navigation bar through a grammar
119 <navbar:define name=navbar imgstar="n:s:s"
120                imgbase="$(IMG)" urlbase="$(ROOT)">
121   #   bar header
122   <navbar:header>
123   </navbar:header>
124   #   button prolog
125   <navbar:prolog>
126     <tr><td>
127   </navbar:prolog>
128   #   the buttons itself
129   <navbar:button id=title    url=""       txt="Title"        img=page-navbar-ti-*.jpg>
130   <navbar:button id=FAQ      url=support/faq.html   txt="FAQ"          img=page-navbar-fq-*.jpg>
131   <navbar:button id=about    url=about/   txt="About"        img=page-navbar-ab-*.jpg>
132   <navbar:button id=news     url=news/    txt="News"         img=page-navbar-ne-*.jpg>
133   <navbar:button id=docs     url=docs/    txt="Documents"    img=page-navbar-do-*.jpg>
134   <navbar:button id=source   url=source/  txt="Source"       img=page-navbar-so-*.jpg>
135   <navbar:button id=contrib  url=contrib/ txt="Contribution" img=page-navbar-co-*.jpg>
136   <navbar:button id=support  url=support/ txt="Support"      img=page-navbar-su-*.jpg>
137   <navbar:button id=related  url=related/ txt="Related"      img=page-navbar-re-*.jpg>
138   #   button epilog
139   <navbar:epilog>
140     </td></tr>
141   </navbar:epilog>
142   #   bar footer
143   <navbar:footer>
144   </navbar:footer>
145 </navbar:define>
146
147 #   and then immediately render it into its layout location
148 #   (Hint: The top and buttom images have to be part of the table
149 #   structure because only this way we can put them 0pt to the
150 #   buttons without a gap)
151 ..PAGE_NAVBAR>>\
152   <table cellspacing=0 cellpadding=0 border=0>\
153     <tr><td><img src="$(IMG)/page-navbar-top.jpg"></td></tr>
154     #   render it!
155     <navbar:render name=navbar select=$(area) $(page:+subselected)>
156     <tr><td><img src="$(IMG)/page-navbar-bot.jpg"><br><p></td></tr>
157   </table>
158 <<..
159
160 ##
161 ##  The Sub Navigation Bar (SNB) [top, horizontally]
162 ##
163
164 #   define the <snb>...</snb> container tag
165 <define-container snb>
166   #   1. define the navigation bar through a grammar
167   <navbar:define name=snb urlbase="$(SNB_ROOT)" 
168                  txtcol_normal="#666666" txtcol_select="#000000">
169     #   bar header
170     <navbar:header>\
171       <table cellspacing=0 cellpadding=0 border=0>
172         <tr>
173     </navbar:header>
174     #   button prolog (normal)
175     <navbar:prolog>\
176           <td><font face="Arial,Helvetica">&nbsp;
177     </navbar:prolog>
178     #   button prolog (selected)
179     <navbar:prolog type=S>\
180           <td bgcolor="#f0f0f0">&nbsp;<font face="Arial,Helvetica"><b>
181     </navbar:prolog>
182     #   ...here the <snb_button> tags will occur...
183     %body
184     #   button epilog (normal)
185     <navbar:epilog>\
186           </font>&nbsp;</td><td>|</td>
187     </navbar:epilog>
188     #   button epilog (selected)
189     <navbar:epilog type=S>\
190           </b></font>&nbsp;</td><td>|</td>
191     </navbar:epilog>
192     #   last button epilog (normal)
193     <navbar:epilog pos=last>\
194           </font>&nbsp;</td><td></td>
195     </navbar:epilog>
196     #   last button epilog (selected)
197     <navbar:epilog type=S pos=last>\
198           </b></font>&nbsp;</td><td></td>
199     </navbar:epilog>
200     #   bar footer
201     <navbar:footer>\
202         </tr>
203       </table>
204     </navbar:footer>
205   </navbar:define>
206   #   2. render the navigation bar and divert
207   #      divert it into it's final location
208   ..PAGE_SUBNAVBAR>>\
209   <navbar:render name=snb select="$(page)">\
210   <<..
211 </define-container>
212
213 #   define the <snb_button> tag for the <snb> container
214 #   (this is for consistency with the tag names)
215 <define-tag snb_button>
216   <navbar:button %attributes>
217 </define-tag>
218
219 #   predefine the contents of the SNB location
220 #   by diverting a whitespace character to it.
221 #   This prevents the table to be folded.
222 ..PAGE_SUBNAVBAR!>>
223 &nbsp;
224 <<..
225
226 #   and now the final WML trick: When the page=<page_name>
227 #   attribute is specified for this template, we read in the SNB
228 #   spec-file which now can use the <snb>..</snb> and
229 #   <snb_button> tags to actually define and render a SNB. This
230 #   is accomplished by doing some sort of a conditional #include. ;-)
231 $(page:*# )$(page:+#include ")$(SNB_RC:-.wmlsnb)$(page:+")
232
233 ##
234 ##  Useful tags (for convenience purposes only)
235 ##
236
237 #   define a <item> tag for <ul>/<ol> item similar to <li> but
238 #   which is nice for URL lists like the Related area where
239 #   we want a special layout.
240 <define-tag item>
241 <preserve name>
242 <preserve url>
243 <preserve aio>
244 <preserve info>
245 <set-var aio=*>
246 <set-var %attributes>
247 <li><imgdot width=1 height=18>\
248     <a href="<get-var url>"><font size=+1 face="Arial,Helvetica"><b><get-var name></b></font></a>
249     <ifeq "<get-var aio>" "" <img src="aio.gif" alt="[all-in-one]" align=absmiddle>>
250     <br>
251     <a href="<get-var url>"><font size=-1><get-var url></font></a><br>
252     <ifeq "<get-var info>" "" "" "<get-var info>">
253 <restore info>
254 <restore aio>
255 <restore url>
256 <restore name>
257 </define-tag>
258
259 #   define a <filelist> tag which can be used to create a file listing which
260 #   is optically more compact than the stuff Apache's mod_autoindex creates.
261 #   Especially the current version is marked red, too.
262 <define-tag filelist>
263 <pre>
264 <b>   Bytes      Timestamp       Filename</b>
265 <b>________ ____________________ ____________________________</b>
266 <:
267 @HI = ();
268 open(FP, "<index.current");
269 while (<FP>) {
270    s|\s*\n$||;
271    push(@HI, $_);
272 }
273 close(FP);
274 sub ls {
275     my ($pat) = @_;
276     my (@F, @R, $f, @S, @T);
277     @F = sort { (stat($a))[9] <=> (stat($b))[9]; } (glob($pat));
278     @R = ();
279     foreach $f (@F) {
280         next if ($f =~ m|^index.*|);
281         if ('%1' ne '') {
282             if (! %1 $f) {
283                 next;
284             }
285         }
286         @S = stat($f);
287         $f = "$f/" if (-d $f);
288         @T = localtime($S[9]);
289         my @moy = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
290                    'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
291         push(@R, sprintf("%"."8d %"."s %"."2d %"."02d:%"."02d:%"."02d %"."d %"."s\n", 
292              $S[7], $moy[$T[4]], $T[3], $T[2], $T[1], $T[0], 1900+$T[5], $f));
293     }
294     return @R;
295 }
296 @L = &ls("%0");
297 foreach $l (@L) {
298     next if ($l =~ m|^\s*$|);
299     $l =~ s|(\s+)(\S+[^/])(\s*\n)$|$1."<a href=\"$2\">$2</a>".$3|e;
300     $l =~ s|(\s+)(\S+/)(\s*\n)$|$1."<a href=\"$2\"><b>$2</b></a>".$3|e;
301     foreach $hi (@HI) {
302         $l =~ s|^(.*$hi.*)$|<font color="#cc3333">$1&nbsp;&nbsp;<b>[LATEST]</b></font>|;
303         $l =~ s|>($hi)<|><font color="#cc3333">$1</font><|;
304     }
305     print $l;
306 }
307 :>
308 </pre>
309 </define-tag>
310
311 <define-tag rfilelist>
312 <pre>
313 <b>   Bytes      Timestamp       Filename</b>
314 <b>________ ____________________ ____________________________</b>
315 <:
316 @HI = ();
317 open(FP, "<index.current");
318 while (<FP>) {
319    s|\s*\n$||;
320    push(@HI, $_);
321 }
322 close(FP);
323 sub ls {
324     my ($pat) = @_;
325     my (@F, @R, $f, @S, @T);
326     @F = sort { (stat($b))[9] <=> (stat($a))[9]; } (glob($pat));
327     @R = ();
328     foreach $f (@F) {
329         next if ($f =~ m|^index.*|);
330         if ('%1' ne '') {
331             if (! %1 $f) {
332                 next;
333             }
334         }
335         @S = stat($f);
336         $f = "$f/" if (-d $f);
337         @T = localtime($S[9]);
338         my @moy = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
339                    'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
340         push(@R, sprintf("%"."8d %"."s %"."2d %"."02d:%"."02d:%"."02d %"."d %"."s\n", 
341              $S[7], $moy[$T[4]], $T[3], $T[2], $T[1], $T[0], 1900+$T[5], $f));
342     }
343     return @R;
344 }
345 @L = &ls("%0");
346 foreach $l (@L) {
347     next if ($l =~ m|^\s*$|);
348     $l =~ s|(\s+)(\S+[^/])(\s*\n)$|$1."<a href=\"$2\">$2</a>".$3|e;
349     $l =~ s|(\s+)(\S+/)(\s*\n)$|$1."<a href=\"$2\"><b>$2</b></a>".$3|e;
350     foreach $hi (@HI) {
351         $l =~ s|^(.*$hi.*)$|<font color="#cc3333">$1&nbsp;&nbsp;<b>[LATEST]</b></font>|;
352         $l =~ s|>($hi)<|><font color="#cc3333">$1</font><|;
353     }
354     print $l;
355 }
356 :>
357 </pre>
358 </define-tag>
359
360 #   define a <cvs> container which can be used to reference 
361 #   files within the CVS repository similar to <a>.
362 <define-container cvs>
363 <preserve href>\
364 <set-var %attributes>\
365   <a href="$(ROOT)/source/exp/<get-var href>"><get-var href></a>\
366 <restore href>\
367 </define-container>
368
369 #
370 <define-tag newsflash>
371 <preserve from>
372 <preserve max>
373 <preserve more>
374 <set-var %attributes>
375 <table width=500 cellspacing=0 cellpadding=1 border=0>
376 <tr><td><font face="Arial,Helvetica"><b>Date</b></font></td> <td>&nbsp;&nbsp;&nbsp;<font face="Arial,Helvetica"><b>Newsflash</b></font></td></tr>
377 <tr><td><hr noshade size=1></td> <td><hr noshade size=1></td></tr>
378 <:
379     open(FP, "< <get-var from>") || die;
380     my $max = ("<get-var max>" eq '' ? 9999 : "<get-var max>");
381     @COL = (
382         '#ffffff',
383         '#f0f0f0',
384     );
385     $ncol = 1;
386     $n = 0;
387     while (<FP>) {
388         $ncol = ($ncol + 1) % 2;
389         $col  = $COL[$ncol];
390         s|="ROOT|="$(ROOT)|g;
391         s|="CVS|="$(ROOT)/source/exp/|g;
392         if (m|^(.+?):(.+)|) {
393             print "<tr bgcolor=\"$col\">\n";
394             print "  <td align=right><font face=\"Arial,Helvetica\"><b>$1:</b></font></td> <td>&nbsp;&nbsp;$2</td>\n";
395             print "</tr>\n";
396         }
397         $n++;
398         last if ($n >= $max);
399     }
400     close(FP);
401 :>
402 <ifeq "<get-var more>" "" "" <prog
403 <tr>
404   <td>&nbsp;</td> <td align=right><a href="<get-var more>">more...</a></td>
405 </tr>
406 >>
407 </table>
408 <restore more>
409 <restore max>
410 <restore from>
411 </define-tag>
412
413 #   define a <disclaimer> tag which displays the usual disclaimer stuff
414 <define-tag disclaimer>
415 <font face="Arial,Helvetica" size=-1>
416 This software package uses strong cryptography, so even if it is created,
417 maintained and distributed from liberal countries in Europe (where it is legal
418 to do this), it falls under certain export/import and/or use restrictions in
419 some other parts of the world.
420 <p>
421 PLEASE REMEMBER THAT EXPORT/IMPORT AND/OR USE OF STRONG CRYPTOGRAPHY
422 SOFTWARE, PROVIDING CRYPTOGRAPHY HOOKS OR EVEN JUST COMMUNICATING TECHNICAL
423 DETAILS ABOUT CRYPTOGRAPHY SOFTWARE IS ILLEGAL IN SOME PARTS OF THE WORLD.
424 SO, WHEN YOU IMPORT THIS PACKAGE TO YOUR COUNTRY, RE-DISTRIBUTE IT FROM
425 THERE OR EVEN JUST EMAIL TECHNICAL SUGGESTIONS OR EVEN SOURCE PATCHES TO THE
426 AUTHOR OR OTHER PEOPLE YOU ARE STRONGLY ADVISED TO PAY CLOSE ATTENTION TO
427 ANY EXPORT/IMPORT AND/OR USE LAWS WHICH APPLY TO YOU. THE AUTHORS OF OPENSSL
428 ARE NOT LIABLE FOR ANY VIOLATIONS YOU MAKE HERE. SO BE CAREFUL, IT
429 IS YOUR RESPONSIBILITY.
430 </font>
431 <p>
432 <font face="Arial,Helvetica" size=-1>
433 CREDIT INFORMATION:
434 This product includes cryptographic software written by Eric A. Young
435 (eay@cryptsoft.com).  This product includes software written by Tim J.  Hudson
436 (tjh@cryptsoft.com).
437 </font>
438 </define-tag>
439
440 #  a tag displaying the used tools   
441 <define-tag website-tools>
442 <font face="Arial,Helvetica" size=-1> 
443 Website designed by
444 <a href="http://www.engelschall.com/">Ralf S. Engelschall</a>
445 and generated with
446 <a href="http://www.engelschall.com/sw/wml/"><font color="#000000">
447 Website META Language</font></a> (WML).<br>
448 All markup code and graphics on this website
449 are Copyright &copy; 1999 <a href="http://www.openssl.org/">The OpenSSL Project</a>, 
450 All rights reserved.<br>
451 This website is served by an 
452 <a href="http://www.apache.org/"><font color="#000000">Apache</font></a>
453 webserver environment.<br>
454 Hardware and bandwidth provided by 
455 <a href="http://opensource.ee.ethz.ch/"><font color="#000000">
456 Department of Electrical Engineering</font></a>
457 of Swiss Federal Institute of Technology, Zurich.
458 </font>
459 </define-tag>
460
461 #  construct an absolute URL out of a relative URL
462 #  (essential for the mirroring of the website!)
463 <define-tag absolute>
464 <:{
465     my ($cwd, $baseurl, $basedir, $subdir, $page, $url);
466
467     #   determine current working directory
468     $cwd = '<get-var WML_SRC_DIRNAME>';
469
470     #   determine base URL
471     $baseurl = '<get-var BASE_URL>' || 'file://';
472
473     #   determine base directory
474     $basedir = '<get-var BASE_DIR>' || '<get-var WML_SRC_DIRNAME>';
475     $basedir = &canonpath("$cwd/$basedir") if ($basedir !~ m|^/|);
476
477     #   determine subdir from base dir to current working dir
478     $subdir = &relpath($basedir, $cwd);
479
480     #   determine document
481     $page = '%0';
482
483     #   construct final URL
484     $url = "$baseurl/$subdir/$page";
485     $url = &canonurl($url);
486
487     #   replace this tag with the constructed URL
488     print $url;
489 }:>
490 </define-tag>
491
492 ##
493 ##  Finally, the layout is now rendered, so divert all
494 ##  following stuff (the code in the local file after the #use 
495 ##  for this template!) into the white body area.
496 ##
497
498 ..PAGE_BODY>>
499