Code

Dynamically add object types for the management list s
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 30 Sep 2010 15:06:55 +0000 (15:06 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 30 Sep 2010 15:06:55 +0000 (15:06 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19876 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.xml
gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc
gosa-plugins/goto/admin/systems/goto/Config/class_filterDeviceItems.inc

index ba1af7e990bbda71fe99643f4552a0e7df1f590d..9a6812df063514569b2ebb6e2343da36579a5907 100644 (file)
     <label>List of items</label>
     <defaultSortColumn>1</defaultSortColumn>
 
-    <objectType>
-      <label>Item</label>
-      <objectClass>FAKE_OC_DeviceItem</objectClass>
-      <category>Device</category>
-      <class>Item</class>
-      <image>images/lists/edit.png</image>
-    </objectType>
-
-    <objectType>
-      <label>1Item</label>
-      <objectClass>1FAKE_OC_DeviceItem</objectClass>
-      <category>Device</category>
-      <class>1Item</class>
-      <image>1images/lists/edit.png</image>
-    </objectType>
+    %TYPES%
 
   </definition>
 
       <value>%{filter:objectType(dn,objectClass)}</value>
     </department>
 
+    <department>
+      <value>%{filter:departmentLink(row,dn,description)}</value>
+      <span>2</span>
+    </department>
+
     <column>
       <value>%{filter:objectType(dn,objectClass)}</value>
     </column>
 
-
     <column>
       <label>Name</label>
       <sortAttribute>cn</sortAttribute>
index 6df4b513b13fefa03b148eb358578be1f92d4324..7f213e87c0485de918cc58d1b1fe75b30a53000c 100644 (file)
@@ -304,6 +304,22 @@ class DeviceConfig extends management
         // Load service xml file and fill in placeholders
         $contents =file_get_contents(get_template_path("goto/Config/DeviceConfig-list.xml", true));
 
+        // Build up device-list configuration   
+        $types ="";
+        foreach($this->itemConfig as $type => $item){
+            $desc = $item['description'];
+            $img = 'images/lists/trash.png';
+            $types .= 
+                "   <objectType>".
+                "     <label>{$desc}</label>".
+                "     <objectClass>{$type}</objectClass>".
+                "     <category>Device</category>".
+                "     <class>dummy</class>".
+                "     <image>{$img}</image>".
+                "   </objectType>";
+        }
+        $contents = preg_replace("/%TYPES%/", $types, $contents);
+
 
         $items = "";
         foreach($this->addableContainerItems as $item){
index b44d8d1dedbaf8636888a496534ad08dc8036f01..d6dd7c912ac9a46816fb4f09ab94410f452359a2 100644 (file)
@@ -39,9 +39,9 @@ class filterDeviceItems {
             $entry[] = 'id';
             $entry['description'] = array($item['type'], 'count' => 1);
             $entry[] = 'description';
-            $entry['objectClass'] = array('FAKE_OC_DeviceItem','count' => 1);
+            $entry['objectClass'] = array($item['type'],'count' => 1);
             $entry[] = 'objectClass';
-            $entry['count'] = 4;
+            $entry['count'] = 5;
             $ret[] = $entry;
         }