From 01ff22d70fd1b03db0556e0e272333dd985e9790 Mon Sep 17 00:00:00 2001 From: Frank Dillon Date: Fri, 20 Jul 2007 20:19:55 +0000 Subject: [PATCH] Changes to include captcha image on post to verify humanity --- lib/WebGUI/Asset/Wobject/Collaboration.pm | 38 ++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm index 796b1d174..56f2af70f 100644 --- a/lib/WebGUI/Asset/Wobject/Collaboration.pm +++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm @@ -241,6 +241,7 @@ sub appendTemplateLabels { $var->{"user.label"} = $i18n->get("user"); $var->{"views.label"} = $i18n->get("views"); $var->{'visitorName.label'} = $i18n->get("visitor"); + $var->{"captcha_label"} = $i18n->get("captcha label"); } #------------------------------------------------------------------- @@ -716,7 +717,13 @@ sub definition { label=>$i18n->get("default karma scale"), hoverHelp=>$i18n->get('default karma scale help'), }, - + useCaptcha => { + fieldType=>"yesNo", + defaultValue=>'0', + tab=>'security', + label=>$i18n->get('use captcha label'), + hoverHelp=>$i18n->get('use captcha hover help'), + }, subscriptionGroupId =>{ fieldType=>"subscriptionGroup", tab=>'security', @@ -1272,6 +1279,35 @@ sub view { #------------------------------------------------------------------- +=head2 www_editSave ( ) + +We're extending www_editSave() here to deal with editing a post that has been denied by the approval process. Our change will reassign the old working tag of this post to the user so that they can edit it. + +=cut + +sub www_editSave { + my $self = shift; + my $session = $self->session; + + my $className = $session->form->param("class"); + + #my $assetId = $self->session->form->param("assetId"); + if($className eq "WebGUI::Asset::Post::Thread") { + my $assetId = $session->form->param("assetId"); + + if($assetId eq "new" && $self->getValue("useCaptcha")) { + my $captcha = $self->session->form->process("captcha","Captcha"); + unless ($captcha) { + return $self->www_add; + } + } + } + + return $self->SUPER::www_editSave(); +} + +#------------------------------------------------------------------- + =head2 www_search ( ) The web method to display and use the forum search interface.