[icinga-checkins] icinga.org: icinga-web/master: * Fix for preferences settings for not logged in users

git at icinga.org git at icinga.org
Thu Jul 29 19:18:01 CEST 2010


Module: icinga-web
Branch: master
Commit: 63d455875d011ae3228f7d5c10ab556b79e0839f
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=63d455875d011ae3228f7d5c10ab556b79e0839f

Author: Marius Hein <marius.hein at netways.de>
Date:   Wed Jul 28 15:04:25 2010 +0200

* Fix for preferences settings for not logged in users

---

 app/modules/AppKit/templates/Ext/HeaderSuccess.php |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/app/modules/AppKit/templates/Ext/HeaderSuccess.php b/app/modules/AppKit/templates/Ext/HeaderSuccess.php
index 28519c8..2f5434c 100755
--- a/app/modules/AppKit/templates/Ext/HeaderSuccess.php
+++ b/app/modules/AppKit/templates/Ext/HeaderSuccess.php
@@ -1,11 +1,17 @@
 <?php
     $username = $tm->_('Guest');
     $auth = false;
+
     if ($us->isAuthenticated()) {
         $username = $us->getNsmUser()->givenName();
         $auth = true;
-		$pref = json_encode($us->getPreferences());
+		$pref = $us->getPreferences();
     }
+	else {
+		$pref = new stdClass();
+	}
+
+
 ?>
 <?
 	
@@ -13,10 +19,12 @@
 <script type="text/javascript">
 Ext.onReady(function() {
 
+	<?php if ($auth === true) { ?>
 	AppKit.onReady(function() {
-		AppKit.setPreferences(<?php echo $pref; ?>);
+		AppKit.setPreferences(<?php echo json_encode($pref); ?>);
 	});
-
+	<?php } ?>
+	
 	var UserMenu = (function() {
 	    var pub = {};
 	    var _LA = AppKit.util.Layout;





More information about the icinga-checkins mailing list