summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a364931)
raw | patch | inline | side by side (parent: a364931)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 3 Sep 2008 10:16:11 +0000 (10:16 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 3 Sep 2008 10:16:11 +0000 (10:16 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12356 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/server/events/opsi_com.pm | patch | blob | history |
index 85f80c0925dd05c16a8c9bd0c477006f3953d586..3c62ab5ab40b45f4bbc7137bffba6465c1c90641 100644 (file)
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.= "<value>$v</value>";
+ }
+ } else {
+ $cnv= $entr->{'values'};
+ }
+ $values->{$entr->{'name'}}= $cnv;
+ $descriptions->{$entr->{'name'}}= "<description>".$entr->{'description'}."</description>";
+ }
+ }
+
if (not &check_opsi_res($res)){
my $r= $res->result;
foreach my $key (keys %{$r}) {
my $item= "\n<item>";
my $value= $r->{$key};
- if (UNIVERSAL::isa( $value, "ARRAY" )){
- foreach my $subval (@{$value}){
- $item.= "<$key>".xml_quote($subval)."</$key>";
- }
- } else {
- $item.= "<$key>".xml_quote($value)."</$key>";
+ my $dsc= "";
+ my $vals= "";
+ if (defined $descriptions->{$key}){
+ $dsc= $descriptions->{$key};
+ }
+ if (defined $values->{$key}){
+ $vals= $values->{$key};
}
+ $item.= "<$key>$dsc<default>".xml_quote($value)."</default>$vals</$key>";
$item.= "</item>";
$xml_msg=~ s/<xxx><\/xxx>/$item<xxx><\/xxx>/;
}