From 5e1cfe458efee858e2b65d0be064c388bcd07c94 Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 3 Sep 2008 10:16:11 +0000 Subject: [PATCH] Added description and values git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12356 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/server/events/opsi_com.pm | 45 ++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/gosa-si/server/events/opsi_com.pm b/gosa-si/server/events/opsi_com.pm index 85f80c092..3c62ab5ab 100644 --- a/gosa-si/server/events/opsi_com.pm +++ b/gosa-si/server/events/opsi_com.pm @@ -582,20 +582,51 @@ sub opsi_get_product_properties { id => 1, }; } - $res = $main::opsi_client->call($main::opsi_url, $callobj); + + # JSON Query 2 + $callobj = { + method => 'getProductPropertyDefinitions_listOfHashes', + params => [ $productId ], + id => 1, + }; + + # Assemble options + my $res2 = $main::opsi_client->call($main::opsi_url, $callobj); + my $values = {}; + my $descriptions = {}; + if (not &check_opsi_res($res2)){ + my $r= $res2->result; + + foreach my $entr (@$r){ + # Unroll values + my $cnv; + if (UNIVERSAL::isa( $entr->{'values'}, "ARRAY" )){ + foreach my $v (@{$entr->{'values'}}){ + $cnv.= "$v"; + } + } else { + $cnv= $entr->{'values'}; + } + $values->{$entr->{'name'}}= $cnv; + $descriptions->{$entr->{'name'}}= "".$entr->{'description'}.""; + } + } + if (not &check_opsi_res($res)){ my $r= $res->result; foreach my $key (keys %{$r}) { my $item= "\n"; my $value= $r->{$key}; - if (UNIVERSAL::isa( $value, "ARRAY" )){ - foreach my $subval (@{$value}){ - $item.= "<$key>".xml_quote($subval).""; - } - } else { - $item.= "<$key>".xml_quote($value).""; + my $dsc= ""; + my $vals= ""; + if (defined $descriptions->{$key}){ + $dsc= $descriptions->{$key}; + } + if (defined $values->{$key}){ + $vals= $values->{$key}; } + $item.= "<$key>$dsc".xml_quote($value)."$vals"; $item.= ""; $xml_msg=~ s/<\/xxx>/$item<\/xxx>/; } -- 2.30.2