[icinga-checkins] icinga.org: icinga-web/r1.6: * Added XTemplate parsing to all medaData attributes (fixes #2309)

git at icinga.org git at icinga.org
Fri Feb 24 15:20:27 CET 2012


Module: icinga-web
Branch: r1.6
Commit: 6d75c912a49193bd4e439c22488f38efb8ed3a68
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=6d75c912a49193bd4e439c22488f38efb8ed3a68

Author: Jannis Mosshammer <jannis.mosshammer at netways.de>
Date:   Fri Feb 24 11:10:11 2012 +0100

* Added XTemplate parsing to all medaData attributes (fixes #2309)

---

 .../Cronks/lib/js/grid/renderer/ColumnRenderer.js  |   22 ++++++++++++++++---
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js b/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js
index 61a5533..fd972de 100755
--- a/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js
+++ b/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js
@@ -21,6 +21,18 @@ Cronk.grid.ColumnRendererUtil = function() {
 			return tpl.apply(data);
 		},
 		
+        applyXTemplateOnMetaData: function(metaData,store,rowIndex) {
+            for(var i in metaData) {
+                if(Ext.isString(metaData[i]))
+                    metaData[i] = Cronk.grid.ColumnRendererUtil.applyXTemplate({
+                        getStore :function() {return store;}
+                    },
+                    rowIndex,
+                    metaData[i]
+                );
+            }
+        },
+
 		testBooleanCondition : function(field, record) {
 			if (Ext.isEmpty(record.data[field]) === false) {
 				return Boolean(Ext.decode(record.data[field]));
@@ -100,9 +112,9 @@ Cronk.grid.ColumnRenderer = {
 	columnElement : function(cfg) {
 		return function(value, metaData, record, rowIndex, colIndex, store) {
 			var my = cfg;	// local reference
-			
+
 			Ext.apply(metaData, Cronk.grid.ColumnRendererUtil.metaDataObject(my));
-			
+			Cronk.grid.ColumnRendererUtil.applyXTemplateOnMetaData(metaData, store, rowIndex);
 			if (("value" in my)) {
 				return my.value;
 			}
@@ -118,6 +130,7 @@ Cronk.grid.ColumnRenderer = {
 	columnMetaData : function(cfg) {
 		return function(value, metaData, record, rowIndex, colIndex, store) {
 			Ext.apply(metaData, Cronk.grid.ColumnRendererUtil.metaDataObject(cfg));
+            Cronk.grid.ColumnRendererUtil.applyXTemplateOnMetaData(metaData, store, rowIndex);
 			return String.format('{0}', value);
 		}
 	},
@@ -133,7 +146,7 @@ Cronk.grid.ColumnRenderer = {
             }
             
             Ext.apply(metaData, Cronk.grid.ColumnRendererUtil.metaDataObject(my));
-            
+            Cronk.grid.ColumnRendererUtil.applyXTemplateOnMetaData(metaData, store, rowIndex);
             var flat_attr = metaData.attr;
             
             delete metaData.attr;
@@ -171,7 +184,7 @@ Cronk.grid.ColumnRenderer = {
 			if (!Ext.isEmpty(cfg.qtip)) {
 				metaData.attr = "ext:qtip='" + cfg.qtip + "'";
 			}
-			
+			Cronk.grid.ColumnRendererUtil.applyXTemplateOnMetaData(metaData, store, rowIndex);
 			return '<div class="' + iconCls + '"></div>';
 		}
 	},
@@ -179,6 +192,7 @@ Cronk.grid.ColumnRenderer = {
 	columnImageFromValue : function(cfg) {
 		return function(value, metaData, record, rowIndex, colIndex, store) {
 			metaData.style += String.format("background: transparent url('{0}') center center no-repeat;", AppKit.util.Dom.imageUrl(value));
+            Cronk.grid.ColumnRendererUtil.applyXTemplateOnMetaData(metaData, store, rowIndex);
 			return "<div style=\"width: 24px; height: 24px\"></div>";
 		}
 	},





More information about the icinga-checkins mailing list