Author:   Lars Michelsen <[email protected]>
Date:     Thu Aug 22 13:13:30 2013 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Thu Aug 22 13:13:30 2013 +0200

Sorting hostgroups in on-demand header menu

---

 .../nagvis-js/classes/NagVisHeaderMenu.php         |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php 
b/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php
index 9bc3574..4e3dd66 100644
--- a/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php
+++ b/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php
@@ -269,6 +269,7 @@ class NagVisHeaderMenu {
         if ($this->templateName == 'on-demand-filter') {
             global $_BACKEND;
             $this->aMacros['hostgroups'] = 
$_BACKEND->getBackend($_GET['backend_id'])->getObjects('hostgroup', '', '');
+            usort($this->aMacros['hostgroups'], Array($this, 
'sortHostgroups'));
             array_unshift($this->aMacros['hostgroups'], array('name1' => '', 
'name2' => ''));
 
             $default = '';
@@ -281,6 +282,10 @@ class NagVisHeaderMenu {
         }
     }
 
+    private function sortHostgroups($a, $b) {
+        return strnatcasecmp($a['name1'], $b['name1']);
+    }
+
     /**
      * Checks if a documentation is available for the current language.
      * It either returns the language tag for the current language when a


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to