summaryrefslogtreecommitdiffstats
path: root/index.cgi
blob: 2f122039e2600150fcd77cfeaa7daa8102d519ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/perl -wT

$request = 'main';
# breaks up a string according to a separator
if(defined($ENV{REQUEST_URI}))
{
  @uri = split('/', $ENV{REQUEST_URI});

  if( $#uri > -1 && -e "/openwcms/data/$uri[1].html" )
  {
    $request = "$uri[1]";
  }
}

require '/openwcms/add_items.pl';
# domain is always the first thing in the string, pick the first element
$domain = (split /\./, $head[0]{href})[0];

print "Content-type: text/html\n\n";
print <<eof;
<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta name="viewport" content="width=device-width" />
	<link href="favicon.ico" type="image/x-icon" rel="icon" />
	<title>$head[0]{title} - $domain</title>
	<meta name="description" content="$head[0]{anchor}" />
	<link rel="stylesheet" href="/style/openwcms.css" type="text/css" />
</head>
<body>
<div id="body-wrapper">

<div id="header">
  <div class="branding"></div>
  <ul>
eof
foreach my $i (0 .. $#header)
{
  print qq(\t<li><a href="$header[$i]{href}" title="$header[$i]{title}">$header[$i]{anchor}</a></li>\n)
}
print <<eof;
  </ul>
</div>

<div id="main">
eof
open (FH, "/openwcms/data/$request.html");
while ($line = <FH>)
{
  chomp $line; # to remove the last trailing newline
  print $line;
}
close (FH);

print <<eof;
</div>

<div id="sidebar">
  <h3><a href='/'>News</a></h3>
  <ul>
eof
foreach my $i (0 .. $#sidebar)
{
  print qq(\t<li><a href='$sidebar[$i]{href}' title='$sidebar[$i]{title}'>[ $sidebar[$i]{anchor} ]</a></li>\n)
}
print <<eof;
  </ul>
</div>

</div>

<div id="footer">
  <a href="$footer[0]{href}" title="$footer[0]{title}" target="_blank">$footer[0]{anchor}</a>
</div>

</body>
</html>
eof