[icinga-checkins] icinga.org: icinga-web/mhein/default: * Nested oarameters in cronks are now json encoded

git at icinga.org git at icinga.org
Fri Sep 10 15:22:15 CEST 2010


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

Author: jmosshammer <jmosshammer at ws-jmosshammer.(none)>
Date:   Wed Sep  1 19:48:39 2010 +0200

* Nested oarameters in cronks are now json encoded

---

 .../templates/System/CronkListingSuccess.php       |   14 +++++++++++++-
 .../Cronks/templates/System/PortalViewSuccess.php  |   14 +++++---------
 .../views/System/CronkLoaderSuccessView.class.php  |   10 ++++++++++
 3 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/app/modules/Cronks/templates/System/CronkListingSuccess.php b/app/modules/Cronks/templates/System/CronkListingSuccess.php
index 2876ffa..eee923c 100755
--- a/app/modules/Cronks/templates/System/CronkListingSuccess.php
+++ b/app/modules/Cronks/templates/System/CronkListingSuccess.php
@@ -109,7 +109,19 @@ Cronk.util.initEnvironment("<?php echo $parentid = $rd->getParameter('parentid')
 				    root: 'resultRow',
 				    data: json,
 				    fields: [
-				        'name', 'id', 'description', 'image', 'parameter'
+				        'name', 'id', 'description', 'image', 
+						{
+							name:'parameter',
+							convert:function(v,record) {
+								if(!Ext.isObject(v))
+									return v;
+								for(var i in v) {
+									if(Ext.isObject(v[i]))
+										v[i] = Ext.encode(v[i]);
+								}
+								return v;
+							}
+						}
 				    ]
 				});
 			},
diff --git a/app/modules/Cronks/templates/System/PortalViewSuccess.php b/app/modules/Cronks/templates/System/PortalViewSuccess.php
index 5a35a9f..336d828 100755
--- a/app/modules/Cronks/templates/System/PortalViewSuccess.php
+++ b/app/modules/Cronks/templates/System/PortalViewSuccess.php
@@ -35,24 +35,20 @@ Cronk.util.initEnvironment("<?php echo $parentid = $rd->getParameter('parentid')
 					portlet.on("add",function(el,resp) {
 						Ext.each(portlet.findByType('container'),function(item) {
         					item.setHeight(portlet.getInnerHeight());
-
         				});
 					});
 
-					portlet.on('resize',function() {
-						Ext.each(portlet.findByType('container'),function(item) {	
-							item.setHeight(portlet.getInnerHeight());						        	
-			        	});
-					},this);
-				
+
+					
 					/**
-					 * Fix width
+					 * Fix width and height
 					 * This must be done via one-shot eventdispatcher to avoid
 					 * endless recursion (resize->change width->width changed->resize->...)
 					 */
 					var resizeFunc = function(el) {
 						Ext.each(portlet.findByType('container'),function(item) {	
-							item.setWidth(portlet.getInnerWidth());		        
+							item.setWidth(portlet.getInnerWidth());
+							item.setHeight(portlet.getInnerHeight());
 		        		});		
 		        		// Attach the listener again after resize
 						portlet.on('resize',resizeFunc,this,{single:true})
diff --git a/app/modules/Cronks/views/System/CronkLoaderSuccessView.class.php b/app/modules/Cronks/views/System/CronkLoaderSuccessView.class.php
index 8a38e03..eec46a7 100755
--- a/app/modules/Cronks/views/System/CronkLoaderSuccessView.class.php
+++ b/app/modules/Cronks/views/System/CronkLoaderSuccessView.class.php
@@ -21,7 +21,17 @@ class Cronks_System_CronkLoaderSuccessView extends CronksBaseView
 				$cronk = $model->getCronk($crname);
 				
 				if (array_key_exists('parameter', $cronk)) {
+					foreach($cronk['parameter'] as $key=>$param) {
+						if(is_array($param) || is_object($param)) {
+							$param = json_encode($param);
+							$cronk['parameter'][$key] = $param;
+							$parameters[$key] = $param;
+						}
+						
+					}
+
 					$parameters = (array)$cronk['parameter'] + $parameters;
+
 				}
 				
 				return $this->createForwardContainer($cronk['module'], $cronk['action'], $parameters, 'simple', 'write');





More information about the icinga-checkins mailing list