You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2012/04/23 15:25:02 UTC

svn commit: r1329228 - in /directory/sandbox/pamarcelot/trunks/directory-website: content/images/ lib/ templates/

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 @@
+                </div><!-- rightColumn -->
+                <div id="endContent"></div>
+            </div><!-- content -->
+            <div id="footer">&copy; 2003-2012, <a href="http://www.apache.org">The Apache Software Foundation</a> - <a href="privacy-policy.html">Privacy Policy</a><br />
+                Apache Directory, ApacheDS, Apache Directory Server, Apache Directory Studio, Apache LDAP API, Apache Triplesec, Triplesec, Apache, the Apache feather logo, and the Apache Directory project logos are trademarks of The Apache Software Foundation.
+            </div>
+        </div><!-- container -->
+    </body>
+</html>
\ 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 @@
+<!DOCTYPE html>
+<!--
+    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.
+-->
+<html>
+	<head>
+		<title>{% block title %}{{ headers.title }}{% endblock %} &mdash; Apache Directory</title>
+		{% block css %}
+		<link href="{{base}}css/common.css" rel="stylesheet" type="text/css">
+		<link href="{{base}}css/green.css" rel="stylesheet" type="text/css">
+		{% endblock %}
+	</head>
+	<body>
+	    <div id="container">
+            <div id="header">
+                <div id="subProjectsNavBar">
+                    <a href="{{base}}">
+                        {% if isDirSite %}
+                        <STRONG>Apache Directory Project</STRONG>
+                        {% else %}
+                        Apache Directory Project
+                        {% endif %}
+                    </a>
+                    &nbsp;|&nbsp;
+                    <a href="{{base}}apacheds">
+                        {% if isDirApacheDS %}
+                        <STRONG>ApacheDS</STRONG>
+                        {% else %}
+                        ApacheDS
+                        {% endif %}
+                    </a>
+                    &nbsp;|&nbsp;
+                    <a href="{{base}}studio">
+                        {% if isDirStudio %}
+                        <STRONG>Apache Directory Studio</STRONG>
+                        {% else %}
+                        Apache Directory Studio
+                        {% endif %}
+                    </a>
+                    &nbsp;|&nbsp;
+                    <a href="{{base}}api">
+                        {% if isDirAPI %}
+                        <STRONG>Apache LDAP API</STRONG>
+                        {% else %}
+                        Apache LDAP API
+                        {% endif %}
+                    </a>
+                </div><!-- subProjectsNavBar -->
+            </div><!-- header -->
+            <div id="content">
+                <div id="leftColumn">
+                    {% include "navigation.html" %}
+                </div><!-- leftColumn -->
+                <div id="rightColumn">
\ 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 %}
+<div id="navigation">
+    {% block project-navigation %}
+    <h5>Latest Downloads</h5>
+    <ul>
+        <li><a href="{{base}}apacheds/downloads.html">ApacheDS {{version_apacheds}}</a></li>
+        <li><a href="{{base}}studio/download.html">Studio {{version_studio}}</a></li>
+        <li><a href="{{base}}api/downloads.html">LDAP API {{version_api}}</a></li>
+    </ul>
+    {% endblock %}
+    {% block common-navigation %}
+    <h5>Community</h5>
+    <ul>
+        <li><a href="{{base}}contribute.html">How to Contribute</a></li>
+        <li><a href="{{base}}team.html">Team</a></li>
+        <li><a href="{{base}}original-project-proposal.html">Original Project Proposal</a></li>
+    </ul>
+    <h5>About Apache</h5>
+    <ul>
+        <li><a href="http://www.apache.org/">Apache</a></li>
+        <li><a href="http://www.apache.org/licenses/">License</a></li>
+        <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+        <li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
+        <li><a href="http://www.apache.org/security/">Security</a></li>
+    </ul>
+    {% endblock %}
+</div><!-- 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 %}
+        <link href="{{base}}css/common.css" rel="stylesheet" type="text/css">
+    	<link href="{{base}}css/green.css" rel="stylesheet" type="text/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 %}
+	<link href="{{base}}css/common.css" rel="stylesheet" type="text/css">
+	<link href="{{base}}css/brown.css" rel="stylesheet" type="text/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 %}
+        <link href="{{base}}css/common.css" rel="stylesheet" type="text/css">
+        <link href="{{base}}css/blue.css" rel="stylesheet" type="text/css">
+    {% endblock %}
+
+    {% block project-navigation %}
+        <h5>Apache Directory Studio</h5>
+        <ul>
+            <li><a href="{{base}}studio/">Home</a></li>
+            <li><a href="{{base}}studio/features.html">Features</a></li>
+            <li><a href="{{base}}studio/screenshots.html">Screenshots</a></li>
+        </ul>
+        <h5>Downloads</h5>
+        <ul>
+            <li><a href="{{base}}studio/2.0/download/">Version 2.0 M3</a>&nbsp;&nbsp;<IMG src="{{base}}images/new_badge.gif" alt="" style="margin-bottom:-3px;" border="0"></li>
+            <li><a href="{{base}}studio/downloads.html">Version 1.5.3</a></li>
+            <li><a href="{{base}}studio/nightly-builds.html">Nightly Builds</a></li>
+            <li><a href="{{base}}studio/download-old-versions.html">Older Versions</a></li>
+        </ul>
+        <h5>Documentation</h5>
+        <ul>
+            <li><a href="{{base}}studio/users-guide.html">User's Guide</a></li>
+            <li><a href="{{base}}studio/developers-guide.html">Developer's Guide</a></li>
+            <li><a href="{{base}}studio/gen-docs/1.5.2.v20091211/index.html">Generated reports (e.g. JavaDocs)</a></li>
+            <li><a href="{{base}}studio/faqs.html">FAQs</a></li>
+        </ul>
+        <h5>Ressources</h5>
+        <ul>
+            <li><a href="{{base}}studio/issue-tracking.html">Issue Tracking</a></li>
+            <li><a href="{{base}}studio/changelog.html">ChangeLog</a></li>
+            <li><a href="{{base}}studio/mailing-lists.html" >Mailing Lists</a></li>
+            <li><a href="{{base}}studio/testimonials.html">Testimonials</a></li>
+        </ul>
+    {% 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 @@
-<!DOCTYPE html>
-<!--
-    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
+{% extends "header.html" %}
+	{% block css %}
+		<link href="{{base}}css/common.css" rel="stylesheet" type="text/css">
+		<link href="{{base}}css/green.css" rel="stylesheet" type="text/css">
+	{% endblock %}
+{% endextends %}
 
-       http://www.apache.org/licenses/LICENSE-2.0
+{% block content %}{{ content|markdown }}{% endblock %}
 
-    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.
--->
-<html>
-	<head>
-		<title>{% block title %}{{ headers.title }}{% endblock %} &mdash; Apache Directory</title>
-	</head>
-	<body>
-		{% block content %}{{ content|markdown }}{% endblock %}
-	</body>
-</html>
+{% include "footer.html" %}
\ No newline at end of file