Changeset 448 for veekun/trunk/lib/Vee
- Timestamp:
- 07/08/08 01:14:42 (21 months ago)
- Location:
- veekun/trunk/lib/Vee/Controller
- Files:
-
- 2 modified
-
Index.pm (modified) (2 diffs)
-
Shoutbox.pm (modified) (2 diffs)
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 });
