added param() method to $session->form

This commit is contained in:
JT Smith 2006-01-23 05:23:21 +00:00
parent f64ec77d8a
commit 68b05cff5c
2 changed files with 40 additions and 3 deletions

View file

@ -1664,14 +1664,14 @@ sub www_manageAssets {
} }
if ($hasClips) { if ($hasClips) {
$output .= '<div style="width: 28%; float: left; padding-right: 30px; font-size: 14px;"><fieldset><legend>'.$i18n->get(1082).'</legend>' $output .= '<div style="width: 28%; float: left; padding-right: 30px; font-size: 14px;"><fieldset><legend>'.$i18n->get(1082).'</legend>'
.WebGUI::Form::formHeader($self->session,) .WebGUI::Form::formHeader($self->session)
.WebGUI::Form::hidden($self->session,{name=>"func",value=>"pasteList"}) .WebGUI::Form::hidden($self->session,{name=>"func",value=>"pasteList"})
.WebGUI::Form::checkbox($self->session,{extras=>'onchange="toggleClipboardSelectAll(this.form);"'}) .WebGUI::Form::checkbox($self->session,{extras=>'onchange="toggleClipboardSelectAll(this.form);"'})
.' '.$i18n->get("select all").'<br />' .' '.$i18n->get("select all").'<br />'
.WebGUI::Form::checkList($self->session,{name=>"assetId",vertical=>1,options=>\%options}) .WebGUI::Form::checkList($self->session,{name=>"assetId",vertical=>1,options=>\%options})
.'<br />' .'<br />'
.WebGUI::Form::submit($self->session,{value=>"Paste"}) .WebGUI::Form::submit($self->session,{value=>"Paste"})
.WebGUI::Form::formFooter($self->session,) .WebGUI::Form::formFooter($self->session)
.' </fieldset></div> ' .' </fieldset></div> '
.'<script type="text/javascript"> .'<script type="text/javascript">
//<![CDATA[ //<![CDATA[

View file

@ -116,11 +116,48 @@ sub new {
} }
#-------------------------------------------------------------------
=head2 param ( field )
Retrieves a form field post from the HTTP request.
=head3 field
The name of the field to retrieve.
=cut
sub param {
my $self = shift;
my $field = shift;
if ($field) {
if ($self->session->request) {
return $self->session->request->body($field) || $self->session->request->param($field);
} else {
return undef;
}
} else {
if ($self->session->request) {
my @params = ();
foreach ($self->session->request->param) {
push(@params, $_);
}
foreach ($self->session->request->body) {
push(@params, $_);
}
return @params;
} else {
return undef;
}
}
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 paramsHashRef ( ) =head2 paramsHashRef ( )
Gets a hash ref of all the params passed in, and their values. Gets a hash ref of all the params passed in to this class, and their values. This should not be confused with the param() method.
=cut =cut