Code

Added device type support
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 11 Jan 2008 16:14:15 +0000 (16:14 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 11 Jan 2008 16:14:15 +0000 (16:14 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8316 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/devices/class_deviceGeneric.inc
gosa-core/plugins/admin/devices/deviceGeneric.tpl

index 1415be066c50b79fd1565b37da23ec1a62bbd17d..bc870eb74c6266989d050222c096758c3bbd11c0 100644 (file)
@@ -10,8 +10,10 @@ class deviceGeneric extends plugin
   public $dev_id        = "";
   public $serial        = "";
   public $base          = "";  
+  public $types;
+  public $type;
 
-  public $posts           = array("description","dev_id","serial","vendor");
+  public $posts           = array("description","dev_id","serial","vendor", "type");
   public $attributes      = array("cn");
   public $objectclasses   = array("top","gotoDevice");
 
@@ -23,6 +25,12 @@ class deviceGeneric extends plugin
 
     $this->is_account = TRUE;
 
+    $this->types= array("camera" => _("Digital camera"),
+                        "harddisk" => _("Harddisk"),
+                        "stick" => _("USB stick"),
+                        "cd" => _("CD/DVD drive"),);
+    asort($this->types);
+
     /* Set class values */
     if(isset($this->attrs['gotoHotplugDevice'][0])){
       $tmp = preg_split("/\|/",$this->attrs['gotoHotplugDevice'][0]);
@@ -31,6 +39,9 @@ class deviceGeneric extends plugin
       $this->dev_id     = $tmp[1];
       $this->serial     = $tmp[2];
       $this->vendor     = $tmp[3];
+      if (isset($tmp[4])){
+        $this->type= $tmp[4];
+      }
     }     
 
     $this->orig_cn = $this->cn;
@@ -60,6 +71,10 @@ class deviceGeneric extends plugin
     foreach($this->posts as $attr){
       $smarty->assign($attr,$this->$attr);
     }
+
+    $smarty->assign("type",$this->type);
+    $smarty->assign ("types", $this->types);
+
     return($smarty->fetch(get_template_path("deviceGeneric.tpl",TRUE,dirname(__FILE__))));
   }
 
index 59f7b9c18e7c3e0af4421f8b9bb316233317ddc2..863851e4492c82d17ec281c3ee7472961cb786b8 100644 (file)
                 <input type="text" size=40 value="{$description}" name="description" id="description">
             </td>
         </tr>
+        <tr>
+            <td><LABEL for="description">{t}Device type{/t}</LABEL>
+            </td>
+            <td>
+               <select id="type" size="1" name="type" title="{t}Choose the device type{/t}">
+                       {html_options options=$types selected=$type}
+               </select>
+            </td>
+        </tr>
     </table>
    </td>
    <td style="vertical-align:top">