removing these files because they need to be renamed to uppercase starting letters

This commit is contained in:
JT Smith 2005-08-23 14:49:57 +00:00
parent c132a72b7b
commit 9fee20bc5b
31 changed files with 0 additions and 4139 deletions

View file

@ -1,129 +0,0 @@
package WebGUI::Form::asset;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Asset;
use WebGUI::Form::button;
use WebGUI::Form::hidden;
use WebGUI::Form::text;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::asset
=head1 DESCRIPTION
Creates an asset selector field.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 name
The name of the field. Defaults to "asset".
=head4 class
Limits the list of selectable assets to a specific class, such as "WebGUI::Asset::Wobject::Article", specified by this parameter.
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
label=>{
defaultValue=>$class->getName()
},
name=>{
defaultValue=> "asset"
},
class=>{
defaultValue=> undef
},
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("asset","Asset");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders an asset selector.
=cut
sub toHtml {
my $self = shift;
my $asset = WebGUI::Asset->newByDynamicClass($self->{value}) || WebGUI::Asset->getRoot;
return WebGUI::Form::hidden->new(
name=>$self->{name},
extras=>$self->{extras},
value=>$asset->getId,
id=>$self->{id}
)->toHtml
.WebGUI::Form::text->new(
name=>$self->{name}."_display",
extras=>' readonly="1" ',
value=>$asset->get("title"),
id=>$self->{id}."_display"
)->toHtml
.WebGUI::Form::button->new(
value=>"...",
extras=>'onclick="window.open(\''.$asset->getUrl("op=formAssetTree&classLimiter=".$self->{class}."&formId=".$self->{id}).'\',\'assetPicker\',\'toolbar=no, location=no, status=no, directories=no, width=400, height=400\');"'
)->toHtml;
}
1;

View file

@ -1,96 +0,0 @@
package WebGUI::Form::button;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::button
=head1 DESCRIPTION
Creates a form button.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 defaultValue
The default text to appear on the button. Defaults to an internationalized version of the word "save".
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
defaultValue=>{
defaultValue=>WebGUI::International::get(62,"WebGUI")
},
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("button","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a button.
=cut
sub toHtml {
my $self = shift;
my $value = $self->fixQuotes($self->{value});
return '<input type="button" name="'.$self->{name}.'" value="'.$value.'" id="'.$self->{id}.'" '.$self->{extras}.' />';
}
1;

View file

@ -1,164 +0,0 @@
package WebGUI::Form::checkList;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Form::checkbox;
use WebGUI::Form::hiddenList;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::checkList
=head1 DESCRIPTION
Creates a series of check box form fields.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control. Also take a look ath WebGUI::Form::checkbox as this class creates a list of checkboxes.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 options
A hash reference containing key values that will be returned with the form post and displayable text pairs. Defaults to an empty hash reference.
=head4 defaultValue
An array reference of the items to be checked if no value is specified. Defaults to an empty array reference.
=head4 vertical
Boolean representing whether the checklist should be represented vertically or horizontally. If set to "1" will be displayed vertically. Defaults to "0".
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
options=>{
defaultValue=>{}
},
defaultValue=>{
defaultValue=>[],
},
vertical=>{
defaultValue=>0
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("941","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns an array or a carriage return ("\n") separated scalar depending upon whether you're returning the values into an array or a scalar.
=cut
sub getValueFromPost {
my $self = shift;
my @data = $session{cgi}->param($self->{name});
return wantarray ? @data : join("\n",@data);
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a series of checkboxes.
=cut
sub toHtml {
my $self = shift;
my $output;
foreach my $key (keys %{$self->{options}}) {
my $checked = 0;
foreach my $item (@{$self->{value}}) {
if ($item eq $key) {
$checked = 1;
}
}
$output .= WebGUI::Form::checkbox->new({
name=>$self->{name},
value=>$key,
extras=>$self->{extras},
checked=>$checked
})->toHtml;
$output .= ${$self->{options}}{$key};
if ($self->{vertical}) {
$output .= "<br />\n";
} else {
$output .= " &nbsp; &nbsp;\n";
}
}
return $output;
}
#-------------------------------------------------------------------
=head2 toHtmlAsHidden ( )
Creates a series of hidden fields representing the data in the list.
=cut
sub toHtmlAsHidden {
my $self = shift;
return WebGUI::Form::hiddenList->new(
value=>$self->{value},
defaultValue=>$self->{defaultValue},
name=>$self->{name},
options=>$self->{options}
)->toHtmlAsHidden;
}
1;

View file

@ -1,118 +0,0 @@
package WebGUI::Form::checkbox;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::checkbox
=head1 DESCRIPTION
Creates a check box form field.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 checked
Defaults to "0". Set to "1" if this field should be checked.
=head4 defaultValue
The value returned by this field if it is checked and no value is specified. Defaults to "1".
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
checked=>{
defaultValue=> 0
},
defaultValue=>{
defaultValue=>1
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 generateIdParameter ( )
A class method that returns a value to be used as the autogenerated ID for this field instance. Returns undef because this field type can have more than one with the same name, therefore autogenerated ID's aren't terribly useful.
=cut
sub generateIdParameter {
return undef
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("943","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders and input tag of type checkbox.
=cut
sub toHtml {
my $self = shift;
my $value = $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($self->{value})));
my $checkedText = ' checked="checked"' if ($self->{checked});
my $idText = ' id="'.$self->{id}.'" ' if ($self->{id});
return '<input type="checkbox" name="'.$self->{name}.'" value="'.$value.'"'.$idText.$checkedText.' '.$self->{extras}.' />';
}
1;

View file

@ -1,72 +0,0 @@
package WebGUI::Form::codearea;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::textarea';
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
=head1 NAME
Package WebGUI::Form::codearea
=head1 DESCRIPTION
Creates a code area form field, which is just like a text area except stretches to fit it's space and allows tabs in it's content.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::textarea.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("codearea","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a code area field.
=cut
sub toHtml {
my $self = shift;
WebGUI::Style::setScript($session{config}{extrasURL}.'/TabFix.js',{type=>"text/javascript"});
$self->{extras} .= ' style="width: 99%; min-width: 440px; height: 400px" onkeypress="return TabFix_keyPress(event)" onkeydown="return TabFix_keyDown(event)"';
return $self->SUPER::toHtml;
}
1;

View file

@ -1,84 +0,0 @@
package WebGUI::Form::color;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
=head1 NAME
Package WebGUI::Form::color
=head1 DESCRIPTION
Creates a color picker which returns hex colors like #000000.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("color","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns a hex color like "#000000". Returns undef if the return value is not a valid color.
=cut
sub getValueFromPost {
my $self = shift;
my $color = $session{cgi}->param($self->{name});
return undef unless $color =~ /\#\w{6}/;
return $color;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a color picker control.
=cut
sub toHtml {
my $self = shift;
WebGUI::Style::setScript($session{config}{extrasURL}.'/colorPicker.js',{ type=>'text/javascript' });
return '<script type="text/javascript">initColorPicker("'.$self->{name}.'","'.($self->{value}).'");</script>';
}
1;

View file

@ -1,94 +0,0 @@
package WebGUI::Form::combo;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::selectList';
use WebGUI::Form::text;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::combo
=head1 DESCRIPTION
Creates a select list merged with a text box form control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::selectList.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("combobox","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns an array or a carriage return ("\n") separated scalar depending upon whether you're returning the values into an array or a scalar.
=cut
sub getValueFromPost {
my $self = shift;
if ($session{cgi}->param($self->{name}."_new")) {
return $session{cgi}->param($self->{name}."_new");
}
return $self->SUPER::getValueFromPost;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a combo box form control.
=cut
sub toHtml {
my $self = shift;
$self->{options}->{''} = '['.WebGUI::International::get(582).']';
$self->{options}->{_new_} = WebGUI::International::get(581).'-&gt;';
return $self->SUPER::toHtml
.WebGUI::Form::text->new(
size=>$session{setting}{textBoxSize}-5,
name=>$self->{name}."_new",
id=>$self->{id}."_new"
)->toHtml;
}
1;

View file

@ -1,145 +0,0 @@
package WebGUI::Form::contentType;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Form::selectList;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::contentType
=head1 DESCRIPTION
Creates a content type selector which can be used in conjunction with WebGUI::HTML::filter().
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 types
An array reference of field types to be displayed. The types are "mixed", "html", "code", and "text". Defaults to all.
=head4 defaultValue
An array reference of the items to be checked if no value is specified. Defaults to "mixed". Possible values are "mixed", "code", "html", and "text".
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
label=>{
defaultValue=>$class->getName()
},
types=>{
defaultValue=>[qw(mixed html code text)]
},
defaultValue=>{
defaultValue=>"mixed",
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("1007","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns either what's posted or if nothing comes back it returns "mixed".
=cut
sub getValueFromPost {
my $self = shift;
return $session{cgi}->param($self->{name}) || "mixed";
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a select list form control.
=cut
sub toHtml {
my $self = shift;
my %types;
foreach my $type (@{$self->{types}}) {
if ($type eq "text") {
$types{text} = WebGUI::International::get(1010);
} elsif ($type eq "mixed") {
$types{mixed} = WebGUI::International::get(1008);
} elsif ($type eq "code") {
$types{code} = WebGUI::International::get(1011);
} elsif ($type eq "html") {
$types{html} = WebGUI::International::get(1009);
}
}
return WebGUI::Form::selectList->new(
options=>\%types,
id=>$self->{id},
name=>$self->{name},
value=>[$self->{value}],
extras=>$self->{extras},
defaultValue=>[$self->{defaultValue}]
)->toHtml;
}
1;

View file

@ -1,156 +0,0 @@
package WebGUI::Form::databaseLink;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::DatabaseLink;
use WebGUI::Form::selectList;
use WebGUI::Grouping;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Session;
use WebGUI::URL;
=head1 NAME
Package WebGUI::Form::databaseLink
=head1 DESCRIPTION
Creates a database connection chooser control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 name
The identifier for this field. Defaults to "databaseLinkId".
=head4 defaultValue
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.
=head4 hoverHelp
A tooltip to tell the user what to do with the field. Defaults a standard piece of help for Database Links.
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
label=>{
defaultValue=>$class->getName()
},
name=>{
defaultValue=>"databaseLinkId"
},
defaultValue=>{
defaultValue=>0
},
afterEdit=>{
defaultValue=>undef
},
hoverHelp=>{
defaultValue=>WebGUI::International::get('1075 description')
},
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("1075","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a database connection picker control.
=cut
sub toHtml {
my $self = shift;
return WebGUI::Form::selectList->new(
id=>$self->{id},
name=>$self->{name},
options=>WebGUI::DatabaseLink::getList(),
value=>[$self->{value}],
extras=>$self->{extras}
)->toHtml;
}
#-------------------------------------------------------------------
=head2 toHtmlWithWrapper ( )
Renders the form field to HTML as a table row complete with labels, subtext, hoverhelp, etc. Also adds manage and edit icons next to the field if the current user is in the admins group.
=cut
sub toHtmlWithWrapper {
my $self = shift;
if (WebGUI::Grouping::isInGroup(3)) {
my $subtext;
if ($self->{afterEdit}) {
$subtext = editIcon("op=editDatabaseLink&amp;lid=".$self->{value}."&amp;afterEdit=".WebGUI::URL::escape($self->{afterEdit}));
}
$subtext .= manageIcon("op=listDatabaseLinks");
$self->{subtext} = $subtext . $self->{subtext};
}
return $self->SUPER::toHtmlWithWrapper;
}
1;

View file

@ -1,149 +0,0 @@
package WebGUI::Form::date;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::text';
use WebGUI::DateTime;
use WebGUI::Form::text;
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
=head1 NAME
Package WebGUI::Form::date
=head1 DESCRIPTION
Accepts and returns and epoch date and creates a date picker control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::text.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the superclass for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 maxlength
Defaults to 10. Determines the maximum number of characters allowed in this field.
=head4 size
Defaults to 10. The displayed size of the box for the date to be typed in.
=head4 noDate
By default a date is placed in the value field. Set this to "1" to leave it empty.
=head4 defaultValue
If no value is specified, this will be used. Defaults to today and now.
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
defaultValue=>{
defaultValue=>time()
},
maxlength=>{
defaultValue=> 10
},
size=>{
defaultValue=> 10
},
noDate=>{
defaultValue=>0
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("479","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns a validated form post result. If the result does not pass validation, it returns undef instead.
=cut
sub getValueFromPost {
my $self = shift;
return WebGUI::DateTime::setToEpoch($session{cgi}->param($self->{name}));
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a date picker control.
=cut
sub toHtml {
my $self = shift;
$self->{value} = WebGUI::DateTime::epochToSet($self->{value}) unless ($self->{noDate} && $self->{value} eq '');
my $language = WebGUI::International::getLanguage($session{user}{language},"languageAbbreviation");
unless ($language) {
$language = WebGUI::International::getLanguage("English","languageAbbreviation");
}
WebGUI::Style::setScript($session{config}{extrasURL}.'/calendar/calendar.js',{ type=>'text/javascript' });
WebGUI::Style::setScript($session{config}{extrasURL}.'/calendar/lang/calendar-'.$language.'.js',{ type=>'text/javascript' });
WebGUI::Style::setScript($session{config}{extrasURL}.'/calendar/calendar-setup.js',{ type=>'text/javascript' });
WebGUI::Style::setLink($session{config}{extrasURL}.'/calendar/calendar-win2k-1.css', { rel=>"stylesheet", type=>"text/css", media=>"all" });
my $mondayFirst = $session{user}{firstDayOfWeek} ? "true" : "false";
return $self->WebGUI::Form::text::toHtml . '<script type="text/javascript">
Calendar.setup({
inputField : "'.$self->{id}.'",
ifFormat : "%Y-%m-%d",
showsTime : false,
timeFormat : "12",
mondayFirst : '.$mondayFirst.'
});
</script>';
}
1;

View file

@ -1,148 +0,0 @@
package WebGUI::Form::dateTime;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::text';
use WebGUI::DateTime;
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
=head1 NAME
Package WebGUI::Form::dateTime
=head1 DESCRIPTION
Accepts and returns and epoch date and creates a date picker control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::text.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the superclass for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 maxlength
Defaults to 19. Determines the maximum number of characters allowed in this field.
=head4 size
Defaults to 19. The displayed size of the box for the date to be typed in.
=head4 defaultValue
If no value is specified, this will be used. Defaults to today and now.
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
defaultValue=>{
defaultValue=>time()
},
maxlength=>{
defaultValue=> 19
},
size=>{
defaultValue=> 19
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("972","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns a validated form post result. If the result does not pass validation, it returns undef instead.
=cut
sub getValueFromPost {
my $self = shift;
return WebGUI::DateTime::setToEpoch($session{cgi}->param($self->{name}));
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a date picker control.
=cut
sub toHtml {
my $self = shift;
my $value = WebGUI::DateTime::epochToSet($self->{value},1);
my $language = WebGUI::International::getLanguage($session{user}{language},"languageAbbreviation");
unless ($language) {
$language = WebGUI::International::getLanguage("English","languageAbbreviation");
}
WebGUI::Style::setScript($session{config}{extrasURL}.'/calendar/calendar.js',{ type=>'text/javascript' });
WebGUI::Style::setScript($session{config}{extrasURL}.'/calendar/lang/calendar-'.$language.'.js',{ type=>'text/javascript' });
WebGUI::Style::setScript($session{config}{extrasURL}.'/calendar/calendar-setup.js',{ type=>'text/javascript' });
WebGUI::Style::setLink($session{config}{extrasURL}.'/calendar/calendar-win2k-1.css', { rel=>"stylesheet", type=>"text/css", media=>"all" });
my $mondayFirst = $session{user}{firstDayOfWeek} ? "true" : "false";
return WebGUI::Form::text->new(
name=>$self->{name},
value=>$value,
size=>$self->{size},
extras=>$self->{extras},
id=>$self->{id},
maxlength=>$self->{maxlength}
)->toHtml . '<script type="text/javascript">
Calendar.setup({
inputField : "'.$self->{id}.'",
ifFormat : "%Y-%m-%d %H:%M:%S",
showsTime : true,
timeFormat : "12",
mondayFirst : '.$mondayFirst.'
});
</script>';
}
1;

View file

@ -1,87 +0,0 @@
package WebGUI::Form::email;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::text';
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
=head1 NAME
Package WebGUI::Form::email
=head1 DESCRIPTION
Creates an email field.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::text.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("480","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns a validated email address. If the result does not pass validation, it returns undef instead.
=cut
sub getValueFromPost {
my $self = shift;
my $value = $session{cgi}->param($self->{name});
if ($value =~ /^([A-Z0-9]+[._+-]?){1,}([A-Z0-9]+[_+-]?)+\@(([A-Z0-9]+[._-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i) {
return $value;
}
return undef;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders an email address field.
=cut
sub toHtml {
my $self = shift;
WebGUI::Style::setScript($session{config}{extrasURL}.'/emailCheck.js',{ type=>'text/javascript' });
$self->{extras} .= ' onchange="emailCheck(this.value)" ';
return $self->SUPER::toHtml;
}
1;

View file

@ -1,164 +0,0 @@
package WebGUI::Form::fieldType;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Form::selectList;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::fieldType
=head1 DESCRIPTION
Creates a form control that will allow you to select a form control type.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 size
Defaults to 1. How many characters tall should this control be represented.
=head4 types
An array reference containing the form control types to be selectable. Defaults to all available types.
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
label=>{
defaultValue=>$class->getName()
},
size=>{
defaultValue=>1
},
types=>{
defaultValue=>$class->getTypes
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("744","WebGUI");
}
#-------------------------------------------------------------------
=head2 getTypes ( )
A class method that returns an array reference of all the form control types present in the system.
=cut
sub getTypes {
my $class = shift;
opendir(DIR,$session{config}{webguiRoot}."/lib/WebGUI/Form/");
my @rawTypes = readdir(DIR);
closedir(DIR);
my @types;
foreach my $type (@rawTypes) {
if ($type =~ /^(.*)\.pm$/) {
next if ($1 eq "Control");
push(@types,$1);
}
}
return \@types;
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns either what's posted or if nothing comes back it returns "text".
=cut
sub getValueFromPost {
my $self = shift;
return $session{cgi}->param($self->{name}) || "text";
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a question selector asking the user where they want to go.
=cut
sub toHtml {
my $self = shift;
my %options;
foreach my $type (@{$self->{types}}) {
my $class = "WebGUI::Form::".$type;
my $cmd = "use ".$class;
eval ($cmd);
if ($@) {
WebGUI::ErrorHandler::error("Couldn't compile form control: ".$type.". Root cause: ".$@);
next;
}
$options{$type} = $class->getName;
}
return WebGUI::Form::selectList->new(
id=>$self->{id},
name=>$self->{name},
options=>\%options,
value=>[$self->{value}],
extras=>$self->{extras},
size=>$self->{size}
)->toHtml;
}
1;

View file

@ -1,156 +0,0 @@
package WebGUI::Form::file;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Style;
=head1 NAME
Package WebGUI::Form::file
=head1 DESCRIPTION
Creates a text input box form field.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 name
If no name is specified a default name of "file" will be used.
=head4 maxAttachments
Defaults to 1. Determines how many files the user can upload with this form control.
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
name=>{
defaultValue=>"file"
},
maxAttachments=>{
defaultValue=>1
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("file","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns the storageId for the storage location that the file(s) got uploaded to. Returns undef if no files were uploaded.
=cut
sub getValueFromPost {
my $self = shift;
my $storage = WebGUI::Storage->create;
$storage->addFileFromFormPost($self->{name});
my @files = $storage->getFiles;
if (scalar(@files) < 1) {
$storage->delete;
return undef;
} else {
return $storage->getId;
}
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a file upload control.
=cut
sub toHtml {
my $self = shift;
WebGUI::Style::setScript($session{config}{extrasURL}.'/FileUploadControl.js',{type=>"text/javascript"});
my $uploadControl = '<script type="text/javascript">
var fileIcons = new Array();
';
opendir(DIR,$session{config}{extrasPath}.'/fileIcons');
my @files = readdir(DIR);
closedir(DIR);
foreach my $file (@files) {
unless ($file eq "." || $file eq "..") {
my $ext = $file;
$ext =~ s/(.*?)\.gif/$1/;
$uploadControl .= 'fileIcons["'.$ext.'"] = "'.$session{config}{extrasURL}.'/fileIcons/'.$file.'";'."\n";
}
}
$uploadControl .= 'var uploader = new FileUploadControl("'.$self->{name}.'", fileIcons, "'.WebGUI::International::get('removeLabel','WebGUI').'","'.$self->{maxAttachments}.'");
uploader.addRow();
</script>';
return $uploadControl;
}
#-------------------------------------------------------------------
=head4 toHtmlAsHidden ( )
Returns undef.
=cut
sub toHtmlAsHidden {
return undef;
}
1;

View file

@ -1,142 +0,0 @@
package WebGUI::Form::filterContent;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use Tie::IxHash;
use WebGUI::Form::selectList;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::filterContent
=head1 DESCRIPTION
Creates a select list containing the content filter options. This is for use with WebGUI::HTML::filter().
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 name
The name of this field to be passed through the URI. Defaults to "filterContent".
=head4 hoverHelp
A tooltip for what to do with this field. Defaults to a general explaination of content filters.
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
label=>{
defaultValue=>$class->getName()
},
name=>{
defaultValue=>"filterContent"
},
hoverHelp=>{
defaultValue=>WebGUI::International::get('418 description')
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("418","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns either what's posted or if nothing comes back it returns "most".
=cut
sub getValueFromPost {
my $self = shift;
return $session{cgi}->param($self->{name}) || "most";
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Returns a select list containing the content filter options. This is for use with WebGUI::HTML::filter().
=cut
sub toHtml {
my $self = 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)
);
return WebGUI::Form::selectList->new(
id=>$self->{id},
options=>\%filter,
name=>$self->{name},
value=>[$self->{value}],
extras=>$self->{extras},
defaultValue=>[$self->{defaultValue}]
)->toHtml;
}
1;

View file

@ -1,129 +0,0 @@
package WebGUI::Form::float;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::text';
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
=head1 NAME
Package WebGUI::Form::float
=head1 DESCRIPTION
Returns a floating point number (decimal) field.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::text.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the superclass for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 maxlength
Defaults to 14. Determines the maximum number of characters allowed in this field.
=head4 defaultValue
Defaults to 0. Used if no value is specified.
=head4 size
Defaults to 11. The number of characters that will be displayed at once in this field. Usually no need to override the default.
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
maxlength=>{
defaultValue=> 14
},
defaultValue=>{
defaultValue=>0
},
size=>{
defaultValue=>11
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("float","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns the integer from the form post, or returns 0.0 if the post result is invalid.
=cut
sub getValueFromPost {
my $self = shift;
my $value = $session{cgi}->param($self->{name});
if ($value =~ /^[\d\-\.]+$/) {
return $value;
}
return 0.0;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a floating point field.
=cut
sub toHtml {
my $self = shift;
WebGUI::Style::setScript($session{config}{extrasURL}.'/inputCheck.js',{ type=>'text/javascript' });
$self->{extras} .= ' onkeyup="doInputCheck(this.form.'.$self->{name}.',\'0123456789-.\')"';
return $self->SUPER::toHtml;
}
1;

View file

@ -1,195 +0,0 @@
package WebGUI::Form::group;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Form::hiddenList;
use WebGUI::Form::selectList;
use WebGUI::Grouping;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Session;
use WebGUI::SQL;
=head1 NAME
Package WebGUI::Form::group
=head1 DESCRIPTION
Creates a group chooser field.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 size
How many rows should be displayed at once? Defaults to 1.
=head4 multiple
Set to "1" if multiple groups should be selectable. Defaults to 0.
=head4 excludeGroups
An array reference containing a list of groups to exclude from the list. Defaults to an empty array reference.
=head4 defaultValue
This will be used if no value is specified. Should be passed as an array reference. Defaults to 7 (Everyone).
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
label=>{
defaultValue=>$class->getName()
},
size=>{
defaultValue=>1
},
defaultValue=>{
defaultValue=>[7]
},
multiple=>{
defaultValue=>0
},
excludeGroups=>{
defaultValue=>[]
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("group","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns either what's posted or if nothing comes back it returns "2" the ID of the Registered Users group.
=cut
sub getValueFromPost {
my $self = shift;
my @data = $session{cgi}->param($self->{name});
if (scalar(@data)) {
return wantarray ? @data : join("\n",@data);
}
return wantarray ? @{[2]} : 2;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
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.
=cut
sub toHtml {
my $self = shift;
my $where;
if ($self->{excludeGroups}[0] ne "") {
$where = "and groupId not in (".quoteAndJoin($self->{excludeGroups}).")";
}
return WebGUI::Form::selectList->new(
options=>WebGUI::SQL->buildHashRef("select groupId,groupName from groups where showInForms=1 $where order by groupName"),
name=>$self->{name},
id=>$self->{id},
value=>$self->{value},
extras=>$self->{extras},
size=>$self->{size},
multiple=>$self->{multiple},
defaultValue=>$self->{defaultValue}
)->toHtml;
}
#-------------------------------------------------------------------
=head2 toHtmlAsHidden ( )
Creates a series of hidden fields representing the data in the list.
=cut
sub toHtmlAsHidden {
my $self = shift;
return WebGUI::Form::hiddenList->new(
value=>$self->{value},
defaultValue=>$self->{defaultValue},
name=>$self->{name},
options=>WebGUI::SQL->buildHashRef("select groupId,groupName from groups")
)->toHtmlAsHidden;
}
#-------------------------------------------------------------------
=head2 toHtmlWithWrapper ( )
Renders the form field to HTML as a table row complete with labels, subtext, hoverhelp, etc. Also adds a manage icon next to the field if the current user is in the admins group.
=cut
sub toHtmlWithWrapper {
my $self = shift;
if (WebGUI::Grouping::isInGroup(3)) {
my $subtext = manageIcon("op=listGroups");
$self->{subtext} = $subtext . $self->{subtext};
}
return $self->SUPER::toHtmlWithWrapper;
}
1;

View file

@ -1,108 +0,0 @@
package WebGUI::Form::hidden;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::hidden
=head1 DESCRIPTION
Creates a hidden field.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 generateIdParameter ( )
A class method that returns a value to be used as the autogenerated ID for this field instance. Returns undef because this field type can have more than one with the same name, therefore autogenerated ID's aren't terribly useful.
=cut
sub generateIdParameter {
return undef
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("hidden","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
A synonym for toHtmlAsHidden.
=cut
sub toHtml {
my $self = shift;
$self->toHtmlAsHidden;
}
#-------------------------------------------------------------------
=head2 toHtmlAsHidden ( )
Renders an input tag of type hidden.
=cut
sub toHtmlAsHidden {
my $self = shift;
my $value = $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($self->{value})));
my $idText = ' id="'.$self->{id}.'" ' if ($self->{id});
return '<input type="hidden" name="'.$self->{name}.'" value="'.$value.'" '.$self->{extras}.$idText.' />'."\n";
}
#-------------------------------------------------------------------
=head2 toHtmlWithWrapper ( )
A synonym for toHtmlAsHidden.
=cut
sub toHtmlWithWrapper {
my $self = shift;
return $self->toHtmlAsHidden;
}
1;

View file

@ -1,140 +0,0 @@
package WebGUI::Form::hiddenList;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::hiddenList
=head1 DESCRIPTION
Creates a list of hidden fields. This is to be used by list type controls (selectList, checkList, etc) to store their vaiuses as hidden values.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 options
A hash reference containing name value pairs. The name of each pair will be used to fill the value attribute of the hidden field. Defaults to an empty hash reference.
=head4 defaultValue
value and defaultValue are array referneces containing the names from the options list that should be stored.
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
options=>{
defaultValue=>{}
},
defaultValue=>{
defaultValue=>[]
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("hidden list","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
A synonym for toHtmlAsHidden.
=cut
sub toHtml {
my $self = shift;
$self->toHtmlAsHidden;
}
#-------------------------------------------------------------------
=head2 toHtmlAsHidden ( )
Renders an input tag of type hidden.
=cut
sub toHtmlAsHidden {
my $self = shift;
my $output;
foreach my $key (keys %{$self->{options}}) {
foreach my $item (@{$self->{values}}) {
if ($item eq $key) {
$output .= hidden({
name=>$self->{name},
value=>$self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($key)))
});
}
}
}
return $output;
}
#-------------------------------------------------------------------
=head2 toHtmlWithWrapper ( )
A synonym for toHtmlAsHidden.
=cut
sub toHtmlWithWrapper {
my $self = shift;
return $self->toHtmlAsHidden;
}
1;

View file

@ -1,129 +0,0 @@
package WebGUI::Form::integer;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::text';
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
=head1 NAME
Package WebGUI::Form::integer
=head1 DESCRIPTION
Creates an input field that accepts positive and negative integer.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::text.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the superclass for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 maxlength
Defaults to 11. Determines the maximum number of characters allowed in this field.
=head4 defaultValue
Defaults to 0. Used if no value is specified.
=head4 size
Defaults to 11. The number of characters that will be displayed at once in this field. Usually no need to override the default.
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
maxlength=>{
defaultValue=> 11
},
defaultValue=>{
defaultValue=>0
},
size=>{
defaultValue=>11
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("482","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns the integer from the form post, or returns 0 if the post result is invalid.
=cut
sub getValueFromPost {
my $self = shift;
my $value = $session{cgi}->param($self->{name});
if ($value =~ /^[\d\-]+$/) {
return $value;
}
return 0;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders an integer field.
=cut
sub toHtml {
my $self = shift;
WebGUI::Style::setScript($session{config}{extrasURL}.'/inputCheck.js',{ type=>'text/javascript' });
$self->{extras} .= ' onkeyup="doInputCheck(this.form.'.$self->{name}.',\'0123456789-\')"';
return $self->SUPER::toHtml;
}
1;

View file

@ -1,156 +0,0 @@
package WebGUI::Form::interval;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use Tie::IxHash;
use WebGUI::DateTime;
use WebGUI::Form::hidden;
use WebGUI::Form::integer;
use WebGUI::Form::selectList;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::interval
=head1 DESCRIPTION
Creates an interval (hours, minutes, seconds, etc) selector.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 defaultValue
A time interval in seconds that is used if value is not specified. Defaults to 1.
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
defaultValue=>{
defaultValue=>1,
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("interval","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns either the interval that was posted (in seconds) or if nothing comes back it returns 0.
=cut
sub getValueFromPost {
my $self = shift;
return WebGUI::DateTime::intervalToSeconds($session{cgi}->param($self->{name}."_interval"),$session{cgi}->param($self->{name}."_units")) || 0;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders an interval control.
=cut
sub toHtml {
my $self = shift;
my %units;
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($self->{value});
return WebGUI::Form::integer->new(
name=>$self->{name}."_interval",
value=>$interval,
extras=>$self->{extras},
id=>$self->{id}."_interval",
)->toHtml
.WebGUI::Form::selectList->new(
options=>\%units,
name=>$self->{name}."_units",
id=>$self->{id}."_units",
value=>[$units]
)->toHtml;
}
#-------------------------------------------------------------------
=head2 toHtmlAsHidden ( )
Returns the field as hidden controls rather than displayable controls.
=cut
sub toHtmlAsHidden {
my $self = shift;
my ($interval, $units) = WebGUI::DateTime::secondsToInterval($self->{value});
return WebGUI::Form::hidden->new(
"name"=>$self->{name}.'_interval',
"value"=>$interval
)->toHtmlAsHidden
.WebGUI::Form::hidden->new(
"name"=>$self->{name}.'_units',
"value"=>$units
)->toHtmmlAsHidden;
}
1;

View file

@ -1,195 +0,0 @@
package WebGUI::Form::ldapLink;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::LDAPLink;
use WebGUI::Form::selectList;
use WebGUI::Grouping;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Session;
use WebGUI::URL;
=head1 NAME
Package WebGUI::Form::ldapLink
=head1 DESCRIPTION
Creates an LDAP connection chooser control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 name
The identifier for this field. Defaults to "ldapLinkId".
=head4 defaultValue
An LDAP link id. Defaults to "0", which is nothing.
=head4 afterEdit
A URL that will be acted upon after editing an LDAP link.
=head4 size
The number of characters tall this list should be. Defaults to '1'.
=head4 multiple
Boolean indicating whether the user can select multiple items from this list like a checkList. Defaults to "0".
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
label=>{
defaultValue=>$class->getName()
},
name=>{
defaultValue=>"ldapLinkId"
},
defaultValue=>{
defaultValue=>[0]
},
size=>{
defaultValue=>1
},
multiple=>{
defaultValue=>0
},
afterEdit=>{
defaultValue=>undef
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("LDAPLink_1075","AuthLDAP");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns an array or a carriage return ("\n") separated scalar depending upon whether you're returning the values into an array or a scalar.
=cut
sub getValueFromPost {
my $self = shift;
my @data = $session{cgi}->param($self->{name});
return wantarray ? @data : join("\n",@data);
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a database connection picker control.
=cut
sub toHtml {
my $self = shift;
return WebGUI::Form::selectList->new(
name=>$self->{name},
id=>$self->{id},
options=>WebGUI::LDAPLink::getList(),
value=>$self->{value},
multiple=>$self->{multiple},
size=>$self->{size},
extras=>$self->{extras}
)->toHtml;
}
#-------------------------------------------------------------------
=head2 toHtmlAsHidden ( )
Creates a series of hidden fields representing the data in the list.
=cut
sub toHtmlAsHidden {
my $self = shift;
return WebGUI::Form::hiddenList->new(
value=>$self->{value},
name=>$self->{name},
options=>WebGUI::LDAPLink::getList()
)->toHtmlAsHidden;
}
#-------------------------------------------------------------------
=head2 toHtmlWithWrapper ( )
Renders the form field to HTML as a table row complete with labels, subtext, hoverhelp, etc. Also adds manage and edit icons next to the field if the current user is in the admins group.
=cut
sub toHtmlWithWrapper {
my $self = shift;
if (WebGUI::Grouping::isInGroup(3)) {
my $subtext;
if ($self->{afterEdit}) {
$subtext = editIcon("op=editLDAPLink&amp;llid=".$self->{value}."&amp;afterEdit=".WebGUI::URL::escape($self->{afterEdit}));
}
$subtext .= manageIcon("op=listLDAPLinks");
$self->{subtext} = $subtext . $self->{subtext};
}
return $self->SUPER::toHtmlWithWrapper;
}
1;

View file

@ -1,177 +0,0 @@
package WebGUI::Form::selectList;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Form::hiddenList;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::selectList
=head1 DESCRIPTION
Creates a select list, aka dropdown list form control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 options
A hash reference containing key values that will be returned with the form post and displayable text pairs. Defaults to an empty hash reference.
=head4 defaultValue
An array reference of the items to be checked if no value is specified. Defaults to an empty array reference.
=head4 size
The number of characters tall this list should be. Defaults to '1'.
=head4 multiple
Boolean indicating whether the user can select multiple items from this list like a checkList. Defaults to "0".
=head4 sortByValue
A boolean value for whether or not the values in the options hash should be sorted. Defaults to "0".
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
options=>{
defaultValue=>{}
},
defaultValue=>{
defaultValue=>[],
},
multiple=>{
defaultValue=>0
},
sortByValue=>{
defaultValue=>0
},
size=>{
defaultValue=>1
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("484","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns an array or a carriage return ("\n") separated scalar depending upon whether you're returning the values into an array or a scalar.
=cut
sub getValueFromPost {
my $self = shift;
my @data = $session{cgi}->param($self->{name});
return wantarray ? @data : join("\n",@data);
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a select list form control.
=cut
sub toHtml {
my $self = shift;
my $multiple = ' multiple="1"' if ($self->{multiple});
my $output = '<select name="'.$self->{name}.'" size="'.$self->{size}.'" id="'.$self->{id}.'" '.$self->{extras}.$multiple.'>';
my %options;
tie %options, 'Tie::IxHash';
if ($self->{sortByValue}) {
foreach my $optionKey (sort {"\L${$self->{options}}{$a}" cmp "\L${$self->{options}}{$b}" } keys %{$self->{options}}) {
$options{$optionKey} = $self->{options}{$optionKey};
}
} else {
%options = %{$self->{options}};
}
foreach my $key (keys %options) {
$output .= '<option value="'.$key.'"';
foreach my $item (@{$self->{value}}) {
if ($item eq $key) {
$output .= ' selected="selected"';
}
}
$output .= '>'.${$self->{options}}{$key}.'</option>';
}
$output .= '</select>'."\n";
return $output;
}
#-------------------------------------------------------------------
=head2 toHtmlAsHidden ( )
Creates a series of hidden fields representing the data in the list.
=cut
sub toHtmlAsHidden {
my $self = shift;
return WebGUI::Form::hiddenList->new(
value=>$self->{value},
defaultValue=>$self->{defaultValue},
name=>$self->{name},
options=>$self->{options}
)->toHtmlAsHidden;
}
1;

View file

@ -1,149 +0,0 @@
package WebGUI::Form::template;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Asset::Template;
use WebGUI::Form::selectList;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Session;
use WebGUI::URL;
=head1 NAME
Package WebGUI::Form::template
=head1 DESCRIPTION
Creates a template chooser control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 name
The identifier for this field. Defaults to "templateId".
=head4 namespace
The namespace for the list of templates to return. If this is omitted, all templates will be displayed.
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
label=>{
defaultValue=>$class->getName()
},
name=>{
defaultValue=>"templateId"
},
namespace=>{
defaultValue=>undef
},
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("template","Asset_Template");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a database connection picker control.
=cut
sub toHtml {
my $self = shift;
my $templateList = WebGUI::Asset::Template->getList($self->{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($session{user}{userId})) {
delete $templateList->{$assetId};
}
}
return WebGUI::Form::selectList->new(
id=>$self->{id},
name=>$self->{name},
options=>$templateList,
value=>[$self->{value}],
extras=>$self->{extras}
)->toHtml;
}
#-------------------------------------------------------------------
=head2 toHtmlWithWrapper ( )
Renders the form field to HTML as a table row complete with labels, subtext, hoverhelp, etc. Also adds manage and edit icons next to the field if the current user is in the admins group.
=cut
sub toHtmlWithWrapper {
my $self = shift;
my $template = WebGUI::Asset::Template->new($self->{value});
if (defined $template && $template->canEdit) {
my $returnUrl;
if (exists $session{asset}) {
$returnUrl = "&proceed=goBackToPage&returnUrl=".WebGUI::URL::escape($session{asset}->getUrl);
}
my $buttons = editIcon("func=edit".$returnUrl,$template->get("url"));
$buttons .= manageIcon("func=manageAssets",$template->getParent->get("url"));
$self->{subtext} = $buttons . $self->{subtext};
}
return $self->SUPER::toHtmlWithWrapper;
}
1;

View file

@ -1,104 +0,0 @@
package WebGUI::Form::text;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::text
=head1 DESCRIPTION
Creates a text input box form field.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 maxlength
Defaults to 255. Determines the maximum number of characters allowed in this field.
=head4 size
Defaults to the setting textBoxSize or 30 if that's not set. Specifies how big of a text box to display.
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
maxlength=>{
defaultValue=> 255
},
size=>{
defaultValue=>$session{setting}{textBoxSize} || 30
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("475","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders an input tag of type text.
=cut
sub toHtml {
my $self = shift;
my $value = $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($self->{value})));
return '<input id="'.$self->{id}.'" type="text" name="'.$self->{name}.'" value="'.$value.'" size="'.$self->{size}.'" maxlength="'.$self->{maxlength}.'" '.$self->{extras}.' />';
}
1;

View file

@ -1,115 +0,0 @@
package WebGUI::Form::textarea;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::textarea
=head1 DESCRIPTION
Creates a text area form field.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 rows
The number of rows (in characters) tall the box should be. Defaults to the setting textAreaRows or 5 if that's not specified.
=head4 columns
The number of columns (in characters) wide the box should be. Defaults to the setting textAreaCols or 50 if that's not specified.
=head4 wrap
The style of wrapping this form should use. Defaults to "virtual". Other possible values are "off" and "physical".
=head
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
rows=>{
defaultValue=> $session{setting}{textAreaRows} || 5
},
columns=>{
defaultValue=> $session{setting}{textAreaCols} || 50
},
wrap=>{
defaultValue=>"virtual"
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("476","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders an input tag of type text.
=cut
sub toHtml {
my $self = shift;
my $value = $self->fixMacros($self->fixTags($self->fixSpecialCharacters($self->{value})));
return '<textarea id="'.$self->{id}.'" name="'.$self->{name}.'" cols="'.$self->{columns}.'" rows="'.$self->{rows}.'" wrap="'.
$self->{wrap}.'" '.$self->{extras}.'>'.$value.'</textarea>';
}
1;

View file

@ -1,146 +0,0 @@
package WebGUI::Form::timeField;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::text';
use WebGUI::DateTime;
use WebGUI::Form::button;
use WebGUI::Form::hidden;
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
=head1 NAME
Package WebGUI::Form::timeField
=head1 DESCRIPTION
Creates a time form field.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::text.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the superclass for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 maxlength
Defaults to 8. Determines the maximum number of characters allowed in this field.
=head4 size
Default to 8. Determines how many characters wide the field wlll be.
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
maxlength=>{
defaultValue=>8
},
size=>{
defaultValue=>8
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("971","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
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.
=cut
sub getValueFromPost {
my $self = shift;
return WebGUI::DateTime::timeToSeconds($session{cgi}->param($self->{name}))-($session{user}{timeOffset}*3600);
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a time field.
=cut
sub toHtml {
my $self = shift;
my $value = WebGUI::DateTime::secondsToTime($self->{value});
WebGUI::Style::setScript($session{config}{extrasURL}.'/inputCheck.js',{ type=>'text/javascript' });
$self->{extras} .= ' onkeyup="doInputCheck(this.form.'.$self->{name}.',\'0123456789:\')"';
return $self->SUPER::toHtml
.WebGUI::Form::button->new(
id=>$self->{id},
extras=>'style="font-size: 8pt;" onClick="window.timeField = this.form.'.$self->{name}.';clockSet = window.open(\''.$session{config}{extrasURL}. '/timeChooser.html\',\'timeChooser\',\'WIDTH=230,HEIGHT=100\');return false"',
value=>WebGUI::International::get(970)
)->toHtml;
}
#-------------------------------------------------------------------
=head2 toHtmlAsHidden ( )
Renders the field as a hidden field.
=cut
sub toHtmlAsHidden {
my $self = shift;
return WebGUI::Form::hidden->new(
name=>$self->{name},
value=>secondsToTime($self->{value})
)->toHtmlAsHidden;
}
1;

View file

@ -1,119 +0,0 @@
package WebGUI::Form::url;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::text';
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
=head1 NAME
Package WebGUI::Form::url
=head1 DESCRIPTION
Creates a URL form field.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::text.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the superclass for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 maxlength
Defaults to 2048. Determines the maximum number of characters allowed in this field.
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
maxlength=>{
defaultValue=> 2048
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("478","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Parses the posted value and tries to make corrections if necessary.
=cut
sub getValueFromPost {
my $self = shift;
my $value = $session{cgi}->param($self->{name});
if ($value =~ /mailto:/) {
return $value;
} elsif ($value =~ /^([A-Z0-9]+[._+-]?){1,}([A-Z0-9]+[_+-]?)+\@(([A-Z0-9]+[._-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i) {
return "mailto:".$value;
} elsif ($value =~ /^\// || $value =~ /:\/\// || $value =~ /^\^/) {
return $value;
}
return "http://".$value;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a URL field.
=cut
sub toHtml {
my $self = shift;
WebGUI::Style::setScript($session{config}{extrasURL}.'/addHTTP.js',{ type=>'text/javascript' });
$self->{extras} .= ' onBlur="addHTTP(this.form.'.$self->{name}.')"';
return $self->SUPER::toHtml;
}
1;

View file

@ -1,124 +0,0 @@
package WebGUI::Form::whatNext;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Form::selectList;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::whatNext
=head1 DESCRIPTION
Creates a what next question field. This is used to allow users direct the flow of forms from one page to another.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 name
The identifier for this field. Defaults to "proceed".
=head4 defaultValue
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.
=head4 hoverHelp
A tooltip to tell the user what to do with the field. Defaults a standard piece of help for Database Links.
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
label=>{
defaultValue=>$class->getName()
},
name=>{
defaultValue=>"proceed"
},
options=>{
defaultValue=>{}
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("744","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a question selector asking the user where they want to go.
=cut
sub toHtml {
my $self = shift;
return WebGUI::Form::selectList->new(
id=>$self->{id},
name=>$self->{name},
options=>$self->{options},
value=>[$self->{value}],
extras=>$self->{extras}
)->toHtml;
}
1;

View file

@ -1,134 +0,0 @@
package WebGUI::Form::yesNo;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Form::radio;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::yesNo
=head1 DESCRIPTION
Creates a yes/no question field.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 defaultValue
Can be a 1 or 0. Defaults to 0 if no value is specified.
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
defaultValue=>{
defaultValue=>0
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("482","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns either a 1 or 0 representing yes, no.
=cut
sub yesNo {
my $self = shift;
if ($session{cgi}->param($self->{name}) > 0) {
return 1;
}
return 0;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a yes/no question field.
=cut
sub toHtml {
my $self = shift;
my ($checkYes, $checkNo);
if ($self->{value}) {
$checkYes = 1;
} else {
$checkNo = 1;
}
my $output = WebGUI::Form::radio->new(
checked=>$checkYes,
name=>$self->{name},
value=>1,
extras=>$self->{extras}
)->toHtml;
$output .= WebGUI::International::get(138);
$output .= '&nbsp;&nbsp;&nbsp;';
$output .= WebGUI::Form::radio->new(
checked=>$checkNo,
name=>$self->{name},
value=>0,
extras=>$self->{extras}
)->toHtml;
$output .= WebGUI::International::get(139);
return $output;
}
1;

View file

@ -1,115 +0,0 @@
package WebGUI::Form::zipcode;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::text';
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
=head1 NAME
Package WebGUI::Form::zipcode
=head1 DESCRIPTION
Creates a zip code form field.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::text.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the superclass for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 maxlength
Defaults to 10. Determines the maximum number of characters allowed in this field.
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
maxlength=>{
defaultValue=> 10
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("944","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns a validated form post result. If the result does not pass validation, it returns undef instead.
=cut
sub getValueFromPost {
my $self = shift;
my $value = $session{cgi}->param($self->{name});
if ($value =~ /^[A-Z\d\s\-]+$/) {
return $value;
}
return undef;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a zip code field.
=cut
sub toHtml {
my $self = shift;
WebGUI::Style::setScript($session{config}{extrasURL}.'/inputCheck.js',{ type=>'text/javascript' });
$self->{extras} .= ' onkeyup="doInputCheck(this.form.'.$self->{name}.',\'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ- \')"';
return $self->SUPER::toHtml;
}
1;