diff --git a/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc b/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc
index e963399626454d40da3960168859ff76acffe465..759be98aed10ce853a14a25c83cc885f4c20d574 100644 (file)
/* Get hostId */
if($hostId != "new"){
- if(preg_match("/^opsi=/",$hostId)){
+ if(preg_match("/^opsi:/",$hostId)){
$this->hostId = preg_replace("/^opsi:=([^,]*),.*$/","\\1",$hostId);
- }else{
- $this->hostId = &$this->parent->cn;
-// $this->mac = &$this->parent->netConfigDNS->macAddress;
+ }elseif($this->parent instanceof wingeneric){
+ $this->hostId = $this->parent->cn;
+ $this->hostId = preg_replace('/\$$/',"",$this->hostId);
}
}
-
+
/* Try to plugin */
$this->init();
}
$list = $this->opsi->list_clients($this->hostId);
$err |= $this->opsi->is_error();
foreach($list as $entry){
- if(preg_match("/^".normalizePreg($this->hostId).".$/i",$entry['NAME'][0]['VALUE'])){
+ if(preg_match("/^".normalizePreg($this->hostId)."$/i",$entry['NAME'][0]['VALUE'])){
$this->initially_was_account = TRUE;
foreach(array("description" => "DESCRIPTION","mac" => "MAC", "note" => "NOTES") as $des => $src){
$this->$des = $entry[$src][0]['VALUE'];
public function save()
{
- /* Check if this a new opsi client
- -Do we have to create this client first?
- */
if(!$this->initially_was_account && $this->is_account){
$res = $this->opsi->add_client($this->hostId,$this->mac,$this->note,$this->description);
if($this->opsi->is_error()){
}
}
foreach($add as $name => $data){
+ echo "Adding '$name' to ".$this->hostId."<br>";
$this->opsi->add_product_to_client($name,$this->hostId);
if($this->opsi->is_error()){
msg_dialog::display(_("Error"),msgPool::siError($this->opsi->get_error()),ERROR_DIALOG);
return;
}
- $this->opsi->set_product_properties($name,$data['CFG'],$this->hostId);
- if($this->opsi->is_error()){
- msg_dialog::display(_("Error"),msgPool::siError($this->opsi->get_error()),ERROR_DIALOG);
- return;
+ if(!empty($data['CFG'])){
+ $this->opsi->set_product_properties($name,$data['CFG'],$this->hostId);
+ if($this->opsi->is_error()){
+ msg_dialog::display(_("Error"),msgPool::siError($this->opsi->get_error()),ERROR_DIALOG);
+ return;
+ }
}
}
if(isset($_POST['cancel_properties']) && is_object($this->dialog)){
$this->dialog = NULL;
}
- if(isset($_POST['save_properties']) && ($this->dialog instanceof opsi_product_config)){
+ if(isset($_POST['save_properties']) && ($this->dialog instanceof opsiProductConfig)){
$this->dialog->save_object();
$pro = $this->dialog->get_product();
$CFG = $this->dialog->get_cfg();
}
if(preg_match("/^edit_lp_/",$name)){
$product = preg_replace("/^edit_lp_(.*)_.$/","\\1",$name);
- $this->dialog = new opsi_product_config($this->config,
+ $this->dialog = new opsiProductConfig($this->config,
$product,$this->a_selectedLocalProducts[$product]['CFG'],$this->hostId);
break;
}