fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14502] testing ajax menu


From: Sigurd Nes
Subject: [Fmsystem-commits] [14502] testing ajax menu
Date: Sat, 28 Nov 2015 19:12:05 +0000

Revision: 14502
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14502
Author:   sigurdne
Date:     2015-11-28 19:12:03 +0000 (Sat, 28 Nov 2015)
Log Message:
-----------
testing ajax menu

Modified Paths:
--------------
    branches/dev-syncromind/phpgwapi/inc/class.menu.inc.php
    branches/dev-syncromind/phpgwapi/templates/portico/head.inc.php
    branches/dev-syncromind/phpgwapi/templates/portico/navbar.inc.php

Added Paths:
-----------
    branches/dev-syncromind/phpgwapi/templates/portico/js/ajax_jsmenu.js

Modified: branches/dev-syncromind/phpgwapi/inc/class.menu.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/inc/class.menu.inc.php     2015-11-28 
16:59:19 UTC (rev 14501)
+++ branches/dev-syncromind/phpgwapi/inc/class.menu.inc.php     2015-11-28 
19:12:03 UTC (rev 14502)
@@ -460,12 +460,16 @@
                        {
                                $vals['url'] = str_replace('&','&', 
$vals['url']);
                                $menu[$i] = $vals;
+                               $menu[$i]['app'] = $app;
                                $menu[$i]['key'] = $key;
                                $menu[$i]['is_leaf'] = true;
+                               $menu[$i]['children'] = false;
                                if(isset($menu[$i]['children']))
                                {
                                        $menu[$i]['is_leaf'] = false;
-                                       unset($menu[$i]['children']);
+                                       $menu[$i]['children'] = true;
+
+//                                     unset($menu[$i]['children']);
                                }
                                $i++;
                        }

Modified: branches/dev-syncromind/phpgwapi/templates/portico/head.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/templates/portico/head.inc.php     
2015-11-28 16:59:19 UTC (rev 14501)
+++ branches/dev-syncromind/phpgwapi/templates/portico/head.inc.php     
2015-11-28 19:12:03 UTC (rev 14502)
@@ -38,18 +38,13 @@
 
        if( !$GLOBALS['phpgw_info']['flags']['noframework'] && 
!$GLOBALS['phpgw_info']['flags']['nonavbar'] )
        {
-               
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/examples/treeview/assets/css/folders/tree.css');
-               phpgwapi_yui::load_widget('treeview');
-               phpgwapi_yui::load_widget('datasource');
-               
$GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent'] = 
'jsmenu';
+               phpgwapi_jquery::load_widget('treeview');
+
+               
$GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent'] = 
'jsmenu';//ajax_menu|jsmenu
                if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent']) 
&& $GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent'] == 
'ajax_menu')
                {
-                       $javascripts[] = 
"/phpgwapi/templates/portico/js/menu.js";
+                       $javascripts[] = 
"/phpgwapi/templates/portico/js/ajax_jsmenu.js";
                }
-               else if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent']) 
&& $GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent'] == 
'jsmenu')
-               {
-                       phpgwapi_jquery::load_widget('treeview');
-               }
 
        }
 

Added: branches/dev-syncromind/phpgwapi/templates/portico/js/ajax_jsmenu.js
===================================================================
--- branches/dev-syncromind/phpgwapi/templates/portico/js/ajax_jsmenu.js        
                        (rev 0)
+++ branches/dev-syncromind/phpgwapi/templates/portico/js/ajax_jsmenu.js        
2015-11-28 19:12:03 UTC (rev 14502)
@@ -0,0 +1,54 @@
+$(function () {
+
+       $('#navbar').jstree({
+               'core': {
+                       'data': {
+                               'url': function (node) {
+
+                                       console.log(node);
+
+                                       var oArgs = {};
+                                       if(node.id === '#')
+                                       {
+                                               oArgs 
={menuaction:'phpgwapi.menu.get_local_menu_ajax',node:'property'};
+                                       }
+                                       else
+                                       {
+                                               var app = node.original.app + 
'|' + node.original.key;
+                                               oArgs 
={menuaction:'phpgwapi.menu.get_local_menu_ajax',node: app};
+                                       }
+
+                                       return phpGWLink('index.php', oArgs, 
true);
+                               },
+                               'data': function (node) {
+                                       return {'id': node.id};
+                               }
+                       }
+               }
+       });
+
+       var to = false;
+
+       $('#navbar_search').keyup(function () {
+               if (to) {
+                       clearTimeout(to);
+               }
+               to = setTimeout(function () {
+                       var v = $('#navbar_search').val();
+                       $('#navbar').jstree(true).search(v);
+               }, 250);
+       });
+       $('#navbar').bind('select_node.jstree', function (e, data) {
+               if (typeof (data.event) == 'undefined')
+               {
+                       return false;
+               }
+               //              var treeInst = $('#treeDiv1').jstree(true);
+               //              treeInst.save_state();
+               setTimeout(function () {
+                       update_content(data.node.a_attr.href);
+                       //window.location.href = data.node.a_attr.href;
+               }, 100);
+
+       });
+});

Modified: branches/dev-syncromind/phpgwapi/templates/portico/navbar.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/templates/portico/navbar.inc.php   
2015-11-28 16:59:19 UTC (rev 14501)
+++ branches/dev-syncromind/phpgwapi/templates/portico/navbar.inc.php   
2015-11-28 19:12:03 UTC (rev 14502)
@@ -151,7 +151,6 @@
                        $_menu_selection = str_replace('::', '|', 
$GLOBALS['phpgw_info']['flags']['menu_selection']);
 
                        $var['treemenu'] = <<<HTML
-                               <div id="MenutreeDiv1"></div>
                                <script type="text/javascript">
                                        var apps = {$applications};
                                        var mapping = {$mapping};
@@ -174,7 +173,7 @@
                                }
                        }
                        $var['treemenu'] = <<<HTML
-                       <ul id="navbar">
+                       <ul>
 {$treemenu}
                        </ul>
 




reply via email to

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