From d65066341b8c9fe6566fc25af5f998abcf6f57a0 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 25 Jul 2012 22:37:56 +0000 Subject: [PATCH] Fix some more attribute issues, silenceing some attribute warnings --- etemplate/js/et2_core_common.js | 8 ++++++++ etemplate/js/et2_widget_box.js | 6 ++++++ etemplate/js/et2_widget_number.js | 12 ++++++++++++ etemplate/js/et2_widget_textbox.js | 2 +- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/etemplate/js/et2_core_common.js b/etemplate/js/et2_core_common.js index 1ff87baccf..72a2c55f42 100644 --- a/etemplate/js/et2_core_common.js +++ b/etemplate/js/et2_core_common.js @@ -124,6 +124,14 @@ function et2_checkType(_val, _type, _attr, _cname) { return _val === "true"; } + if(lcv === "0" || lcv === "1") + { + return _val === "1"; + } + } + else if (typeof _val == "number") + { + return _val != 0; } return _err(); diff --git a/etemplate/js/et2_widget_box.js b/etemplate/js/et2_widget_box.js index 866d01b7fa..2d780ce1aa 100644 --- a/etemplate/js/et2_widget_box.js +++ b/etemplate/js/et2_widget_box.js @@ -22,6 +22,12 @@ */ var et2_box = et2_baseWidget.extend([et2_IDetachedDOM], { + attributes: { + // Not needed + "rows": {"ignore": true}, + "cols": {"ignore": true} + }, + createNamespace: true, init: function() { diff --git a/etemplate/js/et2_widget_number.js b/etemplate/js/et2_widget_number.js index b92eebc1a3..95e7b5bd27 100644 --- a/etemplate/js/et2_widget_number.js +++ b/etemplate/js/et2_widget_number.js @@ -83,3 +83,15 @@ var et2_number = et2_textbox.extend({ et2_register_widget(et2_number, ["int", "integer", "float"]); +/** + * Extend read-only to tell it to ignore special attributes, which + * would cause warnings otherwise + */ +var et2_number_ro = et2_textbox_ro.extend({ + attributes: { + "min": {"ignore": true}, + "max": {"ignore": true}, + "precision": {"ignore": true} + } +}); +et2_register_widget(et2_number_ro, ["int_ro", "integer_ro", "float_ro"]); diff --git a/etemplate/js/et2_widget_textbox.js b/etemplate/js/et2_widget_textbox.js index 0adbceb7fe..758a6310bb 100644 --- a/etemplate/js/et2_widget_textbox.js +++ b/etemplate/js/et2_widget_textbox.js @@ -229,5 +229,5 @@ var et2_textbox_ro = et2_valueWidget.extend([et2_IDetachedDOM], { } }); -et2_register_widget(et2_textbox_ro, ["textbox_ro", "int_ro", "integer_ro", "float_ro"]); +et2_register_widget(et2_textbox_ro, ["textbox_ro"]);