new object pluginset
[unfold.git] / engine / static / js / plugin.js
index 7c22af6..709421e 100644 (file)
@@ -1,22 +1,54 @@
-/* upon document completion, we locate all the hide and show areas, 
- * and configure their behaviour 
- */
-$(document).ready(function() {
-    window.console.log("Setting plugin toggle behaviour");
-    $('.plugin-hide').each(function() {
-       window.console.log("Setting plugin toggle behaviour on hide "+$(this).attr('id'));
-       $(this).click(function () { 
-           window.console.log("click on a HIDE button");
-           var plugin='#'+$(this).attr('id').replace('hide-',''); 
-           var show='#'+$(this).attr('id').replace('hide-','show-'); 
-           jQuery(plugin).hide(); jQuery(show).show(); $(this).hide();});
-       })
-    $('.plugin-show').each(function() {
-       window.console.log("Setting plugin toggle behaviour on show "+$(this).attr('id'));
-       $(this).click(function () { 
-           window.console.log("click on a SHOW button");
-           var plugin='#'+$(this).attr('id').replace('show-',''); 
-           var hide='#'+$(this).attr('id').replace('show-','hide-'); 
-           jQuery(plugin).show(); jQuery(hide).show(); $(this).hide();});
-       })
-    })
+function getMetadata(){
+    return all_headers;
+}
+// returns all fields of a given method
+function getMetadata_fields(method){
+    var result=new Array();
+    jQuery.each(all_headers, function(m,obj){
+        if(m==method){
+            jQuery.each(obj['column'], function(i,f){
+                result.push(f);
+            });
+            return false;
+        }
+    });
+    result.sort(sort_by('column', false, function(a){return a.toUpperCase()}));
+    //result=jQuery(result).sort("column", "asc");
+    return result;
+}
+// returns all properties of a given field
+function getMetadata_field(method, field){
+    //console.log(all_headers);
+    var result=new Array();
+    jQuery.each(all_headers, function(m,obj){
+        if(m==method){
+            jQuery.each(obj['column'], function(i,f){
+                if(f['column']==field){
+                    result.push(f);
+                    return false;
+                }
+            });
+            return false;
+        }
+    });
+    return result[0];
+}
+// returns the value of a property from a field within a method (type of object : resource,node,lease,slice...)
+function getMetadata_property(method, field, property){
+    //console.log(all_headers);
+    var result=null;
+    jQuery.each(all_headers, function(m,obj){
+        if(m==method){
+            jQuery.each(obj['column'], function(i,f){
+                if(f['column']==field){
+                    result=f[property];
+                    return false;
+                }
+            });
+            return false;
+        }
+    });
+    return result;
+    //all_headers[method]['column']
+    //[field][]
+}