[open-ils-commits] r10031 - in trunk/Open-ILS/web/js/dojo/openils:
. widget
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jul 14 17:06:52 EDT 2008
Author: miker
Date: 2008-07-14 17:06:48 -0400 (Mon, 14 Jul 2008)
New Revision: 10031
Modified:
trunk/Open-ILS/web/js/dojo/openils/I18N.js
trunk/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js
Log:
correcting tranlation widget
Modified: trunk/Open-ILS/web/js/dojo/openils/I18N.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/I18N.js 2008-07-14 20:55:28 UTC (rev 10030)
+++ trunk/Open-ILS/web/js/dojo/openils/I18N.js 2008-07-14 21:06:48 UTC (rev 10031)
@@ -22,15 +22,7 @@
dojo.require("fieldmapper.dojoData");
dojo.require("DojoSRF");
dojo.require("dojo.data.ItemFileWriteStore");
- dojo.require("dijit._Widget");
- dojo.require("dijit._Templated");
- dojo.require("dijit.layout.ContentPane");
- dojo.require("dijit.Dialog");
- dojo.require("dijit.form.Button");
- dojo.require("dijit.form.TextBox");
- dojo.require("dijit.form.ComboBox");
-
dojo.declare('openils.I18N', null, {});
openils.I18N.BaseLocales = {
@@ -53,7 +45,7 @@
var classname = obj.classname;
// XXX need to derive identity field from IDL...
- var ident_field = fieldmapper[classname].Identifier || 'id';
+ var ident_field = fieldmapper[classname].Identifier;
var ident_value = obj[ident_field]();
var fielder_args = { query : { fq_field : classname + '.' + field, identity_value : ident_value } };
Modified: trunk/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js 2008-07-14 20:55:28 UTC (rev 10030)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js 2008-07-14 21:06:48 UTC (rev 10031)
@@ -63,9 +63,13 @@
},
renderTranslatorPopup : function () {
-
+
this._targetObject = dojox.jsonPath.query(window, '$.' + this.targetObject, {evalType:"RESULT"});
+ if (!this.unique && this._targetObject) {
+ this.unique = this._targetObject[this._targetObject.Identifier];
+ }
+
var node = dojo.byId(this.field + '_translation_' + this.unique);
var trans_list = openils.I18N.getTranslations( this._targetObject, this.field );
@@ -114,12 +118,12 @@
dojo.query('.update_button',trans_row).style({ visibility : 'visible', display : 'inline'}).instantiate(
dijit.form.Button,
- { onClick : dojo.hitch( this, 'updateTranslation') }
+ { onClick : dojo.hitch( this, new Function('this.updateTranslation('+trans_id+')') ) }
);
dojo.query('.delete_button',trans_row).style({ visibility : 'visible', display : 'inline'}).instantiate(
dijit.form.Button,
- { onClick : dojo.hitch( this, 'removeTranslation') }
+ { onClick : dojo.hitch( this, new Function('this.removeTranslation('+trans_id+')') ) }
);
trans_tbody.appendChild( trans_row );
@@ -167,7 +171,7 @@
},
removeTranslation : function (t) {
- return changeTranslation('delete',t);
+ return this.changeTranslation('delete',t);
},
changeTranslation : function (method, trans_id) {
@@ -201,32 +205,34 @@
writeTranslation : function (method, trans_obj) {
+ var _trans_widget = this;
+
OpenSRF.CachedClientSession('open-ils.permacrud').request({
method : 'open-ils.permacrud.' + method + '.i18n',
timeout: 10,
params : [ ses, trans_obj ],
onerror: function (r) {
//highlighter.editor_pane.red.play();
- if (status_update) status_update( 'Problem saving translation for ' + this._targetObject[this.field]() );
+ if (status_update) status_update( 'Problem saving translation for ' + _trans_widget._targetObject[_trans_widget.field]() );
},
oncomplete : function (r) {
var res = r.recv();
if ( res && res.content() ) {
//highlighter.editor_pane.green.play();
- if (status_update) status_update( 'Saved changes to translation for ' + this._targetObject[this.field]() );
+ if (status_update) status_update( 'Saved changes to translation for ' + _trans_widget._targetObject[_trans_widget.field]() );
if (method == 'delete') {
dojo.NodeList(dojo.byId('translation_row_' + trans_obj.id())).orphan();
} else if (method == 'create') {
- var node = dojo.byId(this.field + '_translation_' + this.unique);
- dijit.byId('i18n_new_locale_' + this._targetObject.classname + '.' + this.field + this.unique).setValue(null);
- dijit.byId('i18n_new_translation_' + this._targetObject.classname + '.' + this.field + this.unique).setValue(null);
- this.renderTranslatorPopup();
+ var node = dojo.byId(_trans_widget.field + '_translation_' + _trans_widget.unique);
+ dijit.byId('i18n_new_locale_' + _trans_widget._targetObject.classname + '.' + _trans_widget.field + _trans_widget.unique).setValue(null);
+ dijit.byId('i18n_new_translation_' + _trans_widget._targetObject.classname + '.' + _trans_widget.field + _trans_widget.unique).setValue(null);
+ _trans_widget.renderTranslatorPopup();
}
} else {
//highlighter.editor_pane.red.play();
- if (status_update) status_update( 'Problem saving translation for ' + this._targetObject[this.field]() );
+ if (status_update) status_update( 'Problem saving translation for ' + _trans_widget._targetObject[_trans_widget.field]() );
}
},
}).send();
More information about the open-ils-commits
mailing list