From ac01014a149f6a061c389ea7332304e0d9ddc81b Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 5 Mar 2012 21:40:44 +0000 Subject: [PATCH] Translate select box options (including empty selection text) using proper egw object --- etemplate/js/et2_widget_button.js | 14 ++++++++++---- etemplate/js/et2_widget_image.js | 1 + etemplate/js/et2_widget_progress.js | 4 ++-- etemplate/js/et2_widget_selectbox.js | 8 ++++---- etemplate/js/test/test.css | 3 +++ 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/etemplate/js/et2_widget_button.js b/etemplate/js/et2_widget_button.js index e90b9d665f..76c81a8d2f 100644 --- a/etemplate/js/et2_widget_button.js +++ b/etemplate/js/et2_widget_button.js @@ -48,6 +48,7 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM], { this.label = ""; this.clicked = false; this.btn = null; + this.image = null; 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"); } jQuery(this.image.getDOMNode()).appendTo(this.btn); + //this.addChild(this.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() { - return [this.getDOMNode(),this.image]; + return [this.getDOMNode()]; }, setDetachedAttributes: function(_nodes, _values) @@ -171,8 +173,7 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM], { this.btn = jQuery(_nodes[0]); - this.image = _nodes[1]; - +console.debug(_nodes, _values); if (typeof _values["id"] != "undefined") { 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["image"] != "undefined") + { + this.image = null; + this.set_image(_values["image"]); + } if (typeof _values["class"] != "undefined") { diff --git a/etemplate/js/et2_widget_image.js b/etemplate/js/et2_widget_image.js index 1086731fdc..360174b19d 100644 --- a/etemplate/js/et2_widget_image.js +++ b/etemplate/js/et2_widget_image.js @@ -131,6 +131,7 @@ var et2_image = et2_baseWidget.extend([et2_IDetachedDOM], { _value = split[1]; } // Get application to use from template ID +//if(app == 'phpgwapi') app = 'infolog'; var src = this.egw().image(_value, app); if(src) { diff --git a/etemplate/js/et2_widget_progress.js b/etemplate/js/et2_widget_progress.js index 30621d993d..9480257ea0 100644 --- a/etemplate/js/et2_widget_progress.js +++ b/etemplate/js/et2_widget_progress.js @@ -20,7 +20,7 @@ /** * Class which implements the "image" XET-Tag */ -var et2_progress = et2_valueWidget.extend(et2_IDetachedDOM, +var et2_progress = et2_valueWidget.extend([et2_IDetachedDOM], { attributes: { "href": { @@ -104,7 +104,7 @@ var et2_progress = et2_valueWidget.extend(et2_IDetachedDOM, */ getDetachedAttributes: function(_attrs) { - _attrs.push("value", "label"); + _attrs.push("value", "label", "onclick"); }, getDetachedNodes: function() { diff --git a/etemplate/js/et2_widget_selectbox.js b/etemplate/js/et2_widget_selectbox.js index 1fdd17b8d1..5a9e5989fe 100644 --- a/etemplate/js/et2_widget_selectbox.js +++ b/etemplate/js/et2_widget_selectbox.js @@ -60,7 +60,7 @@ var et2_selectbox = et2_inputWidget.extend({ // Legacy options could have row count or empty label in first slot 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; } 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]["label"]) _options[key]["label"] = egw().lang(_options[key]["label"]); - if(_options[key]["title"]) _options[key]["title"] = egw().lang(_options[key]["title"]); + if(_options[key]["label"]) _options[key]["label"] = this.egw().lang(_options[key]["label"]); + if(_options[key]["title"]) _options[key]["title"] = this.egw().lang(_options[key]["title"]); } else { - _options[key] = egw().lang(_options[key]); + _options[key] = this.egw().lang(_options[key]); } } diff --git a/etemplate/js/test/test.css b/etemplate/js/test/test.css index 65a9738b44..8aee9f4ccc 100644 --- a/etemplate/js/test/test.css +++ b/etemplate/js/test/test.css @@ -315,6 +315,9 @@ ul.et2_link_string { content: ', '; } +.et2_link_list tr { + cursor: pointer; +} .et2_link_list td.remark { font-style: italic; }