You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ig...@apache.org on 2010/11/03 18:27:05 UTC

svn commit: r1030552 - in /trafficserver/site/branches/ats-cms: ./ content/docs/admin/files.mdtext lib/ lib/path.pm lib/view.pm

Author: igalic
Date: Wed Nov  3 17:27:04 2010
New Revision: 1030552

URL: http://svn.apache.org/viewvc?rev=1030552&view=rev
Log:
Talked to joes, re-adding this as local, so we can edit lib/view.pm and create stuff like language links.

Added:
    trafficserver/site/branches/ats-cms/lib/
    trafficserver/site/branches/ats-cms/lib/path.pm
    trafficserver/site/branches/ats-cms/lib/view.pm
Modified:
    trafficserver/site/branches/ats-cms/   (props changed)
    trafficserver/site/branches/ats-cms/content/docs/admin/files.mdtext

Propchange: trafficserver/site/branches/ats-cms/
            ('svn:externals' removed)

Modified: trafficserver/site/branches/ats-cms/content/docs/admin/files.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/admin/files.mdtext?rev=1030552&r1=1030551&r2=1030552&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/admin/files.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/admin/files.mdtext Wed Nov  3 17:27:04 2010
@@ -1250,11 +1250,27 @@ The following list describes the configu
 the `records.config` file.
 
 
-**System Variables**
+### System Variables ### {#records.config-system-variables}
+
+*`proxy.config.product_company`*
+:  `STRING`
+:  `Apache Software Foundation`
+:  The name of the organization developing Traffic Server.
+
+*`proxy.config.product_vendor`*
+:  `STRING`
+:  `Apache`
+:  The name of the vendor providing Traffic Server.
+
+*`proxy.config.product_name`*
+:  `STRING`
+:  `Traffic Server`
+:  The name of the product.
 
 *`proxy.config.proxy_name`*
-: `STRING`
-: The name of the Traffic Server node.
+:  `STRING`
+:  `<proxy_name>`
+:  The name of the Traffic Server node.
 
 *`proxy.config.bin_path`*
 :  `STRING`
@@ -3387,13 +3403,14 @@ The following example is for the Solaris
     /devices/sbus@1f,0/SUNW,fas@e,880000/sd@2,0:a,raw
     /devices/sbus@1f,0/SUNW,fas@e,880000/sd@2,0:b,raw
 
-**Note:** Size is not required because the partitions are raw.
+**Note:** Size is optional. If not specified, the entire
+partition is used.
 
 #### Linux Example
 
-The following example is for the Linux operating system:
+The following example will use an entire raw disk in the Linux operating system:
 
-    /dev/raw_sdb 9105018880
+    /dev/sdb
 
 
 

Added: trafficserver/site/branches/ats-cms/lib/path.pm
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/lib/path.pm?rev=1030552&view=auto
==============================================================================
--- trafficserver/site/branches/ats-cms/lib/path.pm (added)
+++ trafficserver/site/branches/ats-cms/lib/path.pm Wed Nov  3 17:27:04 2010
@@ -0,0 +1,64 @@
+package path;
+use ASF::Value;
+
+# taken from django's url.py
+
+our @patterns = (
+
+    [qr!^/index\.html$!, news_page =>
+      {
+        svn      => ASF::Value::SVN->new(limit => 5),
+        jira     => ASF::Value::Jira->new(limit => 5,
+                                          url => "http://s.apache.org/q4"),
+        announce => ASF::Value::Mail->new(list => 'announce@apache.org',
+                                          limit => 5),
+        planet   => ASF::Value::Blogs->new(blog => "planet", limit=> 5),
+        blog     => ASF::Value::Blogs->new(blog => "foundation", limit=> 5),
+        twitter  => ASF::Value::Twitter->new(name => 'TheASF', limit => 5),
+      },
+    ],
+
+    [qr!^/dev/index\.html$!, news_page =>
+      {
+        svn      => ASF::Value::SVN->new(limit => 5),
+        twitter  => ASF::Value::Twitter->new(name=>"infrabot", limit => 5),
+        blog     => ASF::Value::Blogs->new(blog => "infra", limit=> 5),
+        jira     => ASF::Value::Jira->new(limit => 5,
+                                          url => "http://s.apache.org/lg"),
+      },
+    ],
+
+    [qr!^/dev/sitemap\.html$!, sitemap => { headers => { title => "Developer Sitemap" }} ],
+
+    [qr!^/licenses/exports/index\.html$!, exports => {} ],
+
+    [qr!\.mdtext$!, single_narrative => { template => "single_narrative.html" }],
+);
+
+
+# for specifying interdependencies between files
+
+our %dependencies = (
+    "/dev/sitemap.html" => [ grep s!^content!!, glob "content/dev/*.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.

Added: trafficserver/site/branches/ats-cms/lib/view.pm
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/lib/view.pm?rev=1030552&view=auto
==============================================================================
--- trafficserver/site/branches/ats-cms/lib/view.pm (added)
+++ trafficserver/site/branches/ats-cms/lib/view.pm Wed Nov  3 17:27:04 2010
@@ -0,0 +1,195 @@
+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.
+
+# foo.en.mdtext and foo.ch.mdtext -> foo.html.en, 
+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;
+
+    # pre process $args{content} to include language links.
+
+    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};
+        }
+    }
+
+    return Dotiac::DTL::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 Dotiac::DTL::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 Dotiac::DTL::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 Dotiac::DTL::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 "&nbsp;&raquo&nbsp;", @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.