On 01/07/2013 05:07 PM, Dave Fisher wrote:

On Jan 7, 2013, at 12:39 PM, Rob Weir wrote:

On Fri, Jan 4, 2013 at 1:12 PM, Kay Schenk <kay.sch...@gmail.com> wrote:
On Thu, Jan 3, 2013 at 4:09 PM, Rob Weir <robw...@apache.org> wrote:


<snip>

Since this is the visitors first impression of the project, I wonder
if it is worth exploring further to see if there is a way to address
these issues?   As I mentioned before, the ASF home page has a "latest
activity" panel that avoids both of these problems:

http://www.apache.org/

Can we copy what they do?


Yes. See below where I show where to find the rest of the code that Rob has 
tracked down.

We can handle it like a feed with ASF::Value type patterns in path.pm

Or we can use xslt and parse a file file in view.pm

Or a combination.



ummm...not sure about this. We would need to do more thorough investigation
here. Right now, I can not easily determine how this column is generated --
manually vs something else.


I did a little research on how the ASF home page works.

You cans see the source here:
http://svn.apache.org/repos/asf/infrastructure/site/trunk/

index.html is here:
http://svn.apache.org/repos/asf/infrastructure/site/trunk/content/index.html

and Latest Activity looks like this:

<h3>Latest Activity</h3>
      <div class="section-content">
        <p><em>This is an overview of activity going on with our
projects. SVN commits, bug reports, tweets, you name it</em>.</p>
      </div>

                         {% for e in twitter.list %}
                         <div class="section-content">
                         <a href="{{ e.url }}">@</a>{{ e.title|safe }}
                         </div>
                         {% endfor %}

                        {% for e in svn.list %}
                        <div class="section-content">
                        <a class="svn"
href="http://svn.apache.org/viewvc?revision={{ e.revision
}};view=revision">r{{ e.revision }}</a>
                          {{ e.message|safe|truncatewords_html:20 }} ({{
                          e.projects|safe }}) &mdash;
                          <a
href="http://people.apache.org/committer-index.html#{{ e.author }}">{{
e.author }}</a>
                        </div>
                        {% endfor %}

                         {% for e in jira.list %}
                         <div class="section-content">
                         <a class="bug" href="{{ e.url }}">{{
e.title|safe }}</a><br/>
                         {{ e.content|safe|truncatewords_html:20 }}
                         </div>
                         {% endfor %}

    </div>



So they are iterating over twitter.list, svn.list and jira.list.  But
it is not leaping out at me where that data comes from.  Presumably it
is RSS/Atom feeds, but I don't see the glue that connects this.

Take a look at www.apache.org's trunk/lib/path.pm:

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 => 'annou...@apache.org',
                                           limit => 3),
         planet   => ASF::Value::Blogs->new(blog => "planet", limit=> 3),
         blog     => ASF::Value::Blogs->new(blog => "foundation", limit=> 3),
         twitter  => ASF::Value::Twitter->new(name => 'TheASF', limit => 3),
       },
     ],

     [qr!^/dev/index\.html$!, news_page =>
       {
         svn      => ASF::Value::SVN->new(limit => 5),
         twitter  => ASF::Value::Twitter->new(name=>"infrabot", limit => 3),
         blog     => ASF::Value::Blogs->new(blog => "infra", limit=> 3),
         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" 
}],
);

And also view.pm, doap2perl.xsl and list2urls.xsl

sub news_page {
     my %args = @_;
     my $count=0;
     for (fetch_doap_url_list()) {
         my $result = parse_doap($_);
         next unless defined $result;
         push @{$args{projects}}, $result;
         last if ++$count == 3;
     }

     return ASF::View::news_page(%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 undef if $result->{pmc} =~ m!^http://attic\.apache\.org!;
     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;
}




But in any case, if this is doable within the CMS -- as it appears to
be -- then one option would be for us to format our news stories as
Atom or RSS feeds.  Then those can be sucked into a panel on the
homepage.  But the nice thing then is the same logic could be used to
put in a list of new bug reports, or forum posts, or check-ins, or
conference paper submissions, or whatever other useful info we can
find a feed for.   We set up a generic capability that could find
other users.

The CMS has perl libraries here:

URL: https://svn.apache.org/repos/infra/websites/cms/build/lib/ASF

./SVNUtil.pm
./Util.pm
./Value/Blogs.pm
./Value/Jira.pm
./Value/Mail.pm
./Value/SVN.pm
./Value/Twitter.pm
./Value.pm
./View.pm

Best Regards,
Dave

OK, this is interesting, and thanks for all the useful information. I'm going to take a wild guess here without looking at the modules yet and say the "limit" variable is used to limit each of these feeds to 5 instances of whatever the feed contains.

At any rate, we could do something like this but it still would not solve a LONG column without scrolling capabilities problem.

But, we should investigate/test/try this I think.




-Rob


In any case, removing the scrolling styling from the current ssi would
certainly do away with the bars. If we wanted to keep all the news items in
one file but only bring in like the last 10 or something, there MAY be a
way to do that. You could certainly do it either with server side JS or a
cgi.

Anyway, I will hold up on this change for now I guess.

I agree that the scroll "bars" don't look very professional. I may find
some nicer looking scrolling mechanism...



-Rob

Thereafter all "news" items will not be added to the home page directly
or
to /news/index.html, but to /news/newslist.ssi (this is a text file, not
html), LIFO order, maintaining the styling you see for other items there.

--
------------------------------------------------------------------------
MzK

"No act of kindness, no matter how small, is ever wasted."
                                 -- Aesop




--
----------------------------------------------------------------------------------------
MzK

"No act of kindness, no matter how small, is ever wasted."
                                                                         --
Aesop


--
------------------------------------------------------------------------
MzK

"No act of kindness, no matter how small, is ever wasted."
                                 -- Aesop

Reply via email to