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

SF.net SVN: ledger-smb: [1481] trunk



Revision: 1481
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1481&view=rev
Author:   einhverfr
Date:     2007-08-31 22:35:34 -0700 (Fri, 31 Aug 2007)

Log Message:
-----------
Expanding menu now works with or without Javascript.

Modified Paths:
--------------
    trunk/UI/menu_expand.html
    trunk/scripts/menu.pl

Modified: trunk/UI/menu_expand.html
===================================================================
--- trunk/UI/menu_expand.html	2007-09-01 04:51:48 UTC (rev 1480)
+++ trunk/UI/menu_expand.html	2007-09-01 05:35:34 UTC (rev 1481)
@@ -48,16 +48,26 @@
 				?>?login=<?lsmb login 
 				?>&<?lsmb FOREACH arg IN item.args 
 				?><?lsmb arg 
-				?>&<?lsmb END ?>"
-				target = "main_window"
-				onclick="return <?lsmb IF item.menu 
-					?>SwitchMenu('sub_<?lsmb item.id ?>')<?lsmb END ?>"
+				?><?lsmb END 
+				?><?lsmb IF item.menu 
+					?>&id=<?lsmb item.id
+					?>&open=<?lsmb open 
+				?><?lsmb END ?>"
+				<?lsmb IF item.module ?> 
+					target = "main_window" 
+				<?lsmb END ?>
+				<?lsmb IF item.menu ?> 
+					onclick="return SwitchMenu('sub_<?lsmb item.id ?>')"
+				<?lsmb END ?>
 				class = "<?lsmb IF item.module ?>Menu<?lsmb
 					ELSE ?>Item<?lsmb END ?>"
 				><?lsmb text(item.label) ?></a>
 		</div>
 		<?lsmb IF item.menu ?>
-			<div id="sub_<?lsmb item.id ?>" class=submenu>
+			<div id="sub_<?lsmb item.id ?>" class=submenu
+			<?lsmb IF item.open ?>
+				style="display: block"
+			<?lsmb END ?>>
 		<?lsmb END ?>
 		<?lsmb old_level = item.level ?>
 	<?lsmb END ?>

Modified: trunk/scripts/menu.pl
===================================================================
--- trunk/scripts/menu.pl	2007-09-01 04:51:48 UTC (rev 1480)
+++ trunk/scripts/menu.pl	2007-09-01 05:35:34 UTC (rev 1481)
@@ -13,6 +13,12 @@
 use strict;
 
 sub __default {
+    my ($request) = @_;
+    if ($request->{menubar}){
+        # todo
+    } else {
+        expanding_menu($request);
+    }
 }
 
 sub root_doc {
@@ -27,18 +33,33 @@
              locale => $request->{_locale},
              path => 'UI',
              template => 'frameset',
-             format => 'HTML'
-        );
-    } else {
-        # TODO:  Create Lynx Initial Menu
-    }
-    $template->render($request);
-}
+		     format => 'HTML'
+		);
+	    } else {
+		# TODO:  Create Lynx Initial Menu
+	    }
+	    $template->render($request);
+	}
 
-sub expanding_menu {
-    my ($request) = @_;
-    my $menu = LedgerSMB::DBObject::Menu->new({base => $request});
-    $menu->generate();
+	sub expanding_menu {
+	    my ($request) = @_;
+	    if ($request->{'open'} !~ s/:$request->{id}:/:/){
+		$request->{'open'} .= ":$request->{id}:";
+	    }
+
+	    # The above system can lead to extra colons.
+	    $request->{'open'} =~ s/:+/:/g;
+
+	    
+
+	    my $menu = LedgerSMB::DBObject::Menu->new({base => $request});
+	    $menu->generate();
+	    for my $item (@{$menu->{menu_items}}){
+                if ($request->{'open'} =~ /:$item->{id}:/ ){
+                    $item->{'open'} = 'true';
+                }
+            }
+
     my $template = LedgerSMB::Template->new(
          user => $request->{_user}, 
          locale => $request->{_locale},


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.