summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 79b6c92)
raw | patch | inline | side by side (parent: 79b6c92)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 22 Dec 2009 08:40:30 +0000 (08:40 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 22 Dec 2009 08:40:30 +0000 (08:40 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14922 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/opsi/admin/opsi/class_opsi.inc | patch | blob | history | |
gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc | patch | blob | history |
diff --git a/gosa-plugins/opsi/admin/opsi/class_opsi.inc b/gosa-plugins/opsi/admin/opsi/class_opsi.inc
index ebbf46c213e71e28cb04e8d95aae754f85e79311..3277b2c7a4765c6ddc59085ecf16a72abf3e02f2 100644 (file)
}
$res = $this->send_data("gosa_opsi_get_full_product_host_information",$this->target,$data,TRUE);
- print_a($res);
$items = array();
+
+ $attrs = array("PRIORITY","ONCESCRIPT","LICENSEREQUIRED","PACKAGEVERSION","PRODUCTVERSION",
+ "ADVICE","SETUPSCRIPT","WINDOWSSOFTWAREIDS","PXECONFIGTEMPLATE","NAME","CREATIONTIMESTAMP",
+ "ALWAYSSCRIPT","PRODUCTID","DESCRIPTION","UNINSTALLSCRIPT","UPDATESCRIPT","PRODUCTCLASSNAMES");
+
if(isset($res['XML'][0]['ITEM'])){
foreach($res['XML'][0]['ITEM'] as $entry){
- $e = array("DESC" => $entry['DESCRIPTION'][0]['VALUE'],
- "NAME" => $entry['PRODUCTID'][0]['VALUE']);
+ $e = array();
+ foreach($attrs as $attr){
+ if(isset($entry[$attr])){
+ foreach($entry[$attr] as $key => $value){
+ if(isset($value['VALUE'])){
+ $e['data'][$attr] = $value['VALUE'];
+ }elseif($value['ELEMENT']){
+ foreach($value['ELEMENT'] as $element){
+ $e['data'][$attr][] = $element['VALUE'];
+ }
+ }
+ }
+ }
+ }
+
+ $e["configurable"] = FALSE;
+ if(isset($entry['PROPERTIES']) && count($entry['PROPERTIES'])){
+ $e["configurable"] = TRUE;
+ $p_data = array();
+
+ foreach($entry['PROPERTIES'][0] as $p_name => $p_values){
+ if(empty($p_values)) continue;
+ $p_data[$p_name]= array();
+ foreach(array('CURRENT','DEFAULT','DESCRIPTION') as $p_tmp){
+ if(isset($p_values[0][$p_tmp])){
+ if(isset($p_values[0][$p_tmp][0]['VALUE'])){
+ $p_data[$p_name][$p_tmp] = $p_values[0][$p_tmp][0]['VALUE'];
+ }
+ }
+ }
+
+ if(isset($p_values[0]['VALUES'][0]['ELEMENT'])){
+ foreach($p_values[0]['VALUES'][0]['ELEMENT'] as $val){
+ $p_data[$p_name]['VALUE'][] = $val['VALUE'];
+ }
+ $p_data[$p_name]['VALUE_CNT'] = count($p_data[$p_name]['VALUE']);
+ }
+ }
+
+ $e["data"]['PROPERTIES'] = $p_data;
+ }
+
+
+ $e["installed"] = FALSE;
+ if(isset($entry['ACTIONREQUEST'])){
+ $e["installed"] = TRUE;
+ }
+
+ $e["requires_licence"] = FALSE;
+ if(isset($e['data']['LICENSEREQUIRED']) && preg_match("/true/i",$e['data']['LICENSEREQUIRED'])){
+ $e["requires_licence"] = TRUE;
+ }
$items[$entry['PRODUCTID'][0]['VALUE']] = $e;
}
}
diff --git a/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc b/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc
index 22476bae9b9ed3890dfc3fe4b79927ff34698126..174764002265534486dfa0ac93666073ddc28b15 100644 (file)
$this->is_account = TRUE;
}
+
/* Try to load client infos from the gosa support daemon
*/
if(!empty($this->hostId)){
-
$list = $this->opsi->list_clients($this->hostId);
$err |= $this->opsi->is_error();
}
}
+ // Get package info
+ if(!empty($this->hostId)){
+ $list = $this->opsi->get_full_product_host_information($this->hostId);
+ }
+
+
/* Read informations about available netboot products.
If not already done, before.
*/
/* Read informations about available netboot products.
If not already done, before.
*/
- if(!$err && !count($this->a_availableLocalProducts)) {
- $this->a_availableLocalProducts = $this->opsi->get_local_products();
- ksort($this->a_availableLocalProducts);
- $err |= $this->opsi->is_error();
+ foreach($list as $key => $entry){
+ if(!$entry['installed']){
+ $this->a_availableLocalProducts[$key] = array('DESC'=>$entry['data']['DESCRIPTION'],'NAME'=>$key);
+ }else{
+ $this->a_selectedLocalProducts[$key] = array('DESC'=>$entry['data']['DESCRIPTION'],'NAME'=>$key);
+ if($entry['configurable']){
+ $this->a_selectedLocalProducts[$key]['CFG'] = $entry['data']['PROPERTIES'];
+ }
+ }
}
+# if(!$err && !count($this->a_availableLocalProducts)) {
+# $this->a_availableLocalProducts = $this->opsi->get_local_products();
+# ksort($this->a_availableLocalProducts);
+# $err |= $this->opsi->is_error();
+# }
/* Get products selected by this host.
*/
$err |= $this->opsi->is_error();
}
- /* Get all selected local products
- */
- if(!$err && !empty($this->hostId) && !count($this->a_selectedLocalProducts)) {
- $tmp = $this->opsi->get_local_products($this->hostId);
- $err |= $this->opsi->is_error();
- $this->a_selectedLocalProducts = $tmp;
- }
+# /* Get all selected local products
+# */
+# if(!$err && !empty($this->hostId) && !count($this->a_selectedLocalProducts)) {
+# $tmp = $this->opsi->get_local_products($this->hostId);
+# $err |= $this->opsi->is_error();
+# $this->a_selectedLocalProducts = $tmp;
+# }
+#
+# /* Load product configuration for all already selected products.
+# */
+# if(!$err && !empty($this->hostId)) {
+# foreach($this->a_selectedLocalProducts as $name => $data){
+# if(!$err && !isset($this->a_selectedLocalProducts[$name]['CFG'])){
+# $CFG = $this->opsi->get_product_properties($name,$this->hostId);
+# $err |= $this->opsi->is_error();
+# $this->a_selectedLocalProducts[$name]['CFG'] = $CFG;
+# }
+# }
+# }
- /* Load product configuration for all already selected products.
- */
- if(!$err && !empty($this->hostId)) {
- foreach($this->a_selectedLocalProducts as $name => $data){
- if(!$err && !isset($this->a_selectedLocalProducts[$name]['CFG'])){
- $CFG = $this->opsi->get_product_properties($name,$this->hostId);
- $err |= $this->opsi->is_error();
- $this->a_selectedLocalProducts[$name]['CFG'] = $CFG;
- }
- }
- }
-
/* Check if everything went fine else reset everything and display a retry button
*/
if($err){