Author: rgardler Date: Wed Dec 28 15:33:51 2011 New Revision: 1225209 URL: http://svn.apache.org/viewvc?rev=1225209&view=rev Log: initial site template
Added: incubator/callback/site/ incubator/callback/site/trunk/ incubator/callback/site/trunk/cgi-bin/ incubator/callback/site/trunk/content/ incubator/callback/site/trunk/content/rave/ incubator/callback/site/trunk/content/rave/css/ incubator/callback/site/trunk/content/rave/css/rave.css (with props) incubator/callback/site/trunk/content/rave/images/ incubator/callback/site/trunk/content/rave/images/apache-incubator-logo.png (with props) incubator/callback/site/trunk/content/rave/index.mdtext (with props) incubator/callback/site/trunk/lib/ incubator/callback/site/trunk/lib/path.pm (with props) incubator/callback/site/trunk/lib/view.pm (with props) incubator/callback/site/trunk/readme.txt incubator/callback/site/trunk/templates/ incubator/callback/site/trunk/templates/sidenav.mdtext (with props) incubator/callback/site/trunk/templates/single_narrative.html (with props) incubator/callback/site/trunk/templates/skeleton.html (with props) Added: incubator/callback/site/trunk/content/rave/css/rave.css URL: http://svn.apache.org/viewvc/incubator/callback/site/trunk/content/rave/css/rave.css?rev=1225209&view=auto ============================================================================== --- incubator/callback/site/trunk/content/rave/css/rave.css (added) +++ incubator/callback/site/trunk/content/rave/css/rave.css Wed Dec 28 15:33:51 2011 @@ -0,0 +1,157 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +body { + color: white; + font-family: Arial,Helvetica,sans-serif; + font-size: 11pt; + margin: 0; +} + +a { + color: #339; + text-decoration: none; +} + +a:visited { + color: #369; +} + +a:hover { + color: #ddf; + background-color: #6badff; +} + +.title { + float:right; +} + +h1,h2,h3,h4,h5,h6 { + color: #6f3f00; +} + +#content { + margin-top: 15px; + margin-left: 200px; + margin-right: 200px; + padding: 0 8px 40px; + color: black; + background: white; +} + +#content h1,h2,h3,h4,h5,h6 { + color: #955500; + border-bottom: 1px solid #ffdaae; + font-weight: normal; + margin: 10px 0 15px; + padding: 5px 0; +} + +#content h1 { + font-size: 18pt; + border: 1px solid #ffdaae; + -moz-border-radius: 10px; + border-radius: 10px; + padding: 15px; +} + +#content h2 { + font-size: 16pt; +} + +#content h3,h4,h5,h6 { + border-bottom: none; + color: #688a6f; + font-size: 14pt; + margin-bottom: 0; +} + +#navigation { + border: 1px solid #ffdaae; + -moz-border-radius: 10px; + border-radius: 10px; + font-size: 85%; + color: #003; + float: left; + padding: 8px; + width: 160px; + background: white; + margin-left: 10px; + margin-right: 10px; +} + +#navigation img { + padding-bottom: 15px; + margin-left: auto; + margin-right: auto; + display: block; +} + +#navigation h1 { + color: #000; + font-size: 1.1em; + padding: 0; + margin-top: 0.8em; + margin-bottom: 0.5em; + border-bottom: 1px dotted #3487ef; +} + +#navigation ul { + margin: 0 0; + padding: 0; + list-style: none; +} + +#navigation li { + margin: 0; + padding: 0; +} + +#navigation li a { + margin: 0; + color: #003; + text-decoration:none; +} + +#navigation li a:visited { + color: #226; +} + +#navigation li a:hover { + background-color: #6badff; + color: #000; +} + +#footer { + margin-top: 15px; + margin-left: 200px; + margin-right: 200px; + border: 1px solid #ffdaae; + -moz-border-radius: 10px; + border-radius: 10px; + background-color:#b0b0b0; + color:#336; + font-size: 80%; + padding: 0 8px; +} + +/* definition lists */ +dd {} +dl {} +dt { + display: inline; + float: left; +} \ No newline at end of file Propchange: incubator/callback/site/trunk/content/rave/css/rave.css ------------------------------------------------------------------------------ svn:executable = * Added: incubator/callback/site/trunk/content/rave/images/apache-incubator-logo.png URL: http://svn.apache.org/viewvc/incubator/callback/site/trunk/content/rave/images/apache-incubator-logo.png?rev=1225209&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/callback/site/trunk/content/rave/images/apache-incubator-logo.png ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/callback/site/trunk/content/rave/images/apache-incubator-logo.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/callback/site/trunk/content/rave/index.mdtext URL: http://svn.apache.org/viewvc/incubator/callback/site/trunk/content/rave/index.mdtext?rev=1225209&view=auto ============================================================================== --- incubator/callback/site/trunk/content/rave/index.mdtext (added) +++ incubator/callback/site/trunk/content/rave/index.mdtext Wed Dec 28 15:33:51 2011 @@ -0,0 +1,5 @@ +Title: Apache WookieRave (Incubating) + +Apache Rave is A new WEb And SOcial Mashup Engine. It will provide an out-of-the-box as well as an extendible lightweight Java platform to host, serve and aggregate (Open)Social Gadgets and services through a highly customizable and Web 2.0 friendly front-end. Rave is targeted as engine for internet and intranet portals and as building block to provide context-aware personalization and collaboration features for multi-site/multi-channel (mobile) oriented and content driven websites and (social) network oriented services and platforms. For the OpenSocial container and services the (Java) Apache Shindig will be integrated. At a later stage further generalization is envisioned to also transparently support W3C Widgets using Apache Wookie. + + Propchange: incubator/callback/site/trunk/content/rave/index.mdtext ------------------------------------------------------------------------------ svn:executable = * Added: incubator/callback/site/trunk/lib/path.pm URL: http://svn.apache.org/viewvc/incubator/callback/site/trunk/lib/path.pm?rev=1225209&view=auto ============================================================================== --- incubator/callback/site/trunk/lib/path.pm (added) +++ incubator/callback/site/trunk/lib/path.pm Wed Dec 28 15:33:51 2011 @@ -0,0 +1,40 @@ +package path; +use ASF::Value; + +# taken from django's url.py + +our @patterns = ( + [qr!\.mdtext$!, single_narrative => { template => "single_narrative.html" }], + +# [qr!^/stanbol/sitemap\.html$!, sitemap => { headers => { title => "Stanbol Sitemap" }} ], + +) ; + +# for specifying interdependencies between files + +#our %dependencies = ( +# "/stanbol/sitemap.html" => [ grep s!^content!!, glob "content/stanbol/*.mdtext" ], +#); + +1; + +=head1 LICENSE + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + + Propchange: incubator/callback/site/trunk/lib/path.pm ------------------------------------------------------------------------------ svn:executable = * Added: incubator/callback/site/trunk/lib/view.pm URL: http://svn.apache.org/viewvc/incubator/callback/site/trunk/lib/view.pm?rev=1225209&view=auto ============================================================================== --- incubator/callback/site/trunk/lib/view.pm (added) +++ incubator/callback/site/trunk/lib/view.pm Wed Dec 28 15:33:51 2011 @@ -0,0 +1,201 @@ +package view; + +# +# BUILD CONSTRAINT: all views must return $content, $extension. +# additional return values (as seen below) are optional. However, +# careful use of symlinks and dependency management in path.pm can +# resolve most issues with this constraint. +# + +use strict; +use warnings; +use Dotiac::DTL qw/Template/; +use Dotiac::DTL::Addon::markup; +use ASF::Util qw/read_text_file shuffle/; +use File::Temp qw/tempfile/; +use LWP::Simple; + +push @Dotiac::DTL::TEMPLATE_DIRS, "templates"; + +# This is most widely used view. It takes a +# 'template' argument and a 'path' argument. +# Assuming the path ends in foo.mdtext, any files +# like foo.page/bar.mdtext will be parsed and +# passed to the template in the "bar" (hash) +# variable. + +sub single_narrative { + my %args = @_; + my $file = "content$args{path}"; + my $template = $args{template}; + $args{path} =~ s/\.mdtext$/\.html/; + $args{breadcrumbs} = breadcrumbs($args{path}); + + read_text_file $file, \%args; + + my $page_path = $file; + $page_path =~ s/\.[^.]+$/.page/; + if (-d $page_path) { + for my $f (grep -f, glob "$page_path/*.mdtext") { + $f =~ m!/([^/]+)\.mdtext$! or die "Bad filename: $f\n"; + $args{$1} = {}; + read_text_file $f, $args{$1}; + } + } + +# $args{sidenav} = {}; +# read_text_file "templates/sidenav.mdtext", $args{sidenav} ; + +# select STDOUT ; +# $| = 1 ; +# for my $ke (keys %args) { +# print STDOUT "$ke \n"; +# } + + return Template($template)->render(\%args), html => \%args; +} + +# Has the same behavior as the above for foo.page/bar.txt +# files, parsing them into a bar variable for the template. +# Otherwise presumes the template is the path. + +sub news_page { + my %args = @_; + my $template = "content$args{path}"; + $args{breadcrumbs} = breadcrumbs($args{path}); + + my $page_path = $template; + $page_path =~ s/\.[^.]+$/.page/; + if (-d $page_path) { + for my $f (grep -f, glob "$page_path/*.mdtext") { + $f =~ m!/([^/]+)\.mdtext$! or die "Bad filename: $f\n"; + $args{$1} = {}; + read_text_file $f, $args{$1}; + } + } + + for ((fetch_doap_url_list())[0..2]) { + push @{$args{projects}}, parse_doap($_); + } + + return Template($template)->render(\%args), html => \%args; +} + +sub sitemap { + my %args = @_; + my $template = "content$args{path}"; + $args{breadcrumbs} .= breadcrumbs($args{path}); + my $dir = $template; + $dir =~ s!/[^/]+$!!; + opendir my $dh, $dir or die "Can't opendir $dir: $!\n"; + my %data; + for (map "$dir/$_", grep $_ ne "." && $_ ne ".." && $_ ne ".svn", readdir $dh) { + if (-f and /\.mdtext$/) { + my $file = $_; + $file =~ s/^content//; + no warnings 'once'; + for my $p (@path::patterns) { + my ($re, $method, $args) = @$p; + next unless $file =~ $re; + my $s = view->can($method) or die "Can't locate method: $method\n"; + my ($content, $ext, $vars) = $s->(path => $file, %$args); + $file =~ s/\.mdtext$/.$ext/; + $data{$file} = $vars; + last; + } + } + } + + my $content = ""; + + for (sort keys %data) { + $content .= "- [$data{$_}->{headers}->{title}]($_)\n"; + for my $hdr (grep /^#/, split "\n", $data{$_}->{content}) { + $hdr =~ /^(#+)\s+([^#]+)?\s+\1\s+\{#([^}]+)\}$/ or next; + my $level = length $1; + $level *= 4; + $content .= " " x $level; + $content .= "- [$2]($_#$3)\n"; + } + } + $args{content} = $content; + return Template($template)->render(\%args), html => \%args; +} + +sub exports { + my %args = @_; + my $template = "content$args{path}"; + $args{breadcrumbs} = breadcrumbs($args{path}); + + my $page_path = $template; + $page_path =~ s/\.[^.]+$/.page/; + if (-d $page_path) { + for my $f (grep -f, glob "$page_path/*.mdtext") { + $f =~ m!/([^/]+)\.mdtext$! or die "Bad filename: $f\n"; + $args{$1} = {}; + read_text_file $f, $args{$1}; + } + $args{table} = `xsltproc $page_path/eccnmatrix.xsl $page_path/eccnmatrix.xml`; + + } + + return Template($template)->render(\%args), html => \%args; +} + +sub parse_doap { + my $url = shift; + my $doap = get $url or die "Can't get $url: $!\n"; + my ($fh, $filename) = tempfile("XXXXXX"); + print $fh $doap; + close $fh; + my $result = eval `xsltproc lib/doap2perl.xsl $filename`; + unlink $filename; + return $result; +} + +sub fetch_doap_url_list { + my $xml = get "http://svn.apache.org/repos/asf/infrastructure/site-tools/trunk/projects/files.xml" + or die "Can't get doap file list: $!\n"; + my ($fh, $filename) = tempfile("XXXXXX"); + print $fh $xml; + close $fh; + chomp(my @urls = grep /^http/, `xsltproc lib/list2urls.xsl $filename`); + unlink $filename; + shuffle \@urls; + return @urls; +} + +1; + +sub breadcrumbs { + my @path = split m!/!, shift; + pop @path; + my @rv; + my $relpath = ""; + for (@path) { + $relpath .= "$_/"; + $_ ||= "Home"; + push @rv, qq(<a href="$relpath">\u$_</a>); + } + return join " » ", @rv; +} + + +=head1 LICENSE + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. Propchange: incubator/callback/site/trunk/lib/view.pm ------------------------------------------------------------------------------ svn:executable = * Added: incubator/callback/site/trunk/readme.txt URL: http://svn.apache.org/viewvc/incubator/callback/site/trunk/readme.txt?rev=1225209&view=auto ============================================================================== --- incubator/callback/site/trunk/readme.txt (added) +++ incubator/callback/site/trunk/readme.txt Wed Dec 28 15:33:51 2011 @@ -0,0 +1,7 @@ +References +=========== + +ASF CMS Intro: http://www.apache.org/dev/cms.html +CMS Reference: http://www.apache.org/dev/cmsref.html + + Added: incubator/callback/site/trunk/templates/sidenav.mdtext URL: http://svn.apache.org/viewvc/incubator/callback/site/trunk/templates/sidenav.mdtext?rev=1225209&view=auto ============================================================================== --- incubator/callback/site/trunk/templates/sidenav.mdtext (added) +++ incubator/callback/site/trunk/templates/sidenav.mdtext Wed Dec 28 15:33:51 2011 @@ -0,0 +1,29 @@ +# General + + - [Home](index.html) + - [About](about.html) + - [Incubator page](/projects/rave.html) + - [License](http://www.apache.org/licenses/LICENSE-2.0) + +# Documentation + + - FIXME + - FIXME + +# Community + + - [Get Involved](get-involved.html) + - [Mailing Lists](mailing-lists.html) + - [People](people.html) + +# Development + - [Source Code](source.html) + - [Issue Tracker](https://issues.apache.org/jira/browse/rave) + +# ASF + + - [Apache Software Foundation](http://www.apache.org) + - [Thanks](http://www.apache.org/foundation/thanks.html) + - [Become a Sponsor](http://www.apache.org/foundation/sponsorship.html) + - [Security](http://www.apache.org/security/) + Propchange: incubator/callback/site/trunk/templates/sidenav.mdtext ------------------------------------------------------------------------------ svn:executable = * Added: incubator/callback/site/trunk/templates/single_narrative.html URL: http://svn.apache.org/viewvc/incubator/callback/site/trunk/templates/single_narrative.html?rev=1225209&view=auto ============================================================================== --- incubator/callback/site/trunk/templates/single_narrative.html (added) +++ incubator/callback/site/trunk/templates/single_narrative.html Wed Dec 28 15:33:51 2011 @@ -0,0 +1 @@ +{% extends "skeleton.html" %} Propchange: incubator/callback/site/trunk/templates/single_narrative.html ------------------------------------------------------------------------------ svn:executable = * Added: incubator/callback/site/trunk/templates/skeleton.html URL: http://svn.apache.org/viewvc/incubator/callback/site/trunk/templates/skeleton.html?rev=1225209&view=auto ============================================================================== --- incubator/callback/site/trunk/templates/skeleton.html (added) +++ incubator/callback/site/trunk/templates/skeleton.html Wed Dec 28 15:33:51 2011 @@ -0,0 +1,53 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE- 2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + + <link href="/rave/css/rave.css" rel="stylesheet" type="text/css"> + <title>Apache Rave (Incubating) - {% block title %}{{ headers.title }}{% endblock %}</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +</head> + +<body> + <div id="banner"> + <img alt="Apache Rave (Incubating)" src="/rave/images/logo.png"/> + <h1 class="title">{% block title %}{{ headers.title }}{% endblock %}</h1> + </div> + + <div id="navigation"> + {% filter markdown %}{% include "sidenav.mdtext" %}{% endfilter %} + </div> + + <div id="content"> + {% block content %}{{ content|markdown }}{% endblock %} + </div> + + <div id="footer"> + <div class="copyright"> + <p> + Copyright © 2011 The Apache Software Foundation, Licensed under + the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>. + <br /> + Apache and the Apache feather logos are trademarks of The Apache Software Foundation. + </p> + </div> + </div> + +</body> +</html> Propchange: incubator/callback/site/trunk/templates/skeleton.html ------------------------------------------------------------------------------ svn:executable = *