[Jifty-commit] r2139 - in Sifty/trunk: . bin doc etc lib lib/Sifty
lib/Sifty/Action lib/Sifty/Model log share share/po share/web
share/web/static share/web/static/css t var var/mason
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Sun Nov 12 16:17:11 EST 2006
Author: kirsten
Date: Sun Nov 12 16:17:10 2006
New Revision: 2139
Added:
Sifty/trunk/
Sifty/trunk/.gdb_history
Sifty/trunk/Makefile.PL
Sifty/trunk/README
Sifty/trunk/bin/
Sifty/trunk/bin/jifty (contents, props changed)
Sifty/trunk/doc/
Sifty/trunk/etc/
Sifty/trunk/etc/.config.yml.swo (contents, props changed)
Sifty/trunk/etc/.config.yml.swp (contents, props changed)
Sifty/trunk/etc/config.yml
Sifty/trunk/lib/
Sifty/trunk/lib/Sifty/
Sifty/trunk/lib/Sifty/Action/
Sifty/trunk/lib/Sifty/Action/ReadPage.pm
Sifty/trunk/lib/Sifty/Dispatcher.pm
Sifty/trunk/lib/Sifty/Model/
Sifty/trunk/lib/Sifty/the_perl_foundation
Sifty/trunk/log/
Sifty/trunk/share/
Sifty/trunk/share/po/
Sifty/trunk/share/web/
Sifty/trunk/share/web/static/
Sifty/trunk/share/web/static/css/
Sifty/trunk/share/web/static/css/main.css
Sifty/trunk/share/web/templates/
Sifty/trunk/share/web/templates/index.html
Sifty/trunk/share/web/templates/nav
Sifty/trunk/share/web/templates/view
Sifty/trunk/share/web/templates/viewtable
Sifty/trunk/sifty (contents, props changed)
Sifty/trunk/svn-commit.2.tmp
Sifty/trunk/svn-commit.tmp
Sifty/trunk/t/
Sifty/trunk/t/00-action-ReadPage.t
Sifty/trunk/t/00-model-Page.t
Sifty/trunk/var/
Sifty/trunk/var/jifty-server.pid
Sifty/trunk/var/mason/
Log:
Initial checkin of Sifty
Added: Sifty/trunk/.gdb_history
==============================================================================
--- (empty file)
+++ Sifty/trunk/.gdb_history Sun Nov 12 16:17:10 2006
@@ -0,0 +1,15 @@
+bt
+bye
+q
+bt
+q
+bt
+run
+quit
+bye
+quit
+?
+help
+bt
+bye
+quit
Added: Sifty/trunk/Makefile.PL
==============================================================================
--- (empty file)
+++ Sifty/trunk/Makefile.PL Sun Nov 12 16:17:10 2006
@@ -0,0 +1,6 @@
+use inc::Module::Install;
+name('Sifty');
+version('0.01');
+requires('Jifty' => '0.60912');
+
+WriteAll;
Added: Sifty/trunk/README
==============================================================================
--- (empty file)
+++ Sifty/trunk/README Sun Nov 12 16:17:10 2006
@@ -0,0 +1,16 @@
+Sifty, a very simple Jifty interface.
+
+Contents:
+- lib/Sifty/Actions/ReadPage.pm
+ This file has the actual action (in the initial case, it pulls a page
+ from a Socialtext website. It could be modified to do any other action
+ and feed it back to the template).
+- lib/Sifty/Dispatcher
+ Handles "/view" URIs as requests for page names, and "/data" URIs as
+ direct REST Query paths to the backend
+- viewtable
+ The Mason template for viewing the site. This has a lot of extra crud in
+ it to support the perl foundation website, but can be modified to make
+ a site look however it wants
+- main.css
+ The perlfoundation website css file. Modify to your liking.
Added: Sifty/trunk/bin/jifty
==============================================================================
--- (empty file)
+++ Sifty/trunk/bin/jifty Sun Nov 12 16:17:10 2006
@@ -0,0 +1,15 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+use File::Basename qw(dirname);
+use UNIVERSAL::require;
+
+BEGIN {
+ Jifty::Util->require or die $UNIVERSAL::require::ERROR;
+ my $root = Jifty::Util->app_root;
+ unshift @INC, "$root/lib" if ($root);
+}
+
+use Jifty::Script;
+$SIG{INT} = $SIG{TERM} = sub { warn "Stopped\n"; exit; };
+Jifty::Script->dispatch();
Added: Sifty/trunk/etc/.config.yml.swo
==============================================================================
Binary file. No diff available.
Added: Sifty/trunk/etc/.config.yml.swp
==============================================================================
Binary file. No diff available.
Added: Sifty/trunk/etc/config.yml
==============================================================================
--- (empty file)
+++ Sifty/trunk/etc/config.yml Sun Nov 12 16:17:10 2006
@@ -0,0 +1,44 @@
+---
+framework:
+ AdminMode: 1
+ ApplicationClass: Sifty
+ ApplicationName: Sifty
+ Database:
+ Database: sifty
+ Driver: SQLite
+ Host: localhost
+ Password: ''
+ RecordBaseClass: Jifty::DBI::Record::Cachable
+ User: ''
+ Version: 0.0.1
+ DevelMode: 1
+ L10N:
+ PoDir: share/po
+ LogLevel: DEBUG
+ Mailer: Sendmail
+ MailerArgs: []
+
+ Plugins: []
+
+ Web:
+ BaseURL: http://localhost
+ DataDir: var/mason
+ Globals: []
+
+ MasonConfig:
+ autoflush: 0
+ default_escape_flags: h
+ error_format: text
+ error_mode: fatal
+ Port: 8888
+ ServeStaticFiles: 1
+ StaticRoot: share/web/static
+ TemplateRoot: share/web/templates
+application:
+ servername: www.socialtext.net
+ realm: 'Socialtext Authentication'
+ port: 80
+ username:
+ password:
+ protocol: http
+ path: /data/workspaces/<workspace>/pages/
Added: Sifty/trunk/lib/Sifty/Action/ReadPage.pm
==============================================================================
--- (empty file)
+++ Sifty/trunk/lib/Sifty/Action/ReadPage.pm Sun Nov 12 16:17:10 2006
@@ -0,0 +1,94 @@
+use strict;
+use warnings;
+
+=head1 NAME
+
+Sifty::Action::ReadPage
+
+=cut
+
+package Sifty::Action::ReadPage;
+use base qw/Sifty::Action Jifty::Action/;
+
+use Jifty::Param::Schema;
+use Jifty::Action schema {
+ param "page";
+ param "path";
+};
+
+=head2 take_action
+
+=cut
+
+use LWP;
+sub take_action {
+ my $self = shift;
+
+ # Create a browser object to grab the content from the
+ # REST API, tell it where to go
+ my $browser = LWP::UserAgent->new;
+ my $servername = Jifty->config->app('servername') . ":" .
+ Jifty->config->app('port');
+ $browser->credentials(
+ $servername,
+ Jifty->config->app('realm'),
+ Jifty->config->app('username') =>
+ Jifty->config->app('password'));
+
+ my $baseuri = Jifty->config->app('protocol') . "://" .
+ Jifty->config->app('servername');
+ my $pageuri = $baseuri;
+
+ if ( $self->argument_value('page')) {
+ $pageuri .=
+ Jifty->config->app('path') . "/" .
+ $self->argument_value('page');
+ } elsif ( $self->argument_value('path') ) {
+ $pageuri .=
+ $self->argument_value('path');
+ }
+
+ # Grab the content
+ my $response = $browser->get ($pageuri);
+ my $content = $response->content;
+
+ # We need to get the page title from the list of pages
+ my $pagelist_uri = $baseuri .
+ Jifty->config->app('path');
+
+ my $page = '';
+ if ( !($page = $self->argument_value('page') ) ) {
+ $page = $self->argument_value('path');
+ $page =~ s#^.*/pages/(.*)$#$1#g;
+ }
+
+ $response = $browser->get($pagelist_uri);
+ my $pagelist = $response->content;
+ my @lines = split (/\n/, $pagelist);
+ foreach my $line ( @lines ) {
+ next unless ($line =~ qr{pages/$page\'});
+ $line =~ s/<li><a href='.*'>(.*)<\/a><\/li>/$1/g;
+ $content = "<h1>$line</h1>" . $content;
+ }
+
+ # Adjust the URLs so they work right within the site
+ my $path = Jifty->config->app('path');
+ $content =~ s#href='../../pages/#href='$path/#g;
+ $content =~ s#href="([^/"]+)"#href="/view/$1"#g;
+ $content =~ s#href="$path#href="/view#g;
+
+ $self->result->content( html => $content );
+}
+
+=head2 report_success
+
+=cut
+
+sub report_success {
+ my $self = shift;
+ # Your success message here
+ $self->result->message('Success');
+}
+
+1;
+
Added: Sifty/trunk/lib/Sifty/Dispatcher.pm
==============================================================================
--- (empty file)
+++ Sifty/trunk/lib/Sifty/Dispatcher.pm Sun Nov 12 16:17:10 2006
@@ -0,0 +1,44 @@
+package Sifty::Dispatcher;
+
+use strict;
+use warnings;
+
+use Jifty::Dispatcher -base;
+
+on '/', run {
+ redirect( '/view/the_perl_foundation');
+};
+
+under ['view'] => [
+ on '*' => run {
+ my $page = $1;
+
+ warn "Page: $page";
+
+ my $action = Jifty->web->new_action( class => 'ReadPage',
+ arguments => { page => $page });
+ $action->run;
+
+ set viewer => $action;
+ show "/viewtable";
+ }
+];
+
+under ['data'] => [
+ on qr{(.*)} => run {
+ my $path = $1;
+
+ warn "Data: $path";
+
+ my $action = Jifty->web->new_action( class => 'ReadPage',
+ arguments => { path => $path });
+ $action->run;
+
+ set viewer => $action;
+ show "/viewtable";
+ }
+];
+
+
+
+1;
Added: Sifty/trunk/lib/Sifty/the_perl_foundation
==============================================================================
--- (empty file)
+++ Sifty/trunk/lib/Sifty/the_perl_foundation Sun Nov 12 16:17:10 2006
@@ -0,0 +1,3 @@
+
+
+
Added: Sifty/trunk/share/web/static/css/main.css
==============================================================================
--- (empty file)
+++ Sifty/trunk/share/web/static/css/main.css Sun Nov 12 16:17:10 2006
@@ -0,0 +1,309 @@
+
+BODY {
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+ font-size:14px;
+ font-weight:normal;
+ background-color: #FFF;
+
+ }
+
+A {
+ text-decoration: underline;
+ color: #333399;
+ }
+
+A:visited {
+ text-decoration: underline;
+ color: #666666;
+ }
+
+/* specify link and visited so the 'hover' style doesn't apply to
+ other links, like those which are just NAME anchors. */
+A:link:hover {
+ text-decoration: underline;
+ color: #0000CC;
+ }
+A:visited:hover {
+ text-decoration: underline;
+ color: #0000CC;
+ }
+
+.RIGHT {
+ text-align: right;
+ }
+
+.HOME {
+ text-align: right;
+ text-decoration: underline;
+ }
+
+.error {
+ color: #DD0000;
+ }
+
+
+TD {
+ font-size:14px;
+ }
+
+.SHADED {
+ background-color: #d2b48c;
+ font-size:14px;
+ font-weight: bold;
+ font-family:helvetica,sans-serif;
+ }
+
+#navigationbody {
+ background-color:#A0B4F1;
+}
+/* Navigation */
+#NAV {
+ width: 180px;
+ font-size:12px;
+ margin:0em;
+ margin-top: -1px;
+ padding:7px;
+ background-color:#A0B4F1;
+ border:1px solid #3E4A74;
+ }
+
+.SIDE {
+ }
+
+#MAIN {
+ font-size:12px;
+ margin-left:1em;
+ }
+
+#MAIN TD {
+ font-size:12px;
+ }
+
+.INDENT {
+ font-size:12px;
+ margin-left:1em;
+ }
+
+.HIGHLIGHT {
+ font-size:12px;
+ border:1px solid orange;
+ background-color: #FFFACD;
+ padding:10px;
+ width: 400px;
+ margin-top: 1.5em;
+ }
+
+.NAVITEM {
+ padding-bottom:.5em;
+ padding-top:1em;
+ width: 180px;
+ }
+
+.MENU {
+ padding-bottom:1em;
+ width: 180px;
+ font-size : 12px;
+ }
+.MENU A:link {
+ color : #222266;
+ text-decoration : none
+ }
+.MENU A:visited {
+ color : #333333;
+ text-decoration : none
+ }
+.MENU A:active {
+ color : #0000CC;
+ text-decoration : none
+ }
+.MENU A:hover {
+ color : #0000CC;
+ text-decoration : none
+ }
+.MENU H3 {
+ color : #000000;
+ margin-bottom: 0em;
+ }
+
+.MENU p {
+ margin-top: 0em;
+ border-left: 1px dashed black;
+ padding-left: .5em;
+ margin-left: .5em;
+}
+
+.SUBMENU {
+ margin-top:-.7em;
+ border-left: 1px dashed black;
+ padding-left: .5em;
+ margin-left: 1.5em;
+ margin-bottom: .5em;
+}
+.TOPIC {
+ font-weight: bolder;
+ font-size: 16px;
+ color: #191970;
+ font-family:helvetica,sans-serif;
+ text-decoration: underline;
+ padding-bottom: 4px;
+ }
+
+.NAVLINE {
+ font-size:12px;
+ }
+.SMALL {
+ font-size: xx-small;
+ }
+
+.TITLE {
+ color: #ccff66;
+ }
+
+.ITEMS {
+ font-size:14px;
+ }
+
+.CR {
+ border-left: 1px solid #191970;
+ border-right: 1px solid #191970;
+ border-bottom: 1px solid #191970;
+ width: 180px;
+ background-color:#eee;
+ color: #333;
+ padding:7px;
+ font-size: x-small;
+ }
+
+.DESCRIPTION {
+ padding-bottom:1em;
+ padding-right:1em;
+ }
+
+
+.TAGLINE {
+ letter-spacing: 2.5px;
+ color: #666;
+ font-size: 14px;
+ font-family: Verdana, Sans-Serif;
+ font-weight: 800;
+ font-style: italic;
+ padding-top: 3px;
+ border-top:2px solid #191970;
+ margin-top: -10px
+ }
+
+/* for perl-directory style */
+.PDFOOTER {
+ font-size: 12px;
+ padding-top: 0px;
+ padding-bottom: 2px;
+ margin-bottom: 12px
+ }
+
+/* for default style */
+.FOOTER {
+ font-size: 12px;
+ padding-top: 3px;
+ border-top:2px solid #191970;
+ margin-top: -10px
+ }
+.wiki-include-title {
+ color: #000;
+ font-weight: bold;
+ font-size:14px;
+ background-color:#A0B4F1;
+ border:1px solid #3E4A74;
+ padding: .5em;
+ margin-top: 0px;
+ }
+
+.wiki-include-title a {
+ color: #000000;
+ text-decoration: none;
+}
+HR {
+ color: #191970;
+ margin-top: .5em;
+ margin-bottom:.5em;
+ }
+
+.CAMEL {
+ float: right;
+ /* margin-top: -5em; */
+ }
+
+H1 {
+ color: #000;
+ font-weight: bold;
+ font-size:16px;
+ background-color:#A0B4F1;
+ border:1px solid #3E4A74;
+ padding: .5em;
+ margin-top: 0px;
+ }
+H1 A {
+ color: #000;
+ text-decoration : none
+ }
+
+H2 {
+ color: #000;
+ font-weight: bold;
+ font-size:14px;
+ background-color:#A0B4F1;
+ border:1px solid #3E4A74;
+ padding: .2em;
+ }
+H2 A {
+ color: #000;
+ text-decoration : none
+ }
+
+H3 {
+ color: #000;
+ font-size: 14px;
+ font-weight: bolder;
+ }
+H3 A {
+ color: #000;
+ text-decoration : none
+ }
+
+TR {
+ vertical-align: top;
+ }
+
+TD.NOVERTPAD {
+ padding-top: 0;
+ padding-bottom: 0;
+ }
+
+IMG.border {
+ border-width: 1px;
+ border-color: #191970;
+ border-style: solid;
+ padding: 4px;
+ margin: 2px;
+ background: white;
+ }
+
+.LOGO {
+ background-color: #fff;
+ padding:1em;
+ }
+
+table.chart {
+ border: 1px solid #000000;
+ border-spacing: 30px;
+}
+
+A.title_link { text-decoration: none; color: #000000; }
+A:visited.title_link { text-decoration: none; color: #000000; }
+A:link:hover.title_link { text-decoration: none; color: #0000FF; }
+A:visited:hover.title_link { text-decoration: none; color: #0000FF; }
+
+.query_wafl_titlebox {
+ color: #000000;
+ display: none;
+}
+
Added: Sifty/trunk/share/web/templates/index.html
==============================================================================
--- (empty file)
+++ Sifty/trunk/share/web/templates/index.html Sun Nov 12 16:17:10 2006
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
+"http://www.w3.org/TR/html4/">
+<html lang="en">
+<head>
+<title><%_( 'The Perl Foundation')%></title>
+</head>
+<FRAMESET COLS="250, *">
+ <FRAME src="/nav/announcements_and_links" name="nav">
+ <FRAME src="/view/the_perl_foundation" name="view">
+</FRAMESET>
+<%args>
+$n => undef
+</%args>
Added: Sifty/trunk/share/web/templates/nav
==============================================================================
--- (empty file)
+++ Sifty/trunk/share/web/templates/nav Sun Nov 12 16:17:10 2006
@@ -0,0 +1,14 @@
+<%args>
+$viewer
+</%args>
+<html>
+<body id=navigationbody>
+<link rel="stylesheet" type="text/css" href="/css/main.css" title="Default CSS2" media="screen">
+<div class="logo">
+ <img align=center src="http://www.perlfoundation.org/images/tpf_logo_150x79.png" border=0>
+</div>
+<div class="menu">
+<% $viewer->result->content->{html} |n %>
+</div>
+</body>
+</html>
\ No newline at end of file
Added: Sifty/trunk/share/web/templates/view
==============================================================================
--- (empty file)
+++ Sifty/trunk/share/web/templates/view Sun Nov 12 16:17:10 2006
@@ -0,0 +1,11 @@
+<%args>
+$viewer
+</%args>
+<html>
+<body>
+<link rel="stylesheet" type="text/css" href="/css/main.css" title="Default CSS2" media="screen">
+<div id=main>
+<% $viewer->result->content->{html} |n %>
+</div>
+</body>
+</html>
Added: Sifty/trunk/share/web/templates/viewtable
==============================================================================
--- (empty file)
+++ Sifty/trunk/share/web/templates/viewtable Sun Nov 12 16:17:10 2006
@@ -0,0 +1,74 @@
+<%args>
+$viewer
+</%args>
+<%init>
+
+my $nav = Jifty->web->new_action(
+ class => 'ReadPage',
+ arguments => { page => 'announcements and links' } );
+$nav->run;
+
+</%init>
+<html>
+<link rel="stylesheet" type="text/css" href="/css/main.css" title="Default CSS2" media="screen">
+<body>
+<table cellspacing="0" width="690">
+<tr valign="top">
+ <td id="nav" width="180" height="350">
+ <div class="logo">
+ <a href="/"><img src="http://www.perlfoundation.org/images/tpf_logo_150x79.png" alt="TPF Logo" border=0></a>
+ </div>
+ <div class="side">
+ <p>
+
+ <DIV class="MENU">
+ <% $nav->result->content->{html} |n %>
+ </div>
+ </td>
+ <td>
+ <div id="main">
+
+</div>
+<div id=main>
+<% $viewer->result->content->{html} |n %>
+ </div>
+ </td>
+</tr>
+<tr>
+ <td colspan=2 align="center" valign="bottom">
+
+ </td>
+</tr>
+</table>
+<table border="0" width="730" cellspacing="0" cellpadding="0">
+<tr align="right">
+ <td width="590" valign="middle">
+ <br>
+ <div class="footer">
+
+ <a href="http://www.perl.org">Perl.org</A> sites
+ : <a href="http://rt.perl.org/perlbug/">bugs</a>
+ | <a href="http://dev.perl.org/">dev</a>
+ | <a href="http://history.perl.org/">history</a>
+ | <a href="http://jobs.perl.org/">jobs</a>
+ | <a href="http://learn.perl.org/">learn</a>
+ | <a href="http://lists.perl.org/">lists</a>
+ | <a href="http://use.perl.org/">use</a>
+ <br>
+ <small>© Copyright 2002-2005 <a href="http://www.perlfoundation.org">The Perl Foundation</a><br>
+ <a href="/contacts.html" >Site Information and Contacts</A></small>
+
+ <div align="left">
+
+ </div>
+ </div>
+ </td>
+ <td valign="middle" align="center">
+
+ <a href="/legal/trademark.html"><img border=0 src="http://www.perlfoundation.org/images/onion_64x64.png" alt="Perl Onion"></a>
+
+ </td>
+</tr>
+</table>
+</body>
+</html>
Added: Sifty/trunk/sifty
==============================================================================
Binary file. No diff available.
Added: Sifty/trunk/svn-commit.2.tmp
==============================================================================
--- (empty file)
+++ Sifty/trunk/svn-commit.2.tmp Sun Nov 12 16:17:10 2006
@@ -0,0 +1,4 @@
+
+--This line, and those below, will be ignored--
+
+A .
Added: Sifty/trunk/svn-commit.tmp
==============================================================================
--- (empty file)
+++ Sifty/trunk/svn-commit.tmp Sun Nov 12 16:17:10 2006
@@ -0,0 +1,4 @@
+Adding a top level directory for the Sifty thingie
+--This line, and those below, will be ignored--
+
+A http://svn.jifty.org/svn/jifty.org/Sifty
Added: Sifty/trunk/t/00-action-ReadPage.t
==============================================================================
--- (empty file)
+++ Sifty/trunk/t/00-action-ReadPage.t Sun Nov 12 16:17:10 2006
@@ -0,0 +1,15 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+
+=head1 DESCRIPTION
+
+A (very) basic test harness for the ReadPage action.
+
+=cut
+
+use Jifty::Test tests => 1;
+
+# Make sure we can load the action
+use_ok('Sifty::Action::ReadPage');
+
Added: Sifty/trunk/t/00-model-Page.t
==============================================================================
--- (empty file)
+++ Sifty/trunk/t/00-model-Page.t Sun Nov 12 16:17:10 2006
@@ -0,0 +1,49 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+
+=head1 DESCRIPTION
+
+A basic test harness for the Page model.
+
+=cut
+
+use Jifty::Test tests => 11;
+
+# Make sure we can load the model
+use_ok('Sifty::Model::Page');
+
+# Grab a system user
+my $system_user = Sifty::CurrentUser->superuser;
+ok($system_user, "Found a system user");
+
+# Try testing a create
+my $o = Sifty::Model::Page->new(current_user => $system_user);
+my ($id) = $o->create();
+ok($id, "Page create returned success");
+ok($o->id, "New Page has valid id set");
+is($o->id, $id, "Create returned the right id");
+
+# And another
+$o->create();
+ok($o->id, "Page create returned another value");
+isnt($o->id, $id, "And it is different from the previous one");
+
+# Searches in general
+my $collection = Sifty::Model::PageCollection->new(current_user => $system_user);
+$collection->unlimit;
+is($collection->count, 2, "Finds two records");
+
+# Searches in specific
+$collection->limit(column => 'id', value => $o->id);
+is($collection->count, 1, "Finds one record with specific id");
+
+# Delete one of them
+$o->delete;
+$collection->redo_search;
+is($collection->count, 0, "Deleted row is gone");
+
+# And the other one is still there
+$collection->unlimit;
+is($collection->count, 1, "Still one left");
+
Added: Sifty/trunk/var/jifty-server.pid
==============================================================================
--- (empty file)
+++ Sifty/trunk/var/jifty-server.pid Sun Nov 12 16:17:10 2006
@@ -0,0 +1 @@
+6287
\ No newline at end of file
More information about the Jifty-commit
mailing list