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