Changeset 21
- Timestamp:
- 02/23/07 23:27:09 (3 years ago)
- Location:
- veekun
- Files:
-
- 6 modified
-
README.pod (modified) (1 diff)
-
lib/Vee.pm (modified) (1 diff)
-
lib/Vee/Controller/Index.pm (modified) (2 diffs)
-
lib/Vee/View/TT.pm (modified) (1 diff)
-
site_options.yml (modified) (1 diff)
-
templates/index.tt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
veekun/README.pod
r13 r21 25 25 Catalyst::Plugin::Session::Store::DBIC 26 26 DBIx::Class 27 DateTime 27 28 Email::Valid 28 29 Image::Size -
veekun/lib/Vee.pm
r13 r21 67 67 } 68 68 69 =head2 cache 70 71 Returns a cache hash for holding small bits of data useful between requests 72 but not worth a database table/row/hit. 73 74 =cut 75 76 my $cache = {}; 77 sub cache { 78 return $cache; 79 } 80 69 81 =head2 uri 70 82 -
veekun/lib/Vee/Controller/Index.pm
r18 r21 4 4 use warnings; 5 5 use base 'Catalyst::Controller'; 6 7 use DateTime; 6 8 7 9 __PACKAGE__->config->{namespace} = ''; … … 54 56 } ); 55 57 58 # check for latest subversion revision every 15 minutes or so 59 if (not $c->cache->{svn} or $c->cache->{svn}{last_checked} < time - 15 * 60) { 60 eval { 61 open my $svn_fh, '-|', 'svn', 'log', '--limit' => 1, '--incremental', $c->site_opts->{svn_url}; 62 my (undef, $details, undef, @log) = <$svn_fh>; 63 close $svn_fh; 64 my ($rev, $user, $time, undef) = split / \| /, $details; 65 $rev =~ s/^r//; 66 my ($yr, $mo, $day, $hr, $min, $sec, $tz) = split /[- :]/, $time, 7; 67 68 $c->cache->{svn} = { 69 revision => $rev, 70 user => $user, 71 time => new DateTime( 72 year => $yr, 73 month => $mo, 74 day => $day, 75 hour => $hr, 76 minute => $min, 77 second => $sec, 78 time_zone => substr $tz, 0, 5, 79 ), 80 last_checked => time, 81 log => join '', @log, 82 } 83 }; 84 } 85 86 $s->{recent_revision} = $c->cache->{svn}; 87 56 88 $s->{recent_users} = $c->model('DBIC::Users')->search( 57 89 { lastactive => { '>', time - $c->site_opts->{user_activity_timeout} } }, -
veekun/lib/Vee/View/TT.pm
r13 r21 45 45 FILTERS => { 46 46 # vee_basic => \&Vee::format_basic, 47 nohtml => sub { return Vee->vee_cleanse(@_) },47 nohtml => \&Vee::Utils::cleanse, 48 48 bbcode => \&Vee::BBCode::apply_bbcode, 49 49 timespan => \&_format_timespan, -
veekun/site_options.yml
r13 r21 70 70 user_activity_timeout: 900 71 71 72 # URL for Subversion repository path to check for activity 73 # Note that at the moment this *requires* anon access! 74 svn_url: svn://veekun.com/veekun 75 72 76 # Number of posts => rank you get 73 77 post_ranks: -
veekun/templates/index.tt
r18 r21 22 22 <p>I am wide open to suggestions, comments, criticisms, improvements, and free 23 23 money.</p> 24 [% IF recent_revision %] 25 <div style="border: 1px dotted navy; -moz-border-radius: 8px; padding: 4px;"> 26 <p> <em>Last Subversion commit:</em> <a href="/viewvc?view=rev&revision=[% recent_revision.revision.replace('r','') %]">[% recent_revision.revision %]</a> </p> 27 <p><code>[% recent_revision.log | nohtml %]</code></p> 28 <p>by [% recent_revision.user %] on [% recent_revision.time %]</p> 29 </div> 30 [% END %] 24 31 <div id="rightcol"> 25 32 <div class="front-box"> … … 44 51 [% now = time %] 45 52 [% WHILE (u = recent_users.next) %] 46 [%# TODO: what the hell is this, it doesn't work at all does it? %] 47 [% IF !loop.first && loop.last.lastactive > now - 600 && loop.prev.lastactive < now - 600 %] | [% END %] 53 [%# IF NOT done_user_sep AND last_user AND last_user.lastactive < now - 600; done_user_set = 1 %] | [%# END %] 48 54 <a href="/users/[% u.id %]" title="[% now - u.lastactive | timespan %]">[% u.name %]</a> 55 [% last_user = u %] 49 56 [% END %] 50 57 [% IF !recent_users.size %]
