fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [11241] test ajax menu


From: Sigurd Nes
Subject: [Fmsystem-commits] [11241] test ajax menu
Date: Mon, 29 Jul 2013 13:19:33 +0000

Revision: 11241
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11241
Author:   sigurdne
Date:     2013-07-29 13:19:33 +0000 (Mon, 29 Jul 2013)
Log Message:
-----------
test ajax menu

Modified Paths:
--------------
    trunk/property/js/yahoo/test.menu.js
    trunk/property/test_menu.php

Modified: trunk/property/js/yahoo/test.menu.js
===================================================================
--- trunk/property/js/yahoo/test.menu.js        2013-07-29 10:59:34 UTC (rev 
11240)
+++ trunk/property/js/yahoo/test.menu.js        2013-07-29 13:19:33 UTC (rev 
11241)
@@ -1,56 +1,5 @@
 
-//test_
 
-var items = [
-    {"Id": "1", "Name": "abc", "Parent": "2"},
-    {"Id": "2", "Name": "abc", "Parent": ""},
-    {"Id": "3", "Name": "abc", "Parent": "5"},
-    {"Id": "4", "Name": "abc", "Parent": "2"},
-    {"Id": "5", "Name": "abc", "Parent": ""},
-    {"Id": "6", "Name": "abc", "Parent": "2"},
-    {"Id": "7", "Name": "abc", "Parent": "6"},
-    {"Id": "8", "Name": "abc", "Parent": "6"}
-];
-
-function buildHierarchy(arry) {
-
-    var roots = [], children = {};
-
-    // find the top level nodes and hash the children based on parent
-    for (var i = 0, len = arry.length; i < len; ++i) {
-        var item = arry[i],
-            p = item.Parent,
-            target = !p ? roots : (children[p] || (children[p] = []));
-
-        target.push({ value: item });
-    }
-
-    // function to recursively build the tree
-    var findChildren = function(parent) {
-        if (children[parent.value.Id]) {
-            parent.children = children[parent.value.Id];
-            for (var i = 0, len = parent.children.length; i < len; ++i) {
-                findChildren(parent.children[i]);
-            }
-        }
-    };
-
-    // enumerate through to handle the case where there are multiple roots
-    for (var i = 0, len = roots.length; i < len; ++i) {
-        findChildren(roots[i]);
-    }
-
-    return roots;
-}
-
-
-var test = buildHierarchy(items);
-//console.log(buildHierarchy(items));​
-
-// test
-
-
-
 function get_html (sUrl)
 {
        document.getElementById('html_content').src = sUrl;
@@ -213,6 +162,7 @@
 
                var menu_tree_data;
                var menu_arranged_data = {};
+               proxy_data[0] = {};
 
                if(typeof(Storage)!=="undefined")
                {
@@ -228,21 +178,25 @@
                {
                        alert(menu_tree_data);
                        menu_tree_data = JSON.parse(menu_tree_data);
-                       var k = 0;
-                       for (var i=0, j=menu_tree_data.length; i<j; i++)
-                       {
-                               if(menu_tree_data[i]['parent'] == 0)
-                               {
-                                       menu_arranged_data[k] = 
menu_tree_data[i];
-                                       k++;
-                               }
-                               else
-                               {
-                               
-                               }
-                       }
+                       console.log(menu_tree_data);
 
+                       var test = buildHierarchy(menu_tree_data);
 
+var items = [
+    {"id": "1", "Name": "abc", "parent": "2"},
+    {"id": "2", "Name": "abc", "parent": ""},
+    {"id": "3", "Name": "abc", "parent": "5"},
+    {"id": "4", "Name": "abc", "parent": "2"},
+    {"id": "5", "Name": "abc", "parent": ""},
+    {"id": "6", "Name": "abc", "parent": "2"},
+    {"id": "7", "Name": "abc", "parent": "6"},
+    {"id": "8", "Name": "abc", "parent": "6"}
+];
+
+//                     var test = buildHierarchy(items);
+
+                       console.log(test);
+
                }
 
 //             console.log(menu_tree_data);
@@ -280,6 +234,65 @@
           //will be generated as needed by the dynamic loader.
 
           tree.draw();
+
+
+
+
+//----------test -------------
+
+
+function buildHierarchy(arry) {
+
+alert(arry.length);
+//console.log(arry);
+    var roots = [], children = {};
+
+    // find the top level nodes and hash the children based on parent
+    for (var i = 0, len = arry.length; i < len; ++i)
+    {
+        var item = arry[i],
+            p = item.parent,
+            target = !p ? roots : (children[p] || (children[p] = []));
+
+// console.log(arry[i]);
+        target.push({ value: item });
+    }
+
+    // function to recursively build the tree
+    var findChildren = function(parent) {
+        if (children[parent.value.id])
+        {
+            parent.children = children[parent.value.id];
+            for (var i = 0, len = parent.children.length; i < len; ++i)
+            {
+                findChildren(parent.children[i]);
+            }
+        }
+    };
+
+    // enumerate through to handle the case where there are multiple roots
+    for (var i = 0, len = roots.length; i < len; ++i) {
+        findChildren(roots[i]);
+    }
+
+    return roots;
+}
+
+
+// ------test -----------
+
+
+
+
+
+
+
+
+
+
+
+
+
        }
 
 

Modified: trunk/property/test_menu.php
===================================================================
--- trunk/property/test_menu.php        2013-07-29 10:59:34 UTC (rev 11240)
+++ trunk/property/test_menu.php        2013-07-29 13:19:33 UTC (rev 11241)
@@ -60,7 +60,7 @@
                <script type="text/javascript">
                   var apps = {$applications};
                   var mapping = {$mapping};
-                  var proxy_data = {};
+                  var proxy_data = new Array();
                </script>
 HTML;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]