a few changes to the form control system before i continue making controls

This commit is contained in:
JT Smith 2005-07-26 21:29:08 +00:00
parent 7d95169b38
commit 6ebf9c9ff3
20 changed files with 331 additions and 1199 deletions

View file

@ -165,6 +165,19 @@ sub definition {
return $definition;
}
#-------------------------------------------------------------------
=head2 getName ( )
Returns a human readable name for this form control type. You MUST override this method with your own when creating new form controls.
=cut
sub getName {
return "Form control not properly created."
}
#-------------------------------------------------------------------
=head2 fixMacros ( string )
@ -297,7 +310,6 @@ sub new {
unless (exists $params{value}) {
$params{value} = $params{defaultValue};
}
WebGUI::ErrorHandler::debug($class);
bless \%params, $class;
}
@ -362,7 +374,10 @@ sub toHtmlWithWrapper {
$hoverHelp = qq| onmouseover="return escape('$hoverHelp')"| if ($hoverHelp);
my $subtext = $self->{subtext};
$subtext = qq| <span class="formSubtext">$subtext</span>| if ($subtext);
return '<tr'.$rowClass.'><td'.$labelClass.$hoverHelp.' valign="top" style="width: 25%;">'.$self->{label}.'</td><td valign="top"'.$fieldClass.' style="width: 75%;">'.$self->toHtml.$subtext."</td></tr>\n";
return '<tr'.$rowClass.'>
<td'.$labelClass.$hoverHelp.' valign="top" style="width: 25%;">'.$self->{label}.'</td>
<td valign="top"'.$fieldClass.' style="width: 75%;">'.$self->toHtml().$subtext."</td>
</tr>\n";
} else {
return $self->toHtmlAsHidden;
}

View file

@ -20,6 +20,7 @@ use WebGUI::Asset;
use WebGUI::Form::button;
use WebGUI::Form::hidden;
use WebGUI::Form::text;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
@ -75,6 +76,19 @@ sub 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 ( )

View file

@ -65,6 +65,19 @@ sub 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 ( )

View file

@ -17,6 +17,7 @@ package WebGUI::Form::checkList;
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Form::checkbox;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
@ -79,6 +80,19 @@ sub 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 ( )

View file

@ -16,6 +16,7 @@ package WebGUI::Form::checkbox;
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
@ -71,6 +72,19 @@ sub definition {
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("943","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )

View file

@ -16,6 +16,7 @@ package WebGUI::Form::codearea;
use strict;
use base 'WebGUI::Form::text';
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
@ -38,6 +39,19 @@ The following methods are specifically available from this class. Check the supe
=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 ( )

View file

@ -16,6 +16,7 @@ package WebGUI::Form::color;
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
@ -37,6 +38,19 @@ The following methods are specifically available from this class. Check the supe
=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 ( )

View file

@ -39,6 +39,19 @@ The following methods are specifically available from this class. Check the supe
=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 ( )

View file

@ -73,6 +73,19 @@ sub 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 ( )

View file

@ -18,6 +18,8 @@ use strict;
use base 'WebGUI::Form::Control';
use WebGUI::DatabaseLink;
use WebGUI::Form::selectList;
use WebGUI::Grouping;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
@ -56,6 +58,18 @@ The identifier for this field. Defaults to "databaseLinkId".
A database link id. Defaults to "0", which is the WebGUI database.
=head4 afterEdit
A URL that will be acted upon after editing a database link. Typically there is a link next to the select list that reads "Edit this database link" and this is the URL to go to after editing is complete.
=head4 label
A label displayed next to the field when toHtmlWithWrapper() is called. Defaults to "Database Link".
=head4 hoverHelp
A tooltip to tell the user what to do with the field. Defaults a standard piece of help for Database Links.
=cut
sub definition {
@ -68,10 +82,30 @@ sub definition {
defaultValue=>{
defaultValue=>0
},
afterEdit=>{
defaultValue=>undef
},
label=>{
defaultValue=>WebGUI::International::get(1075)
},
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");
}
#-------------------------------------------------------------------
@ -90,6 +124,25 @@ sub toHtml {
)->toHtml;
}
#-------------------------------------------------------------------
=head2 toHtmlWithWrapper ( )
=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

@ -17,6 +17,7 @@ package WebGUI::Form::date;
use strict;
use base 'WebGUI::Form::text';
use WebGUI::DateTime;
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
@ -86,6 +87,19 @@ sub definition {
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 ( )

View file

@ -17,6 +17,7 @@ package WebGUI::Form::dateTime;
use strict;
use base 'WebGUI::Form::text';
use WebGUI::DateTime;
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
@ -79,6 +80,19 @@ sub definition {
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 ( )

View file

@ -16,6 +16,7 @@ package WebGUI::Form::email;
use strict;
use base 'WebGUI::Form::text';
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
@ -37,6 +38,19 @@ The following methods are specifically available from this class. Check the supe
=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 ( )

View file

@ -16,6 +16,7 @@ package WebGUI::Form::hidden;
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
@ -36,6 +37,19 @@ The following methods are specifically available from this class. Check the supe
=cut
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("hidden","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )

View file

@ -16,6 +16,7 @@ package WebGUI::Form::selectList;
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
@ -92,6 +93,19 @@ sub 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 ( )

View file

@ -16,6 +16,7 @@ package WebGUI::Form::text;
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
@ -71,6 +72,20 @@ sub 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 ( )

View file

@ -16,6 +16,7 @@ package WebGUI::Form::textarea;
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
@ -80,6 +81,20 @@ sub 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 ( )

View file

@ -16,6 +16,7 @@ package WebGUI::Form::zipcode;
use strict;
use base 'WebGUI::Form::text';
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Style;
@ -64,6 +65,20 @@ sub definition {
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 ( )

File diff suppressed because it is too large Load diff

View file

@ -3301,6 +3301,36 @@ Privileges and styles assigned to pages in the package will not be copied when t
context => q|option for Rich Editor in profile|
},
'color' => {
message => q|Color|,
lastUpdated =>0,
context => q|Field type name|
},
'combobox' => {
message => q|Combo Box|,
lastUpdated =>0,
context => q|Field type name|
},
'hidden' => {
message => q|Hidden|,
lastUpdated =>0,
context => q|Field type name|
},
'codearea' => {
message => q|Code Area|,
lastUpdated =>0,
context => q|Field type name|
},
'button' => {
message => q|Button|,
lastUpdated =>0,
context => q|Field type name|
},
'cancel' => {
message => q|cancel|,
lastUpdated =>1092930637,