new attribute type "rawstring" not doing html-entity decoding used just for "value" attribute

This commit is contained in:
Ralf Becker 2015-03-11 12:12:52 +00:00
parent 6c22a1cb20
commit f3869d366e
2 changed files with 7 additions and 6 deletions

View File

@ -40,6 +40,7 @@ var et2_validTypes = ["boolean", "string", "html", "float", "integer", "any", "j
var et2_typeDefaults = { var et2_typeDefaults = {
"boolean": false, "boolean": false,
"string": "", "string": "",
"rawstring": "", // no html-entity decoding
"html": "", "html": "",
"js": null, "js": null,
"float": 0.0, "float": 0.0,
@ -153,7 +154,7 @@ function et2_checkType(_val, _type, _attr, _widget)
} }
// Check whether the given value is of the type "string" // Check whether the given value is of the type "string"
if (_type == "string" || _type == "html") if (_type == "string" || _type == "html" || _type == "rawstring")
{ {
if (typeof _val == "number") // as php is a bit vague here, silently convert to a string if (typeof _val == "number") // as php is a bit vague here, silently convert to a string
{ {
@ -162,7 +163,7 @@ function et2_checkType(_val, _type, _attr, _widget)
if (typeof _val == "string") if (typeof _val == "string")
{ {
return _type == "html" ? _val : html_entity_decode(_val); return _type == "string" ? html_entity_decode(_val) : _val;
} }
// Handle some less common possibilities // Handle some less common possibilities

View File

@ -21,7 +21,7 @@
* et2_valueWidget is the base class for et2_inputWidget - valueWidget introduces * et2_valueWidget is the base class for et2_inputWidget - valueWidget introduces
* the "value" attribute and automatically loads it from the "content" array * the "value" attribute and automatically loads it from the "content" array
* after loading from XML. * after loading from XML.
* *
* @augments et2_baseWidget * @augments et2_baseWidget
*/ */
var et2_valueWidget = et2_baseWidget.extend( var et2_valueWidget = et2_baseWidget.extend(
@ -37,14 +37,14 @@ var et2_valueWidget = et2_baseWidget.extend(
"value": { "value": {
"name": "Value", "name": "Value",
"description": "The value of the widget", "description": "The value of the widget",
"type": "string", "type": "rawstring", // no html-entity decoding
"default": et2_no_init "default": et2_no_init
} }
}, },
/** /**
* *
* *
* @memberOf et2_valueWidget * @memberOf et2_valueWidget
* @param _attrs * @param _attrs
*/ */