Code

Updated Server service
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Jan 2010 15:19:20 +0000 (15:19 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Jan 2010 15:19:20 +0000 (15:19 +0000)
-Not finished yet

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15266 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/systems/admin/systems/class_filterServerService.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/class_serverService.inc
gosa-plugins/systems/admin/systems/serverService-filter.tpl [new file with mode: 0644]
gosa-plugins/systems/admin/systems/serverService-filter.xml [new file with mode: 0644]
gosa-plugins/systems/admin/systems/serverService-list.tpl [new file with mode: 0644]
gosa-plugins/systems/admin/systems/serverService-list.xml [new file with mode: 0644]

diff --git a/gosa-plugins/systems/admin/systems/class_filterServerService.inc b/gosa-plugins/systems/admin/systems/class_filterServerService.inc
new file mode 100644 (file)
index 0000000..dd5e0da
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+class filterServerService {
+
+  static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "")
+  {
+    $plugins = ServerService::getServiceList();
+    $list = array();
+    foreach($plugins as $name => $obj){
+      if($obj->is_account){
+        $data = $plugins[$name]->getListEntry();
+        $data['objectClass'] = array('FAKE_OC_ServerService'); 
+        $data['name'] = $name;
+        foreach($data as $key => $value){
+          if(!is_array($data[$key])) $data[$key] = array($data[$key]);
+          $list[$name][] = $key;
+          $list[$name][$key] = $data[$key];
+          $list[$name][$key]['count'] = count($data[$key]);
+          $list[$name]['count'] = count($data);
+          $list[$name]['dn'] = $key;
+        }
+      }
+    }
+    return($list);
+  }
+}
+
+?>
index 4bd58ed1894d29ca7ff73227e0b95b6f0595615e..9a69e433ccd3d31f5cf0dcc4df59edcfa8322c84 100644 (file)
@@ -30,37 +30,58 @@ define("SERVICE_RESTARTED",_("Restart"));
 
 define("ALL_SERVICES",100);
 
-class ServerService extends plugin
+class ServerService extends management
 {
   /* attribute list for save action */
   var $ignore_account   = TRUE;
   var $attributes       = array();
   var $objectclasses    = array();
-
+  var $skipFooter       = TRUE;
+  var $skipHeader       = TRUE;
   var $divList          = NULL;
 
   var $plugins          = array();
   var $pluign_names     = array();
 
   var $current          = "";
+  var $dialog           = FALSE;
   var $backup           = NULL;
   var $acl              ;
   var $cn;
   var $parent           ;
 
-  function ServerService (&$config, $dn,$parent)
+  var $pl_notify = FALSE;
+
+  function __construct (&$config, $dn,$parent)
   {
-    plugin::plugin($config);
+    $this->config = $config;
     $this->parent = $parent;
+    $this->ui     = get_userinfo();
     $this->dn= $dn;
-
-    /* Adapt parent attributes */
     if(isset($this->parent->attrs)){
       $this->attrs = $this->parent->attrs;
     }
 
-    foreach ($config->data['TABS']['SERVERSERVICE'] as $plug){
 
+    // Set storage points - We do not have any - We just create a fake list which lists all services 
+    $this->storagePoints = array();
+
+#    // Build filter
+ #   if (session::global_is_set(get_class($this)."_filter")){
+  #    $filter= session::global_get(get_class($this)."_filter");
+   # } else {
+      $filter = new filter(get_template_path("serverService-filter.xml", true));
+      $filter->setObjectStorage($this->storagePoints);
+    #}
+    $this->setFilter($filter);
+
+    // Build headpage
+    $headpage = new listing(get_template_path("serverService-list.xml", true));
+    $headpage->setFilter($filter);
+
+    
+    // Initialize list of used and useable services.
+    foreach ($config->data['TABS']['SERVERSERVICE'] as $plug){
       if(class_available($plug['CLASS'])){
 
         $name= $plug['CLASS'];
@@ -82,25 +103,17 @@ class ServerService extends plugin
         #trigger_error("Service class missing: ".$plug['CLASS']);
       }
     }
-    $this->divList = new divListSystemService($config,$this);
+
+    parent::__construct($config, $ui, "systems", $headpage);
        }
 
-  function set_acl_base($base)
-  {
-    plugin::set_acl_base($base);
-    foreach($this->plugins as $name => $obj){
-      $this->plugins[$name]->set_acl_base($base);
-    }
-  }
 
-  function set_acl_category($category)
-  {
-    plugin::set_acl_category($category);
-    foreach($this->plugins as $name => $obj){
-      $this->plugins[$name]->set_acl_category($category);
-    }
+  static function getServiceList()
+  { 
+    return(session::get('ServerService'));
   }
 
+
   function execute()
   {
     /* Variable initialisation */  
@@ -269,16 +282,8 @@ class ServerService extends plugin
 
 
     /* Dispaly services overview */
-    $this->divList->execute();
-    $list = array();
-
-    foreach($this->plugins as $name => $obj){
-      if($obj->is_account){
-        $list[$name] = $this->plugins[$name]->getListEntry(); 
-      }
-    }
-    $this->divList -> setEntries($list);
-    return("<table style='width:100%;'><tr><td>".$this->divList->Draw()."</td></tr></table>");
+    session::set('ServerService', $this->plugins);
+    return(management::execute());
   }
 
 
@@ -480,6 +485,22 @@ class ServerService extends plugin
     }
   }
   
+
+  // Forward plugin ACLs 
+  function set_acl_base($base)
+  {
+    foreach($this->plugins as $name => $obj){
+      $this->plugins[$name]->set_acl_base($base);
+    }
+  }
+
+  // Forward plugin ACLs 
+  function set_acl_category($category)
+  {
+    foreach($this->plugins as $name => $obj){
+      $this->plugins[$name]->set_acl_category($category);
+    }
+  }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
diff --git a/gosa-plugins/systems/admin/systems/serverService-filter.tpl b/gosa-plugins/systems/admin/systems/serverService-filter.tpl
new file mode 100644 (file)
index 0000000..16ddf73
--- /dev/null
@@ -0,0 +1,8 @@
+<div class="contentboxh">
+ <p class="contentboxh">
+  <img src="images/launch.png" align="right" alt="[F]">{t}Filter{/t}
+ </p>
+</div>
+
+<div class="contentboxb">
+</div>
diff --git a/gosa-plugins/systems/admin/systems/serverService-filter.xml b/gosa-plugins/systems/admin/systems/serverService-filter.xml
new file mode 100644 (file)
index 0000000..5f84814
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<filterdef>
+  <definition>
+    <category>server</category>
+    <template>serverService-filter.tpl</template>
+    <initial>true</initial>
+  </definition>
+
+  <search>
+    <query>
+      <backend>ServerService</backend>
+      <filter>...</filter>
+      <attribute>dn</attribute>
+      <attribute>objectClass</attribute>
+      <attribute>name</attribute>
+      <attribute>Message</attribute>
+    </query>
+    <scope>auto</scope>
+  </search>
+
+</filterdef>
diff --git a/gosa-plugins/systems/admin/systems/serverService-list.tpl b/gosa-plugins/systems/admin/systems/serverService-list.tpl
new file mode 100644 (file)
index 0000000..b233c58
--- /dev/null
@@ -0,0 +1,31 @@
+<input type='image' src='images/empty.png' name='no_action_posted' value='do_nothing' alt='' style='width:2px;height:2px;'>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=2>
+  <tr>
+    <td style="vertical-align:top; width:50%;">
+      <div class="contentboxh">
+        <p class="contentboxh">&nbsp;{$HEADLINE}&nbsp;{$SIZELIMIT}</p>
+      </div>
+      
+      <div class="contentboxb">
+       <div style='background:white;padding:0px;padding:3px;'>
+        <table><tr>
+          <td>{$ROOT}&nbsp;</td><td>{$BACK}&nbsp;</td><td>{$HOME}&nbsp;</td><td>{$RELOAD}&nbsp;</td><td>{$SEPARATOR}&nbsp;</td><td>{t}Base{/t} {$BASE}&nbsp;<input class='center' type='image' src='images/lists/submit.png' align='middle' title='{t}Update{/t}' name='submit_department' alt='{t}Submit{/t}'>&nbsp;</td><td>{$SEPARATOR}&nbsp;</td><td><img src='images/rocket.png' alt='' class='center'></td><td> {$ACTIONS}</td>
+        </tr></table>
+       </div>
+      </div>
+      
+      <div style='height:4px;'>
+      </div>
+      
+      <input type="hidden" id="d_save" value="450">
+      <input type="hidden" id="d_space" value="760">
+      {$LIST}
+    </td>
+    <td style='vertical-align:top'>
+      {$FILTER}
+    </td>
+  </tr>
+</table>
+
+<input type="hidden" name="ignore">
diff --git a/gosa-plugins/systems/admin/systems/serverService-list.xml b/gosa-plugins/systems/admin/systems/serverService-list.xml
new file mode 100644 (file)
index 0000000..f93d44e
--- /dev/null
@@ -0,0 +1,323 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<list>
+  <definition>
+    <departmentBrowser>false</departmentBrowser>
+    <departmentRootVisible>false</departmentRootVisible>
+    <baseMode>false</baseMode>
+    <multiSelect>true</multiSelect>
+    <template>serverService-list.tpl</template>
+    <label>List of services</label>
+    <defaultSortColumn>1</defaultSortColumn>
+
+    <objectType>
+      <label>Service</label>
+      <objectClass>FAKE_OC_ServerService</objectClass>
+      <category>server</category>
+      <class>ServerService</class>
+      <image>images/lits/new.png</image>
+    </objectType>
+
+  </definition>
+
+  <table>
+    <layout>||250px|170px;r|</layout>
+
+    <column>
+      <label>Description</label>
+      <sortAttribute>Message</sortAttribute>
+      <sortType>string</sortType>
+      <value>%{filter:link(row,dn,"%s",Message)}</value>
+      <export>true</export>
+    </column>
+
+    <column>
+      <label>Actions</label>
+      <value>%{filter:actions(dn,row,objectClass)}</value>
+    </column>
+
+  </table>
+
+  <actionmenu>
+
+    <action>
+     <type>sub</type>
+     <image>images/lists/new.png</image>
+     <label>Create</label>
+
+     <action>
+      <name>new_goServer</name>
+      <type>entry</type>
+      <image>plugins/systems/images/select_server.png</image>
+      <label>Server</label>
+      <depends>servgeneric</depends>
+     </action>
+
+     <action>
+      <name>new_gotoWorkstation</name>
+      <type>entry</type>
+      <image>plugins/systems/images/select_workstation.png</image>
+      <label>Workstation</label>
+      <depends>workgeneric</depends>
+     </action>
+
+     <action>
+      <name>new_gotoTerminal</name>
+      <type>entry</type>
+      <image>plugins/systems/images/select_terminal.png</image>
+      <label>Terminal</label>
+      <depends>termgeneric</depends>
+     </action>
+
+     <action>
+      <name>new_gotoPrinter</name>
+      <type>entry</type>
+      <image>plugins/systems/images/select_printer.png</image>
+      <label>Network printer</label>
+      <depends>printgeneric</depends>
+     </action>
+
+     <action>
+      <name>new_goFonHardware</name>
+      <type>entry</type>
+      <image>plugins/systems/images/select_phone.png</image>
+      <label>Phone</label>
+      <depends>phoneGeneric</depends>
+     </action>
+
+     <action>
+      <name>new_ieee802Device</name>
+      <type>entry</type>
+      <image>plugins/systems/images/select_component.png</image>
+      <label>Network device</label>
+      <depends>componentGeneric</depends>
+     </action>
+
+     <action>
+      <name>new_FAKE_OC_OpsiHost</name>
+      <type>entry</type>
+      <image>plugins/systems/images/select_winstation.png</image>
+      <label>Opsi client</label>
+      <depends>opsi</depends>
+     </action>
+    </action>
+
+    <action>
+      <type>separator</type>
+    </action>
+
+    <action>
+     <type>sub</type>
+     <image>images/rocket.png</image>
+     <label>Trigger action</label>
+
+      <action>
+        <name>T_DaemonEvent_halt</name>
+        <depends>DaemonEvent_halt</depends>
+        <type>entry</type>
+        <image>images/lists/reload.png</image>
+        <label>Halt </label>
+      </action>
+
+      <action>
+        <name>T_DaemonEvent_reboot</name>
+        <depends>DaemonEvent_reboot</depends>
+        <type>entry</type>
+        <image>images/lists/reload.png</image>
+        <label>Reboot</label>
+      </action>
+
+      <action>
+        <name>T_DaemonEvent_wakeup</name>
+        <depends>DaemonEvent_wakeup</depends>
+        <type>entry</type>
+        <image>images/lists/on.png</image>
+        <label>Wakeup</label>
+      </action>
+
+      <action>
+        <name>T_DaemonEvent_update</name>
+        <depends>DaemonEvent_update</depends>
+        <type>entry</type>
+        <image>plugins/goto/images/update.png</image>
+        <label>Update</label>
+      </action>
+
+      <action>
+        <name>T_DaemonEvent_lock</name>
+        <depends>DaemonEvent_lock</depends>
+        <type>entry</type>
+        <image>images/lists/locked.png</image>
+        <label>Lock</label>
+      </action>
+
+      <action>
+        <name>T_DaemonEvent_activate</name>
+        <depends>DaemonEvent_activate</depends>
+        <type>entry</type>
+        <image>images/lists/unlocked.png</image>
+        <label>Activate</label>
+      </action>
+
+      <action>
+        <name>T_DaemonEvent_reinstall</name>
+        <depends>DaemonEvent_reinstall</depends>
+        <type>entry</type>
+        <image>plugins/goto/images/reinstall.png</image>
+        <label>Reinstall</label>
+      </action>
+
+
+    </action>
+
+
+
+    <action>
+     <type>sub</type>
+     <image>plugins/systems/images/clock.png</image>
+     <label>Schedule action</label>
+
+      <action>
+        <name>S_DaemonEvent_halt</name>
+        <depends>DaemonEvent_halt</depends>
+        <type>entry</type>
+        <image>images/lists/off.png</image>
+        <label>Halt</label>
+      </action>
+
+      <action>
+        <name>S_DaemonEvent_reboot</name>
+        <depends>DaemonEvent_reboot</depends>
+        <type>entry</type>
+        <image>images/lists/reload.png</image>
+        <label>Reboot</label>
+      </action>
+
+      <action>
+        <name>S_DaemonEvent_wakeup</name>
+        <depends>DaemonEvent_wakeup</depends>
+        <type>entry</type>
+        <image>images/lists/on.png</image>
+        <label>Wakeup</label>
+      </action>
+
+      <action>
+        <name>S_DaemonEvent_update</name>
+        <depends>DaemonEvent_update</depends>
+        <type>entry</type>
+        <image>plugins/goto/images/update.png</image>
+        <label>Update</label>
+      </action>
+
+      <action>
+        <name>S_DaemonEvent_lock</name>
+        <depends>DaemonEvent_lock</depends>
+        <type>entry</type>
+        <image>images/lists/locked.png</image>
+        <label>Lock</label>
+      </action>
+
+      <action>
+        <name>S_DaemonEvent_activate</name>
+        <depends>DaemonEvent_activate</depends>
+        <type>entry</type>
+        <image>images/lists/unlocked.png</image>
+        <label>Activate</label>
+      </action>
+
+      <action>
+        <name>S_DaemonEvent_reinstall</name>
+        <depends>DaemonEvent_reinstall</depends>
+        <type>entry</type>
+        <image>plugins/goto/images/reinstall.png</image>
+        <label>Reinstall</label>
+      </action>
+
+    </action>
+
+    <action>
+      <type>separator</type>
+    </action>
+
+    <action>
+      <name>activateMultiple</name>
+      <depends>DaemonEvent_activate</depends>
+      <type>entry</type>
+      <image>images/lists/unlocked.png</image>
+      <label>Activate systems</label>
+    </action>
+
+    <action>
+      <name>remove</name>
+      <type>entry</type>
+      <image>images/lists/trash.png</image>
+      <label>Remove</label>
+    </action>
+
+    <action>
+      <type>exporter</type>
+    </action>
+
+    <action>
+      <type>separator</type>
+    </action>
+
+    <action>
+      <type>copypaste</type>
+    </action>
+
+    <action>
+      <type>snapshot</type>
+    </action>
+
+  </actionmenu>
+
+  <actiontriggers snapshot="true" copypaste="true">
+
+    <action>
+      <name>setPassword</name>
+      <type>entry</type>
+      <objectclass>FAKE_OC_PWD_changeAble</objectclass>
+      <image>images/lists/key.png</image>
+      <label>Change password</label>
+    </action>
+
+
+    <action>
+      <name>createISO</name>
+      <type>entry</type>
+      <objectclass>gotoWorkstation</objectclass>
+      <objectclass>FAIobject</objectclass>
+      <image>plugins/systems/images/cdrom.png</image>
+      <acl>workstation/workgeneric[createFAICD:w]</acl>
+      <label>Create ISO</label>
+    </action>
+
+    <action>
+      <name>cp</name>
+      <type>copypaste</type>
+    </action>
+
+    <action>
+      <name>edit</name>
+      <type>entry</type>
+      <image>images/lists/edit.png</image>
+      <label>Edit role</label>
+    </action>
+
+    <action>
+      <name>snapshot</name>
+      <type>snapshot</type>
+    </action>
+
+    <action>
+      <name>remove</name>
+      <type>entry</type>
+      <image>images/lists/trash.png</image>
+      <acl>%acl[d]</acl>
+      <label>Remove system</label>
+    </action>
+
+  </actiontriggers>
+
+</list>