a bugfix for sql report and a few more updates to the form system

This commit is contained in:
JT Smith 2005-07-27 18:38:41 +00:00
parent 4eaf8c3827
commit ce6ee697f9
5 changed files with 29 additions and 513 deletions

View file

@ -391,240 +391,7 @@ sub filterContent {
}
#-------------------------------------------------------------------
=head2 float ( name [, label, value, maxlength, extras, subtext, size, uiLevel, defaultValue ] )
Adds an integer row to this form.
=head3 name
The name field for this form element.
=head3 label
The left column label for this form row.
=head3 value
The default value for this form element.
=head3 maxlength
The maximum number of characters to allow in this form element. Defaults to 11.
=head3 extras
If you want to add anything special to this form element like javascript actions, or stylesheet information, you'd add it in here as follows:
'onChange="this.form.submit()"'
=head3 subtext
Extra text to describe this form element or to provide special instructions.
=head3 size
The number of characters wide this form element should be. There should be no reason for anyone to specify this.
=head3 uiLevel
The UI level for this field. See the WebGUI developer's site for details. Defaults to "0".
=head3 defaultValue
When no other value is specified, this will be used.
=head3 hoverHelp
A string of text or HTML to be displayed when a user's mouse hover's over a field label. It is meant to describe to the user what to use the field for.
=cut
sub float {
my ($output);
my ($self, @p) = @_;
my ($name, $label, $value, $maxlength, $extras, $subtext, $size, $uiLevel, $defaultValue, $hoverHelp) =
rearrange([qw(name label value maxlength extras subtext size uiLevel defaultValue hoverHelp)], @p);
if (_uiLevelChecksOut($uiLevel)) {
$output = WebGUI::Form::float({
"name"=>$name,
"value"=>$value,
"maxlength"=>$maxlength,
"size"=>$size,
"extras"=>$extras,
defaultValue=>$defaultValue
});
$output .= _subtext($subtext);
$output = $self->_tableFormRow($label,$output,$hoverHelp);
} else {
$output = WebGUI::Form::hidden({
"name"=>$name,
"value"=>$value,
defaultValue=>$defaultValue
});
}
$self->{_data} .= $output;
}
#-------------------------------------------------------------------
=head2 group ( name [, label, value, size, multiple, extras, subtext, uiLevel, excludeGroups, defaultValue ] )
Adds a group pull-down to this form. A group pull down provides a select list that provides name value pairs for all the groups in the WebGUI system.
=head3 name
The name field for this form element.
=head3 label
The left column label for this form row.
=head3 value
The default value(s) for this form element. This should be passed as an array reference.
=head3 size
How many rows should be displayed at once?
=head3 multiple
Set to "1" if multiple groups should be selectable.
=head3 extras
If you want to add anything special to this form element like javascript actions, or stylesheet information, you'd add it in here as follows:
'onChange="this.form.submit()"'
=head3 subtext
Extra text to describe this form element or to provide special instructions.
=head3 uiLevel
The UI level for this field. See the WebGUI developer's site for details. Defaults to "0".
=head3 excludeGroups
An array reference containing a list of groups to exclude from the list.
=head3 defaultValue
When no other value is specified, this will be used. Should be passed as an array reference. Defaults to "7" (Everyone).
=head3 hoverHelp
A string of text or HTML to be displayed when a user's mouse hover's over a field label. It is meant to describe to the user what to use the field for.
=cut
sub group {
my ($output);
my ($self, @p) = @_;
my ($name, $label, $value, $size, $multiple, $extras, $subtext, $uiLevel, $excludeGroups, $defaultValue, $hoverHelp) =
rearrange([qw(name label value size multiple extras subtext uiLevel excludeGroups defaultValue hoverHelp)], @p);
if (_uiLevelChecksOut($uiLevel)) {
if (WebGUI::Grouping::isInGroup(3)) {
$subtext = manageIcon("op=listGroups").$subtext;
}
$output = WebGUI::Form::group({
"name"=>$name,
"size"=>$size,
"value"=>$value,
"multiple"=>$multiple,
"extras"=>$extras,
excludeGroups=>$excludeGroups,
defaultValue=>$defaultValue
});
$output .= _subtext($subtext);
$output = $self->_tableFormRow($label,$output,$hoverHelp);
} else {
my $hashRef = WebGUI::SQL->buildHashRef("select groupId,groupName from groups");
$output = WebGUI::Form::hiddenList({
"name"=>$name,
"options"=>$hashRef,
"value"=>$value,
defaultValue=>$defaultValue
});
}
$self->{_data} .= $output;
}
#-------------------------------------------------------------------
=head2 interval ( name [, label, value, extras, subtext, uiLevel, defaultValue ] )
Adds a time interval row to this form.
=head3 name
The the base name for this form element. This form element actually returns two values under different names. They are name_interval and name_units.
=head3 label
The left column label for this form row.
=head3 value
The number of seconds in this interval.
=head3 extras
If you want to add anything special to this form element like javascript actions, or stylesheet information, you'd add it in here as follows:
'onChange="this.form.submit()"'
=head3 subtext
Extra text to describe this form element or to provide special instructions.
=head3 uiLevel
The UI level for this field. See the WebGUI developer's site for details. Defaults to "0".
=head3 defaultValue
When no value is specified, we'll use this instead. Defaults to 1.
=head3 hoverHelp
A string of text or HTML to be displayed when a user's mouse hover's over a field label. It is meant to describe to the user what to use the field for.
=cut
sub interval {
my ($output);
my ($self, @p) = @_;
my ($name, $label, $value, $extras, $subtext, $uiLevel, $defaultValue, $hoverHelp) =
rearrange([qw(name label value extras subtext uiLevel defaultValue hoverHelp)], @p);
if (_uiLevelChecksOut($uiLevel)) {
$output = WebGUI::Form::interval({
"name"=>$name,
"value"=>$value,
"extras"=>$extras,
defaultValue=>$defaultValue
});
$output .= _subtext($subtext);
$output = $self->_tableFormRow($label,$output,$hoverHelp);
} else {
my ($interval, $units) = WebGUI::DateTime::secondsToInterval($value||$defaultValue||1);
$output = WebGUI::Form::hidden({
"name"=>$name.'_interval',
"value"=>$interval
});
$output .= WebGUI::Form::hidden({
"name"=>$name.'_units',
"value"=>$units
});
}
$self->{_data} .= $output;
}
#-------------------------------------------------------------------