Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3661290A3 for ; Mon, 23 Apr 2012 13:25:31 +0000 (UTC) Received: (qmail 99342 invoked by uid 500); 23 Apr 2012 13:25:31 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 99181 invoked by uid 500); 23 Apr 2012 13:25:26 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 99133 invoked by uid 99); 23 Apr 2012 13:25:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Apr 2012 13:25:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Apr 2012 13:25:23 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0793B238897A for ; Mon, 23 Apr 2012 13:25:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1329228 - in /directory/sandbox/pamarcelot/trunks/directory-website: content/images/ lib/ templates/ Date: Mon, 23 Apr 2012 13:25:02 -0000 To: commits@directory.apache.org From: pamarcelot@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120423132503.0793B238897A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: pamarcelot Date: Mon Apr 23 13:25:01 2012 New Revision: 1329228 URL: http://svn.apache.org/viewvc?rev=1329228&view=rev Log: Added rules to serve different templates depending on the path (global/api/apacheds/studio sub-sites). Added: directory/sandbox/pamarcelot/trunks/directory-website/content/images/new_badge.gif (with props) directory/sandbox/pamarcelot/trunks/directory-website/templates/footer.html directory/sandbox/pamarcelot/trunks/directory-website/templates/header.html directory/sandbox/pamarcelot/trunks/directory-website/templates/navigation.html directory/sandbox/pamarcelot/trunks/directory-website/templates/page-apacheds.html directory/sandbox/pamarcelot/trunks/directory-website/templates/page-api.html directory/sandbox/pamarcelot/trunks/directory-website/templates/page-studio.html Modified: directory/sandbox/pamarcelot/trunks/directory-website/lib/path.pm directory/sandbox/pamarcelot/trunks/directory-website/lib/view.pm directory/sandbox/pamarcelot/trunks/directory-website/templates/page.html Added: directory/sandbox/pamarcelot/trunks/directory-website/content/images/new_badge.gif URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/directory-website/content/images/new_badge.gif?rev=1329228&view=auto ============================================================================== Binary file - no diff available. Propchange: directory/sandbox/pamarcelot/trunks/directory-website/content/images/new_badge.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Modified: directory/sandbox/pamarcelot/trunks/directory-website/lib/path.pm URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/directory-website/lib/path.pm?rev=1329228&r1=1329227&r2=1329228&view=diff ============================================================================== --- directory/sandbox/pamarcelot/trunks/directory-website/lib/path.pm (original) +++ directory/sandbox/pamarcelot/trunks/directory-website/lib/path.pm Mon Apr 23 13:25:01 2012 @@ -2,8 +2,26 @@ package path; # All our pages use the same view function our @patterns = ( - [qr!^/.*\.html$!, normal_page => {} ], - [qr!^/.*\.mdtext$!, normal_page => { template=>"page.html" } ], + # Basic HTML content + [qr!^/.*\.html$!, template_page => {} ], + + # Apache DS sub-project pages + [qr!apacheds\/.*?\.mdtext$!, template_page => { + template => "page-apacheds.html", + isDirApacheDS => true } ], + + # LDAP API sub-project pages + [qr!api\/.*?\.mdtext$!, template_page => { + template => "page-api.html", + isDirAPI => true } ], + # Apache Directory Studio sub-project pages + [qr!studio\/.*?\.mdtext$!, template_page => { + template => "page-studio.html", + isDirStudio => true } ], + # Directory project global pages + [qr!^/.*\.mdtext$!, template_page => { + template => "page.html", + isDirSite => true } ] ); # for specifying interdependencies between files Modified: directory/sandbox/pamarcelot/trunks/directory-website/lib/view.pm URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/directory-website/lib/view.pm?rev=1329228&r1=1329227&r2=1329228&view=diff ============================================================================== --- directory/sandbox/pamarcelot/trunks/directory-website/lib/view.pm (original) +++ directory/sandbox/pamarcelot/trunks/directory-website/lib/view.pm Mon Apr 23 13:25:01 2012 @@ -21,13 +21,16 @@ push @Dotiac::DTL::TEMPLATE_DIRS, "templ # like foo.page/bar.mdtext will be parsed and # passed to the template in the "bar" (hash) # variable. -sub normal_page { +sub template_page +{ my %args = @_; my $file = "content$args{path}"; $args{path} =~ s/\.mdtext$/\.html/; + $args{base} = _base($args{path}); my $template = $file; - if($args{template}) { + if( $args{template} ) + { $template = $args{template}; } @@ -36,8 +39,10 @@ sub normal_page { my $page_path = $file; $page_path =~ s/\.[^.]+$/.page/; - if (-d $page_path) { - for my $f (grep -f, glob "$page_path/*.mdtext") { + 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}; @@ -47,6 +52,25 @@ sub normal_page { return Dotiac::DTL::Template($template)->render(\%args), html => \%args; } +# Gets the base of the path +sub _base +{ + my $path = shift; + + my @path_components = split( m!/!, $path ); + pop @path_components; + pop @path_components; + + my $rel = "./"; + + for (@path_components) + { + $rel .= "../"; + } + + return $rel; +} + # Generates cwiki-style breadcrumbs sub breadcrumbs { my ($fullpath, $headerref) = @_; Added: directory/sandbox/pamarcelot/trunks/directory-website/templates/footer.html URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/directory-website/templates/footer.html?rev=1329228&view=auto ============================================================================== --- directory/sandbox/pamarcelot/trunks/directory-website/templates/footer.html (added) +++ directory/sandbox/pamarcelot/trunks/directory-website/templates/footer.html Mon Apr 23 13:25:01 2012 @@ -0,0 +1,9 @@ + +
+ + + + + \ No newline at end of file Added: directory/sandbox/pamarcelot/trunks/directory-website/templates/header.html URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/directory-website/templates/header.html?rev=1329228&view=auto ============================================================================== --- directory/sandbox/pamarcelot/trunks/directory-website/templates/header.html (added) +++ directory/sandbox/pamarcelot/trunks/directory-website/templates/header.html Mon Apr 23 13:25:01 2012 @@ -0,0 +1,67 @@ + + + + + {% block title %}{{ headers.title }}{% endblock %} — Apache Directory + {% block css %} + + + {% endblock %} + + +
+ +
+
+ {% include "navigation.html" %} +
+
\ No newline at end of file Added: directory/sandbox/pamarcelot/trunks/directory-website/templates/navigation.html URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/directory-website/templates/navigation.html?rev=1329228&view=auto ============================================================================== --- directory/sandbox/pamarcelot/trunks/directory-website/templates/navigation.html (added) +++ directory/sandbox/pamarcelot/trunks/directory-website/templates/navigation.html Mon Apr 23 13:25:01 2012 @@ -0,0 +1,28 @@ +{% block navigation %} + +{% endblock %} \ No newline at end of file Added: directory/sandbox/pamarcelot/trunks/directory-website/templates/page-apacheds.html URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/directory-website/templates/page-apacheds.html?rev=1329228&view=auto ============================================================================== --- directory/sandbox/pamarcelot/trunks/directory-website/templates/page-apacheds.html (added) +++ directory/sandbox/pamarcelot/trunks/directory-website/templates/page-apacheds.html Mon Apr 23 13:25:01 2012 @@ -0,0 +1,10 @@ +{% extends "header.html" %} + {% block css %} + + + {% endblock %} +{% endextends %} + +{% block content %}{{ content|markdown }}{% endblock %} + +{% include "footer.html" %} \ No newline at end of file Added: directory/sandbox/pamarcelot/trunks/directory-website/templates/page-api.html URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/directory-website/templates/page-api.html?rev=1329228&view=auto ============================================================================== --- directory/sandbox/pamarcelot/trunks/directory-website/templates/page-api.html (added) +++ directory/sandbox/pamarcelot/trunks/directory-website/templates/page-api.html Mon Apr 23 13:25:01 2012 @@ -0,0 +1,10 @@ +{% extends "header.html" %} +{% block css %} + + +{% endblock %} +{% endextends %} + +{% block content %}{{ content|markdown }}{% endblock %} + +{% include "footer.html" %} \ No newline at end of file Added: directory/sandbox/pamarcelot/trunks/directory-website/templates/page-studio.html URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/directory-website/templates/page-studio.html?rev=1329228&view=auto ============================================================================== --- directory/sandbox/pamarcelot/trunks/directory-website/templates/page-studio.html (added) +++ directory/sandbox/pamarcelot/trunks/directory-website/templates/page-studio.html Mon Apr 23 13:25:01 2012 @@ -0,0 +1,40 @@ +{% extends "header.html" %} + {% block css %} + + + {% endblock %} + + {% block project-navigation %} +
Apache Directory Studio
+ +
Downloads
+ +
Documentation
+ +
Ressources
+ + {% endblock %} +{% endextends %} + +{% block content %}{{ content|markdown }}{% endblock %} + +{% include "footer.html" %} \ No newline at end of file Modified: directory/sandbox/pamarcelot/trunks/directory-website/templates/page.html URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/trunks/directory-website/templates/page.html?rev=1329228&r1=1329227&r2=1329228&view=diff ============================================================================== --- directory/sandbox/pamarcelot/trunks/directory-website/templates/page.html (original) +++ directory/sandbox/pamarcelot/trunks/directory-website/templates/page.html Mon Apr 23 13:25:01 2012 @@ -1,25 +1,10 @@ - - - - - {% block title %}{{ headers.title }}{% endblock %} — Apache Directory - - - {% block content %}{{ content|markdown }}{% endblock %} - - +{% include "footer.html" %} \ No newline at end of file