[icinga-checkins] icinga.org: icinga-web/mhein/default: * Make the topmenu ie safe

git at icinga.org git at icinga.org
Fri Oct 30 16:14:50 CET 2009


Module: icinga-web
Branch: mhein/default
Commit: bfbc559913b7ddc771a10b40411875fa249da51a
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=bfbc559913b7ddc771a10b40411875fa249da51a

Author: Marius Hein <marius.hein at netways.de>
Date:   Fri Oct 30 16:13:38 2009 +0100

* Make the topmenu ie safe

---

 .../AppKit/templates/Widgets/ShowNavigationTop.php |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/app/modules/AppKit/templates/Widgets/ShowNavigationTop.php b/app/modules/AppKit/templates/Widgets/ShowNavigationTop.php
index ebbfd84..d84c9be 100755
--- a/app/modules/AppKit/templates/Widgets/ShowNavigationTop.php
+++ b/app/modules/AppKit/templates/Widgets/ShowNavigationTop.php
@@ -25,16 +25,18 @@ foreach ($iterator as $name=>$navItem) {
 
 		for ($i=$check_depth;$i>$iterator->getDepth();$i--) {
 			$open--;
-			$d .= ']}},';
+			$d .= ']}}';
 		} 
 
 	}
 
+	if (!preg_match('@(\{|\[)$@', $d)) $d .= ',';
+	
 	$d .= '{';
 	$d .= 'text: "'. $navItem->getCaption(). '",';
 	
 	if ($navItem->getRoute() !== null) {
-		$d .= 'href: "'. $ro->gen( $navItem->getRoute() ). '",';
+		$d .= 'href: "'. $ro->gen( $navItem->getRoute() ). '"';
 	
 	} else {
 		// UH?
@@ -42,9 +44,9 @@ foreach ($iterator as $name=>$navItem) {
 
 	if ($navItem->getContainer()->hasChildren()) {
 		$open++;
-		$d .= 'menu: { items: [';
+		$d .= ',menu: { items: [';
 	} else {
-		$d .= '},';
+		$d .= '}';
 	}
 	
 	$check_depth = $iterator->getDepth();
@@ -52,7 +54,7 @@ foreach ($iterator as $name=>$navItem) {
 	}
 
 	for ($i=$open; $i>0; $i--) {
-		$d .= ']}},';
+		$d .= ']}}';
 	}
 
 }
@@ -65,7 +67,7 @@ var xh = '';
 
 <?php if ($us->isAuthenticated()) { ?>
 xh += '<?php echo $tm->_('User')?>: <?php echo $us->getNsmUser()->givenName(); ?>'
-xh += '| <a href="<?php echo $ro->gen('appkit.logout'); ?>">Logout</a>'
+xh += ' | <a href="<?php echo $ro->gen('appkit.logout'); ?>">Logout</a>'
 <?php } else { ?>
 xh += '<?php echo $tm->_('User')?>: <?php echo $tm->_('Guest')?>'
 <?php } ?>





More information about the icinga-checkins mailing list