Author: chirag
Date: Fri Jul 16 21:28:38 2010
New Revision: 964954

URL: http://svn.apache.org/viewvc?rev=964954&view=rev
Log:
SHINDIG-1378 - Caja removes unknown attributes in os:PeopleSelector
Code Review: http://codereview.appspot.com/1715049/show

Modified:
    shindig/trunk/config/OSML_library.xml

Modified: shindig/trunk/config/OSML_library.xml
URL: 
http://svn.apache.org/viewvc/shindig/trunk/config/OSML_library.xml?rev=964954&r1=964953&r2=964954&view=diff
==============================================================================
--- shindig/trunk/config/OSML_library.xml (original)
+++ shindig/trunk/config/OSML_library.xml Fri Jul 16 21:28:38 2010
@@ -32,21 +32,18 @@
         ${My.person.name.formatted}
       </os:If>
       <a href="${My.person.profileUrl}" 
if="${My.person.profileUrl}">${My.person.name.formatted}</a>
-    </div> 
+    </div>
   </Template>
   <TemplateDef tag="os:PeopleSelector">
     <Template>
-      <select onchange="os_PeopleSelector_onchange(this)" 
-          name="${My.inputName}" 
-          multiple="${My.multiple}"
-          x-var="${My.var}"
-          x-max="${My.max}"
-          x-onselect="${My.onselect}">
-        <option repeat="${My.group}" value="${Cur.id}" selected="${Cur.id == 
My.selected}">${Cur.name.formatted}</option>          
+      <select onchange="os_PeopleSelector_onchange(this, '${My.var}', ${My.max 
? My.max : 0}, '${My.onselect}')"
+          name="${My.inputName}"
+          multiple="${My.multiple}">
+        <option repeat="${My.group}" value="${Cur.id}" selected="${Cur.id == 
My.selected}">${Cur.name.formatted}</option>
       </select>
     </Template>
     <JavaScript><![CDATA[
-        function os_PeopleSelector_onchange(select) {
+        function os_PeopleSelector_onchange(select, varAttr, maxAttr, 
onSelectAttr) {
           var selected;
           if (!select.multiple) {
             selected = select.options[select.selectedIndex].value;
@@ -57,13 +54,12 @@
                 selected.push(select.options[i].value);
               }
             }
-            var max = select.getAttribute("x-max");
             try {
-              max = 1*max;
+              maxAttr = 1*maxAttr;
             } catch (e) {
-              max = 0;
+              maxAttr = 0;
             }
-            if (max && selected.length > max && select['x-selected']) {
+            if (maxAttr && selected.length > maxAttr && select['x-selected']) {
               selected = select['x-selected'];
               for (var i = 0; i < select.options.length; i++) {
                 select.options[i].selected = false;
@@ -76,20 +72,19 @@
               }
             }
           }
-          select['x-selected'] = selected;          
-          var varAttr = select.getAttribute("x-var");
+          select['x-selected'] = selected;
           if (varAttr) {
             if (opensocial.data) {
               opensocial.data.getDataContext().putDataSet(varAttr, selected);
             }
           }
-          var onSelect = select.getAttribute("x-onselect");
-          if (onSelect) {
-            if (window[onSelect] && typeof(window[onSelect]) == 'function') {
-              window[onSelect](selected);
+
+          if (onSelectAttr) {
+            if (window[onSelectAttr] && typeof(window[onSelectAttr]) == 
'function') {
+              window[onSelectAttr](selected);
             } else {
               if (!select['x-onselect-fn']) {
-                select['x-onselect-fn'] = new Function(onSelect);
+                select['x-onselect-fn'] = new Function(onSelectAttr);
               }
               select['x-onselect-fn'].apply(select);
             }


Reply via email to