Added support for attribute descriptor 'translate': '\!no_lang', fixed problem with selectbox options not being read from sel_options, removed attributes from init function as they were either outdated or not used

This commit is contained in:
Andreas Stöckel 2011-08-24 10:05:52 +00:00
parent 04aa3d35b9
commit 7b5e73b600
15 changed files with 27 additions and 29 deletions

View File

@ -50,7 +50,7 @@ var et2_checkbox = et2_inputWidget.extend({
} }
}, },
init: function(_parent) { init: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.input = null; this.input = null;

View File

@ -37,7 +37,7 @@ var et2_date = et2_inputWidget.extend({
*/ */
date: new Date(), date: new Date(),
init: function(_parent) { init: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.input = null; this.input = null;

View File

@ -27,7 +27,7 @@ var et2_description = et2_baseWidget.extend({
"name": "Caption", "name": "Caption",
"type": "string", "type": "string",
"description": "Displayed text", "description": "Displayed text",
"translate": true "translate": "!no_lang"
}, },
/** /**
@ -78,7 +78,7 @@ var et2_description = et2_baseWidget.extend({
legacyOptions: ["font_style", "href", "activate_links", "for", legacyOptions: ["font_style", "href", "activate_links", "for",
"extra_link_target", "extra_link_popup", "extra_link_title"], "extra_link_target", "extra_link_popup", "extra_link_title"],
init: function(_parent) { init: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.value = ""; this.value = "";

View File

@ -23,7 +23,7 @@
*/ */
var et2_grid = et2_DOMWidget.extend({ var et2_grid = et2_DOMWidget.extend({
init: function(_parent) { init: function() {
// Create the table body and the table // Create the table body and the table
this.tbody = $j(document.createElement("tbody")); this.tbody = $j(document.createElement("tbody"));
this.table = $j(document.createElement("table")) this.table = $j(document.createElement("table"))

View File

@ -24,7 +24,7 @@ var et2_hbox = et2_baseWidget.extend({
createNamespace: true, createNamespace: true,
init: function(_parent) { init: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.alignData = { this.alignData = {

View File

@ -21,7 +21,7 @@
*/ */
var et2_hrule = et2_baseWidget.extend({ var et2_hrule = et2_baseWidget.extend({
init: function(_parent) { init: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.setDOMNode(document.createElement("hr")); this.setDOMNode(document.createElement("hr"));

View File

@ -40,7 +40,7 @@ var et2_number = et2_textbox.extend({
} }
}, },
init: function(_parent) { init: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
}, },

View File

@ -43,7 +43,7 @@ var et2_radiobox = et2_inputWidget.extend({
} }
}, },
init: function(_parent) { init: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.input = null; this.input = null;

View File

@ -52,17 +52,17 @@ var et2_selectbox = et2_inputWidget.extend({
legacyOptions: ["rows"], legacyOptions: ["rows"],
init: function(_parent, _attrs) { init: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
// Only allow options inside this element // Only allow options inside this element
this.supportedWidgetClasses = [et2_option]; this.supportedWidgetClasses = [et2_option];
// 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 _attrs.rows == "string" && isNaN(_attrs.rows)) { if(typeof this.options.rows == "string" && isNaN(this.options.rows)) {
this.options.empty_label = _attrs.rows; this.options.empty_label = 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;
this.createInputWidget(); this.createInputWidget();
}, },
@ -149,7 +149,7 @@ var et2_selectbox = et2_inputWidget.extend({
} }
// Create the widget and add it as a child // Create the widget and add it as a child
this.addChild(et2_createWidget("option", attrs)); et2_createWidget("option", attrs, this);
} }
} }
}); });
@ -165,7 +165,7 @@ et2_register_widget(et2_selectbox, ["menupopup", "listbox", "select-cat",
*/ */
var et2_selectbox_ro = et2_selectbox.extend({ var et2_selectbox_ro = et2_selectbox.extend({
init: function(_parent, _attrs) { init: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.supportedWidgetClasses = []; this.supportedWidgetClasses = [];

View File

@ -27,7 +27,7 @@ var et2_tabbox = et2_DOMWidget.extend({
* Currently selected tab * Currently selected tab
*/ */
selected_index: 0, selected_index: 0,
init: function(_parent, _type) { init: function() {
// Create the outer tabbox container // Create the outer tabbox container
this.container = $j(document.createElement("div")) this.container = $j(document.createElement("div"))
.addClass("et2_tabbox"); .addClass("et2_tabbox");
@ -47,8 +47,7 @@ var et2_tabbox = et2_DOMWidget.extend({
this.tabData = []; this.tabData = [];
}, },
destroy: function(_parent, _type) { destroy: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.container = null; this.container = null;

View File

@ -49,7 +49,7 @@ var et2_template = et2_DOMWidget.extend({
/** /**
* Initializes this template widget as a simple container. * Initializes this template widget as a simple container.
*/ */
init: function(_parent) { init: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.proxiedTemplate = null; this.proxiedTemplate = null;

View File

@ -52,7 +52,7 @@ var et2_textbox = et2_inputWidget.extend({
}, },
}, },
init: function(_parent) { init: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.input = null; this.input = null;

View File

@ -514,14 +514,13 @@ var et2_widget = Class.extend({
} }
// Translate the attributes // Translate the attributes
if (!_attrs["no_lang"]) for (var key in _attrs)
{ {
for (var key in _attrs) if (_attrs[key] && typeof this.attributes[key] != "undefined")
{ {
if (typeof this.attributes[key] != "undefined" && this.attributes[key].translate) if (this.attributes[key].translate === true ||
{ (this.attributes[key].translate === "!no_lang" && !_attrs["no_lang"]))
_attrs[key] = egw.lang(_attrs[key]); _attrs[key] = egw.lang(_attrs[key]);
}
} }
} }
}, },

View File

@ -70,7 +70,7 @@ var timesheet_data = {
"button[save]":false, "button[save]":false,
"button[save_new]":false, "button[save_new]":false,
"button[apply]":false, "button[apply]":false,
"ts_owner":true, /* "ts_owner":true,*/
"tabs":{ "tabs":{
"customfields":true "customfields":true
} }

View File

@ -129,7 +129,7 @@
</menulist> </menulist>
</row> </row>
<row class="row"> <row class="row">
<description value="Project" options=",,,ts_project"/> <description no_lang="true" value="Project" options=",,,ts_project"/>
<grid spacing="1" padding="1"> <grid spacing="1" padding="1">
<columns> <columns>
<column/> <column/>