Changeset 448
- Timestamp:
- 07/08/08 01:14:42 (3 months ago)
- Location:
- veekun/trunk
- Files:
-
- 3 modified
-
lib/Vee/Controller/Index.pm (modified) (2 diffs)
-
lib/Vee/Controller/Shoutbox.pm (modified) (2 diffs)
-
templates/index.tt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
veekun/trunk/lib/Vee/Controller/Index.pm
r407 r448 30 30 31 31 my $shoutbox_fields = { 32 name => { type => 'text', size => 20, maxlength => 20 },33 32 content => { type => 'textarea', rows => 3, cols => 20 }, 34 33 }; … … 77 76 78 77 my $shoutbox_form = Vee::Form->new( 79 id => 'shoutbox',78 id => 'shoutbox', 80 79 fields => $shoutbox_fields, 81 80 params => $c->req->params, 82 81 ); 83 84 if ($c->user) {85 $shoutbox_form->force( name => $c->user->name );86 }87 82 $s->{shoutbox_form} = $shoutbox_form; 88 83 -
veekun/trunk/lib/Vee/Controller/Shoutbox.pm
r406 r448 59 59 my $s = $c->stash; 60 60 61 if (not $c->user) { 62 $c->vee_abort("Only registered users may post in the shoutbox."); 63 } 64 61 65 my $content = Vee::Utils::fix_newlines( $c->req->params->{content} ); 62 my $name = $c->req->params->{name}63 || ($c->user ? $c->user->name : 'Anonymous');64 66 65 if ( !$content) {67 if (not $content) { 66 68 $c->vee_abort("Sorry, no mimes allowed."); 67 69 } … … 78 80 79 81 $c->model('DBIC::Shoutbox')->create({ 80 name => $name,81 user_id => ($c->user ? $c->user->obj->id : undef),82 ip => Vee::Utils::inet_aton($c->req->address),83 time => time,82 name => $c->user->name, 83 user_id => $c->user->obj->id, 84 ip => Vee::Utils::inet_aton($c->req->address), 85 time => time, 84 86 content => $content, 85 87 }); -
veekun/trunk/templates/index.tt
r412 r448 115 115 <p> Shoutbox is empty. </p> 116 116 [% END %] 117 [%# TODO: permissions here would be nice I suppose~ %] 118 [% IF 1 OR allowed('shoutbox.post') %] 117 [% IF c.user # allowed('shoutbox.post') %] 119 118 <form class="front-shout-form" action="/shoutbox/post" method="post"> 120 119 <p> [% shoutbox_form.get_tag('content') %] </p> 121 <p> 122 <label> Name: [% shoutbox_form.get_tag('name') %] </label> 123 <input type="submit" name="submit" value="Post"/> <input type="reset" value="Clear"/> 124 </p> 120 <p> <input type="submit" name="submit" value="Post"/> <input type="reset" value="Clear"/> </p> 125 121 </form> 126 122 [% END %]
