Code

Show the available services directly in the service menu instead of a sub dialog
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 19 May 2010 13:08:09 +0000 (13:08 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 19 May 2010 13:08:09 +0000 (13:08 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18553 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/systems/admin/systems/class_serverService.inc
gosa-plugins/systems/admin/systems/serverService-list.xml

index 80bd240e0439008c0b010a9018c61b257a61e951..5e4e35ced3f4916ebc7804f44968f60a61408d7a 100644 (file)
@@ -73,12 +73,6 @@ class ServerService extends management
         }
         $this->setFilter($filter);
 
-        // Build headpage
-        $headpage = new listing(get_template_path("serverService-list.xml", true));
-        $headpage->registerElementFilter("filterServiceStatus", "ServerService::filterServiceStatus");
-        $headpage->setFilter($filter);
-
-
         // Initialize list of used and useable services.
         foreach ($config->data['TABS']['SERVERSERVICE'] as $plug){
             if(class_available($plug['CLASS'])){
@@ -101,6 +95,24 @@ class ServerService extends management
             }
         }
 
+        // Load service xml file and fill in placeholders
+        $contents =file_get_contents(get_template_path("serverService-list.xml", true));
+        $template = "
+            <action>
+            <name>new_%s</name>
+            <type>entry</type>
+            <label>%s</label>
+            </action>";
+        $serviceList = "";
+        foreach($this->getAllUnusedServices() as $name => $desc){
+            $serviceList.= sprintf($template, $name,_($desc));
+        }
+        $contents = preg_replace("/%SERVICES%/",$serviceList, $contents);
+
+        $headpage = new listing($contents,TRUE);
+        $headpage->registerElementFilter("filterServiceStatus", "ServerService::filterServiceStatus");
+        $headpage->setFilter($filter);
+
         parent::__construct($config, $this->ui, "services", $headpage);
         $this->registerAction("new",                "newService");
         $this->registerAction("remove",             "removeService");
index e4937c87875b6ba96cbe773078e10979c21e4f86..ddd3132cb88aba090373c2b8595131cae1b2bacf 100644 (file)
@@ -1,5 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <list>
   <definition>
     <departmentBrowser>false</departmentBrowser>
      <image>images/lists/element.png[new]</image>
      <label>Create</label>
 
-     <action>
-      <name>new</name>
-      <type>entry</type>
-      <image>images/lists/element.png[new]</image>
-      <label>Service</label>
-     </action>
+     %SERVICES%
+
     </action>
 
     <action>