diff --git a/gosa-plugins/goto/admin/devices/class_deviceGeneric.inc b/gosa-plugins/goto/admin/devices/class_deviceGeneric.inc
index bc870eb74c6266989d050222c096758c3bbd11c0..a92a9cbb7d7295c5e3857d5177064f7049e1ebf6 100644 (file)
$this->is_account = TRUE;
$this->types= array("camera" => _("Digital camera"),
- "harddisk" => _("Harddisk"),
- "stick" => _("USB stick"),
- "cd" => _("CD/DVD drive"),);
+ "disc" => _("USB stick"),
+ "cdrom" => _("CD/DVD drive"),);
asort($this->types);
/* Set class values */
$message = plugin::check();
if(empty($this->cn)||(preg_match("/[^a-z0-9]/i",$this->cn))){
- $message[]=_("Please specify a valid name. Only 0-9 a-Z is allowed.");
+ $message[]= msgPool::invalid(_("Name"),$this->cn,"/^[a-z0-9]*$/i");
}
if(preg_match("/[^a-z0-9!\"?.,;:-_\(\) ]/i",$this->description)){
- $message[]=_("Invalid character in description. Please specify a valid description.");
+ $message[]= msgPool::invalid(_("Description"),$this->cn,"/^[a-z0-9!\"?.,;:-_\(\) ]*$/i");
}
/* Skip serial check if vendor and product id are given */
if(preg_match("/^\s+$/i",$this->dev_id)){
- $message[]=_("Please specify a valid iSerial.");
+ $message[]= msgPool::invalid(_("iSerial"),"","01234");
}
if(empty($this->serial) || !$this->is_2byteHex($this->serial)){
- $message[]=_("Please specify a valid vendor ID. (2 byte hex like '0xFFFF')");
+ $message[]= msgPool::invalid(_("Serial"),"","","0x1234");
}
if(empty($this->vendor) || !$this->is_2byteHex($this->vendor)){
- $message[]=_("Please specify a valid product ID. (2 byte hex like '0xFFFF')");
+ $message[]= msgPool::invalid(_("Vendor ID"),"","","0x1234");
}
/* Check if entry already exists */
$ldap = $this->config->get_ldap_link();
$ldap->search("(&(objectClass=gotoDevice)(cn=".$this->cn."*))",array("cn"));
if($ldap->count()){
- $message[]=_("An Entry with this name already exists.");
+ $message[]= msgPool::duplicated(_("Name"));
}
}
$ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDeviceDN=".$this->dn."))",array("cn","gotoHotplugDeviceDN"));
$skip = FALSE;
- $str ="";
- $cnt = 3;
- while($cnt && $attrs = $ldap->fetch()){
+ $obj = array();
+ while($attrs = $ldap->fetch()){
+ $obj[$ldap->getDN()]= $attrs['cn'][0];
$skip =TRUE;
- $str .= $attrs['cn'][0].", ";
- $cnt --;
}
if($skip){
- $str = preg_replace("/, $/","",$str);
- if($cnt == 0){
- $str .= "...";
- }
- print_red(sprintf(_("Can't remove the device '%s' it is still in use be this user(s) : %s"),$this->cn,$str));
+ msg_dialog::display(_("Error"), msgPool::stillInUse(_("Device"), $obj), INFO_DIALOG);
}else{
$ldap->rmdir_recursive($this->dn);
}
$ldap->cd($this->dn);
$ldap->add($this->attrs);
}
- show_ldap_error($ldap->get_error(),_("Device could not be saved."));
+ if (!$ldap->success()){
+ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
+ }
}