[MKDoc-commit] [1.8] Comment plugin now updates the Contributor
table when posting
bruno at mkdoc.demon.co.uk
bruno at mkdoc.demon.co.uk
Thu Sep 1 12:43:13 BST 2005
Log Message:
-----------
[1.8] Comment plugin now updates the Contributor table when posting
Modified Files:
--------------
mkd/flo/plugin:
Comment.pm
-------------- next part --------------
Index: Comment.pm
===================================================================
RCS file: /var/spool/cvs/mkd/flo/plugin/Comment.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lflo/plugin/Comment.pm -Lflo/plugin/Comment.pm -u -r1.2 -r1.3
--- flo/plugin/Comment.pm
+++ flo/plugin/Comment.pm
@@ -57,6 +57,9 @@
Once the form is POSTed, the user is redirected back to the parent document
(which may or may not display the commment itself).
+The Contributor table is updated to indicate that this user has contributed to
+this document
+
=cut
sub template_path { return '/comment' };
@@ -82,6 +85,7 @@
my $cgi = $self->cgi();
$self->_update_document_from_cgi();
+ $self->_update_contributor();
$self->{comment} = $self->cgi->param ('comment');
$self->_send_mail();
@@ -107,6 +111,17 @@
$document->save();
}
+sub _update_contributor
+{
+ my $self = shift;
+ my $user = $self->user;
+ my $document = $self->parent;
+
+ my $contributor_t = flo::Standard::table ('Contributor');
+ $contributor_t->get (Editor_ID => $user->id, Document_ID => $document->id) and return 1;
+ $contributor_t->insert (Editor_ID => $user->id, Document_ID => $document->id);
+}
+
=pod
The plugin only activates if enabled in the plugin list and if the user is
More information about the MKDoc-commit
mailing list