summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 794f1cb)
raw | patch | inline | side by side (parent: 794f1cb)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 11 Aug 2006 06:04:31 +0000 (06:04 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 11 Aug 2006 06:04:31 +0000 (06:04 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4475 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/personal/environment/class_hotplugDialog.inc | patch | blob | history | |
plugins/personal/environment/hotplugDialogNew.tpl | patch | blob | history |
diff --git a/plugins/personal/environment/class_hotplugDialog.inc b/plugins/personal/environment/class_hotplugDialog.inc
index dbb082141e3ea561f3e3306cfb14f04b2019527a..dc61ecf84bc4c720ad3bf6f0ad275292466f6f7f 100644 (file)
function save_object()
{
if(isset($_POST['dialogissubmitted'])){
+ plugin::save_object();
foreach($this->attributes as $s_attr){
if(isset($_POST[$s_attr])){
- $this->$s_attr = stripslashes($_POST[$s_attr]);
+ if(in_array($s_attr,array("HOT_produkt","HOT_vendor"))){
+ $this->$s_attr = strtolower(stripslashes($_POST[$s_attr]));
+ }else{
+ $this->$s_attr = stripslashes($_POST[$s_attr]);
+ }
}else{
$this->$s_attr = false;
}
}
- plugin::save_object();
}
}
$message= plugin::check();
if(!$this->use_existing){
- if((empty($this->HOT_name))||(preg_match("/[^a-z0-9]/i",$this->HOT_name))){
+
+ if(empty($this->HOT_name)||(preg_match("/[^a-z0-9]/i",$this->HOT_name))){
$message[]=_("Please specify a valid name. Only 0-9 a-Z is allowed.");
}
- if((empty($this->HOT_description))||(preg_match("/[^a-z0-9!\"?.,;:-_\(\) ]/i",$this->HOT_description))){
+ if(preg_match("/[^a-z0-9!\"?.,;:-_\(\) ]/i",$this->HOT_description)){
$message[]=_("Invalid character in description. Please specify a valid description.");
}
- if((empty($this->HOT_id))||(preg_match("/[\|]/i",$this->HOT_id))){
+
+ if(preg_match("/[\|]/i",$this->HOT_id)){
$message[]=_("Please specify a valid id.");
}
- if((empty($this->HOT_vendor))||(preg_match("/[\|]/i",$this->HOT_vendor))){
- $message[]=_("Please specify a valid id.");
+ if(!$this->is_2byteHex($this->HOT_vendor)){
+ $message[]=_("Please specify a valid vendor id. (2 byte hex like '0xFFFF')");
}
- if((empty($this->HOT_produkt))||(preg_match("/[\|]/i",$this->HOT_produkt))){
- $message[]=_("Please specify a valid id.");
+ if(!$this->is_2byteHex($this->HOT_produkt)){
+ $message[]=_("Please specify a valid product id. (2 byte hex like '0xFFFF')");
}
$ldap = $this->config->get_ldap_link();
return ($message);
}
+ function is_2byteHex($str)
+ {
+ return empty($str) || preg_match("/^(0x|x|)[a-f0-9][a-f0-9][a-f0-9][a-f0-9]/i",$str);
+ }
+
+
+
/* Save to LDAP */
function save()
diff --git a/plugins/personal/environment/hotplugDialogNew.tpl b/plugins/personal/environment/hotplugDialogNew.tpl
index 5a6fb3386c50e75dae912d81b44710739623c6aa..927395d01ad2a7d8ebd9a81bfaddcbac40dce0b6 100644 (file)
</td>
</tr>
<tr>
- <td><LABEL for="HOT_description">{t}Description{/t}</LABEL>{$must}
+ <td><LABEL for="HOT_description">{t}Description{/t}</LABEL>
</td>
<td>
<input type="text" size=40 value="{$HOT_description}" name="HOT_description" id="HOT_description">
<td style="vertical-align:top">
<table summary="">
<tr>
- <td><LABEL for="HOT_vendor">{t}Vendor ID{/t}</LABEL>{$must}
+ <td><LABEL for="HOT_id">{t}Serial number{/t} {t}(iSerial){/t}</LABEL>
</td>
<td>
- <input type="text" value="{$HOT_vendor}" name="HOT_vendor" id="HOT_vendor">
+ <input type="text" value="{$HOT_id}" name="HOT_id" id="HOT_id">
</td>
+ <td colspan="2"> </td>
</tr>
<tr>
- <td><LABEL for="HOT_id">{t}Device ID{/t}</LABEL>{$must}
+ <td><LABEL for="HOT_vendor">{t}Vendor-ID{/t} {t}(idVendor){/t}</LABEL>
</td>
<td>
- <input type="text" value="{$HOT_id}" name="HOT_id" id="HOT_id">
+ <input type="text" value="{$HOT_vendor}" name="HOT_vendor" id="HOT_vendor">
</td>
- <td colspan="2"> </td>
</tr>
<tr>
- <td><LABEL for="HOT_produkt">{t}Product ID{/t}</LABEL>{$must}
+ <td><LABEL for="HOT_produkt">{t}Product-ID{/t} {t}(idProduct){/t}</LABEL>
</td>
<td>
<input type="text" value="{$HOT_produkt}" name="HOT_produkt" id="HOT_produkt">