[open-ils-commits] r10086 - in
branches/acq-experiment/Open-ILS/web: conify/global/config
js/dojo/openils/widget
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jul 21 22:34:37 EDT 2008
Author: miker
Date: 2008-07-21 22:34:35 -0400 (Mon, 21 Jul 2008)
New Revision: 10086
Modified:
branches/acq-experiment/Open-ILS/web/conify/global/config/copy_status.html
branches/acq-experiment/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js
Log:
more translator widget work
Modified: branches/acq-experiment/Open-ILS/web/conify/global/config/copy_status.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/conify/global/config/copy_status.html 2008-07-21 12:49:49 UTC (rev 10085)
+++ branches/acq-experiment/Open-ILS/web/conify/global/config/copy_status.html 2008-07-22 02:34:35 UTC (rev 10086)
@@ -196,8 +196,6 @@
'status_grid.rowHeightChanged('+row+')',
0
);
- var oldnode = dojo.byId('name_translation_' + row);
- if (oldnode) dijit.byNode(oldnode).destroyRecursive();
return '<span class="status_grid_trans_cell_'+row+'"></span>';
}
return '';
Modified: branches/acq-experiment/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js 2008-07-21 12:49:49 UTC (rev 10085)
+++ branches/acq-experiment/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js 2008-07-22 02:34:35 UTC (rev 10086)
@@ -39,16 +39,20 @@
[dijit._Widget, dijit._Templated],
{
- templateString : "<span dojoAttachPoint='node'><div id='${field}_translation_button_${unique}' dojoAttachPoint='translateLabelNode' dojoType='dijit.form.DropDownButton'><span>Translate</span><div id='${field}_translation_${unique}' dojoAttachPoint='tooltipDialog' dojoType='dijit.TooltipDialog'><div dojoType='dijit.layout.ContentPane'><table><tbody class='translation_tbody_template' style='display:none; visibility:hidden;'><tr><th dojoAttachPoint='localeLabelNode'/><td class='locale'><div class='locale_combobox'></div></td><th dojoAttachPoint='translationLabelNode'/><td class='translation'><div class='translation_textbox'></div></td><td><button class='create_button' style='display:none; visibility:hidden;'><span dojoAttachPoint='createButtonNode'/></button><button class='update_button' style='display:none; visibility:hidden;'><span dojoAttachPoint='updateButtonNode'/></button><button class='delete_button' style='display:none; visibility:hidden;'><span dojoAttachPoint='remo
veButtonNode'/></button></td></tr></tbody><tbody class='translation_tbody'></tbody></table></div></div></div></span>",
+ templateString : "<span id='${field}_translation_${unique}' dojoAttachPoint='containerNode'><div id='${field}_translation_button_${unique}' dojoAttachPoint='translateLabelNode' dojoType='dijit.form.DropDownButton'><span>Translate</span><div id='${field}_translation_tooltip_${unique}' dojoAttachPoint='tooltipDialog' dojoType='dijit.TooltipDialog'><div dojoType='dijit.layout.ContentPane'><table><tbody class='translation_tbody_template' style='display:none; visibility:hidden;'><tr><th dojoAttachPoint='localeLabelNode'/><td class='locale'><div class='locale_combobox'></div></td><th dojoAttachPoint='translationLabelNode'/><td class='translation'><div class='translation_textbox'></div></td><td><button class='create_button' style='display:none; visibility:hidden;'><span dojoAttachPoint='createButtonNode'/></button><button class='update_button' style='display:none; visibility:hidden;'><span dojoAttachPoint='updateButtonNode'/></button><button class='delete_button' style='display:
none; visibility:hidden;'><span dojoAttachPoint='removeButtonNode'/></button></td></tr></tbody><tbody class='translation_tbody'></tbody></table></div></div></div></span>",
widgetsInTemplate: true,
field : "",
targetObject : "",
unique : "",
+ postMixInProperties : function () {
+ if (!this.unique) this.unique = openils.widget.TranslatorPopup._unique++;
+ },
+
postCreate : function () {
- dojo.connect(this.tooltipDialog, 'onOpen', this, 'renderTranslatorPopup');
+ dojo.connect(this.tooltipDialog, 'onFocus', this, 'renderTranslatorPopup');
this.nls = dojo.i18n.getLocalization("openils.widget", "TranslatorPopup");
@@ -64,9 +68,11 @@
renderTranslatorPopup : function () {
+ var _trans_dijit = this;
+
this._targetObject = dojox.jsonPath.query(window, '$.' + this.targetObject, {evalType:"RESULT"});
- var node = dojo.byId(this.field + '_translation_' + this.unique);
+ var node = dojo.byId(this.field + '_translation_tooltip_' + this.unique);
var trans_list = openils.I18N.getTranslations( this._targetObject, this.field );
@@ -114,12 +120,12 @@
dojo.query('.update_button',trans_row).style({ visibility : 'visible', display : 'inline'}).instantiate(
dijit.form.Button,
- { onClick : dojo.hitch( this, 'updateTranslation') }
+ { onClick : dojo.hitch( _trans_dijit, '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( _trans_dijit, 'removeTranslation', trans_id) }
);
trans_tbody.appendChild( trans_row );
@@ -155,7 +161,7 @@
dojo.query('.create_button',trans_row).style({ visibility : 'visible', display : 'inline'}).instantiate(
dijit.form.Button,
- { onClick : dojo.hitch( this, 'createTranslation') }
+ { onClick : dojo.hitch( _trans_dijit, 'createTranslation') }
);
trans_tbody.appendChild( trans_row );
@@ -186,7 +192,7 @@
},
createTranslation : function () {
- var node = dojo.byId(this.field + '_translation_' + this.unique);
+ var node = dojo.byId(this.field + '_translation_tooltip_' + this.unique);
var trans_obj = new i18n().fromHash({
isnew : 1,
@@ -201,32 +207,34 @@
writeTranslation : function (method, trans_obj) {
+ var _trans_dijit = 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_dijit._targetObject[_trans_dijit.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_dijit._targetObject[_trans_dijit.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_dijit.field + '_translation_tooltip_' + _trans_dijit.unique);
+ dijit.byId('i18n_new_locale_' + _trans_dijit._targetObject.classname + '.' + _trans_dijit.field + _trans_dijit.unique).setValue(null);
+ dijit.byId('i18n_new_translation_' + _trans_dijit._targetObject.classname + '.' + _trans_dijit.field + _trans_dijit.unique).setValue(null);
+ _trans_dijit.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_dijit._targetObject[_trans_dijit.field]() );
}
},
}).send();
More information about the open-ils-commits
mailing list