AxKit-App-TABOO
view release on metacpan or search on metacpan
lib/AxKit/App/TABOO/XSP/Comment.pm view on Meta::CPAN
my $story = AxKit::App::TABOO::Data::Story->new();
$story->load(what => 'storyname,sectionid',
limit => {storyname => $args{'storyname'},
sectionid => $args{'sectionid'}});
$story->lasttimestamp($timestamp);
$story->save;
1;
EOC
}
=head2 C<E<lt>this-comment/E<gt>>
Will return an XML representation of the data submitted in the last
request, enclosed in a C<comment-submission> element. Particularly
useful for previewing a submission.
=cut
sub this_comment : struct {
return << 'EOC'
my %args;
foreach my $name ($cgi->param) {
$args{$name} = $cgi->param($name);
}
$args{'username'} = AxKit::App::TABOO::loggedin(AxKit::App::TABOO::session($r));
my $timestamp = localtime;
unless ($args{'timestamp'}) {
$args{'timestamp'} = $timestamp->datetime;
}
my $comment = AxKit::App::TABOO::Data::Comment->new();
$comment->populate(\%args);
$comment->adduserinfo();
# $comment->addcatinfo();
my $doc = XML::LibXML::Document->new();
my $root = $doc->createElementNS('http://www.kjetil.kjernsmo.net/software/TABOO/NS/Comment/Output', 'comm:comment-submission');
$doc->setDocumentElement($root);
$comment->write_xml($doc, $root); # Return an XML representation
EOC
}
=head2 C<E<lt>get-comment/E<gt>>
Will return an XML representation of the data for a previously saved
comment, enclosed in a C<comment-loaded> element. It needs to get the
comment identified by C<storyname>, C<sectionid> and C<commentpath>
attributes or child elements.
=cut
sub get_comment : struct attribOrChild(storyname,sectionid,commentpath) {
return << 'EOC'
my $comment = AxKit::App::TABOO::Data::Comment->new();
unless ($comment->load(what => '*', limit => {sectionid => $attr_sectionid,
storyname=> $attr_storyname,
commentpath=> $attr_commentpath})) {
throw Apache::AxKit::Exception::Retval(
return_code => 404,
-text => "Requested comment $attr_commentpath not found.");
}
$comment->adduserinfo();
my $doc = XML::LibXML::Document->new();
my $root = $doc->createElementNS('http://www.kjetil.kjernsmo.net/software/TABOO/NS/Comment/Output', 'comm:comment-loaded');
$doc->setDocumentElement($root);
$comment->write_xml($doc, $root); # Return an XML representation
EOC
}
1;
=head1 FORMALITIES
See L<AxKit::App::TABOO>.
=cut
( run in 0.767 second using v1.01-cache-2.11-cpan-39bf76dae61 )