]> jspc29.x-matter.uni-frankfurt.de Git - trb3web.git/commitdiff
set-up finished
authorJan Michel <jmichel@jspc29.x-matter.uni-frankfurt.de>
Fri, 10 May 2013 17:05:13 +0000 (19:05 +0200)
committerJan Michel <jmichel@jspc29.x-matter.uni-frankfurt.de>
Fri, 10 May 2013 17:05:13 +0000 (19:05 +0200)
WebConfig.pm [new file with mode: 0644]
contact.htm [new file with mode: 0644]
frame.pm
help.htm [new file with mode: 0644]
index.pl
main.htm [new file with mode: 0644]
styleold.css

diff --git a/WebConfig.pm b/WebConfig.pm
new file mode 100644 (file)
index 0000000..060214e
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/perl
+
+
+
+###################################
+##Content Menu Setup
+###################################
+
+#Entries for top menu
+our @toplink = (["main","Main"],
+                ["contact","Contact"]
+               );
+
+               
+               
+               
+#Entries for sidebar menu
+our $menues = {
+
+    withhelp => [["main","Main"],
+                 ["contact", "Contact"],
+                 ["help", "Help"]             
+                ],
+                 
+    withouthelp  => [["main","Main"],
+                     ["contact", "Contact"],
+                    ],
+};
+
+
+#Assign a menu to each file that shall not show the main menu
+#file name => menue name
+our $menuselect = {
+  "default" => "withouthelp",
+  "contact" => "withhelp",                  #just to demonstrate it
+  };
+           
+           
+1;
\ No newline at end of file
diff --git a/contact.htm b/contact.htm
new file mode 100644 (file)
index 0000000..f1ca756
--- /dev/null
@@ -0,0 +1,2 @@
+<h3>Contact</h3>
+This guys, that guy, and ... this guy as well.
index cd0dbdf1776cfc3e492408989f85a9a61b26c92e..6888e703231cc9de7f7106abb862a69e3861dea8 100755 (executable)
--- a/frame.pm
+++ b/frame.pm
@@ -1,24 +1,23 @@
 #!/usr/bin/perl -w\r
-use Data::Dumper;\r
 \r
-#Entries for top menu\r
-my $toplink = {"index.pl" => "Main",\r
-               "contact.pl" => "Contact"\r
-               };\r
 \r
-#Entries for sidebar menu\r
-my $menues = {\r
-    toplevel => {"index.pl" => "Main",\r
-                 "contact.pl" => "Contact"\r
-                 },\r
-    contact  => {"index.pl" => "Main",\r
-                 }\r
-           };\r
+use WebConfig;\r
 \r
+           \r
+           \r
+           \r
+           \r
+           \r
+###################################\r
+##Functions\r
+###################################\r
 \r
 \r
 sub makeframe {\r
-my ($menu) = @_;\r
+my ($select) = @_;\r
+my $menu = $menuselect->{"default"};\r
+$menu = $menuselect->{$select} if exists $menuselect->{$select};\r
+\r
 \r
 print <<HDOC;\r
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\r
@@ -39,8 +38,8 @@ print <<HDOC;
 <ul id="menu">\r
 HDOC\r
 \r
-foreach my $k (keys %$toplink) {\r
-  print "<li><a href=\"$k\">$toplink->{$k}</a>\n";\r
+while (my ($k) = each @toplink) {\r
+  print "<li><a href=\"index.pl?$toplink[$k]->[0]\">$toplink[$k]->[1]</a>\n";\r
   }\r
 \r
 \r
@@ -56,8 +55,8 @@ HDOC
 \r
 print "<dl id=\"navigation\"><dt>\n";\r
 print "\n<dd><ul>\n";\r
-foreach my $k (keys $menues->{$menu}) {\r
-  print "<li><a href=\"$k\">$menues->{$menu}->{$k}</a>\n";\r
+while (my ($k) = each $menues->{$menu})  {\r
+  print "<li><a href=\"index.pl?$menues->{$menu}->[$k]->[0]\">$menues->{$menu}->[$k]->[1]</a>\n";\r
   }\r
 print "</ul></dl>\r\n";\r
 }\r
diff --git a/help.htm b/help.htm
new file mode 100644 (file)
index 0000000..94d7786
--- /dev/null
+++ b/help.htm
@@ -0,0 +1,44 @@
+<h3>Help for changing content</h3>
+<ul>
+  <li>A content file is contains plain HTML code, headings start with &lt;h3&gt;.
+  <li>Links to other files are given as "?filename". Note the question mark and the missing .htm.
+  <li>If a file should show up in the menues, edit WebConfig.pm:
+    <ul>
+      <li><tt>@toplink</tt> contains entries to menue at the top-right. Each entry consists of filename and link name to be shown in the menue.
+      <li><tt>$menues</tt> contains the menues. Each menue is an array of filename => link name pairs.
+      <li><tt>$menuselect</tt> decides which menue is shown for which page. Insert a pair of filename and menue name.
+    </ul>
+</ul>
+
+
+
+<pre>
+#Entries for top menu
+our @toplink = (["main","Main"],
+                ["contact","Contact"]
+               );
+
+               
+               
+               
+#Entries for sidebar menu
+our $menues = {
+
+    withhelp => [["main","Main"],
+                 ["contact", "Contact"],
+                 ["help", "Help"]             
+                ],
+                 
+    withouthelp  => [["main","Main"],
+                     ["contact", "Contact"],
+                    ],
+};
+
+
+#Assign a menu to each file that shall not show the main menu
+#file name => menue name
+our $menuselect = {
+  "default" => "withouthelp",
+  "contact" => "withhelp",                  #just to demonstrate it
+  };
+</pre>
\ No newline at end of file
index bf690be8f5bce6d82f96b425ca3a2c30fe85a4b0..c5b1adc27b57ad40855a912f20f34f9c340f2cf8 100755 (executable)
--- a/index.pl
+++ b/index.pl
@@ -1,16 +1,25 @@
 #!/usr/bin/perl -w
+use strict;
+use warnings;
+use CGI::Carp qw(fatalsToBrowser);
+use frame;
 print "Content-type: text/html\n\n";
 
-use frame;
+my $file = $ENV{'QUERY_STRING'};
+$file = "main" unless (defined $file && $file =~ /\w/ && -e "$file.htm");
+
+
+
+makeframe($file);
+print "<div id=\"content\">\n\n";
 
-makeframe("toplevel");
+my $MYF;
+open ($MYF, "<$file.htm") or return "";
+while (<$MYF>){
+  print $_;
+  }
 
-print <<HDOC;
-<div id="content">
-<h3>Basic Stuff</h3>
-Very good thing, indeed.
-</div>
-HDOC
+print "\n\n</div>";
 
 
 makefoot();
\ No newline at end of file
diff --git a/main.htm b/main.htm
new file mode 100644 (file)
index 0000000..df46773
--- /dev/null
+++ b/main.htm
@@ -0,0 +1,2 @@
+<h3>Basic Stuff</h3>
+Very good thing, indeed.
\ No newline at end of file
index 423da57326e4fa1ce322487e37e7f5a28310365b..625aa93df771685530405f278ae6816c16244cab 100644 (file)
@@ -22,6 +22,7 @@ body {
   background-color: #ffe; /*#dddde1;#e5ebdf*/
   font-size: .9em;
   width:100%;
+  height:100%;
   font-family: Lucida Sans, Verdana, Arial, Helvetica, SunSans-Regular, Sans-Serif;
   color:#474756;  
   /*margin: 100px 140px  5px 190px;*/
@@ -229,4 +230,13 @@ h3, h4 {
 
 dt {
    font-weight:bold;
+   }
+   
+   
+pre {
+   background:#eee;
+   width:90%;
+   overflow:auto;
+   border:1px solid #aaa;
+   line-height:110%;
    }
\ No newline at end of file