Merge branch 'jordan' of ssh://git.onelab.eu/git/myslice into jordan
[myslice.git] / unfold / js / unfold-helper.js
index 3a76049..8d75cc3 100644 (file)
@@ -4,11 +4,11 @@ var unfold = {
        if (maxdepth===undefined) maxdepth=5;
        var up=null, counter=0;
        while (true) {
-           console.log(counter+" "+msg+" id='"+dom.id+"' ["+dom.classList+"]");
+           messages.debug(counter+" "+msg+" id='"+dom.id+"' ["+dom.classList+"]");
            up=dom.parentNode;
            counter += 1;
            if ( (up == null) || (up === dom)) break;
-           if (counter >= maxdepth) { console.log(counter+" "+msg+" -> ..."); break; }
+           if (counter >= maxdepth) { messages.debug(counter+" "+msg+" -> ..."); break; }
            dom=up;
        }
     },
@@ -22,10 +22,23 @@ var unfold = {
 
     errorDisplay : function (error) {
        return '<div class="error"><dl id="system-message"><dt class="error">Notice</dt><dd class="error message"><ul><li>' + error + '</li></ul></dd></dl></div>';
-    return out;
     },
 
+    get_value: function (value) {
+        //if(typeof(jQuery(value).attr('value'))!="undefined"){
+        if (/<span value=['"].*['"]>.*<\/span>/i.test(value)) {
+            return jQuery(value).attr('value');
+        } else {
+            return value;
+        }
+    },
+
+    escape_id: function(id) {
+        return id.replace( /(:|\.|\[|\])/g, "\\$1" );
+    }
+
 } // global unfold
 
 // xxx tmp - until all plugins are ported
-errorDisplay = unfold.errorDisplay;
+errorDisplay   = unfold.errorDisplay;
+get_value      = unfold.get_value;