| 1 | package Silki::Controller::Site; | ||
| 2 | { | ||
| 3 | $Silki::Controller::Site::VERSION = '0.29'; | ||
| 4 | } | ||
| 5 | |||
| 6 | use strict; | ||
| 7 | use warnings; | ||
| 8 | use namespace::autoclean; | ||
| 9 | |||
| 10 | use Silki::Help::Dir; | ||
| 11 | use Silki::Schema::User; | ||
| 12 | use Silki::Schema::Wiki; | ||
| 13 | |||
| 14 | use Moose; | ||
| 15 | |||
| 16 | BEGIN { extends 'Silki::Controller::Base' } | ||
| 17 | |||
| 18 | with qw( | ||
| 19 | Silki::Role::Controller::Pager | ||
| 20 | ); | ||
| 21 | |||
| 22 | sub site : Path('/') : Args(0) { | ||
| 23 | my $self = shift; | ||
| 24 | my $c = shift; | ||
| 25 | |||
| 26 | if ( $c->user()->is_authenticated() ) { | ||
| 27 | $c->stash()->{user_wiki_count} = $c->user()->member_wiki_count(); | ||
| 28 | $c->stash()->{user_wikis} = $c->user()->member_wikis(); | ||
| 29 | } | ||
| 30 | |||
| 31 | $c->stash()->{public_wiki_count} = Silki::Schema::Wiki->PublicWikiCount(); | ||
| 32 | $c->stash()->{public_wikis} = Silki::Schema::Wiki->PublicWikis(); | ||
| 33 | |||
| 34 | $c->stash()->{template} = '/site/dashboard'; | ||
| 35 | } | ||
| 36 | |||
| 37 | sub system_log : Path('/logs') : Args(0) { | ||
| 38 | my $self = shift; | ||
| 39 | my $c = shift; | ||
| 40 | |||
| 41 | $self->_require_site_admin($c); | ||
| 42 | |||
| 43 | my ( $limit, $offset ) | ||
| 44 | = $self->_make_pager( $c, Silki::Schema::SystemLog->Count() ); | ||
| 45 | |||
| 46 | $c->stash()->{logs} = Silki::Schema::SystemLog->All( | ||
| 47 | limit => $limit, | ||
| 48 | offset => $offset, | ||
| 49 | ); | ||
| 50 | |||
| 51 | $c->stash()->{template} = '/log/logs'; | ||
| 52 | } | ||
| 53 | |||
| 54 | sub help : Path('/help') : Args(0) { | ||
| 55 | my $self = shift; | ||
| 56 | my $c = shift; | ||
| 57 | |||
| 58 | $c->stash()->{help} = Silki::Help::Dir->new( locale_code => 'en' ); | ||
| 59 | |||
| 60 | $c->stash()->{template} = '/site/help'; | ||
| 61 | } | ||
| 62 | |||
| 63 | __PACKAGE__->meta()->make_immutable(); | ||
| 64 | |||
| 65 | 1; | ||
| 66 | |||
| 67 | # ABSTRACT: Controller class for the site | ||
| 68 | |||
| 69 | |||
| 70 | |||
| 71 | =pod | ||
| 72 | |||
| 73 | =head1 NAME | ||
| 74 | |||
| 75 | Silki::Controller::Site - Controller class for the site | ||
| 76 | |||
| 77 | =head1 VERSION | ||
| 78 | |||
| 79 | version 0.29 | ||
| 80 | |||
| 81 | =head1 AUTHOR | ||
| 82 | |||
| 83 | Dave Rolsky <autarch@urth.org> | ||
| 84 | |||
| 85 | =head1 COPYRIGHT AND LICENSE | ||
| 86 | |||
| 87 | This software is Copyright (c) 2011 by Dave Rolsky. | ||
| 88 | |||
| 89 | This is free software, licensed under: | ||
| 90 | |||
| 91 | The GNU Affero General Public License, Version 3, November 2007 | ||
| 92 | |||
| 93 | =cut | ||
| 94 | |||
| 95 | |||
| 96 | __END__ |