Translate select box options (including empty selection text) using proper egw object

This commit is contained in:
Nathan Gray 2012-03-05 21:40:44 +00:00
parent 731b8cf460
commit ac01014a14
5 changed files with 20 additions and 10 deletions

View File

@ -48,6 +48,7 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM], {
this.label = ""; this.label = "";
this.clicked = false; this.clicked = false;
this.btn = null; this.btn = null;
this.image = null;
if (!this.options.readonly) if (!this.options.readonly)
{ {
@ -76,10 +77,11 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM], {
this.btn.removeClass("et2_button_text").addClass("et2_button_icon"); this.btn.removeClass("et2_button_text").addClass("et2_button_icon");
} }
jQuery(this.image.getDOMNode()).appendTo(this.btn); jQuery(this.image.getDOMNode()).appendTo(this.btn);
//this.addChild(this.image);
} }
if(!found_image) if(!found_image)
{ {
this.set_label(this.options.label); this.set_label(this.label);
} }
}, },
@ -163,7 +165,7 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM], {
getDetachedNodes: function() getDetachedNodes: function()
{ {
return [this.getDOMNode(),this.image]; return [this.getDOMNode()];
}, },
setDetachedAttributes: function(_nodes, _values) setDetachedAttributes: function(_nodes, _values)
@ -171,8 +173,7 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM], {
this.btn = jQuery(_nodes[0]); this.btn = jQuery(_nodes[0]);
this.image = _nodes[1]; console.debug(_nodes, _values);
if (typeof _values["id"] != "undefined") if (typeof _values["id"] != "undefined")
{ {
this.set_id(_values["id"]); this.set_id(_values["id"]);
@ -184,6 +185,11 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM], {
if (typeof _values["value"] != "undefined") if (typeof _values["value"] != "undefined")
{ {
} }
if (typeof _values["image"] != "undefined")
{
this.image = null;
this.set_image(_values["image"]);
}
if (typeof _values["class"] != "undefined") if (typeof _values["class"] != "undefined")
{ {

View File

@ -131,6 +131,7 @@ var et2_image = et2_baseWidget.extend([et2_IDetachedDOM], {
_value = split[1]; _value = split[1];
} }
// Get application to use from template ID // Get application to use from template ID
//if(app == 'phpgwapi') app = 'infolog';
var src = this.egw().image(_value, app); var src = this.egw().image(_value, app);
if(src) if(src)
{ {

View File

@ -20,7 +20,7 @@
/** /**
* Class which implements the "image" XET-Tag * Class which implements the "image" XET-Tag
*/ */
var et2_progress = et2_valueWidget.extend(et2_IDetachedDOM, var et2_progress = et2_valueWidget.extend([et2_IDetachedDOM],
{ {
attributes: { attributes: {
"href": { "href": {
@ -104,7 +104,7 @@ var et2_progress = et2_valueWidget.extend(et2_IDetachedDOM,
*/ */
getDetachedAttributes: function(_attrs) { getDetachedAttributes: function(_attrs) {
_attrs.push("value", "label"); _attrs.push("value", "label", "onclick");
}, },
getDetachedNodes: function() { getDetachedNodes: function() {

View File

@ -60,7 +60,7 @@ var et2_selectbox = et2_inputWidget.extend({
// Legacy options could have row count or empty label in first slot // Legacy options could have row count or empty label in first slot
if(typeof this.options.rows == "string" && isNaN(this.options.rows)) { if(typeof this.options.rows == "string" && isNaN(this.options.rows)) {
this.options.empty_label = this.options.rows; this.options.empty_label = this.egw().lang(this.options.rows);
this.options.rows = 1; this.options.rows = 1;
} }
if(this.options.rows > 1) this.options.multiple = true; if(this.options.rows > 1) this.options.multiple = true;
@ -210,12 +210,12 @@ var et2_selectbox = et2_inputWidget.extend({
{ {
if (_options[key] instanceof Object) if (_options[key] instanceof Object)
{ {
if(_options[key]["label"]) _options[key]["label"] = egw().lang(_options[key]["label"]); if(_options[key]["label"]) _options[key]["label"] = this.egw().lang(_options[key]["label"]);
if(_options[key]["title"]) _options[key]["title"] = egw().lang(_options[key]["title"]); if(_options[key]["title"]) _options[key]["title"] = this.egw().lang(_options[key]["title"]);
} }
else else
{ {
_options[key] = egw().lang(_options[key]); _options[key] = this.egw().lang(_options[key]);
} }
} }

View File

@ -315,6 +315,9 @@ ul.et2_link_string {
content: ', '; content: ', ';
} }
.et2_link_list tr {
cursor: pointer;
}
.et2_link_list td.remark { .et2_link_list td.remark {
font-style: italic; font-style: italic;
} }