fixed a few bugs and also made it so language translators can enable the translations for javascript helpers

This commit is contained in:
JT Smith 2005-07-29 15:00:30 +00:00
parent cca54fb0c3
commit 4033ad4b83
7 changed files with 33 additions and 5 deletions

View file

@ -93,6 +93,10 @@ A text label that will be displayed if toHtmlWithWrapper() is called.
A unique identifier that can be used to identify this field with javascripts and cascading style sheets. Is autogenerated if not specified. The autogenerated version is the value of the name parameter concatinated with the string "_formId". So for a field called "title" it would be "title_formId".
=head4 idPrefix
If specified, this will be prepended to the id (whether autogenerated or not) to prevent overlap of two similar forms on the same page.
=head4 uiLevel
The UI Level that the user must meet or exceed if this field should be displayed with toHtmlWithWrapper() is called.
@ -166,6 +170,9 @@ sub definition {
defaultValue=>undef
},
id=>{
defaultValue=>undef
},
idPrefix=>{
defaultValue=>undef
}
});
@ -352,6 +359,8 @@ sub new {
unless ($params{id}) {
$params{id} = $class->generateIdParameter($params{name});
}
# preventing ID collisions
$params{id} = $params{idPrefix}.$params{id};
bless \%params, $class;
}

View file

@ -124,8 +124,12 @@ Renders a date picker control.
sub toHtml {
my $self = shift;
my $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-en.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";

View file

@ -117,8 +117,12 @@ Renders a date picker control.
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-en.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";
@ -131,7 +135,7 @@ sub toHtml {
maxlength=>$self->{maxlength}
)->toHtml . '<script type="text/javascript">
Calendar.setup({
inputField : "'.$self->{name}.'",
inputField : "'.$self->{id}.'",
ifFormat : "%Y-%m-%d %H:%M:%S",
showsTime : true,
timeFormat : "12",