Author: mwringe
Date: 2011-11-21 11:02:30 -0500 (Mon, 21 Nov 2011)
New Revision: 8105
Modified:
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/gadget/Gadgets.js
Log:
GTNPORTAL-2280: fix issue where default values for gadget preferences were not being
used.
Modified: portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/gadget/Gadgets.js
===================================================================
---
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/gadget/Gadgets.js 2011-11-21
11:45:51 UTC (rev 8104)
+++
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/gadget/Gadgets.js 2011-11-21
16:02:30 UTC (rev 8105)
@@ -653,8 +653,12 @@
theText = document.createTextNode(value.displayValue);
optEl.appendChild(theText);
optEl.setAttribute("value", value.value);
- if(userValue && value.value == userValue)
- optEl.setAttribute("selected", "selected");
+ if(userValue && value.value == userValue) {
+ optEl.setAttribute("selected", "selected");
+ }
+ else if (prefs[att].defaultValue && value.value ==
prefs[att].defaultValue) {
+ optEl.setAttribute("selected", "selected");
+ }
el.appendChild(optEl);
}
el.id = elID;
@@ -667,6 +671,9 @@
if (userPrefs[att]) {
el.value = userPrefs[att];
}
+ else if (prefs[att].defaultValue) {
+ el.value = prefs[att].defaultValue;
+ }
attEl.appendChild(el);
}
else if (type == "bool") {
@@ -678,6 +685,9 @@
prefs[att]["default"] == "true") {
el.checked = true;
}
+ else {
+ el.checked = prefs[att].defaultValue;
+ }
attEl.appendChild(el);
}
formEl.appendChild(attEl);