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

@ -415,178 +415,6 @@ sub formHeader {
}
#-------------------------------------------------------------------
=head2 float ( hashRef )
Returns an floating point field.
=head3 name
The name field for this form element.
=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 size
The number of characters wide this form element should be. There should be no reason for anyone to specify this.
=head3 defaultValue
This will be used if no value is specified.
=cut
sub float {
my $params = shift;
my $value = $params->{value} || 0;
my $size = $params->{size} || 11;
WebGUI::Style::setScript($session{config}{extrasURL}.'/inputCheck.js',{ type=>'text/javascript' });
return text({
name=>$params->{name},
value=>$value,
size=>$size,
extras=>'onKeyUp="doInputCheck(this.form.'.$params->{name}.',\'0123456789.\')" '.$params->{extras},
maxlength=>$params->{maxlength},
defaultValue=>$params->{defaultValue}
});
}
#-------------------------------------------------------------------
=head2 group ( hashRef ] )
Returns a group pull-down field. 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 value
The selected group id(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 excludeGroups
An array reference containing a list of groups to exclude from the list.
=head3 defaultValue
This will be used if no value is specified. Should be passed as an array reference. Defaults to 7 (Everyone).
=cut
sub group {
my $params = shift;
my (%hash, $value, $where);
$value = $params->{value};
if ($$value[0] eq "") { #doing long form otherwise arrayRef didn't work
$value = [7];
}
tie %hash, 'Tie::IxHash';
my $exclude = $params->{excludeGroups};
if ($$exclude[0] ne "") {
$where = "and groupId not in (".quoteAndJoin($exclude).")";
}
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where showInForms=1 $where order by groupName");
return selectList({
options=>\%hash,
name=>$params->{name},
value=>$value,
extras=>$params->{extras},
size=>$params->{size},
multiple=>$params->{multiple},
defaultValue=>$params->{defaultValue}
});
}
#-------------------------------------------------------------------
=head2 interval ( hashRef )
Returns a time interval field.
=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 intervalValue
The default value for interval portion of this form element. Defaults to '1'.
=head3 unitsValue
The default value for units portion of this form element. Defaults to 'seconds'. Possible values are 'seconds', 'minutes', 'hours', 'days', 'weeks', 'months', and 'years'.
=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 defaultValue
This will be used if no value is specified.
=cut
sub interval {
my $params = shift;
my (%units);
my $value = $params->{value} || $params->{defaultValue} || 1;
tie %units, 'Tie::IxHash';
%units = ('seconds'=>WebGUI::International::get(704),
'minutes'=>WebGUI::International::get(705),
'hours'=>WebGUI::International::get(706),
'days'=>WebGUI::International::get(700),
'weeks'=>WebGUI::International::get(701),
'months'=>WebGUI::International::get(702),
'years'=>WebGUI::International::get(703));
my ($interval, $units) = WebGUI::DateTime::secondsToInterval($value);
my $output = integer({
name=>$params->{name}.'_interval',
value=>$interval,
extras=>$params->{extras}
});
$output .= selectList({
name=>$params->{name}.'_units',
value=>[$units],
options=>\%units
});
return $output;
}
#-------------------------------------------------------------------
=head2 ldapLink ( hashRef )