AutoGrid, EditPane, FlattenerGrid, GridColumnPicker and HoldingCode.
[LFW: One string amended in conflict resolution; commit message edited
to wrap; one line of code moved (this.nls assignment in
GridColumnPicker.js).]
Signed-off-by: Pasi Kallinen <pasi.kallinen@pttk.fi>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
{
+ "SEASON_SPRING": "Spring",
+ "SEASON_SUMMER": "Summer",
+ "SEASON_FALL": "Fall",
+ "SEASON_WINTER": "Winter",
+ "SELECT_VALID_CAP": "Have you selected a valid caption and pattern?",
+ "NO_CAP_SUBFIELDS": "No caption subfields in selected caption and pattern",
+ "COMPILE": "Create Holding Code",
+ "ERROR_BLANK_FIELDS": "A valid holding code cannot be produced with any blank fields.",
+ "WIZARD": "Wizard",
"CREATE_ISSUANCE": "Create Issuance",
"MODIFY_ISSUANCE": "Modify Issuance",
"SAVE_SUCCESSFUL": "Save Successful",
dojo.require('openils.widget.GridColumnPicker');
dojo.require('openils.widget._GridHelperColumns');
dojo.require('openils.Util');
+ dojo.requireLocalization('openils.widget', 'AutoFieldWidget');
dojo.declare(
'openils.widget.AutoGrid',
this.overrideEditWidgetClass = {};
this.overrideWidgetArgs = {};
+ this.nls = dojo.i18n.getLocalization('openils.widget', 'AutoFieldWidget');
+
if(this.editOnEnter)
this._applyEditOnEnter();
else if(this.singleEditStyle)
var back = dojo.create('a', {
- innerHTML : 'Back', // TODO i18n
+ innerHTML : self.nls.BACK,
style : 'padding-right:6px;',
href : 'javascript:void(0);',
onclick : function() {
});
var forw = dojo.create('a', {
- innerHTML : 'Next', // TODO i18n
+ innerHTML : self.nls.NEXT,
style : 'padding-right:6px;',
href : 'javascript:void(0);',
onclick : function() {
dojo.require('openils.widget.PCrudFilterDialog');
dojo.place(
dojo.create('a', {
- innerHTML : 'Filter', // TODO i18n
+ innerHTML : self.nls.FILTER,
style : 'padding-right:6px;',
href : 'javascript:void(0);',
onclick : function() {
dojo.require('openils.Util');
dojo.require('openils.PermaCrud');
dojo.require('dijit.form.Button');
+ dojo.requireLocalization('openils.widget', 'AutoFieldWidget');
dojo.declare(
'openils.widget.EditPane',
this.fieldDocs = pcrud.search('fdoc', {fm_class:this.fmClass});
*/
+ this.nls = dojo.i18n.getLocalization('openils.widget', 'AutoFieldWidget');
+
var table = this.existingTable;
if(!table) {
var table = this.table = document.createElement('table');
var self = this;
new dijit.form.Button({
- label:'Cancel', // XXX
+ label: this.nls.CANCEL,
onClick : this.onCancel
}, cancelSpan);
if(this.hideSaveButton) return;
new dijit.form.Button({
- label:'Save', // XXX
+ label:this.nls.SAVE,
onClick: function() {self.performAutoEditAction();}
}, applySpan);
},
// in this edit pane. If any required value is null, then return
// an error object.
mapValues: function (fn) {
- var e = 0, msg = this.fmIDL.label + ' ';
+ var e = 0, msg = '', lbl = this.fmIDL.label;
dojo.forEach(this.fieldList, function (f) {
var v, w = f.widget;
if ((v = w.getFormattedValue()) === null && w.isRequired()) { e++; }
fn(f.name, v);
});
if (e > 0) {
- msg += 'edit pane has ' + e + ' required field(s) that contain no value(s)';
- return new Error(msg);
+ return new Error(dojo.string.substitute(this.nls.REQ_FIELDS_EMPTY, [lbl, e]));
}
},
"_setupLinks": function() {
this.linkHolder = new dijit.layout.ContentPane();
+ var localeStrings = this.localeStrings;
dojo.place(this.linkHolder.domNode, this.domNode, "before");
if (this.showLoadFilter) {
if (!this.filterAlwaysInDiv) {
new dijit.form.Button(
{
- "label": "Filter", /* XXX i18n */
+ "label": localeStrings.FILTER,
"onClick": dojo.hitch(
this, function() { this.filterUi.show(); }
)
dojo.require('openils.Event');
dojo.require('openils.Util');
dojo.require('fieldmapper.Fieldmapper');
-
+ dojo.requireLocalization('openils.widget', 'AutoFieldWidget');
dojo.declare('openils.widget.GridColumnPicker', null, {
constructor : function (authtoken, persistKey, grid, structure) {
var _this = this;
+ this.nls = dojo.i18n.getLocalization('openils.widget', 'AutoFieldWidget');
this.grid = grid;
this.persistKey = this.USER_PERSIST_SETTING+'.'+persistKey;
this.authtoken = authtoken || openils.User.authtoken;
this.dialog = this.buildDialog();
this.dialogTable = this.dialog.containerNode.getElementsByTagName('tbody')[0];
+
// replace: called after any sort changes
this.onSortChange = function(list) {console.log('onSortChange()')}
// replace: called after user settings are first retrieved
buildDialog : function() {
var self = this;
-
- // TODO i18n
- var dialog = new dijit.Dialog({title : 'Column Picker'});
+ var dialog = new dijit.Dialog({title : this.nls.COLUMN_PICKER});
var table = dojo.create('table', {'class':'oils-generic-table', innerHTML :
- "<table><thead><tr><th width='30%'>Column</th><th width='23%'>Display</th>" +
- "<th width='23%'>Auto Width</th><th width='23%'>Sort Priority</th></tr></thead>" +
+ "<table><thead><tr><th width='30%'>" + this.nls.COLUMN + "</th>" +
+ "<th width='23%'>" + this.nls.DISPLAY + "</th>" +
+ "<th width='23%'>" + this.nls.AUTO_WIDTH + "</th>" +
+ "<th width='23%'>" + this.nls.SORT_PRIORITY + "</th></tr></thead>" +
"<tbody />"});
var tDiv = dojo.create('div');
var textDiv = dojo.create('div', {style : 'padding:5px; margin-top:5px; border-top:1px solid #333',
innerHTML :
- "<i>A Sort Priority of '0' means no sorting is applied.<br/>" +
- "<i>Apply a negative Sort Priority for descending sort."});
+ "<i>" + this.nls.SORT_PRIORITY_ZERO + "<br/>" +
+ "<i>" + this.nls.SORT_PRIORITY_MINUS});
var wrapper = dojo.create('div');
wrapper.appendChild(tDiv);
wrapper.appendChild(bDiv);
dialog.containerNode.appendChild(wrapper);
- var button = new dijit.form.Button({label:'Save'},
+ var button = new dijit.form.Button({label: this.nls.SAVE },
dojo.query('[name=save_button]', bDiv)[0]);
button.onClick = function() { dialog.hide(); self.update(true); };
- button = new dijit.form.Button({label:'Cancel'},
+ button = new dijit.form.Button({label: this.nls.CANCEL },
dojo.query('[name=cancel_button]', bDiv)[0]);
button.onClick = function() { dialog.hide(); };
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.form.DropDownButton");
dojo.require("dijit.form.TextBox");
+ dojo.requireLocalization('openils.serial', 'serial');
/* XXX These variables and functions preceding the call to dojo.declar()
* all pollute the window namespace. They're not written as methods for
* into there anyway.
*/
+ var _localeStrings = dojo.i18n.getLocalization('openils.serial', 'serial');
+
var _needed_fields = "abcdefghijklm";
var _season_store = new dojo.data.ItemFileReadStore({
"data": {
"identifier": "code",
"label": "label",
"items": [
- {"code": 21, "label": "Spring"},
- {"code": 22, "label": "Summer"},
- {"code": 23, "label": "Fall"},
- {"code": 24, "label": "Winter"}
+ {"code": 21, "label": _localeStrings.SEASON_SPRING},
+ {"code": 22, "label": _localeStrings.SEASON_SUMMER},
+ {"code": 23, "label": _localeStrings.SEASON_FALL},
+ {"code": 24, "label": _localeStrings.SEASON_WINTER}
]
}
}); /* XXX i18n the above seasons. Also maybe don't
}
if (!dojo.isArray(pattern_code)) {
- div.innerHTML =
- "Have you selected a valid caption and pattern?";/* XXX i18n */
+ div.innerHTML = _localeStrings.SELECT_VALID_CAP;
return;
}
}
if (!fields.length) {
- div.innerHTML = /* XXX i18n (below) */
- "No caption subfields in seleted caption and pattern";
+ div.innerHTML = _localeStrings.NO_CAP_SUBFIELDS;
return;
}
new dijit.form.Button(
{
- "label": "Create Holding Code",
+ "label": _localeStrings.COMPILE,
"onClick": function() {
inputs.forEach(
function(input) {
var value = input.input.attr("value");
if (value === null || value === "") {
- /* XXX i18n */
- alert("A valid holding code cannot be " +
- "produced with any blank fields.");
+ alert(_localeStrings.ERROR_BLANK_FIELDS);
}
holding_code.push(input.subfield);
holding_code.push(value);
this.wizard_button = new dijit.form.Button(
{
- "label": "Wizard" /* XXX i18n */,
+ "label": _localeStrings.WIZARD,
"onClick": function() {
_prepare_ttip_dialog(target_div, self);
}
{
+ "NEXT" : "Next",
+ "BACK" : "Back",
+ "FILTER" : "Filter",
+ "CANCEL" : "Cancel",
+ "SAVE" : "Save",
+ "REQ_FIELDS_EMPTY" : "${0} edit pane has ${1} required field(s) that contain no value(s)",
+ "COLUMN_PICKER" : "Column Picker",
+ "COLUMN" : "Column",
+ "DISPLAY" : "Display",
+ "AUTO_WIDTH" : "Auto Width",
+ "SORT_PRIORITY" : "Sort Priority",
+ "SORT_PRIORITY_ZERO" : "A Sort Priority of '0' means no sorting is applied.",
+ "SORT_PRIORITY_MINUS" : "Apply a negative Sort Priority for descending sort.",
"TRUE" : "True",
"FALSE" : "False",
"UNSET" : "Unset",