Commits

Anonymous committed 8a6ca37

Started the conversion to Latemp.

  • Participants
  • Parent commits d5d1bac

Comments (0)

Files changed (5)

 
 SUBDIRS_DEST = $(addprefix $(TARGET)/,$(SUBDIRS))
 
-WML_FLAGS += --passoption=2,-X --passoption=3,-I../lib/ --passoption=7,"-S imgsize" -DROOT~.
+LATEMP_WML_INCLUDE_PATH =$(shell latemp-config --wml-include-path)
+
+WML_FLAGS += --passoption=2,-X3074 --passoption=3,-I../lib/ --passoption=7,"-S imgsize" -DROOT~.
+
+WML_FLAGS += -DLATEMP_THEME=sinorca-2.0
+
+WML_FLAGS += -I$(LATEMP_WML_INCLUDE_PATH) -I../lib/
 
 RSYNC = rsync --progress --verbose --rsh=ssh 
 

File lib/MyNavData.pm

 my $tree_contents =
 {
     'host' => "hackers",
-    'value' => "The Hackers-IL Homepage",
+    'text' => "The Hackers-IL Homepage",
     'title' => "Hackers-IL: Israeli Software Enthusiasts",
     'expand_re' => "",
     'subs' =>
     [
         {
-            'value' => "Home",
+            'text' => "Home",
             'url' => "",
         },
         {
-            'value' => "Wiki",
+            'text' => "Wiki",
             'url' => "wiki/",
         },
         {
-            'value' => "Mailing Lists",
+            'text' => "Mailing Lists",
             'url' => "mailing-lists/",
         },
     ],

File lib/MyNavLinks.pm

+package MyNavLinks;
+
+use strict;
+use warnings;
+
+use vars qw($nav_buttons_html);
+
+use base 'Class::Accessor';
+
+__PACKAGE__->mk_accessors(qw(root nav_links));
+
+use Template;
+
+# load Template::Stash to make method tables visible
+use Template::Stash;
+
+# Define a method to return a substring.
+$Template::Stash::SCALAR_OPS->{ 'substr' } = sub {
+    return substr($_[0], $_[1], $_[2]);
+};
+
+
+sub new
+{
+    my $class = shift;
+    my $self = {};
+    bless $self, $class;
+    $self->initialize(@_);
+    return $self;
+}
+
+sub initialize
+{
+    my $self = shift;
+    my %args = (@_);
+    %{$self} = %args;
+}
+
+sub get_nav_buttons_html
+{
+    my $self = shift;
+
+    my (%args) = (@_);
+    
+    my $with_accesskey = $args{'with_accesskey'};
+
+    my $nav_links = $self->nav_links();
+    my $root = $self->root();    
+
+    my $template = 
+        Template->new(
+        {
+            'POST_CHOMP' => 1,
+        }
+        );
+
+    my @buttons =
+    (
+        { 
+            'dir' => "prev", 
+            'button' => "left", 
+            'title' => "Previous Page",
+        },
+        { 
+            'dir' => "up", 
+            'button' => "up", 
+            'title' => "Up in the Site",
+        },
+        {
+            'dir' => "next", 
+            'button' => "right", 
+            'title' => "Next Page",
+        },
+    );
+
+    foreach my $button (@buttons)
+    {
+        my $dir = $button->{'dir'};
+        if ($button->{'exists'} = exists($nav_links->{$dir}))
+        {
+            $button->{'link'} = $nav_links->{$dir};
+        }
+    }
+    
+    my $vars = 
+    {
+        'buttons' => \@buttons,
+        'root' => $root,
+        'with_accesskey' => $with_accesskey,
+    };
+    
+    my $nav_links_template = <<'EOF';
+[% USE HTML %]
+[% FOREACH b = buttons %]
+[% SET key = b.dir.substr(0, 1) %]
+<li>
+[% IF b.exists %]
+<a href="[% HTML.escape(b.link) %]" title="[% b.title %] (Alt+[% key FILTER upper %])"
+[% IF with_accesskey %]
+accesskey="[% key %]"
+[% END %]
+>[% END %]<img src="[% root %]/images/arrow-[% b.button %][% UNLESS b.exists %]-disabled[% END %].png"
+alt="[% b.title %]" class="bless" />[% IF b.exists %]</a>
+[% END %]
+</li>
+[% END %]
+EOF
+    
+    my $nav_buttons_html = "";
+    
+    $template->process(\$nav_links_template, $vars, \$nav_buttons_html);
+    return $nav_buttons_html;
+}
+
+sub get_total_html
+{
+    my $self = shift;
+
+    return "<ul class=\"nav_links\">\n" .
+        $self->get_nav_buttons_html(@_) .
+        "\n</ul>";
+}
+
+1;
+

File lib/latemp/themes/sinorca-2.0/template.wml

+<latemp_init_h_w_navmenu />
+
+<latemp_html_header standard="xhtml1.0-strict" />
+<head>
+<title>{#SUBJECT_LOC#}</title>
+<link rel="stylesheet" type="text/css" href="$(ROOT)/sinorca-screen.css" media="screen" title="Sinorca (screen)" />
+<link rel="stylesheet" type="text/css" href="$(ROOT)/sinorca-print.css" media="print" />
+
+<:{
+use CGI qw();
+
+while (my ($key, $url) = each(%$nav_links))
+{
+    print "<link rel=\"$key\" href=\"" . CGI::escapeHTML($url) . "\" />\n"
+}
+}:>
+</head>
+<body>
+
+
+<define-tag rellink whitespace="delete">
+<preserve url />
+<set-var %attributes />
+$(ROOT)/<get-var url />
+<restore url />
+</define-tag>
+
+<define-tag site:link whitespace="delete">
+<preserve url />
+<set-var %attributes />
+http://perl-begin.berlios.de/<get-var url />
+<restore url />
+</define-tag>
+
+<define-tag wiki:link whitespace="delete">
+<preserve url />
+<set-var %attributes />
+<ifeq "<get-var url />" "" 
+    "<set-var url="/Main/HomePage" />" 
+    "<set-var url="/<get-var url />" />" 
+    />
+<site:link url="Wiki/pmwiki/pmwiki.php" /><get-var url />
+<restore url />
+</define-tag>
+
+<define-tag mailing:list:link whitespace="delete">
+https://lists.berlios.de/mailman/listinfo/perl-begin-help
+</define-tag>
+
+<define-tag web:forum:link whitespace="delete">
+http://developer.berlios.de/forum/forum.php?forum_id=2341
+</define-tag>
+
+<define-tag nothing></define-tag>
+
+    <!-- For non-visual user agents: -->
+      <div id="top"><a href="#main-copy" class="doNotDisplay doNotPrint">Skip to main content.</a></div>
+
+    <!-- ##### Header ##### -->
+
+    <div id="header">
+      <div class="midHeader">
+        <h1 class="headerTitle">{#SUBJECT_LOC#}</h1>
+      </div>
+    </div>
+
+    <!-- ##### Side Bar ##### -->
+
+    <div id="side-bar">
+      <div>
+<a href="$(ROOT)" class="nobg" title="Hackers-IL Logo"><img 
+   src="$(ROOT)/images/glider-israel.png" style="border:0;padding-right:0.5em;"
+   alt="The Hackers-IL Emblem" 
+   /></a>
+      </div>
+
+      <div>
+<:{ print join("\n", @$nav_html); }:>        
+      </div>
+
+      <div>
+<define-tag validhtml>
+<p>
+<a href="http://www.spreadfirefox.com/?q=affiliates&amp;id=0&amp;t=70"><img 
+   style="margin-top:1em; border:0;" alt="Get Firefox!" 
+   title="Get Firefox! A safer, faster, better web-browser." 
+   src="$(ROOT)/images/get-firefox.gif" /></a>
+</p>
+<p>
+<a href="http://validator.w3.org/check/referer"><img 
+    style="border:0" src="http://www.w3.org/Icons/valid-xhtml10" 
+         alt="Valid XHTML 1.0!"
+         /></a>
+</p>
+<p>
+ <a href="http://jigsaw.w3.org/css-validator/validator?uri=http%%3A//perl-begin.berlios.de/$(FILENAME)"><img style="border:0"
+       src="http://jigsaw.w3.org/css-validator/images/vcss" 
+       alt="Valid CSS!" /></a>
+</p>
+<p>
+</p>
+</define-tag>
+
+# <ifeq "$(FILENAME)" "index.html" "<validhtml />" "" />
+
+<validhtml />
+      
+      </div>
+    </div>
+
+    <!-- ##### Main Copy ##### -->
+
+    <div id="main-copy">
+
+
+{#BODY#}
+
+</div>
+    <!-- ##### Footer ##### -->
+
+    <div id="footer">
+      <div class="left">
+        <b>Webmaster:</b> <a href="mailto:shlomif@iglu.org.il">Shlomi Fish - shlomif@iglu.org.il</a>
+      </div>
+
+      <br class="doNotDisplay doNotPrint" />
+
+      <div class="right">
+        This design is (almost) public domain.<br />
+        Based on <a href="http://www.oswd.org/viewdesign.phtml?id=1165&referer=%2Fsearch.php%3Fsearchstring%3Dsinorca%26tab%3Ddescription">the Sinorca Design</a><br />
+        <a href="./index.html" class="doNotPrint">This is a footer link</a>
+      </div>
+    </div>
+
+</body>
+</html>
+
+<define-tag subject>
+{#SUBJECT_LOC#:%0:##}
+</define-tag>
+
+
+#   per default we are in body
+{#BODY#:
+

File template.wml

-# #use wml::des::navbar
-
-<:{
-use MyNavData;
-use Shlomif::NavMenu;
-
-my $filename = "$(FILENAME)";
-$filename =~ s!index\.html$!!;
-$filename = "/$filename";
-
-my $nav_bar = Shlomif::NavMenu->new(
-    'path_info' => $filename,
-    'current_host' => "hackers",
-    MyNavData::get_params(),
-    );
-
-my $rendered_results = 
-        $nav_bar->render(
-            no_ie => 'true',
-            (0 ? (styles =>
-            {
-                'bar' => 'nav',
-                'level0' => 'navbarmain',
-                'level1' => 'navbarnested',
-                'level2' => "navbarnested",
-                'level3' => "navbarnested",
-                'level4' => "navbarnested",
-                'list' => "navbarmain",
-            }): ()),
-            );
-
-use vars qw($nav_links);
-
-$nav_links = $rendered_results->{nav_links};
-
-use vars qw($nav_html);
-
-$nav_html = $rendered_results->{html};
-
-}:>
-
-<define-tag email:link>
-<a href="mailto:%0">%0</a>
-</define-tag>
-
-# The Definition of the page itself
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html 
-     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
-<head>
-<title>{#SUBJECT_LOC#}</title>
-<link rel="stylesheet" type="text/css" href="$(ROOT)/sinorca-screen.css" media="screen" title="Sinorca (screen)" />
-<link rel="stylesheet" type="text/css" href="$(ROOT)/sinorca-print.css" media="print" />
-
-<:{
-use CGI qw();
-
-while (my ($key, $url) = each(%$nav_links))
-{
-    print "<link rel=\"$key\" href=\"" . CGI::escapeHTML($url) . "\" />\n"
-}
-}:>
-</head>
-<body>
-
-
-<define-tag rellink whitespace="delete">
-<preserve url />
-<set-var %attributes />
-$(ROOT)/<get-var url />
-<restore url />
-</define-tag>
-
-<define-tag site:link whitespace="delete">
-<preserve url />
-<set-var %attributes />
-http://perl-begin.berlios.de/<get-var url />
-<restore url />
-</define-tag>
-
-<define-tag wiki:link whitespace="delete">
-<preserve url />
-<set-var %attributes />
-<ifeq "<get-var url />" "" 
-    "<set-var url="/Main/HomePage" />" 
-    "<set-var url="/<get-var url />" />" 
-    />
-<site:link url="Wiki/pmwiki/pmwiki.php" /><get-var url />
-<restore url />
-</define-tag>
-
-<define-tag mailing:list:link whitespace="delete">
-https://lists.berlios.de/mailman/listinfo/perl-begin-help
-</define-tag>
-
-<define-tag web:forum:link whitespace="delete">
-http://developer.berlios.de/forum/forum.php?forum_id=2341
-</define-tag>
-
-<define-tag nothing></define-tag>
-
-    <!-- For non-visual user agents: -->
-      <div id="top"><a href="#main-copy" class="doNotDisplay doNotPrint">Skip to main content.</a></div>
-
-    <!-- ##### Header ##### -->
-
-    <div id="header">
-      <div class="midHeader">
-        <h1 class="headerTitle">{#SUBJECT_LOC#}</h1>
-      </div>
-    </div>
-
-    <!-- ##### Side Bar ##### -->
-
-    <div id="side-bar">
-      <div>
-<a href="$(ROOT)" class="nobg" title="Hackers-IL Logo"><img 
-   src="$(ROOT)/images/glider-israel.png" style="border:0;padding-right:0.5em;"
-   alt="The Hackers-IL Emblem" 
-   /></a>
-      </div>
-
-      <div>
-<:{ print join("\n", @$nav_html); }:>        
-      </div>
-
-      <div>
-<define-tag validhtml>
-<p>
-<a href="http://www.spreadfirefox.com/?q=affiliates&amp;id=0&amp;t=70"><img 
-   style="margin-top:1em; border:0;" alt="Get Firefox!" 
-   title="Get Firefox! A safer, faster, better web-browser." 
-   src="$(ROOT)/images/get-firefox.gif" /></a>
-</p>
-<p>
-<a href="http://validator.w3.org/check/referer"><img 
-    style="border:0" src="http://www.w3.org/Icons/valid-xhtml10" 
-         alt="Valid XHTML 1.0!"
-         /></a>
-</p>
-<p>
- <a href="http://jigsaw.w3.org/css-validator/validator?uri=http%%3A//perl-begin.berlios.de/$(FILENAME)"><img style="border:0"
-       src="http://jigsaw.w3.org/css-validator/images/vcss" 
-       alt="Valid CSS!" /></a>
-</p>
-<p>
-</p>
-</define-tag>
-
-# <ifeq "$(FILENAME)" "index.html" "<validhtml />" "" />
-
-<validhtml />
-      
-      </div>
-    </div>
-
-    <!-- ##### Main Copy ##### -->
-
-    <div id="main-copy">
-
-
-{#BODY#}
-
-</div>
-    <!-- ##### Footer ##### -->
-
-    <div id="footer">
-      <div class="left">
-        <b>Webmaster:</b> <a href="mailto:shlomif@iglu.org.il">Shlomi Fish - shlomif@iglu.org.il</a>
-      </div>
-
-      <br class="doNotDisplay doNotPrint" />
-
-      <div class="right">
-        This design is (almost) public domain.<br />
-        Based on <a href="http://www.oswd.org/viewdesign.phtml?id=1165&referer=%2Fsearch.php%3Fsearchstring%3Dsinorca%26tab%3Ddescription">the Sinorca Design</a><br />
-        <a href="./index.html" class="doNotPrint">This is a footer link</a>
-      </div>
-    </div>
-
-</body>
-</html>
-
-<define-tag subject>
-{#SUBJECT_LOC#:%0:##}
-</define-tag>
-
-
-#   per default we are in body
-{#BODY#:
-