From bcc81e906c6d17d1b79504c8eacfd1ffcec6902b Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 24 Nov 2011 14:01:24 -0800 Subject: [PATCH] Remove more deprecated Form code. --- lib/WebGUI/Asset/Wobject/WikiMaster.pm | 9 ++++++--- lib/WebGUI/Form.pm | 3 ++- lib/WebGUI/Role/Asset/Comments.pm | 12 ++++++++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/WebGUI/Asset/Wobject/WikiMaster.pm b/lib/WebGUI/Asset/Wobject/WikiMaster.pm index 40ddd2141..0492ddb24 100644 --- a/lib/WebGUI/Asset/Wobject/WikiMaster.pm +++ b/lib/WebGUI/Asset/Wobject/WikiMaster.pm @@ -344,11 +344,14 @@ sub appendSearchBoxVars { my $var = shift; my $queryText = shift; my $submitText = WebGUI::International->new($self->session, 'Asset_WikiMaster')->get('searchLabel'); + use WebGUI::Form::Hidden; + use WebGUI::Form::Text; + use WebGUI::Form::Submit; $var->{'searchFormHeader'} = join '', (WebGUI::Form::formHeader($self->session, { action => $self->getUrl, method => 'GET', }), - WebGUI::Form::hidden($self->session, { name => 'func', value => 'search' })); - $var->{'searchQuery'} = WebGUI::Form::text($self->session, { name => 'query', value => $queryText }); - $var->{'searchSubmit'} = WebGUI::Form::submit($self->session, { value => $submitText }); + WebGUI::Form::Hidden->new($self->session, { name => 'func', value => 'search' })->toHtml); + $var->{'searchQuery'} = WebGUI::Form::Text($self->session, { name => 'query', value => $queryText })->toHtml; + $var->{'searchSubmit'} = WebGUI::Form::Submit($self->session, { value => $submitText }->toHtml); $var->{'searchFormFooter'} = WebGUI::Form::formFooter($self->session); $var->{'canAddPages'} = $self->canEditPages(); return $self; diff --git a/lib/WebGUI/Form.pm b/lib/WebGUI/Form.pm index 69575d2ac..3312257b1 100644 --- a/lib/WebGUI/Form.pm +++ b/lib/WebGUI/Form.pm @@ -144,7 +144,8 @@ sub formHeader { my $enctype = (exists $params->{enctype} && $params->{enctype} ne "") ? $params->{enctype} : "multipart/form-data"; # Fix a query string in the action URL - my $hidden = csrfToken($session); + use WebGUI::Form::CsrfToken; + my $hidden = WebGUI::Form::CsrfToken->new($session)->toHtml; if ($action =~ /\?/) { ($action, my $query) = split /\?/, $action, 2; my @params = split /[&;]/, $query; diff --git a/lib/WebGUI/Role/Asset/Comments.pm b/lib/WebGUI/Role/Asset/Comments.pm index 989d6e2d6..49d3788d7 100644 --- a/lib/WebGUI/Role/Asset/Comments.pm +++ b/lib/WebGUI/Role/Asset/Comments.pm @@ -219,12 +219,16 @@ sub getFormattedComments { $out .= q{}.$comment->{alias}.q{: "}.WebGUI::HTML::format($comment->{comment},'text').q{"}; } if ($self->canComment) { + use WebGUI::Form::Hidden; + use WebGUI::Form::Textarea; + use WebGUI::Form::CommentRating; + use WebGUI::Form::Submit; $out .= '
'; $out .= WebGUI::Form::formHeader($session, {action=>$self->getUrl}); - $out .= WebGUI::Form::hidden($session, {name=>"func",value=>"addComment"}); - $out .= WebGUI::Form::textarea($session, {name=>"comment"}); - $out .= WebGUI::Form::commentRating($session, {name=>"rating"}); - $out .= WebGUI::Form::submit($session); + $out .= WebGUI::Form::Hidden->new($session, {name=>"func",value=>"addComment"})->toHtml; + $out .= WebGUI::Form::Textarea->new($session, {name=>"comment"})->toHtml; + $out .= WebGUI::Form::CommentRating->new($session, {name=>"rating"})->toHtml; + $out .= WebGUI::Form::Submit->new($session)->toHtml; $out .= WebGUI::Form::formFooter($session); $out .= '
'; }