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

@ -1,6 +1,10 @@
6.7.0
- Added the ability to override the UI Level of any field in the edit form of
any asset in the WebGUI config file.
- Translation providers can now add languageAbbreviation and locale
properties to their translation in order to activate the translations of
javascript helper components like the rich editor and the calendar
date picker.
- Added the ability to override the UI Level of an entire asset in the config
file.
- fix [ 1229042 ] crumbtrail should show full path...

View file

@ -452,6 +452,11 @@ sub getRichEditor {
push(@plugins,"") if ($button eq "");
push(@plugins,"") if ($button eq "");
}
my $language = WebGUI::International::getLanguage($session{user}{language},"languageAbbreviation");
unless ($language) {
$language = WebGUI::International::getLanguage("English","languageAbbreviation");
}
$config{language} = $language;
$config{content_css} = $self->getValue("cssFile") if ($self->getValue("cssFile") ne "");
$config{width} = $self->getValue("editorWidth") if ($self->getValue("editorWidth") > 0);
$config{height} = $self->getValue("editorHeight") if ($self->getValue("editorHeight") > 0);

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",

View file

@ -104,7 +104,7 @@ Defaults to "English". The language to retrieve the properties for.
=head3 propertyName
If this is specified, only the value of the property will be returned, instead of the hash reference to all properties. The valid values are "toolbar" and "label".
If this is specified, only the value of the property will be returned, instead of the hash reference to all properties. The valid values are "toolbar", "languageAbbreviation", "locale", and "label".
=cut

View file

@ -5,7 +5,9 @@ use strict;
our $LANGUAGE = {
label => 'English',
toolbar => 'metal'
toolbar => 'metal',
languageAbbreviation => 'en',
locale => 'US'
};
sub makeUrlCompliant {