i18n the controls for the JsonTable form plugin. Fixes bug #12116

This commit is contained in:
Colin Kuskie 2011-04-21 19:54:18 -07:00
parent d4672a92f1
commit ef08d0d481
4 changed files with 49 additions and 6 deletions

View file

@ -1,5 +1,6 @@
7.10.15
- fixed #12117: Thingy - www_searchViaAjax broken
- fixed #12116: JsonTable form control needs i18n
7.10.14
- fixed #12094: Cannot enter in Macros in URLs inside TinyMCE.

View file

@ -137,6 +137,10 @@ Send JS required for this plugin.
sub headTags {
my $self = shift;
my ( $url, $style ) = $self->session->quick(qw( url style ));
$style->setScript(
$url->extras('yui/build/connect/connect-min.js'),
{ type => 'text/javascript' },
);
$style->setScript(
$url->extras('yui/build/yahoo-dom-event/yahoo-dom-event.js'),
{ type => 'text/javascript' },
@ -145,6 +149,10 @@ sub headTags {
$url->extras('yui/build/json/json-min.js'),
{ type => 'text/javascript' },
);
$style->setScript(
$url->extras('yui-webgui/build/i18n/i18n.js'),
{ type => 'text/javascript' },
);
$style->setScript(
$url->extras('yui-webgui/build/form/jsontable.js'),
{ type => 'text/javascript' },
@ -162,6 +170,7 @@ Renders an input tag of type text.
sub toHtml {
my $self = shift;
my $session = $self->session;
my $i18n = WebGUI::International->new($session, 'WebGUI');
my ( $url, $style ) = $session->quick(qw( url style ));
my $value = $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($self->getOriginalValue)));
my $output = '';
@ -176,7 +185,7 @@ sub toHtml {
# Buttons to add rows in the table footer
my $cols = scalar @{ $self->get('fields') } + 1; # Extra column for buttons
$output .= '</thead><tfoot><tr><td colspan="' . $cols . '">'
. '<button id="' . $self->get('id') . '_add">' . "Add" . '</button>'
. '<button id="' . $self->get('id') . '_add">' . $i18n->get('Add') . '</button>'
. '</td></tr></tfoot>'
;

View file

@ -4725,6 +4725,24 @@ Users may override this setting in their profile.
context => 'Description for pick style template page',
},
'Up' => {
message => 'Up',
lastUpdate => 0,
context => 'Up, as in move up.',
},
'Down' => {
message => 'Down',
lastUpdate => 0,
context => 'Down, as in move down.',
},
'Add' => {
message => 'Add',
lastUpdate => 0,
context => 'Add, as in to append or add more',
},
};
1;

View file

@ -60,8 +60,21 @@ WebGUI.Form.JsonTable
},
this, true
);
this.init();
this.i18n
= new WebGUI.i18n( {
namespaces : {
'WebGUI' : [
"576",
"Up",
"Down"
]
},
onpreload : {
fn : WebGUI.Form.JsonTable.prototype.init,
obj : this,
override : true
}
} );
return this;
};
@ -69,6 +82,7 @@ WebGUI.Form.JsonTable
/****************************************************************************
* addActions( row )
* Add the row actions to the given row
* Delay creating this so that the i18n object exists
*/
WebGUI.Form.JsonTable.prototype.addActions
= function (row) {
@ -76,7 +90,7 @@ WebGUI.Form.JsonTable.prototype.addActions
var buttonCell = row.lastChild;
var deleteButton = document.createElement('input');
deleteButton.type = "button";
deleteButton.value = "Delete";
deleteButton.value = this.i18n.get('WebGUI', '576');
YAHOO.util.Event.addListener( deleteButton, "click",
function (e) {
this.deleteRow( row );
@ -87,7 +101,7 @@ WebGUI.Form.JsonTable.prototype.addActions
var moveUpButton = document.createElement('input');
moveUpButton.type = "button";
moveUpButton.value = "Up";
moveUpButton.value = this.i18n.get('WebGUI', 'Up');
YAHOO.util.Event.addListener( moveUpButton, "click",
function (e) {
this.moveRowUp( row );
@ -98,7 +112,7 @@ WebGUI.Form.JsonTable.prototype.addActions
var moveDownButton = document.createElement('input');
moveDownButton.type = "button";
moveDownButton.value = "Down";
moveDownButton.value = this.i18n.get('WebGUI', 'Down');
YAHOO.util.Event.addListener( moveDownButton, "click",
function (e) {
this.moveRowDown( row );
@ -164,6 +178,7 @@ WebGUI.Form.JsonTable.prototype.init
}
}
}
};
/****************************************************************************