[icinga-checkins] icinga.org: icinga-web/master: * Real ajax logout feature (a simple dialog)

git at icinga.org git at icinga.org
Thu May 27 17:37:55 CEST 2010


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

Author: Marius Hein <marius.hein at netways.de>
Date:   Thu May 27 17:37:11 2010 +0200

* Real ajax logout feature (a simple dialog)

---

 app/modules/AppKit/actions/LogoutAction.class.php  |    2 +-
 app/modules/AppKit/lib/js/AppKitUtil.js            |   18 ++++++++++++++++++
 app/modules/AppKit/templates/Ext/HeaderSuccess.php |    2 +-
 .../AppKit/views/LogoutSuccessView.class.php       |    3 +++
 4 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/app/modules/AppKit/actions/LogoutAction.class.php b/app/modules/AppKit/actions/LogoutAction.class.php
index 952a82d..b40d118 100755
--- a/app/modules/AppKit/actions/LogoutAction.class.php
+++ b/app/modules/AppKit/actions/LogoutAction.class.php
@@ -19,7 +19,7 @@ class AppKit_LogoutAction extends AppKitBaseAction
 		return 'Input';
 	}
 	
-	public function executeWrite(AgaviRequestDataHolder $rd)
+	public function execute(AgaviRequestDataHolder $rd)
 	{
 		
 		if ($rd->getParameter('logout', false) == 1) {
diff --git a/app/modules/AppKit/lib/js/AppKitUtil.js b/app/modules/AppKit/lib/js/AppKitUtil.js
index 1791f4b..bc82647 100755
--- a/app/modules/AppKit/lib/js/AppKitUtil.js
+++ b/app/modules/AppKit/lib/js/AppKitUtil.js
@@ -46,6 +46,24 @@ AppKit.util = (function() {
 			else {
 				return pstores.add(store_name, (new Ext.util.MixedCollection));
 			}
+		},
+		
+		/**
+		 * Handling logout the agavi way
+		 * @param string target
+		 */
+		doLogout : function(target) {
+			Ext.Msg.show({
+				title: _('To be on the verge to logout ...'),
+				msg: _('Are you sure to to this?'),
+				buttons: Ext.MessageBox.YESNO,
+				icon: Ext.MessageBox.QUESTION,
+				fn: function(b) {
+					if (b=="yes") {
+						AppKit.changeLocation(target);
+					}
+				}
+			});
 		}
 		
 	});
diff --git a/app/modules/AppKit/templates/Ext/HeaderSuccess.php b/app/modules/AppKit/templates/Ext/HeaderSuccess.php
index 1635a5b..48e860e 100755
--- a/app/modules/AppKit/templates/Ext/HeaderSuccess.php
+++ b/app/modules/AppKit/templates/Ext/HeaderSuccess.php
@@ -58,7 +58,7 @@ Ext.onReady(function() {
                         iconCls: 'silk-user-go',
                         width: 'auto',
                         handler: function() {
-							AppKit.changeLocation('<?echo $ro->gen("appkit.logout"); ?>');
+							AppKit.util.doLogout('<?echo $ro->gen("appkit.logout", array('logout' => 1)); ?>');
                         }
                     }]
                 }
diff --git a/app/modules/AppKit/views/LogoutSuccessView.class.php b/app/modules/AppKit/views/LogoutSuccessView.class.php
index 6ef2a62..d029e35 100755
--- a/app/modules/AppKit/views/LogoutSuccessView.class.php
+++ b/app/modules/AppKit/views/LogoutSuccessView.class.php
@@ -7,6 +7,9 @@ class AppKit_LogoutSuccessView extends AppKitBaseView
 		$this->setupHtml($rd);
 
 		$this->setAttribute('title', 'Logout');
+		
+		
+		$this->getResponse()->setRedirect(AgaviConfig::get('de.icinga.appkit.web_path'));
 	}
 }
 





More information about the icinga-checkins mailing list