]> ruin.nu Git - ndwebbie.git/commitdiff
Update to be compatible with newer Catalyst.
authorMichael Andreen <harv@ruin.nu>
Sat, 15 Mar 2014 20:51:50 +0000 (21:51 +0100)
committerMichael Andreen <harv@ruin.nu>
Sat, 15 Mar 2014 20:51:50 +0000 (21:51 +0100)
dependencies
lib/NDWeb.pm
lib/NDWeb/Controller/Root.pm
lib/NDWeb/Controller/Wiki.pm
root/static/ui/ui.datepicker.css [changed mode: 0755->0644]

index 51ca051ab7bd4fc2740b0c41592afc46336dff85..3cabb012b798997b6254d7f7f67d9247a684fa36 100644 (file)
@@ -1,10 +1,10 @@
 - Task::Catalyst - Pulls in Moose and lots of other dependencies
 - DBD::Pg
 - Catalyst::Plugin::PageCache
 - Task::Catalyst - Pulls in Moose and lots of other dependencies
 - DBD::Pg
 - Catalyst::Plugin::PageCache
-- Catalyst::Plugin::Cache
 - Catalyst::Plugin::Compress::Zlib
 - Catalyst::Plugin::Session::DynamicExpiry
 - Catalyst::Plugin::Compress::Zlib
 - Catalyst::Plugin::Session::DynamicExpiry
-- Catalyst::Plugin::Unicode
+- Catalyst::Plugin::Session::State::Cookie
+- Catalyst::Plugin::Session::Store::File
 - Catalyst::Plugin::Authorization::ACL
 - Parse::BBCode
 - Catalyst::Model::Adaptor
 - Catalyst::Plugin::Authorization::ACL
 - Parse::BBCode
 - Catalyst::Model::Adaptor
@@ -27,6 +27,7 @@ Bot deps:
 
 
 ------- Pulled by other things
 
 
 ------- Pulled by other things
+- Catalyst::Plugin::Cache
 DateTime::TimeZone
 Email::Valid
 CGI
 DateTime::TimeZone
 Email::Valid
 CGI
index b72d765a9e971d0b3e99545a195b7245af2fd415..63708aaa847df6a96dc7afbad1983d8ab373b5cb 100644 (file)
@@ -13,11 +13,12 @@ use Catalyst::Runtime 5.80;
 #                 directory
 
 use parent qw/Catalyst/;
 #                 directory
 
 use parent qw/Catalyst/;
+
 use Catalyst qw/
        -Debug
        ConfigLoader
        Static::Simple
 use Catalyst qw/
        -Debug
        ConfigLoader
        Static::Simple
-       Unicode
+       Unicode::Encoding
 
        Authentication
        Authentication::Store::NDWeb
 
        Authentication
        Authentication::Store::NDWeb
@@ -31,9 +32,6 @@ use Catalyst qw/
        Session::Store::File
        Session::State::Cookie
 
        Session::Store::File
        Session::State::Cookie
 
-       Compress::Gzip
-       Compress::Deflate
-
        Cache
        PageCache
 /;
        Cache
        PageCache
 /;
@@ -86,6 +84,7 @@ __PACKAGE__->config( page_cache => {
 });
 
 __PACKAGE__->config( default_model => 'Model');
 });
 
 __PACKAGE__->config( default_model => 'Model');
+__PACKAGE__->config( encoding => 'UTF-8');
 # Start the application
 __PACKAGE__->setup();
 
 # Start the application
 __PACKAGE__->setup();
 
index 6fab7f29fcde410fb1f674a54405c9cd18db8f6b..4aa6d9557dd2100ce52003bc8718424c0d23b661 100644 (file)
@@ -33,7 +33,7 @@ NDWeb::Controller::Root - Root Controller for NDWeb
 sub index : Local Path Args(0) {
        my ( $self, $c ) = @_;
 
 sub index : Local Path Args(0) {
        my ( $self, $c ) = @_;
 
-       $c->visit('/wiki/index');
+       $c->visit('/wiki/main');
 }
 
 sub default : Path {
 }
 
 sub default : Path {
index 1c3ea8714e3f48fa1b23da4320447318210bdfe9..2e54d48cc602deb7ff34b71fc1f20541a5e4aed9 100644 (file)
@@ -29,16 +29,22 @@ sub auto : Priate {
        $c->stash(wikiformat => \&wikiformat);
 }
 
        $c->stash(wikiformat => \&wikiformat);
 }
 
-sub index :Path :Args(0) {
-       my ( $self, $c ) = @_;
+sub index :Path :Args(1) {
+       my ( $self, $c, $page ) = @_;
 
 
-       push @{$c->req->captures}, ('Info','Main');
-       $c->forward('page');
+       $c->forward('page',$page);
        $c->stash(template => 'wiki/page.tt2');
 }
 
        $c->stash(template => 'wiki/page.tt2');
 }
 
-sub page : LocalRegex(^(?:([A-Z]\w*)(?::|%3A))?([A-Z]\w*)$) {
+sub main :Path :Args(0) {
        my ( $self, $c ) = @_;
        my ( $self, $c ) = @_;
+
+       $c->forward('page', ['Info:Main']);
+       $c->stash(template => 'wiki/page.tt2');
+}
+
+sub page : Private {
+       my ( $self, $c, $p ) = @_;
        my $dbh = $c->model;
 
        $c->forward('findPage');
        my $dbh = $c->model;
 
        $c->forward('findPage');
@@ -47,8 +53,8 @@ sub page : LocalRegex(^(?:([A-Z]\w*)(?::|%3A))?([A-Z]\w*)$) {
        $c->forward('loadText');
 
        unless ($c->stash->{page}->{wpid}){
        $c->forward('loadText');
 
        unless ($c->stash->{page}->{wpid}){
-               $c->stash->{page}->{namespace} = $c->req->captures->[0];
-               $c->stash->{page}->{name} = $c->req->captures->[1];
+               $c->stash->{page}->{namespace} = $c->stash->{namespace};
+               $c->stash->{page}->{name} = $c->stash->{name};
                $c->stash->{page}->{fullname} = ($c->stash->{page}->{namespace} ? $c->stash->{page}->{namespace}.':' : '')
                        . $c->stash->{page}->{name};
                $c->stash->{page}->{post} = $dbh->selectrow_array(q{SELECT post
                $c->stash->{page}->{fullname} = ($c->stash->{page}->{namespace} ? $c->stash->{page}->{namespace}.':' : '')
                        . $c->stash->{page}->{name};
                $c->stash->{page}->{post} = $dbh->selectrow_array(q{SELECT post
@@ -59,8 +65,8 @@ sub page : LocalRegex(^(?:([A-Z]\w*)(?::|%3A))?([A-Z]\w*)$) {
        $c->stash(title => $c->stash->{page}->{fullname});
 }
 
        $c->stash(title => $c->stash->{page}->{fullname});
 }
 
-sub edit : LocalRegex(^edit/(?:([A-Z]\w*)(?::|%3A))?([A-Z]\w*)$) {
-       my ( $self, $c ) = @_;
+sub edit :Local :Args(1) {
+       my ( $self, $c, @p ) = @_;
        my $dbh = $c->model;
 
        $c->forward('findPage');
        my $dbh = $c->model;
 
        $c->forward('findPage');
@@ -72,12 +78,12 @@ sub edit : LocalRegex(^edit/(?:([A-Z]\w*)(?::|%3A))?([A-Z]\w*)$) {
        unless ($c->stash->{page}->{wpid}){
                $c->acl_access_denied('test',$c->action,'No edit access for this page')
                        unless @{$c->stash->{namespaces}};
        unless ($c->stash->{page}->{wpid}){
                $c->acl_access_denied('test',$c->action,'No edit access for this page')
                        unless @{$c->stash->{namespaces}};
-               $c->stash->{page}->{namespace} = $c->req->captures->[0];
-               $c->stash->{page}->{name} = $c->req->captures->[1];
+               $c->stash->{page}->{namespace} = $c->stash->{namespace};
+               $c->stash->{page}->{name} = $c->stash->{name};
        }
 }
 
        }
 }
 
-sub history : LocalRegex(^history/(?:([A-Z]\w*)(?::|%3A))?([A-Z]\w*)$) {
+sub history :Local :Args(1) {
        my ( $self, $c ) = @_;
        my $dbh = $c->model;
 
        my ( $self, $c ) = @_;
        my $dbh = $c->model;
 
@@ -195,12 +201,16 @@ sub findPage : Private {
 
        my @arguments = ($c->stash->{UID});
        my $where;
 
        my @arguments = ($c->stash->{UID});
        my $where;
-       if ($p){
+       if ($p =~ /^\d+$/){
                $where =  q{AND wpid = $2};
                push @arguments, $p;
                $where =  q{AND wpid = $2};
                push @arguments, $p;
-       }else{
+       } elsif ($p =~ /^(?:([A-Z]\w*):)?([A-Z]\w*)$/){
                $where = q{AND (namespace = COALESCE($2,'') AND name = $3)};
                $where = q{AND (namespace = COALESCE($2,'') AND name = $3)};
-               push @arguments, @{$c->req->captures};
+               push @arguments, $1, $2;
+               $c->stash(namespace => $1);
+               $c->stash(name => $2);
+       } else {
+               $c->detach('/default');
        }
 
        my $query = q{SELECT wpid,namespace,name,wprev
        }
 
        my $query = q{SELECT wpid,namespace,name,wprev
old mode 100755 (executable)
new mode 100644 (file)