[Jifty-commit] r463 - wifty/trunk/lib/Wifty wifty/trunk/web/templates

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Jan 5 14:50:43 EST 2006


Author: jesse
Date: Thu Jan  5 14:50:42 2006
New Revision: 463

Added:
   wifty/trunk/lib/Wifty/Dispatcher.pm
   wifty/trunk/web/templates/autohandler
Modified:
   /   (props changed)
   wifty/trunk/web/templates/create/dhandler

Log:
 r22138 at truegrounds:  jesse | 2006-01-05 20:48:46 +0100
 Create now uses the dispatcher!


Added: wifty/trunk/lib/Wifty/Dispatcher.pm
==============================================================================
--- (empty file)
+++ wifty/trunk/lib/Wifty/Dispatcher.pm	Thu Jan  5 14:50:42 2006
@@ -0,0 +1,8 @@
+package Wifty::Dispatcher;
+use Jifty::Dispatcher -base;
+
+under 'create/*', run {
+    set page => $1;
+    set action => Jifty->web->new_action( class => 'CreatePage' );
+};
+1;

Added: wifty/trunk/web/templates/autohandler
==============================================================================
--- (empty file)
+++ wifty/trunk/web/templates/autohandler	Thu Jan  5 14:50:42 2006
@@ -0,0 +1,29 @@
+<%init>
+$r->content_type('text/html; charset=utf-8');
+Jifty->web->handle_request();
+
+if ($m->base_comp->path =~ m|/_elements/|) {
+    # Requesting an internal component by hand -- naughty
+    $m->redirect("/errors/requested_private_component");
+#} elsif (not Jifty->web->current_user->id and $m->request_comp->path !~ m{^/(?:welcome|dhandler|css|js|images|validator\.xml)} ) {
+#    # Not logged in, trying to access a protected page
+#    $m->notes->{'login-nextpage'} =  $m->{top_path};
+#    Jifty->web->redirect('/welcome/');
+}
+$m->comp('/_elements/nav');
+require Wifty::Dispatcher;
+Wifty::Dispatcher->handle_request();
+return;
+</%init>
+<%def .setup_actions>
+<%init>
+Jifty->web->allow_actions(qr/.*/);
+# this method turns around and calls the setup_actions method 
+# it's called by Jifty::Web->setup_page_actions.
+my $delegate = $m->fetch_comp($m->next_comp->path);
+if ($delegate and $delegate->method_exists('setup_actions')) {
+    $delegate->call_method('setup_actions');
+}
+
+</%init>
+</%def>

Modified: wifty/trunk/web/templates/create/dhandler
==============================================================================
--- wifty/trunk/web/templates/create/dhandler	(original)
+++ wifty/trunk/web/templates/create/dhandler	Thu Jan  5 14:50:42 2006
@@ -1,7 +1,3 @@
-<%init>
-my $page = $m->dhandler_arg;
-my $action = Jifty->web->new_action( class => 'CreatePage');
-</%init>
 <&|/_elements/wrapper, title => 'New page: '. $page&>
 <% Jifty->web->form->start %>
 <% Jifty->web->form->next_page( url => '/view/'.$page) %>
@@ -11,3 +7,7 @@
 <% Jifty->web->form->end %>
 <& /_elements/markup &>
 </&>
+<%args>
+$action
+$page
+</%args>


More information about the Jifty-commit mailing list