[icinga-checkins] icinga.org: icinga-web/mhein/default: * multiple principal targets possible display fix (principalEditor)

git at icinga.org git at icinga.org
Wed Jan 19 17:37:19 CET 2011


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

Author: Marius Hein <marius.hein at netways.de>
Date:   Wed Jan 19 17:32:06 2011 +0100

* multiple principal targets possible display fix (principalEditor)

---

 .../templates/Admin/PrincipalEditorSuccess.php     |   61 ++++++++++---------
 app/modules/Cronks/config/cronks.xml               |    2 +-
 2 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/app/modules/AppKit/templates/Admin/PrincipalEditorSuccess.php b/app/modules/AppKit/templates/Admin/PrincipalEditorSuccess.php
index 580a409..b9df0d4 100755
--- a/app/modules/AppKit/templates/Admin/PrincipalEditorSuccess.php
+++ b/app/modules/AppKit/templates/Admin/PrincipalEditorSuccess.php
@@ -223,39 +223,42 @@ AppKit.principalEditor.principalSelector = Ext.extend(Ext.tree.TreePanel,{
 	},
 	
 	setPrincipals: function(selected) {
-		for(var name in selected) {
-			var desc_Record = this.getPrincipalDescriptor(name);
-			if(!desc_Record)
-				continue;
-	
-			var fields = AppKit.principalEditor.fieldConverter(desc_Record.get("fields"));
-			var ctr = 0;
-			if(fields.length > 0) {
-				for(var fieldNr in selected[name]) {
-					if(!fields[ctr] || Ext.isFunction(selected[name][fieldNr]))
-						continue;
-
-					fields[ctr]["id"] = fieldNr;
-					for(var fieldName in selected[name][fieldNr]) {
-						if(Ext.isFunction(selected[name][fieldNr][fieldName]))
-							continue;
-						if(!Ext.isDefined(fields[ctr]))
-							break;
-						fields[ctr]["name"] = fieldName;
-						fields[ctr++]["value"] = selected[name][fieldNr][fieldName];
-					}
-				}
-			}
-			desc_Record.set("fields",fields);
-
-			this.addPrincipal(desc_Record);
-			if(desc_Record.store)
-				desc_Record.store.remove(desc_Record);
-		}
+		
+		Ext.iterate(selected, function(target_name) {
+			
+			var fields = selected[target_name];
+			
+			Ext.iterate(fields, function(target_id, o) {
+			
+				var desc_record = this.getPrincipalDescriptor(target_name);
+				
+				var fields_list = AppKit.principalEditor.fieldConverter(desc_record.get("fields"));
+				
+				var i=0;
+				
+				Ext.iterate(o, function(fieldName, fieldValue) {
+					
+					fields_list[i].name = fieldName;
+					fields_list[i].value = fieldValue;
+					
+				}, this)
+				
+				desc_record.set('fields', fields_list);
+				
+				AppKit.log(desc_record);
+				
+				this.addPrincipal(desc_record);
+				
+				if(desc_record.store) desc_record.store.remove(desc_record);
+				
+			}, this);
+			
+		}, this);
 	},
 	
 	getPrincipalDescriptor: function(pr_name) {
 		store = AppKit.principalEditor.principalStore;
+		
 		var found = null;
 		store.each(function(record) {
 			if(record.get("name") == pr_name) {
diff --git a/app/modules/Cronks/config/cronks.xml b/app/modules/Cronks/config/cronks.xml
index beccb62..0c6f126 100755
--- a/app/modules/Cronks/config/cronks.xml
+++ b/app/modules/Cronks/config/cronks.xml
@@ -87,7 +87,7 @@
 				<ae:parameter name="name">Hostgroups</ae:parameter>
 				<ae:parameter name="categories">data</ae:parameter>
 				<ae:parameter name="image">cronks.Dots</ae:parameter>
-				<ae:parameter name="groupsonly">appkit_admin</ae:parameter>
+				<!-- <ae:parameter name="groupsonly">appkit_admin</ae:parameter> -->
 				<ae:parameter name="ae:parameter">
 					<ae:parameter name="template">icinga-hostgroup-summary-template</ae:parameter>
 				</ae:parameter>





More information about the icinga-checkins mailing list