Author: [email protected]
Date: Wed Jan 18 12:33:29 2012
New Revision: 1925

Log:
[AMDATUOPENSOCIAL-140] Added utility methods used by login and useradmin gadgets

Modified:
   
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/js/dashboard_gadget.js

Modified: 
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/js/dashboard_gadget.js
==============================================================================
--- 
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/js/dashboard_gadget.js
       (original)
+++ 
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/js/dashboard_gadget.js
       Wed Jan 18 12:33:29 2012
@@ -6,8 +6,56 @@
     window.parent.updateCSS(document);
   }
 
+  function to_rfc3986(value){
+     var tmp =  encodeURIComponent(value);
+     tmp = tmp.replace('!','%21');
+     tmp = tmp.replace('*','%2A');
+     tmp = tmp.replace('(','%28');
+     tmp = tmp.replace(')','%29');
+     tmp = tmp.replace("'",'%27');
+     return tmp;
+  }
+
+  function ensureArray(input) {
+    // check if this result is an array
+    if (jQuery.isArray(input)) {
+      return input;
+    }
+    var result = [];
+    if (input != null) {
+      result.push(input);
+    }
+    return result;
+  }
+
+  function show(id) {
+    var obj = document.getElementById(id);
+    obj.style.visibility = "";
+    obj.style.display = "";
+  }
+
+  function hide(id) {
+    var obj = document.getElementById(id);
+    obj.style.visibility = "hidden";
+    obj.style.display = "none";
+  }
+
+  function getCookie(cookieName) {
+    var results = document.cookie.match ( '(^|;) ?' + cookieName + 
'=([^;]*)(;|$)' );
+    if (results) {
+      return (unescape(results[2]));
+    } else {
+      return null;
+    }
+}
+
   // Public methods and variables.
   return {
-    updateCSS:updateCSS
+    updateCSS:updateCSS,
+    to_rfc3986:to_rfc3986,
+    ensureArray:ensureArray,
+    show:show,
+    hide:hide,
+    getCookie:getCookie
   }
 }();
\ No newline at end of file
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits

Reply via email to