From 9b7cd5019c9019acb5d376bd50c9606c75a447cc Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 27 Sep 2011 23:44:07 +0000 Subject: [PATCH] Silence some messages about missing attribute attributes --- etemplate/js/et2_core_common.js | 1 + etemplate/js/et2_core_widget.js | 5 ++++- etemplate/js/et2_widget_button.js | 12 ++++++------ etemplate/js/et2_widget_image.js | 6 ++++++ etemplate/js/et2_widget_progress.js | 10 ++++++++++ etemplate/js/et2_widget_template.js | 7 +++++++ 6 files changed, 34 insertions(+), 7 deletions(-) diff --git a/etemplate/js/et2_core_common.js b/etemplate/js/et2_core_common.js index 027c33af6d..fd4580d900 100644 --- a/etemplate/js/et2_core_common.js +++ b/etemplate/js/et2_core_common.js @@ -378,6 +378,7 @@ function et2_validateAttrib(_id, _attrib) _attrib["name"] = _id; et2_debug("log", "Human name ('name'-Field) for attribute '" + _id + "' has not been supplied, set to '" + _id + "'"); +console.debug(_attrib); } if (typeof _attrib["description"] == "undefined") diff --git a/etemplate/js/et2_core_widget.js b/etemplate/js/et2_core_widget.js index 92cd53e152..2b9b737c16 100644 --- a/etemplate/js/et2_core_widget.js +++ b/etemplate/js/et2_core_widget.js @@ -128,7 +128,10 @@ var et2_widget = Class.extend({ * function and passed as second parameter of the widget constructor */ "type": { - "ignore": true + "name": "Widget type", + "type": "string", + "ignore": true, + "description": "What kind of widget this is" }, /** diff --git a/etemplate/js/et2_widget_button.js b/etemplate/js/et2_widget_button.js index 4dd8bdc230..5f604214ed 100644 --- a/etemplate/js/et2_widget_button.js +++ b/etemplate/js/et2_widget_button.js @@ -158,7 +158,7 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM], { */ getDetachedAttributes: function(_attrs) { - _attrs.push("value", "class", "image" ); + _attrs.push("label", "value", "class", "image", "onclick" ); }, getDetachedNodes: function() @@ -177,6 +177,10 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM], { { this.set_id(_values["id"]); } + if (typeof _values["label"] != "undefined") + { + this.set_label(_values["label"]); + } if (typeof _values["value"] != "undefined") { } @@ -186,11 +190,7 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM], { this.set_class(_values["class"]); } - if (typeof _values["onclick"] == "string") - { - _values["onclick"] = new Function(_values["onclick"]); - } - if (typeof _values["onclick"] == "function") + if (typeof _values["onclick"] != "undefined") { this.options.onclick = _values["onclick"]; } diff --git a/etemplate/js/et2_widget_image.js b/etemplate/js/et2_widget_image.js index b5c573c2d8..c3cbd68e9f 100644 --- a/etemplate/js/et2_widget_image.js +++ b/etemplate/js/et2_widget_image.js @@ -46,8 +46,14 @@ var et2_image = et2_baseWidget.extend(et2_IDetachedDOM, { "description": "widthxheight, if popup should be used, eg. 640x480" }, "imagemap":{ + // TODO: Do something with this + "name": "Image map", + "description": "Currently not implemented" }, "label": { + "name": "Label", + "type": "string", + "description": "Label for image" } }, legacyOptions: ["href", "extra_link_target", "imagemap", "extra_link_popup", "id"], diff --git a/etemplate/js/et2_widget_progress.js b/etemplate/js/et2_widget_progress.js index b352e5952d..621aaaaf0c 100644 --- a/etemplate/js/et2_widget_progress.js +++ b/etemplate/js/et2_widget_progress.js @@ -40,6 +40,16 @@ var et2_progress = et2_valueWidget.extend(et2_IDetachedDOM, "description": "widthxheight, if popup should be used, eg. 640x480" }, "label": { + "name": "Label", + "default": "", + "type": "string", + "description": "The label is displayed as the title. The label can contain variables, as descript for name. If the label starts with a '@' it is replaced by the value of the content-array at this index (with the '@'-removed and after expanding the variables).", + "translate": true + }, + "onchange": { + "name": "onchange", + "type": "js", + "description": "JS code which is executed when the value changes." } }, legacyOptions: ["href", "extra_link_target", "imagemap", "extra_link_popup", "id"], diff --git a/etemplate/js/et2_widget_template.js b/etemplate/js/et2_widget_template.js index fc5d38d4e8..30b575ce4f 100644 --- a/etemplate/js/et2_widget_template.js +++ b/etemplate/js/et2_widget_template.js @@ -29,8 +29,15 @@ var et2_template = et2_DOMWidget.extend({ attributes: { "template": { + "name": "Template", + "type": "string", + "description": "Name / ID of template" }, "group": { + // TODO: Not implemented + "name": "Group", + "description":"Not implemented", + "default": 0 }, "version": { "name": "Version",