added most of the rest of the form controls
This commit is contained in:
parent
ce6ee697f9
commit
b86148acaa
12 changed files with 35 additions and 1870 deletions
|
|
@ -815,7 +815,8 @@ sub www_editField {
|
|||
-name=>"type",
|
||||
-label=>WebGUI::International::get(23,"Asset_DataForm"),
|
||||
-hoverHelp=>WebGUI::International::get('23 description',"Asset_DataForm"),
|
||||
-value=>$field{type} || "text"
|
||||
-value=>$field{type} || "text",
|
||||
-types=>[qw(dateTime time float zipcode text textarea HTMLArea url date email phone integer yesNo selectList radioList checkList)]
|
||||
);
|
||||
$f->integer(
|
||||
-name=>"width",
|
||||
|
|
|
|||
|
|
@ -158,95 +158,6 @@ sub dynamicField {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 fieldType ( hashRef )
|
||||
|
||||
Returns a field type select list field. This is primarily useful for building dynamic form builders.
|
||||
|
||||
=head3 name
|
||||
|
||||
The name field for this form element.
|
||||
|
||||
=head3 types
|
||||
|
||||
An array reference of field types to be displayed. The field names are the names of the methods from this forms package. Note that not all field types are supported. Defaults to all.
|
||||
|
||||
=head3 value
|
||||
|
||||
The default value for this form element.
|
||||
|
||||
=head3 size
|
||||
|
||||
The number of characters tall this form element should be. Defaults to "1".
|
||||
|
||||
=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 fieldType {
|
||||
my $params = shift;
|
||||
my (%hash, $output, $type);
|
||||
tie %hash, 'Tie::IxHash';
|
||||
# NOTE: What you are about to see is bad code. Do not attempt this
|
||||
# without adult supervision. =)
|
||||
my @types = qw(dateTime time float zipcode text textarea HTMLArea url date email phone integer yesNo selectList radioList checkList);
|
||||
$params->{types} = \@types unless ($params->{types});
|
||||
foreach $type (@{$params->{types}}) {
|
||||
if ($type eq "text") {
|
||||
$hash{text} = WebGUI::International::get(475);
|
||||
} elsif ($type eq "timeField") {
|
||||
$hash{timeField} = WebGUI::International::get(971);
|
||||
} elsif ($type eq "dateTime") {
|
||||
$hash{dateTime} = WebGUI::International::get(972);
|
||||
} elsif ($type eq "textarea") {
|
||||
$hash{textarea} = WebGUI::International::get(476);
|
||||
} elsif ($type eq "HTMLArea") {
|
||||
$hash{HTMLArea} = WebGUI::International::get(477);
|
||||
} elsif ($type eq "url") {
|
||||
$hash{url} = WebGUI::International::get(478);
|
||||
} elsif ($type eq "date") {
|
||||
$hash{date} = WebGUI::International::get(479);
|
||||
} elsif ($type eq "float") {
|
||||
$hash{float} = WebGUI::International::get("float");
|
||||
} elsif ($type eq "email") {
|
||||
$hash{email} = WebGUI::International::get(480);
|
||||
} elsif ($type eq "phone") {
|
||||
$hash{phone} = WebGUI::International::get(481);
|
||||
} elsif ($type eq "integer") {
|
||||
$hash{integer} = WebGUI::International::get(482);
|
||||
} elsif ($type eq "yesNo") {
|
||||
$hash{yesNo} = WebGUI::International::get(483);
|
||||
} elsif ($type eq "selectList") {
|
||||
$hash{selectList} = WebGUI::International::get(484);
|
||||
} elsif ($type eq "radioList") {
|
||||
$hash{radioList} = WebGUI::International::get(942);
|
||||
} elsif ($type eq "checkList") {
|
||||
$hash{checkList} = WebGUI::International::get(941);
|
||||
} elsif ($type eq "zipcode") {
|
||||
$hash{zipcode} = WebGUI::International::get(944);
|
||||
} elsif ($type eq "checkbox") {
|
||||
$hash{checkbox} = WebGUI::International::get(943);
|
||||
}
|
||||
}
|
||||
return selectList({
|
||||
options=>\%hash,
|
||||
name=>$params->{name},
|
||||
value=>[$params->{value}],
|
||||
extras=>$params->{extras},
|
||||
size=>$params->{size},
|
||||
defaultValue=>[$params->{defaultValue}]
|
||||
});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 file ( hashRef )
|
||||
|
|
@ -311,53 +222,6 @@ sub files {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 filterContent ( hashRef )
|
||||
|
||||
Returns a select list containing the content filter options. This is for use with WebGUI::HTML::filter().
|
||||
|
||||
=head3 name
|
||||
|
||||
The name field for this form element. This defaults to "filterContent".
|
||||
|
||||
=head3 value
|
||||
|
||||
The default value for this form element.
|
||||
|
||||
=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 filterContent {
|
||||
my $params = shift;
|
||||
my %filter;
|
||||
tie %filter, 'Tie::IxHash';
|
||||
%filter = (
|
||||
'none'=>WebGUI::International::get(420),
|
||||
'macros'=>WebGUI::International::get(891),
|
||||
'javascript'=>WebGUI::International::get(526),
|
||||
'most'=>WebGUI::International::get(421),
|
||||
'all'=>WebGUI::International::get(419)
|
||||
);
|
||||
my $name = $params->{name} || "filterContent";
|
||||
return selectList({
|
||||
name=>$name,
|
||||
options=>\%filter,
|
||||
value=>[$params->{value}],
|
||||
extras=>$params->{extras},
|
||||
defaultValue=>[$params->{defaultValue}]
|
||||
});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 formFooter ( )
|
||||
|
|
@ -415,524 +279,6 @@ sub formHeader {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 ldapLink ( hashRef )
|
||||
|
||||
Returns a select list of ldap links.
|
||||
|
||||
=head3 name
|
||||
|
||||
The name field for this form element. Defaults to "ldapLinkId".
|
||||
|
||||
=head3 value
|
||||
|
||||
The default value(s) for this form element. This should be passed as an array reference.
|
||||
|
||||
=head3 defaultValue
|
||||
|
||||
This will be used if no value is specified. Defaults to 0 (the WebGUI database).
|
||||
|
||||
=head3 size
|
||||
|
||||
The number of characters tall this form element should be. Defaults to "1".
|
||||
|
||||
=head3 multiple
|
||||
|
||||
A boolean value for whether this select list should allow multiple selections. Defaults to "0".
|
||||
|
||||
=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()"'
|
||||
|
||||
=cut
|
||||
|
||||
sub ldapLink {
|
||||
my $params = shift;
|
||||
my $value = $params->{value} || [$params->{defaultValue}] || [0];
|
||||
my $name = $params->{name} || "ldapLinkId";
|
||||
my $size = $params->{size} || 1;
|
||||
my $multiple = $params->{multiple} || 0;
|
||||
my $extras = $params->{extras} || "";
|
||||
return selectList({
|
||||
name=>$name,
|
||||
options=>WebGUI::LDAPLink::getList(),
|
||||
value=>$value,
|
||||
size=>$size,
|
||||
multiple=>$multiple,
|
||||
extras=>$extras
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 password ( hashRef )
|
||||
|
||||
Returns a password 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 "35".
|
||||
|
||||
=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. Defaults to "30" unless overridden in the settings.
|
||||
|
||||
=head3 defaultValue
|
||||
|
||||
This will be used if no value is specified.
|
||||
|
||||
=cut
|
||||
|
||||
sub password {
|
||||
my $params = shift;
|
||||
my $value = _fixQuotes($params->{value}||$params->{defaultValue});
|
||||
my $maxLength = $params->{maxlength} || 35;
|
||||
my $size = $params->{size} || $session{setting}{textBoxSize} || 30;
|
||||
return '<input type="password" name="'.$params->{name}.'" value="'.$value.'" size="'.
|
||||
$size.'" maxlength="'.$maxLength.'" '.$params->{extras}.' />';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 phone ( hashRef )
|
||||
|
||||
Returns a telephone number 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.
|
||||
|
||||
=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 phone {
|
||||
my $params = shift;
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}.'/inputCheck.js',{ type=>'text/javascript' });
|
||||
my $maxLength = $params->{maxlength} || 30;
|
||||
return text({
|
||||
name=>$params->{name},
|
||||
maxlength=>$maxLength,
|
||||
extras=>'onkeyup="doInputCheck(this.form.'.$params->{name}.',\'0123456789-()+ \')" '.$params->{extras},
|
||||
value=>$params->{value},
|
||||
size=>$params->{size},
|
||||
defaultValue=>$params->{defaultValue}
|
||||
});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 radio ( hashRef )
|
||||
|
||||
Returns a radio button.
|
||||
|
||||
=head3 name
|
||||
|
||||
The name field for this form element.
|
||||
|
||||
=head3 checked
|
||||
|
||||
If you'd like this radio button to be defaultly checked, set this to "1".
|
||||
|
||||
=head3 value
|
||||
|
||||
The default value for this form element.
|
||||
|
||||
=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 radio {
|
||||
my $params = shift;
|
||||
my $checkedText = ' checked="1"' if ($params->{checked});
|
||||
my $value = defined($params->{value}) ? $params->{value} : $params->{defaultValue};
|
||||
return '<input type="radio" name="'.$params->{name}.'" value="'.$value.'"'.$checkedText.' '.$params->{extras}.' />';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 radioList ( hashRef )
|
||||
|
||||
Returns a radio button list field.
|
||||
|
||||
=head3 name
|
||||
|
||||
The name field for this form element.
|
||||
|
||||
=head3 options
|
||||
|
||||
The list of options for this list. Should be passed as a hash reference.
|
||||
|
||||
=head3 value
|
||||
|
||||
The default value for this form element. This should be passed as a scalar.
|
||||
|
||||
=head3 vertical
|
||||
|
||||
If set to "1" the radio button elements will be laid out horizontally. Defaults to "0".
|
||||
|
||||
=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 radioList {
|
||||
my $params = shift;
|
||||
my ($output, $key, $checked);
|
||||
my $value = defined($params->{value}) ? $params->{value} : $params->{defaultValue};
|
||||
foreach $key (keys %{$params->{options}}) {
|
||||
$checked = 0;
|
||||
$checked = 1 if ($key eq $value);
|
||||
$output .= radio({
|
||||
name=>$params->{name},
|
||||
value=>$key,
|
||||
checked=>$checked,
|
||||
extras=>$params->{extras}
|
||||
});
|
||||
$output .= ' '.$params->{options}->{$key};
|
||||
if ($params->{vertical}) {
|
||||
$output .= "<br />\n";
|
||||
} else {
|
||||
$output .= " \n";
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 submit ( hashRef )
|
||||
|
||||
Returns a submit button.
|
||||
|
||||
=head3 value
|
||||
|
||||
The button text for this submit button.
|
||||
|
||||
=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. Defaults to "save".
|
||||
|
||||
=cut
|
||||
|
||||
sub submit {
|
||||
my $params = shift;
|
||||
my $value = $params->{value} || $params->{defaultValue} || WebGUI::International::get(62);
|
||||
$value = _fixQuotes($value);
|
||||
my $wait = WebGUI::International::get(452);
|
||||
my $extras = $params->{extras} || 'onclick="this.value=\''.$wait.'\'"';
|
||||
return '<input type="submit" value="'.$value.'" '.$extras.' />';
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 template ( hashRef )
|
||||
|
||||
Returns a select list of templates.
|
||||
|
||||
=head3 name
|
||||
|
||||
The name field for this form element. Defaults to "templateId".
|
||||
|
||||
=head3 value
|
||||
|
||||
The unique identifier for the selected template.
|
||||
|
||||
=head3 namespace
|
||||
|
||||
The namespace for the list of templates to return. If this is omitted, all templates will be displayed.
|
||||
|
||||
=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 template {
|
||||
my $params = shift;
|
||||
my $templateId = $params->{value} || $params->{defaultValue};
|
||||
my $name = $params->{name} || "templateId";
|
||||
my $userId = $session{user}{userId};
|
||||
my $templateList = WebGUI::Asset::Template->getList($params->{namespace});
|
||||
|
||||
#Remove entries from template list that the user does not have permission to view.
|
||||
for my $assetId ( keys %{$templateList} ) {
|
||||
my $asset = WebGUI::Asset::Template->new($assetId);
|
||||
|
||||
if (!$asset->canView($userId)) {
|
||||
delete $templateList->{$assetId};
|
||||
}
|
||||
}
|
||||
return selectList({
|
||||
name=>$name,
|
||||
options=>$templateList,
|
||||
value=>[$templateId],
|
||||
extras=>$params->{extras}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 timeField ( hashRef )
|
||||
|
||||
Returns a time field, 24 hour format.
|
||||
|
||||
=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 8.
|
||||
|
||||
=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. Defaults to 8.
|
||||
|
||||
=head3 defaultValue
|
||||
|
||||
This will be used if no value is specified. Defaults to now.
|
||||
|
||||
=cut
|
||||
|
||||
sub timeField {
|
||||
my $params = shift;
|
||||
my $value = WebGUI::DateTime::secondsToTime($params->{value}||$params->{defaultValue});
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}.'/inputCheck.js',{ type=>'text/javascript' });
|
||||
my $output = text({
|
||||
name=>$params->{name},
|
||||
value=>$value,
|
||||
size=>$params->{size} || 8,
|
||||
extras=>'onKeyUp="doInputCheck(this.form.'.$params->{name}.',\'0123456789:\')" '.$params->{extras},
|
||||
maxlength=>$params->{maxlength} || 8
|
||||
});
|
||||
$output .= '<input type="button" style="font-size: 8pt;" onClick="window.timeField = this.form.'.
|
||||
$params->{name}.';clockSet = window.open(\''.$session{config}{extrasURL}.
|
||||
'/timeChooser.html\',\'timeChooser\',\'WIDTH=230,HEIGHT=100\');return false" value="'.
|
||||
WebGUI::International::get(970).'" />';
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 url ( hashRef )
|
||||
|
||||
Returns a URL 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 2048.
|
||||
|
||||
=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 url {
|
||||
my $params = shift;
|
||||
my $maxLength = $params->{maxlength} || 2048;
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}.'/addHTTP.js',{ type=>'text/javascript' });
|
||||
return text({
|
||||
name=>$params->{name},
|
||||
value=>$params->{value},
|
||||
extras=>$params->{extras}.' onBlur="addHTTP(this.form.'.$params->{name}.')"',
|
||||
size=>$params->{size},
|
||||
maxlength=>$maxLength,
|
||||
defaultValue=>$params->{defaultValue}
|
||||
});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 whatNext ( hashRef ] )
|
||||
|
||||
Returns a "What next?" select list for use with chained action forms in WebGUI.
|
||||
|
||||
=head3 options
|
||||
|
||||
A hash reference of the possible actions that could happen next.
|
||||
|
||||
=head3 value
|
||||
|
||||
The selected element in this list.
|
||||
|
||||
=head3 name
|
||||
|
||||
The name field for this form element. Defaults to "proceed".
|
||||
|
||||
=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 whatNext {
|
||||
my $params = shift;
|
||||
my $name = $params->{name} || "proceed";
|
||||
return selectList({
|
||||
options=>$params->{options},
|
||||
name=>$name,
|
||||
value=>[$params->{value}],
|
||||
extras=>$params->{extras},
|
||||
defaultValue=>[$params->{defaultValue}]
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 yesNo ( hashRef )
|
||||
|
||||
Returns a yes/no radio field.
|
||||
|
||||
=head3 name
|
||||
|
||||
The name field for this form element.
|
||||
|
||||
=head3 value
|
||||
|
||||
The default value(s) for this form element. Valid values are "1" and "0". Defaults to "1".
|
||||
|
||||
=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. Defaults to 1.
|
||||
|
||||
=cut
|
||||
|
||||
sub yesNo {
|
||||
my $params = shift;
|
||||
my ($checkYes, $checkNo);
|
||||
my $value = $params->{value}||$params->{defaultValue};
|
||||
if ($value) {
|
||||
$checkYes = 1;
|
||||
} else {
|
||||
$checkNo = 1;
|
||||
}
|
||||
my $output = radio({
|
||||
checked=>$checkYes,
|
||||
name=>$params->{name},
|
||||
value=>1,
|
||||
extras=>$params->{extras}
|
||||
});
|
||||
$output .= WebGUI::International::get(138);
|
||||
$output .= ' ';
|
||||
$output .= radio({
|
||||
checked=>$checkNo,
|
||||
name=>$params->{name},
|
||||
value=>0,
|
||||
extras=>$params->{extras}
|
||||
});
|
||||
$output .= WebGUI::International::get(139);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ Add extra attributes to the form tag like
|
|||
|
||||
=head4 label
|
||||
|
||||
A text label that will be displayed if toHtmlWithWrapper() is called.
|
||||
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to the getName() method call.
|
||||
|
||||
=head4 uiLevel
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ sub definition {
|
|||
defaultValue=>undef
|
||||
},
|
||||
label=>{
|
||||
defaultValue=>undef
|
||||
defaultValue=>$class->getName
|
||||
},
|
||||
uiLevel=>{
|
||||
defaultValue=>1
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ Renders and input tag of type checkbox.
|
|||
|
||||
sub toHtml {
|
||||
my $self = shift;
|
||||
my $value = $self->fixQuotes($self->{value});
|
||||
my $value = $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($self->{value})));
|
||||
my $checkedText = ' checked="checked"' if ($self->{checked});
|
||||
return '<input type="checkbox" name="'.$self->{name}.'" value="'.$value.'"'.$checkedText.' '.$self->{extras}.' />';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ use WebGUI::Grouping;
|
|||
use WebGUI::Icon;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::URL;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -61,11 +62,7 @@ A database link id. Defaults to "0", which is the WebGUI database.
|
|||
|
||||
=head4 afterEdit
|
||||
|
||||
A URL that will be acted upon after editing a database link. Typically there is a link next to the select list that reads "Edit this database link" and this is the URL to go to after editing is complete.
|
||||
|
||||
=head4 label
|
||||
|
||||
A label displayed next to the field when toHtmlWithWrapper() is called. Defaults to "Database Link".
|
||||
A URL that will be acted upon after editing a database link.
|
||||
|
||||
=head4 hoverHelp
|
||||
|
||||
|
|
@ -86,9 +83,6 @@ sub definition {
|
|||
afterEdit=>{
|
||||
defaultValue=>undef
|
||||
},
|
||||
label=>{
|
||||
defaultValue=>WebGUI::International::get(1075)
|
||||
},
|
||||
hoverHelp=>{
|
||||
defaultValue=>WebGUI::International::get('1075 description')
|
||||
},
|
||||
|
|
@ -121,7 +115,8 @@ sub toHtml {
|
|||
return WebGUI::Form::selectList->new(
|
||||
name=>$self->{name},
|
||||
options=>WebGUI::DatabaseLink::getList(),
|
||||
value=>[$self->{value}]
|
||||
value=>[$self->{value}],
|
||||
extras=>$self->{extras}
|
||||
)->toHtml;
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +135,7 @@ sub toHtmlWithWrapper {
|
|||
if ($self->{afterEdit}) {
|
||||
$subtext = editIcon("op=editDatabaseLink&lid=".$self->{value}."&afterEdit=".WebGUI::URL::escape($self->{afterEdit}));
|
||||
}
|
||||
$subtext = .= manageIcon("op=listDatabaseLinks");
|
||||
$subtext .= manageIcon("op=listDatabaseLinks");
|
||||
$self->{subtext} = $subtext . $self->{subtext};
|
||||
}
|
||||
return $self->SUPER::toHtmlWithWrapper;
|
||||
|
|
@ -148,5 +143,6 @@ sub toHtmlWithWrapper {
|
|||
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ sub getValueFromPost {
|
|||
if (scalar(@data)) {
|
||||
return wantarray ? @data : join("\n",@data);
|
||||
}
|
||||
return wantarray ? @[2] : 2;
|
||||
return wantarray ? @{[2]} : 2;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -176,8 +176,7 @@ Renders the form field to HTML as a table row complete with labels, subtext, hov
|
|||
sub toHtmlWithWrapper {
|
||||
my $self = shift;
|
||||
if (WebGUI::Grouping::isInGroup(3)) {
|
||||
my $subtext;
|
||||
$subtext = .= manageIcon("op=listGroups");
|
||||
my $subtext = manageIcon("op=listGroups");
|
||||
$self->{subtext} = $subtext . $self->{subtext};
|
||||
}
|
||||
return $self->SUPER::toHtmlWithWrapper;
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ sub toHtml {
|
|||
extras=>$self->{extras}
|
||||
)->toHtml
|
||||
.WebGUI::Form::selectList->new(
|
||||
options=>\%units
|
||||
options=>\%units,
|
||||
name=>$self->{name}."_units",
|
||||
value=>[$self->{value}]
|
||||
)->toHtml;
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ sub getValueFromPost {
|
|||
|
||||
=head2 toHtml ( )
|
||||
|
||||
Renders an input tag of type text.
|
||||
Renders a zip code field.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
|
|||
|
|
@ -44,9 +44,6 @@ These functions are available from this package:
|
|||
|
||||
=cut
|
||||
|
||||
sub _checkEmailAddy {
|
||||
return ($_[0] =~ /^([A-Z0-9]+[._+-]?){1,}([A-Z0-9]+[_+-]?)+\@(([A-Z0-9]+[._-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -70,76 +67,6 @@ sub AUTOLOAD {
|
|||
return $class->new({name=>$fieldName})->getValueFromPost;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 fieldType ( name )
|
||||
|
||||
Returns a field type. Defaults to "text".
|
||||
|
||||
=head3 name
|
||||
|
||||
The name of the form variable to retrieve.
|
||||
|
||||
=cut
|
||||
|
||||
sub fieldType {
|
||||
return ($session{form}{$_[0]} || "text");
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 filterContent ( name )
|
||||
|
||||
Returns a scalar filter type. Defaults to "most".
|
||||
|
||||
=head3 name
|
||||
|
||||
The name of the form variable to retrieve.
|
||||
|
||||
=cut
|
||||
|
||||
sub filterContent {
|
||||
return ($session{form}{$_[0]} || "most");
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 password ( name )
|
||||
|
||||
Returns a string.
|
||||
|
||||
=head3 name
|
||||
|
||||
The name of the form variable to retrieve.
|
||||
|
||||
=cut
|
||||
|
||||
sub password {
|
||||
return $session{form}{$_[0]};
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 phone ( name )
|
||||
|
||||
Returns a string filtered to allow only digits, spaces, and these special characters: + - ( )
|
||||
|
||||
=head3 name
|
||||
|
||||
The name of the form variable to retrieve.
|
||||
|
||||
=cut
|
||||
|
||||
sub phone {
|
||||
if ($session{form}{$_[0]} =~ /^[\d\s\-\+\(\)]+$/) {
|
||||
return $session{form}{$_[0]};
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -180,128 +107,5 @@ sub process {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 radio ( name )
|
||||
|
||||
Returns a string.
|
||||
|
||||
=head3 name
|
||||
|
||||
The name of the form variable to retrieve.
|
||||
|
||||
=cut
|
||||
|
||||
sub radio {
|
||||
return $session{form}{$_[0]};
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 radioList ( name )
|
||||
|
||||
Returns a string.
|
||||
|
||||
=head3 name
|
||||
|
||||
The name of the form variable to retrieve.
|
||||
|
||||
=cut
|
||||
|
||||
sub radioList {
|
||||
return $session{form}{$_[0]};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 template ( name )
|
||||
|
||||
Returns a template id. Defaults to "1".
|
||||
|
||||
=head3 name
|
||||
|
||||
The name of the form variable to retrieve.
|
||||
|
||||
=cut
|
||||
|
||||
sub template {
|
||||
if (exists $session{form}{$_[0]}) {
|
||||
return $session{form}{$_[0]};
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 timeField ( name )
|
||||
|
||||
Returns the number of seconds since 00:00:00 on a 24 hour clock. Note, this will adjust for the user's time offset in the reverse manner that the form field
|
||||
adjusts for it in order to make the times come out appropriately.
|
||||
|
||||
=head3 name
|
||||
|
||||
The name of the form variable to retrieve.
|
||||
|
||||
=cut
|
||||
|
||||
sub timeField {
|
||||
return WebGUI::DateTime::timeToSeconds($session{form}{$_[0]})-($session{user}{timeOffset}*3600);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 url ( name )
|
||||
|
||||
Returns a URL.
|
||||
|
||||
=head3 name
|
||||
The name of the form variable to retrieve.
|
||||
|
||||
=cut
|
||||
|
||||
sub url {
|
||||
if ($session{form}{$_[0]} =~ /mailto:/) {
|
||||
return $session{form}{$_[0]};
|
||||
} elsif (_checkEmailAddy($session{form}{$_[0]})) {
|
||||
return "mailto:".$session{form}{$_[0]};
|
||||
} elsif ($session{form}{$_[0]} =~ /^\// || $session{form}{$_[0]} =~ /:\/\// || $session{form}{$_[0]} =~ /^\^/) {
|
||||
return $session{form}{$_[0]};
|
||||
}
|
||||
return "http://".$session{form}{$_[0]};
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 yesNo ( name )
|
||||
|
||||
Returns either a 1 or 0 or undef representing yes, no, and undefined. Defaults to "0".
|
||||
|
||||
=head3 name
|
||||
|
||||
The name of the form variable to retrieve.
|
||||
|
||||
=cut
|
||||
|
||||
sub yesNo {
|
||||
if ($session{form}{$_[0]} > 0) {
|
||||
return 1;
|
||||
}
|
||||
elsif ($session{form}{$_[0]} eq "") {
|
||||
return undef;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -215,7 +215,8 @@ sub www_editProfileField {
|
|||
-label=>WebGUI::International::get(486,"WebGUIProfile"),
|
||||
-hoverHelp=>WebGUI::International::get('486 description',"WebGUIProfile"),
|
||||
-value=>$data{dataType},
|
||||
-defaultValue=>"text"
|
||||
-defaultValue=>"text",
|
||||
-types=>[qw(dateTime time float zipcode text textarea HTMLArea url date email phone integer yesNo selectList radioList checkList)]
|
||||
);
|
||||
$f->textarea(
|
||||
-name => "dataValues",
|
||||
|
|
|
|||
|
|
@ -3270,11 +3270,6 @@ Privileges and styles assigned to pages in the package will not be copied when t
|
|||
lastUpdated => 1031514049
|
||||
},
|
||||
|
||||
'356' => {
|
||||
message => q|Template|,
|
||||
lastUpdated => 1031514049
|
||||
},
|
||||
|
||||
'38' => {
|
||||
message => q|You do not have sufficient privileges to perform this operation. Please ^a(log in with an account); that has sufficient privileges before attempting this operation.|,
|
||||
lastUpdated => 1031514049
|
||||
|
|
@ -3343,6 +3338,24 @@ Privileges and styles assigned to pages in the package will not be copied when t
|
|||
context => q|Field type name|
|
||||
},
|
||||
|
||||
'radio' => {
|
||||
message => q|Radio Button|,
|
||||
lastUpdated =>0,
|
||||
context => q|Field type name|
|
||||
},
|
||||
|
||||
'read only' => {
|
||||
message => q|Read Only|,
|
||||
lastUpdated =>0,
|
||||
context => q|Field type name|
|
||||
},
|
||||
|
||||
'submit' => {
|
||||
message => q|Submit|,
|
||||
lastUpdated =>0,
|
||||
context => q|Field type name|
|
||||
},
|
||||
|
||||
'button' => {
|
||||
message => q|Button|,
|
||||
lastUpdated =>0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue