[icinga-checkins] icinga.org: icinga-web/master: * get url view fix

git at icinga.org git at icinga.org
Thu Jan 20 13:51:43 CET 2011


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

Author: Marius Hein <marius.hein at netways.de>
Date:   Thu Jan 20 13:51:05 2011 +0100

* get url view fix

---

 app/modules/AppKit/lib/js/AppKitUtil.js            |    7 +++++++
 app/modules/Cronks/lib/js/CronkTabpanel.js         |   11 ++++++-----
 app/modules/Cronks/lib/js/Tabhelper.js             |   13 ++++++++++---
 app/modules/Cronks/lib/js/grid/GridPanel.js        |    4 +++-
 .../Cronks/templates/System/CronkPortalSuccess.php |    2 ++
 .../views/System/CronkPortalSuccessView.class.php  |   16 ++++++++++++----
 6 files changed, 40 insertions(+), 13 deletions(-)

diff --git a/app/modules/AppKit/lib/js/AppKitUtil.js b/app/modules/AppKit/lib/js/AppKitUtil.js
index d772ae4..fb429ba 100755
--- a/app/modules/AppKit/lib/js/AppKitUtil.js
+++ b/app/modules/AppKit/lib/js/AppKitUtil.js
@@ -187,6 +187,13 @@ AppKit.util.Config = (function() {
 		
 		getMap : function() {
 			return this.map;
+		},
+		
+		getBaseUrl : function() {
+			return (this.get('issecure')==true) ? 'https://' : 'http://'
+				+ this.get('domain')
+				+ this.get('path');
+			
 		}
 		
 	}))());
diff --git a/app/modules/Cronks/lib/js/CronkTabpanel.js b/app/modules/Cronks/lib/js/CronkTabpanel.js
index 3753526..692eaae 100755
--- a/app/modules/Cronks/lib/js/CronkTabpanel.js
+++ b/app/modules/Cronks/lib/js/CronkTabpanel.js
@@ -15,7 +15,6 @@ Ext.extend(Cronk.util.Tabpanel, Ext.ux.SlidingTabPanel, {
 	
 	setURLTab : function(params) {
 		this.URLTabData = params;
-		
 	},
 	
 	getTabIndex: function(tab) {
@@ -63,12 +62,14 @@ Ext.extend(Cronk.util.Tabpanel, Ext.ux.SlidingTabPanel, {
 					this.add(item);
 				}, this);
 				
-				// Sets the active tab
-				this.setActiveTab(state.active || 0);
 				if(this.URLTabData) {
-
-					this.setActiveTab(this.add(this.plugins.createURLCronk(this.URLTabData)));		
+					var index = this.add(this.plugins.createURLCronk(this.URLTabData));
+					this.setActiveTab(index);	
 				}				
+				else {
+					this.setActiveTab(state.active || 0);
+				}
+				
 				this.getActiveTab().doLayout();
 			}
 				
diff --git a/app/modules/Cronks/lib/js/Tabhelper.js b/app/modules/Cronks/lib/js/Tabhelper.js
index 23b1fb4..d8607b7 100755
--- a/app/modules/Cronks/lib/js/Tabhelper.js
+++ b/app/modules/Cronks/lib/js/Tabhelper.js
@@ -195,7 +195,7 @@ Cronk.util.CronkTabHelper = Ext.extend(Object, {
 		msg.getDialog().alignTo(this.contextmenu.el, 'tr-tr');
 	},
 	
-	createURLCronk: function(data) {
+	createURLCronk: function(data) {		
 		
 		var urlCronk =  Cronk.factory({
 			title: data.title,
@@ -211,8 +211,12 @@ Cronk.util.CronkTabHelper = Ext.extend(Object, {
 		urlCronk.on("add",function(p, c, i) {
 			if(!c.store)
 				return null; 
-
+			
 			Ext.apply(c.store.baseParams,data.cr_base);
+			
+			c.store.originParams= {};
+			Ext.apply(c.store.originParams,data.cr_base);
+			
 			c.store.groupDir = data.groupDir;
 			c.store.groupField = data.groupField;
 			
@@ -222,9 +226,12 @@ Cronk.util.CronkTabHelper = Ext.extend(Object, {
 				c.parentCmp.sort_array[0]['direction'] = data.groupDir;
 				c.parentCmp.sort_array[0]['field'] = data.groupField;
 			}
+			
 			c.store.load();
-
+			
+			AppKit.log(c.getState());
 		});
+		
 		return urlCronk;
 	}
 	
diff --git a/app/modules/Cronks/lib/js/grid/GridPanel.js b/app/modules/Cronks/lib/js/grid/GridPanel.js
index 26d0b0e..1c4bd73 100755
--- a/app/modules/Cronks/lib/js/grid/GridPanel.js
+++ b/app/modules/Cronks/lib/js/grid/GridPanel.js
@@ -84,7 +84,9 @@ Cronk.grid.GridPanel = Ext.extend(Ext.grid.GridPanel, {
 									xtype:'textfield',
 									fieldLabel: _('Link'),
 									width:350,
-									value: AppKit.c.path + "/web/customPortal/"+urlParams
+									value: AppKit.util.Config.getBaseUrl()
+									+ "/web/customPortal/"
+									+ urlParams
 								},
 								bbar: [{
 									text: _('Close'),
diff --git a/app/modules/Cronks/templates/System/CronkPortalSuccess.php b/app/modules/Cronks/templates/System/CronkPortalSuccess.php
index be0928b..205794f 100755
--- a/app/modules/Cronks/templates/System/CronkPortalSuccess.php
+++ b/app/modules/Cronks/templates/System/CronkPortalSuccess.php
@@ -95,9 +95,11 @@ Cronk.util.initEnvironment('viewport-center', function() {
 		}]
 		
 	});
+	
 	if(<?php echo $rd->getParameter("isURLView") ? 1 : 0 ?>) {
 		Ext.getCmp('cronk-tabs').setURLTab(<?php echo $rd->getParameter('URLData');?>);
 	}
+	
 	AppKit.util.Layout.doLayout();
 		
 }, { run: true, extready: true });
diff --git a/app/modules/Cronks/views/System/CronkPortalSuccessView.class.php b/app/modules/Cronks/views/System/CronkPortalSuccessView.class.php
index ffd4664..887a311 100755
--- a/app/modules/Cronks/views/System/CronkPortalSuccessView.class.php
+++ b/app/modules/Cronks/views/System/CronkPortalSuccessView.class.php
@@ -41,8 +41,13 @@ class Cronks_System_CronkPortalSuccessView extends CronksBaseView
 		foreach($formatFields as $fieldName) {
 			$field = $fields[$fieldName];
 			$result = array();
-			// split at ; 
-			$fieldParts = explode(";",$field);
+			
+			// Because of empty arrays in javascript
+			$field = preg_replace('/;$/', '', $field);
+			
+			// split at ;
+			$fieldParts = explode(';',$field);
+			
 			foreach($fieldParts as $currentField) {
 				if(!$currentField)
 					continue;
@@ -50,8 +55,11 @@ class Cronks_System_CronkPortalSuccessView extends CronksBaseView
 				//rebuild field
 				$parts = array();
 				if(preg_match("/(\w*?)\|(.*?)_\d+=(.*)/",$currentField,$parts)) {
-					if(!isset($result[$parts[1]]))
-						$result[$parts[1]] = array();
+					
+					// @todo: Works better without, quickfix!
+					//if(!isset($result[$parts[1]]))
+					//	$result[$parts[1]] = array();
+						
 					$result[$parts[1]."[".$parts[2]."]"] = $parts[3];
 				} else {
 					$str = explode("=",$currentField);





More information about the icinga-checkins mailing list