diff --git a/lib/WebGUI/Asset/Wobject/SQLReport.pm b/lib/WebGUI/Asset/Wobject/SQLReport.pm index 14f47ed4b..71ebca8fb 100644 --- a/lib/WebGUI/Asset/Wobject/SQLReport.pm +++ b/lib/WebGUI/Asset/Wobject/SQLReport.pm @@ -285,19 +285,23 @@ sub _storeQueries { #------------------------------------------------------------------- sub _parsePlaceholderParams { - my $self = shift; - my $params = shift; - my @placeholderParams; - foreach my $param (split /\s*,\s*/, $params) { - if($param =~ /^form:/) { - $param = $session{form}{$'}; - } elsif ($param =~ /^query(\d):/) { - $param = $self->{_query}{$1}{rowData}{$'}; - } - $param = WebGUI::Macro::process($param); - push(@placeholderParams, $param); - } - return \@placeholderParams; + my $self = shift; + my $params = shift; + my @placeholderParams; + foreach my $row (split(/\n/,$params)) { + next unless $row ne ""; + my ($type,$field) = split(/:/,$row); + chop($field); + my $param; + if($type =~ /^form/) { + $param = $session{form}{$field}; + } elsif ($param =~ /^query(\d)/) { + $param = $self->{_query}{$1}{rowData}{$field}; + } + $param = WebGUI::Macro::process($param); + push(@placeholderParams, $param); + } + return \@placeholderParams; } diff --git a/lib/WebGUI/Form.pm b/lib/WebGUI/Form.pm index c2ffa6f8c..e6fb90b57 100644 --- a/lib/WebGUI/Form.pm +++ b/lib/WebGUI/Form.pm @@ -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 ) diff --git a/lib/WebGUI/FormProcessor.pm b/lib/WebGUI/FormProcessor.pm index aa4a69748..e71ec0edc 100644 --- a/lib/WebGUI/FormProcessor.pm +++ b/lib/WebGUI/FormProcessor.pm @@ -104,101 +104,6 @@ sub filterContent { } -#------------------------------------------------------------------- - -=head2 float ( name ) - -Returns a floating point (decimal) number. Defaults to "0.0". - -=head3 name - -The name of the form variable to retrieve. - -=cut - -sub float { - if ($session{form}{$_[0]} =~ /^[\d\.\-]+$/) { - return $session{form}{$_[0]}; - } - return 0.0; -} - - -#------------------------------------------------------------------- - -=head2 group ( name ) - -Returns a group Id. Defaults to 2 (registered users). - -=head3 name - -The name of the form variable to retrieve. - -=cut - -sub group { - my $value = selectList($_[0]); - if (defined $value) { - return $value; - } - return 2; -} - - -#------------------------------------------------------------------- - -=head2 hiddenList ( name ) - -Returns an array or a carriage return ("\n") separated scalar depending upon whether you're returning the values into an array or a scalar. - -=head3 name - -The name of the form variable to retrieve. - -=cut - -sub hiddenList { - return selectList($_[0]); -} - - -#------------------------------------------------------------------- - -=head2 integer ( name ) - -Returns an integer. Defaults to "0". - -=head3 name - -The name of the form variable to retrieve. - -=cut - -sub integer { - if ($session{form}{$_[0]} =~ /^[\d\-]+$/) { - return $session{form}{$_[0]}; - } - return 0; -} - - -#------------------------------------------------------------------- - -=head2 interval ( name ) - -Returns an interval in seconds. Defaults to "0". - -=head3 name - -The name of the form variable to retrieve. - -=cut - -sub interval { - my $val = WebGUI::DateTime::intervalToSeconds($session{form}{$_[0]."_interval"},$session{form}{$_[0]."_units"}) || 0; - return $val; -} - #------------------------------------------------------------------- diff --git a/lib/WebGUI/HTMLForm.pm b/lib/WebGUI/HTMLForm.pm index b7005b17b..f12b0dded 100644 --- a/lib/WebGUI/HTMLForm.pm +++ b/lib/WebGUI/HTMLForm.pm @@ -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; -} #------------------------------------------------------------------- diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index 9c4c120f2..575829c79 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -3325,6 +3325,18 @@ Privileges and styles assigned to pages in the package will not be copied when t context => q|Field type name| }, + 'interval' => { + message => q|Interval|, + lastUpdated =>0, + context => q|Field type name| + }, + + 'group' => { + message => q|Group|, + lastUpdated =>0, + context => q|Field type name| + }, + 'codearea' => { message => q|Code Area|, lastUpdated =>0,