Code

Moved systems
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Jan 2008 16:56:22 +0000 (16:56 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Jan 2008 16:56:22 +0000 (16:56 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8484 594d385d-05f5-0310-b6e9-bd551577e9d8

44 files changed:
gosa-core/plugins/admin/systems/class_baseSelectDialog.inc [deleted file]
gosa-core/plugins/admin/systems/class_componentGeneric.inc [deleted file]
gosa-core/plugins/admin/systems/class_divListSystem.inc [deleted file]
gosa-core/plugins/admin/systems/class_divListSystemService.inc [deleted file]
gosa-core/plugins/admin/systems/class_servGeneric.inc [deleted file]
gosa-core/plugins/admin/systems/class_serverService.inc [deleted file]
gosa-core/plugins/admin/systems/class_systemManagement.inc [deleted file]
gosa-core/plugins/admin/systems/class_termDNS.inc [deleted file]
gosa-core/plugins/admin/systems/component.tpl [deleted file]
gosa-core/plugins/admin/systems/contents.tpl [deleted file]
gosa-core/plugins/admin/systems/main.inc [deleted file]
gosa-core/plugins/admin/systems/network.tpl [deleted file]
gosa-core/plugins/admin/systems/password.tpl [deleted file]
gosa-core/plugins/admin/systems/paste_generic.tpl [deleted file]
gosa-core/plugins/admin/systems/remove.tpl [deleted file]
gosa-core/plugins/admin/systems/server.tpl [deleted file]
gosa-core/plugins/admin/systems/services/ServiceAddDialog.tpl [deleted file]
gosa-core/plugins/admin/systems/services/class_ServiceAddDialog.inc [deleted file]
gosa-core/plugins/admin/systems/services/class_goService.inc [deleted file]
gosa-core/plugins/admin/systems/tabs_arpnewdevice.inc [deleted file]
gosa-core/plugins/admin/systems/tabs_component.inc [deleted file]
gosa-core/plugins/admin/systems/tabs_server.inc [deleted file]
gosa-plugins/systems/admin/systems/class_baseSelectDialog.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/class_componentGeneric.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/class_divListSystem.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/class_divListSystemService.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/class_servGeneric.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/class_serverService.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/class_systemManagement.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/class_termDNS.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/component.tpl [new file with mode: 0644]
gosa-plugins/systems/admin/systems/contents.tpl [new file with mode: 0644]
gosa-plugins/systems/admin/systems/main.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/network.tpl [new file with mode: 0644]
gosa-plugins/systems/admin/systems/password.tpl [new file with mode: 0644]
gosa-plugins/systems/admin/systems/paste_generic.tpl [new file with mode: 0644]
gosa-plugins/systems/admin/systems/remove.tpl [new file with mode: 0644]
gosa-plugins/systems/admin/systems/server.tpl [new file with mode: 0644]
gosa-plugins/systems/admin/systems/services/ServiceAddDialog.tpl [new file with mode: 0644]
gosa-plugins/systems/admin/systems/services/class_ServiceAddDialog.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/services/class_goService.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/tabs_arpnewdevice.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/tabs_component.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/tabs_server.inc [new file with mode: 0644]

diff --git a/gosa-core/plugins/admin/systems/class_baseSelectDialog.inc b/gosa-core/plugins/admin/systems/class_baseSelectDialog.inc
deleted file mode 100644 (file)
index 04275e0..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-<?php
-
-class baseSelectDialog extends MultiSelectWindow
-{
-  var $selectedBase        = ""; // Used for navigation 
-  var $base_selection_regex = "*"; // Used regex ... 
-  var $BaseToUse         = false;  // used to specify the selected base, 
-                                      // false if none is selected
-
-  var $allowedBases         = array();
-  var $parent               = NULL;
-  function baseSelectDialog (&$config,$parent,$onlyAllowThisBases = array())
-  {
-    $module= "all";
-    MultiSelectWindow::MultiSelectWindow($config, "BASEselectWindow", $module);
-   
-    $this->parent = $parent;
-    $this->selectedBase = $config->current['BASE'];
-    $this->allowedBases  = $onlyAllowThisBases;
-
-    $this->SetTitle("Base");
-    $this->SetSummary(_("Choose a base"));
-    $this->SetListHeader("<div style='background:#F0F0F9;padding:5px;'>".
-        " <input class='center' type='image' src='images/list_root.png' align='middle'
-        title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
-        " <input class='center' type='image' align='middle' src='images/list_back.png'
-        title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'>&nbsp;".
-        " <input class='center' type='image' align='middle' src='images/list_home.png'
-        title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'>&nbsp;".
-        " <input class='center' type='image' src='images/list_reload.png' align='middle' title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
-        "</div>");
-
-    $this->SetInformation(_("Step in the prefered tree and click save to use the current subtree as base. Or click the image at the end of each entry."));
-
-    $this->EnableAplhabet   (true);
-    $this->EnableCloseButton(true);
-    $this->EnableSaveButton (true);
-
-    $this->SetSaveButtonString(_("Use"));
-    $this->SetCloseButtonString(_("Cancel"));
-
-    $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>_("Base")));
-    $this->AddHeader(array("string"=>_("Action"),"attach"=>"style='width:50px;border-right:0px;'"));
-
-    /*                  Text        ,Value    ,Name         ,Is selected */
-//  $this->AddCheckBox("Doesnothing","servers","Doesnothing",true);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("base_selection_regex",_("Filter entries with this syntax"),"*"      , true);
-  }
-
-  function execute()
-  {
-    $this->setEntries();
-    return($this->Draw());
-  }
-
-  function setEntries()
-  {
-    $this->ClearElementsList();
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->selectedBase);
-    $ldap->ls("(&(objectClass=gosaDepartment)
-                 (|(ou=".$this->base_selection_regex.")
-                   (cn=".$this->base_selection_regex.")
-                   (description=".$this->base_selection_regex.")))",
-              $this->selectedBase,array("ou","description","cn"));
-
-    $link = "<a href='?plug=".$_GET['plug']."&open_dep=%s'>%s</a>";
-
-    $base_back          = preg_replace("/^[^,]+,/","",$this->selectedBase);
-    $base_back          = convert_department_dn($base_back);
-  
-    /* Add departments, to be able to switch into them
-     */
-    while($attrs = $ldap->fetch()){
-      $key = $attrs['dn']  ;
-      $val = $attrs['ou'][0];
-    
-      if(count($this->allowedBases) != 0){
-        if(!isset($this->allowedBases[$key])){
-          continue;
-          break;
-        }
-      }
-      /* Append description */ 
-      if(isset($attrs['description'][0])){
-        $val.=" [".$attrs['description'][0]."]";
-      }
-
-      /* Add missing entries ... */
-      if(!isset($this->config->departments[trim($key)])){
-        $this->config->departments[trim($key)]="";
-      }
-
-      /* check if this department contains sub-departments
-         Display different image in this case
-       */
-      $non_empty="";
-      $keys= str_replace("/","\/",$key);
-      foreach($this->config->departments as $keyd ){
-        if(preg_match("/,".$keys."/",$keyd)){
-          $non_empty="full";
-        }
-      }
-
-      /* Add to divlist */
-      $field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>", 
-                      "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($link,base64_encode($key),$val), "attach" => "style=''");
-      $field3 = array("string" => sprintf("&nbsp;<input title='"._("Select this base")."' type='image' img src='images/save.png' name='usebase_%s'>",base64_encode($key)), 
-                      "attach" => "style='width:50px;border-right:0px;text-align:right;'");
-      $this->AddElement(array($field1,$field2,$field3));
-    }
-  }
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-    $this->BaseToUse = $this->selectedBase;
-  }
-
-  function isSelected() 
-  {
-    return($this->BaseToUse);
-  }
-
-  function setCurrentBase($base)
-  {
-    $this->selectedBase = $base;
-  }
-
-  function save_object()
-  {
-    /* Save current base */
-    $old_base = $this->selectedBase;
-  
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object();   
-    
-    if(isset($_GET['open_dep'])){
-      $this->selectedBase = base64_decode($_GET['open_dep']);
-    } 
-
-    $s_action ="";
-    foreach($_POST as $key => $value){
-      if(preg_match("/^dep_back.*/i",$key)){
-        $s_action="back";
-      }elseif(preg_match("/^dep_root.*/",$key)){
-        $s_action="root";
-      }elseif(preg_match("/^dep_home.*/i",$key)){
-        $s_action="home";
-      }elseif(preg_match("/^usebase_/",$key)){
-        $tmp = preg_replace("/^usebase_/","",$key);
-        $tmp = preg_replace("/_.*$/","",$tmp);
-        $tmp = base64_decode($tmp);
-        $this->BaseToUse = $tmp;
-      }
-    }
-
-    $ui= get_userinfo();
-    /* Homebutton is posted */
-    if($s_action=="home"){
-      $this->selectedBase=(preg_replace("/^[^,]+,/","",$ui->dn));
-      $this->selectedBase=(preg_replace("/^[^,]+,/","",$this->selectedBase));
-    }
-
-    /* back to the roots ^^ */
-    if($s_action=="root"){
-      $this->selectedBase=($this->config->current['BASE']);
-    }
-
-    /* If Backbutton is Posted */
-    if($s_action=="back"){
-      $base_back          = preg_replace("/^[^,]+,/","",$this->selectedBase);
-      $base_back          = convert_department_dn($base_back);
-
-      if(isset($this->config->departments[trim($base_back)])){
-        $this->selectedBase= $this->config->departments[trim($base_back)];
-      }else{
-        $this->selectedBase= $this->config->departments["/"];
-      }
-    }
-
-    /* Restore old base, if selected base is not allowed */
-    if(count($this->allowedBases) && !isset($this->allowedBases[$this->selectedBase])){
-      $this->selectedBase = $old_base;
-    }
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/class_componentGeneric.inc b/gosa-core/plugins/admin/systems/class_componentGeneric.inc
deleted file mode 100644 (file)
index 5836251..0000000
+++ /dev/null
@@ -1,331 +0,0 @@
-<?php
-
-class componentGeneric extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage component base objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Generic terminal attributes */
-  var $interfaces= array();
-  var $ignore_account= TRUE;
-
-  /* Needed values and lists */
-  var $base= "";
-  var $cn= "";
-  var $description= "";
-  var $orig_dn= "";
-
-  /* attribute list for save action */
-  var $attributes= array("cn", "description");
-  var $objectclasses= array("top", "device", "ipHost", "ieee802Device");
-  var $netConfigDNS;
-  var $view_logged  = FALSE;
-
-  function componentGeneric (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    /* Set base */
-    if ($this->dn == "new"){
-      $ui= get_userinfo();
-      $this->base= dn2base($ui->dn);
-      $this->cn= "";
-    } else {
-      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
-    }
-    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses, true);
-    /* Save dn for later references */
-    $this->orig_dn= $this->dn;
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","component/".get_class($this),$this->dn);
-    }
-
-    /* Do we represent a valid phone? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
-        _("This 'dn' has no network features.")."</b>";
-      return($display);
-    }
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $smarty->assign("bases", $this->config->idepartments);
-
-    /* Set acls */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    $smarty->assign("bases", $this->get_allowed_bases());
-
-    /* Assign attributes */
-    foreach ($this->attributes as $attr){
-      $smarty->assign("$attr", $this->$attr);
-    }
-    $smarty->assign("base_select", $this->base);
-
-    /* Show main page */
-    $str = $this->netConfigDNS->execute();
-    if(is_object($this->netConfigDNS->dialog)){
-      return($str);
-    }
-    $smarty->assign("netconfig", $str);
-    return($smarty->fetch (get_template_path('component.tpl', TRUE)));
-  }
-
-  function set_acl_base($base)
-  {
-    plugin::set_acl_base($base);
-    $this->netConfigDNS->set_acl_base($base);
-  }
-
-  function set_acl_category($cat)
-  {
-    plugin::set_acl_category($cat);
-    $this->netConfigDNS->set_acl_category($cat);
-  }
-
-  function remove_from_parent()
-  {
-    $ldap= $this->config->get_ldap_link();
-    $this->netConfigDNS->remove_from_parent();
-    $ldap->rmdir($this->dn);
-    
-    new log("remove","component/".get_class($this),$this->dn,$this->attributes,$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of system component/generic with dn '%s' failed."),$this->dn));
-    $this->handle_post_events(array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    
-    /* Create a base backup and reset the
-       base directly after calling plugin::save_object();
-       Base will be set seperatly a few lines below */
-    $base_tmp = $this->base;
-    plugin::save_object();
-    $this->base = $base_tmp;
-
-    $this->netConfigDNS->save_object();
-
-    /* Set new base if allowed */
-    $tmp = $this->get_allowed_bases();
-    if(isset($_POST['base'])){
-      if(isset($tmp[$_POST['base']])){
-        $this->base= $_POST['base'];
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-    $message= array_merge($message,$this->netConfigDNS->check());
-
-    $this->dn= "cn=".$this->cn.",".get_ou('componentou').$this->base;
-
-    if ($this->cn == "" ){
-      $message[]= _("The required field 'Component name' is not set.");
-    }
-
-    /* Check if given name is a valid host/dns name */
-    if(!tests::is_dns_name($this->cn)){
-      $message[] = _("Please specify a valid name for this object.");
-    }
-
-    /* To check for valid ip*/
-    if($this->netConfigDNS->ipHostNumber == ""){
-       $message[]= _("The required field IP address is empty.");
-    } else {
-      if (!tests::is_ip($this->netConfigDNS->ipHostNumber)){
-        $message[]= _("The field IP address contains an invalid address.");
-      }
-    }
-
-    if ($this->orig_dn != $this->dn){
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd ($this->base);
-      $ldap->search ("(cn=".$this->cn.")", array("cn"));
-      if ($ldap->count() != 0){
-        while ($attrs= $ldap->fetch()){
-          if(preg_match("/cn=dhcp,/",$attrs['dn'])){
-            continue;
-          }
-          if ($attrs['dn'] != $this->orig_dn){
-            $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
-            break;
-          }
-        }
-      }
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    /* Remove all empty values */
-    if ($this->orig_dn == 'new'){
-      $attrs= array();
-      foreach ($this->attrs as $key => $val){
-        if (is_array($val) && count($val) == 0){
-          continue;
-        }
-        $attrs[$key]= $val;
-      }
-      $this->attrs= $attrs;
-    }
-
-    /* If this is a new Object IP & Mac aren't set.
-         IP & Mac are msut attributes, so we set this values by here. */
-    if($this->orig_dn == 'new'){
-      $this->attrs['ipHostNumber'] = $this->netConfigDNS->ipHostNumber;
-      $this->attrs['macAddress']  = $this->netConfigDNS->macAddress;
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    if ($this->orig_dn == 'new'){
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      new log("create","component/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-      
-    } else {
-      if ($this->orig_dn != $this->dn){
-        $this->move($this->orig_dn, $this->dn);
-      }
-
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-      new log("modify","component/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-    }
-
-    $this->netConfigDNS->cn = $this->cn;
-    $this->netConfigDNS->save();
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system component/generic with dn '%s' failed."),$this->dn));
-  }
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Generic"),
-          "plDescription" => _("Component generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 1,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("component" => array("description"  => _("Network device"),
-                                                        "objectClass"  => array("device", "ipHost", "ieee802Device"))),
-          "plProvidedAcls"=> array(
-            "cn"                  => _("Name"),
-            "base"                => _("Base"),
-            "description"         => _("Description"))
-          ));
-  }
-
-  /* Display generic part for server copy & paste */
-  function getCopyDialog()
-  {
-    $vars = array("cn");
-    $smarty = get_smarty();
-    $smarty->assign("cn" ,$this->cn);
-    $smarty->assign("object","component");
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-    if(isset($source['macAddress'][0])){
-      $this->netConfigDNS->macAddress = $source['macAddress'][0];
-    }
-    if(isset($source['ipHostNumber'][0])){
-      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/class_divListSystem.inc b/gosa-core/plugins/admin/systems/class_divListSystem.inc
deleted file mode 100644 (file)
index 61871b7..0000000
+++ /dev/null
@@ -1,468 +0,0 @@
-<?php
-
-class divListSystem extends MultiSelectWindow
-{
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-
-  /* Regex */
-  var $Regex              = "*";
-  var $UserRegex          = "*";
-
-  /* CheckBoxes, to change default values modify $this->AddCheckBox */
-  var $ShowServers;
-  var $ShowTerminals;
-  var $ShowWorkstations;
-  var $ShowWinWorkstations;
-  var $ShowPrinters;
-  var $ShowDevices;
-  var $ShowPhones;
-
-  /* Subsearch checkbox */
-  var $SubSearch;
-
-  var $parent             ;
-  var $ui                 ;
-
-  function divListSystem (&$config,$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config, "System", array("server",
-                                                                  "workstation",
-                                                                  "terminal",
-                                                                  "phone",
-                                                                  "incoming",
-                                                                  "printer"));
-
-    $this->parent       = $parent;
-    $this->ui           = get_userinfo();
-
-    /* Set list strings */
-    $this->SetTitle(_("List of systems"));
-    $this->SetSummary(_("List of systems"));
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->SetInformation(_("This menu allows you to add, remove and change the properties of specific systems. You can only add systems which have already been started once."));
-
-    $this->EnableAplhabet   (true);
-
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 110;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>_("System / Department")));
-    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:".$action_col_size."px;border-right:0px;'"));
-
-    /*                  Text        ,Value    ,Name         ,Is selected */
-    $this->AddCheckBox("ShowServers",         _("Select to see servers"),            _("Show servers"),          true);
-    $this->AddCheckBox("ShowTerminals",       _("Select to see Linux terminals"),    _("Show terminals") ,       true);
-    $this->AddCheckBox("ShowWorkstations",    _("Select to see Linux workstations"), _("Show workstations"),     true);
-    $this->AddCheckBox("ShowWinWorkstations", _("Select to see MicroSoft Windows based workstations"), _("Show windows based workstations"),true);
-    $this->AddCheckBox("ShowPrinters",        _("Select to see network printers"),    _("Show network printers") ,true);
-    $this->AddCheckBox("ShowPhones",          _("Select to see VOIP phones"),         _("Show phones") ,          true);
-    $this->AddCheckBox("ShowDevices",         _("Select to see network devices"),     _("Show network devices"),  true);
-
-    /* Add SubSearch checkbox */
-    $this->AddCheckBox(SEPERATOR);
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Display systems matching"),"*" , true);
-    $this->AddRegex   ("UserRegex", _("Display systems of user"), "*" , false, "images/search_user.png");
-  }
-
-  function GenHeader()
-  {
-   /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $first = "";
-    $found = FALSE;
-    $department = $departments = array();
-    foreach($this->module as $module){
-      $d = $ui->get_module_departments($module);      
-      foreach($d as $department){
-        $departments[$department] = $department;
-      }
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $departments)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* If there is at least one c (Create) and one w (Write) acl in this combination
-        display the snapshot paste icon. BUT check the correct acls in the management plugin */
-    $all_module_acls = "";
-    foreach($this->module as $module){
-      $all_module_acls .= $ui->has_complete_category_acls($this->selectedBase,$module);
-    }
-
-    /* Must we add an additional seperator */
-    $add_sep = false;
-   
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-
-    /* Add base selection */
-    $listhead .= _("Base")."&nbsp; <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
-      " <input class='center' type='image' src='images/list_submit.png' align='middle'
-      title='"._("Submit department")."' name='submit_department' alt='".           _("Submit")."'>&nbsp;";
-
-    /* Handle create icons */ 
-    $s = ".|"._("Actions")."|\n";
-    $s.= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"terminal/termgeneric"))){
-      $s.= "...|<img src='images/select_terminal.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Terminal")."|"."newsystem_terminal|\n";
-    }
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"workstation/workgeneric"))){
-      $s.= "...|<img src='images/select_workstation.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Workstation")."|"."newsystem_workstation|\n";
-    }
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"workstation/workgeneric"))){
-      $s.= "...|<img src='images/select_server.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Server")."|"."newsystem_server|\n";
-    }
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"phone/phoneGeneric"))){
-      $s.= "...|<img src='images/select_phone.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Phone")."|"."newsystem_phone|\n";
-    }
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"printer/printgeneric"))){
-      $s.= "...|<img src='images/select_printer.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Printer")."|"."newsystem_printer|\n";
-    }
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"component/componentGeneric"))){
-      $s.= "...|<img src='images/select_component.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Component")."|"."newsystem_component|\n";
-    }
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-    }
-
-    /* Get copy & paste icon */
-    $Copy_Paste ="";
-    if(preg_match("/(c.*w|w.*c)/",$all_module_acls) &&  $this->parent->CopyPasteHandler){
-      $s .= "..|---|\n";
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$all_module_acls)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-    $this->SetListHeader($listhead);
-  }
-
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-  function setEntries($terminals)
-  {
-    $img1  = "<img class='center' src='images/printer.png'            alt='C' title='"._("Cups Server")  ."'>";
-    $img2  = "<img class='center' src='images/scanner.png'            alt='L' title='"._("Log Db") ."'>";
-    $img3  = "<img class='center' src='images/select_terminal.png'    alt='L' title='"._("Syslog Server") ."'>";
-    $img4  = "<img class='center' src='images/mailto.png'             alt='M' title='"._("Mail Server")  ."'>";
-    $img5  = "<img class='center' src='images/select_phone.png'       alt='I' title='"._("Imap Server") ."'>";
-    $img6  = "<img class='center' src='images/fax_small.png'          alt='F' title='"._("Nfs Server")   ."'>";
-    $img7  = "<img class='center' src='images/select_winstation.png'  alt='K' title='"._("Kerberos Server") ."'>";
-    $img8  = "<img class='center' src='images/select_phone.png'       alt='A' title='"._("Asterisk Server") ."'>";
-    $img9  = "<img class='center' src='images/fax_small.png'          alt='F' title='"._("Fax Server") ."'>";
-    $img10 = "<img class='center' src='images/save.png'               alt='L' title='"._("Ldap Server") ."'>";
-
-    $empty    ="<img src='images/empty.png' style='width:16px ; height: 16px;' class='center' alt=''>";
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 110;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    // User and Template  Images
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-
-    /* ACL mapping */
-    $ui = get_userinfo();
-    $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
-          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
-          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
-          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
-          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
-          "incoming"    => array("CLASS"=>"",             "TABCLASS" =>"",              "ACL"=> "incoming/systems"),
-          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
-
-
-    $cnts = array("component" => 0 , "terminal" => 0 , "workstation" => 0 , 
-                  "printer" => 0 , "phone" => 0 , "server" => 0,
-                  "NewDevice" => 0, "winstation"=> 0);
-
-    // Test Every Entry and generate divlist Array
-    foreach($terminals as $key => $val){
-
-      /* Get system type, it is used to fetch the acls for the current object.
-          "winstation" acls are stored as 2winworkstation", so we have to map this here */
-      $type     = $this->parent->get_system_type($val);
-      if($type == "winstation") {
-        $acl_type = "winworkstation";
-      }else{
-        $acl_type = $type;
-      }
-
-      /* Map NewDevice acls to workstation acls */
-      if($type == "NewDevice" || $type == "ArpNewDevice"){
-        $type     = "incoming";
-        $acl_type = "incoming";
-      }
-
-      /* Get complete category acls */
-      $acl_all  = $ui->has_complete_category_acls($val['dn'],$acl_type) ;
-  
-      /* Get specific generic acls */
-      $acl      = $ui->get_permissions($val['dn'],$tabs[$type]['ACL']);
-
-      $action ="";
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $action.= "<input class='center' type='image'
-          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        $action.= "<input class='center' type='image'
-          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-      }
-      $action.= "<input class='center' type='image' src='images/edit.png' 
-                    alt='"._("edit")."'     name='system_edit_%KEY%' title='"._("Edit system")."'>";
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $action.= $this->GetSnapShotActions($val['dn']);
-      }else{
-        $action.= $empty."&nbsp;".$empty."&nbsp;";
-      }
-
-
-      if(preg_match("/d/",$acl)){
-        $action.= "<input class='center' type='image' src='images/edittrash.png' 
-          alt='"._("delete")."'   name='system_del_%KEY%' title='"._("Delete system")."'>";
-      }else{
-        $action.= $empty;    
-      }
-
-      /* Generate picture list, which is currently disabled */
-      if(in_array("goCupsServer"    ,$val['objectClass'])) $cups    = $img1;   else $cups  =$empty;
-      if(in_array("goLogDBServer"   ,$val['objectClass'])) $logdb   = $img2;   else $logdb =$empty;
-      if(in_array("goSyslogServer"  ,$val['objectClass'])) $syslog  = $img3;   else $syslog=$empty;
-      if(in_array("goImapServer"    ,$val['objectClass'])) $imap    = $img4;   else $imap  =$empty;
-      if(in_array("sambaSamAccount" ,$val['objectClass'])) $samba   = $img5;   else $samba =$empty;
-      if(in_array("goShareServer"   ,$val['objectClass'])) $nfs     = $img6;   else $nfs   =$empty;
-      if(in_array("goKrbServer"     ,$val['objectClass'])) $krb     = $img7;   else $krb   =$empty;
-      if(in_array("goFonServer"     ,$val['objectClass'])) $fon     = $img8;   else $fon   =$empty;
-      if(in_array("goFaxServer"     ,$val['objectClass'])) $fax     = $img9;   else $fax   =$empty;
-      if(in_array("goLdapServer"    ,$val['objectClass'])) $ldap     = $img10;   else $ldap   =$empty;
-
-      $pics = $cups.$logdb.$syslog.$imap.$samba.$nfs.$krb.$fon.$fax.$ldap;
-      $pics = ""; // Pictures currently hidden
-
-      $val['cn'][0]= preg_replace('/\$$/', '', $val['cn'][0]);
-
-      // Generate Array to Add
-      $dsc= "";
-      if (isset($val['description'][0])){
-        $dsc= " [".$val['description'][0]."]";
-      }
-      if((isset($val['is_new']))&&(!empty($val['is_new']))){
-        $display= $val["cn"][0]." ".$val['is_new'].$dsc;
-      }else{
-        $display= $val["cn"][0].$dsc;
-      }
-
-     
-      /* Check if this is a terminal/workstation && if we are allowed to change the gotoRootPasswd */
-      $pwd_acl =""; 
-      if(in_array("gotoWorkstation",$val['objectClass'])){
-        $pwd_acl = $ui->get_permissions($val['dn'],"workstation/workgeneric","gotoRootPasswd");
-      }    
-      if(in_array("gotoTerminal",$val['objectClass'])){
-        $pwd_acl = $ui->get_permissions($val['dn'],"terminal/termgeneric","gotoRootPasswd");
-      }    
-      if(preg_match("/w/",$pwd_acl)){
-        $action2 = "<input class='center' type='image' src='images/certs.png' alt='"._("Password")."'   name='system_setpwd_%KEY%' title='"._("Set root password")."'>";
-      }else{
-        $action2 = $empty;
-      }
-
-
-      if(in_array("gotoWorkstation",$val['objectClass'])){
-        $action2= "<input class='center' type='image' src='images/cdrom.png' alt='"._("Create CD")."'   
-                      name='gen_cd_%KEY%' title='"._("Create FAI CD")."'>&nbsp;".$action2;
-      }else{
-        $action2= $empty.$action2;
-      }
-
-      if(isset($val['message'])){
-        $display.= "  (".$val['message'].")";
-      }
-
-      $img    = $this->parent->convert_list($val);
-
-      /* Cutted objects should be displayed in light grey */
-      if($this->parent->CopyPasteHandler){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $val['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-
-      $type = $this->parent->get_system_type($val);
-      if($type == "ArpNewDevice"){
-        $type = "NewDevice";
-      }
-      $cnts[$type] ++;
-
-
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                      "attach" => "style='width:20px;'");
-
-      $field1 = array("string" => sprintf($img['img'],$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
-      $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
-      $this->AddElement( array($field0,$field1,$field2,$field3));
-    }
-
-    /* Create summary string for list footer */
-    $num_deps=0;
-    if(!$this->SubSearch){
-      $num_deps = count($this->Added_Departments);
-    }
-
-    $num_ser_str = _("Number of listed servers");
-    $num_ws_str  = _("Number of listed workstations");
-    $num_ter_str = _("Number of listed terminals");
-    $num_pho_str = _("Number of listed phones");
-    $num_prt_str = _("Number of listed printers");
-    $num_com_str = _("Number of listed network components");
-    $num_new_str = _("Number of listed new devices");
-    $num_wws_str = _("Number of listed windows workstations");
-    $num_dep_str = _("Number of listed departments");
-
-    $str = "<img class='center' src='images/select_server.png'
-      title='".$num_ser_str."' alt='".$num_ser_str."'>&nbsp;".$cnts['server']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/select_workstation.png'
-      title='".$num_ws_str."' alt='".$num_ws_str."'>&nbsp;".$cnts['workstation']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/select_terminal.png'
-      title='".$num_ter_str."' alt='".$num_ter_str."'>&nbsp;".$cnts['terminal']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/select_phone.png'
-      title='".$num_pho_str."' alt='".$num_pho_str."'>&nbsp;".$cnts['phone']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/select_printer.png'
-      title='".$num_prt_str."' alt='".$num_prt_str."'>&nbsp;".$cnts['printer']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/select_component.png'
-      title='".$num_com_str."' alt='".$num_com_str."'>&nbsp;".$cnts['component']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/select_newsystem.png'
-      title='".$num_new_str."' alt='".$num_new_str."'>&nbsp;".$cnts['NewDevice']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/select_winstation.png'
-      title='".$num_wws_str."' alt='".$num_wws_str."'>&nbsp;".$cnts['winstation']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/folder.png'
-      title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-
-    $this->set_List_Bottom_Info($str);
-  }
-
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-  }
-
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow :: save_object();  
-
-
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/class_divListSystemService.inc b/gosa-core/plugins/admin/systems/class_divListSystemService.inc
deleted file mode 100644 (file)
index ca31601..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-<?php
-
-class divListSystemService extends MultiSelectWindow
-{
-  /* CheckBoxes, to change default values modify $this->AddCheckBox */
-  var $parent             ;
-  var $ui                 ;
-
-  function divListSystemService ($config,$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config,"SystemService", "server");
-    
-    $this->parent       = $parent;
-    $this->ui           = get_userinfo();
-    $this->EnableJSLeaveMsg(TRUE);
-
-    /* Set list strings */
-    $this->SetTitle(_("Installed services"));
-    $this->SetSummary(_("Installed services"));
-
-    /* Result page will look like a headpage */
-    $this->SetInformation(_("This menu allows you to add, remove and configure the properties of a specific service."));
-
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* set Page header */
-    $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>_("Service name")));
-    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:100px;border-right:0px;'"));
-    $this->HideFilterPart();
-  }
-
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $listhead = "<div style='background:#F0F0F9;height:16px;padding:0px;'>".
-    " <input type='image' align='middle' src='images/select_new_server.png' class='center' 
-        name='addNewService' alt='"._("Add service")."' title='"._("Add new service")."'>&nbsp;".
-    " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-    " <input type='image' align='middle' src='images/status_start_all.png' class='center'
-        name='startServices' alt='"._("Start all")."' title='"._("Start all services")."'>&nbsp;".
-    " <input type='image' align='middle' src='images/status_stop_all.png'  class='center'   
-        name='stopServices' alt='"._("Stop service")."' title='"._("Stop all services")."'>&nbsp;".
-    " <input type='image' align='middle' src='images/status_restart_all.png'    class='center'
-        name='restartServices' alt='"._("Restart service")."' title='"._("Restart all services")."'>&nbsp;".
-    "</div>";
-    $this->SetListHeader($listhead);
-  }
-
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-  function setEntries($list)
-  {
-    $tmp = array();
-    foreach($list as $name => $entry){
-      $tmp[$name] = $entry['Message']; 
-    }
-
-    natcasesort($tmp);
-    $tmp2 = array();
-    foreach($tmp as $name => $value){
-      $tmp2[$name] = $list[$name];
-    }
-
-    $ui = get_userinfo();
-
-    foreach($tmp2 as $name => $entry){
-      switch($entry['Status']){
-        case ''      : $str ="&nbsp;";break;
-        case SERVICE_STOPPED  : $str ="<img src='images/status_stopped.png' title='"._("Stopped")."'>"; break;
-        case SERVICE_STARTED  : $str ="<img src='images/status_running.png' title='"._("Started")."'>"; break;
-        case SERVICE_RESTARTED : $str ="<img src='images/status_restarting.png' title='"._("Restarting")."' alt='R'>"; break;
-        default: $str= "<img src='images/select_user.png' alt='".$entry['Status']."' title='"._("User status")." : ".$entry['Status']."'>";
-      }
-
-      /* Get acls */
-      $acl = $ui->get_permissions($this->parent->dn,"server/".$name);
-      if(preg_match("/w/i",$acl) && !preg_match("/r/i",$acl)){
-        continue;
-      }
-  
-      $WasAccount = $this->parent->plugins[$name] -> initially_was_account;    
-  
-      $plug = $_GET['plug'];
-      $link = "<a href='?plug=".$plug."&amp;act=open&amp;id=".$name."'>".$entry['Message']."</a>";
-
-      $field1 = array("string" => $str ,"attach" => "style='width:20px;'");
-      $field2 = array("string" => $link);
-
-      $actions ="";
-      if($entry['AllowStart'] && $WasAccount){
-        $actions .= "&nbsp;<input type='image' name='StartSingleService_".$name."' src='images/status_start.png'
-                            title='"._("Start service")."'>";
-      }else{
-        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
-      }
-      if($entry['AllowStart'] && $WasAccount){
-        $actions .= "&nbsp;<input type='image' name='StopSingleService_".$name."' src='images/status_stop.png'
-                            title='"._("Stop service")."'>";
-      }else{
-        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
-      }
-      if($entry['AllowStart'] && $WasAccount){
-        $actions .= "&nbsp;<input type='image' name='RestartSingleService_".$name."' src='images/status_restart.png'
-                            title='"._("Restart service")."'>";
-      }else{
-        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
-      }
-
-      /* Check if edit is enabled and allowed for current service */
-      if($entry['AllowEdit'] && preg_match("/(r|w)/i",$acl)){
-        $actions .= "&nbsp;<input type='image' name='EditSingleService_".$name."' src='images/edit.png'
-                            title='"._("Edit service")."'>";
-      }else{
-        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
-      }
-
-      /* Check if remove is enabled and allowed for current service */
-      if($entry['AllowRemove'] && preg_match("/d/i",$acl)){
-        $actions .= "&nbsp;<input type='image' name='RemoveSingleService_".$name."' src='images/edittrash.png'
-                            title='"._("Remove service")."'>";
-      }else{
-        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
-      }
-
-      $field3 = array("string" => $actions ,"attach" => "style='width:100px;border-right:0px;'");
-      $this->AddElement(array($field1,$field2,$field3));
-    }
-  }
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow :: save_object();   
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/class_servGeneric.inc b/gosa-core/plugins/admin/systems/class_servGeneric.inc
deleted file mode 100644 (file)
index 91eec68..0000000
+++ /dev/null
@@ -1,444 +0,0 @@
-<?php
-
-class servgeneric extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage server base objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Generic terminal attributes */
-  var $ignore_account= TRUE;
-  var $interfaces= array();
-
-  /* Needed values and lists */
-  var $base= "";
-  var $cn= "";
-  var $l= "";
-  var $description= "";
-  var $orig_dn= "";
-  var $didAction= FALSE;
-
-  /* attribute list for save action */
-  var $attributes= array("cn", "description","gotoMode");
-  var $objectclasses= array("top", "GOhard", "goServer");
-
-  var $gotoMode= "locked";
-
-  var $netConfigDNS;
-  var $modes = array();
-  var $ui   ;
-  var $mapActions   = array("reboot"          => "",
-                            "instant_update"  => "softupdate",
-                            "localboot"       => "localboot",
-                            "update"          => "sceduledupdate",
-                            "reinstall"       => "install",
-                            "rescan"          => "",
-                            "memcheck"        => "memcheck",
-                            "sysinfo"         => "sysinfo");
-
-  var $fai_activated  =FALSE;
-  var $view_logged = FALSE;
-
-  function servgeneric (&$config, $dn= NULL, $parent= NULL)
-  {
-    /* Check if FAI is activated */
-    $tmp = $config->search("faiManagement", "CLASS",array('menu','tabs'));
-    
-    if(!empty($tmp)){
-      $this->fai_activated = TRUE;
-    }
-
-    plugin::plugin ($config, $dn, $parent);
-
-    $this->ui = get_userinfo();
-    $this->modes["active"]= _("Activated");
-    $this->modes["locked"]= _("Locked");
-
-    /* Set base */
-    if ($this->dn == "new"){
-      $ui= get_userinfo();
-      $this->base= dn2base($ui->dn);
-      $this->cn= "";
-    } else {
-      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
-    }
-    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
-    $this->netConfigDNS->set_acl_category("server");
-    $this->netConfigDNS->set_acl_base($this->base);
-       
-    /* Save dn for later references */
-    $this->orig_dn= $this->dn;
-  }
-
-
-  function set_acl_base($base)
-  {
-    plugin::set_acl_base($base);
-    $this->netConfigDNS->set_acl_base($base);
-  }
-
-
-  function set_acl_category($cat)
-  {
-    plugin::set_acl_category($cat);
-    $this->netConfigDNS->set_acl_category($cat);
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    /* Do we represent a valid server? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
-        _("This 'dn' has no server features.")."</b>";
-      return($display);
-    }
-
-    /* Check for action */
-    if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate")){
-      $cmd = $this->config->search("workgeneric", "ACTIONCMD",array('tabs'));
-      if ($cmd == ""){
-        print_red(_("No ACTIONCMD definition found in your gosa.conf"));
-      } else {
-
-        exec ($cmd." ".$this->netConfigDNS->macAddress." ".escapeshellarg($_POST['saction']), $dummy, $retval);
-        if ($retval != 0){
-          print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
-        } else {
-          $this->didAction= TRUE;
-
-          /* Set FAIstate */
-          if($this->fai_activated && $this->dn != "new"){
-            $ldap = $this->config->get_ldap_link();
-            $ldap->cd($this->config->current['BASE']);
-            $ldap->cat($this->dn,array("objectClass"));
-            $res = $ldap->fetch();
-
-            $attrs = array();
-            $attrs['FAIstate'] = "";
-            if(isset($this->mapActions[$_POST['saction']])){
-              $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']];
-            }
-
-            for($i = 0; $i < $res['objectClass']['count'] ; $i ++){
-              $attrs['objectClass'][] = $res['objectClass'][$i];
-            }
-
-            if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
-              $attrs['objectClass'][] = "FAIobject";
-            }
-
-            if($attrs['FAIstate'] == ""){
-#FIXME we should check if FAIobject is used anymore
-              $attrs['FAIstate'] = array();
-            }
-
-            $ldap->cd($this->dn);
-            $ldap->modify($attrs);
-          }
-          show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/generic (FAIstate) with dn '%s' failed."),$this->dn)); 
-        }
-      }
-    }
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once ){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-  
-        /* Only accept allowed bases */
-        $tmp = $this->get_allowed_bases();
-        if($tmp[$this->dialog->isSelected()]){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    /* Assign base ACL */
-    $smarty->assign("bases"   , $this->get_allowed_bases());
-
-    /* Assign attributes */
-    foreach ($this->attributes as $attr){
-      $smarty->assign("$attr", $this->$attr);
-    }
-
-    $smarty->assign("staticAddress", "");
-    $smarty->assign("base_select", $this->base);
-
-    /* Assign status */
-    $query= "fping -q -r 1 -t 500 ".$this->cn;
-    exec ($query, $dummy, $retval);
-
-    /* Offline */
-    if ($retval == 0){
-      $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"),
-                                       "instant_update" => _("Instant update"),
-                                       "update" => _("Scheduled update"),
-                                       "reinstall" => _("Reinstall"),
-                                       "rescan" => _("Rescan hardware"),
-                                       "memcheck" => _("Memory test"),
-                                       "localboot" => _("Force localboot"),
-                                       "sysinfo"  => _("System analysis")));
-    } else {
-      $smarty->assign("actions", array("wake" => _("Wake up"),
-                                       "reinstall" => _("Reinstall"),
-                                       "update" => _("Scheduled update"),
-                                       "memcheck" => _("Memory test"),
-                                       "localboot" => _("Force localboot"),
-                                       "sysinfo"  => _("System analysis")));
-    }
-
-    /* Show main page */
-    $smarty->assign("fai_activated",$this->fai_activated);
-
-    $str = $this->netConfigDNS->execute();
-    if(is_object($this->netConfigDNS->dialog)){
-      return($str);
-    }
-    $smarty->assign("netconfig", $str);
-    $smarty->assign("modes", $this->modes);
-
-    return($smarty->fetch (get_template_path('server.tpl', TRUE)));
-  }
-
-  function remove_from_parent()
-  {
-    /* Cancel if there's nothing to do here */
-    if ((!$this->initially_was_account) || (!$this->acl_is_removeable())){
-      return;
-    }
-
-    $this->netConfigDNS->remove_from_parent();
-    $ldap= $this->config->get_ldap_link();
-    $ldap->rmdir($this->dn);
-
-    new log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of system server/generic with dn '%s' failed."),$this->dn)); 
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-    }
-    $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Save current base, to be able to revert to last base, 
-        if new base is invalid or not allowed to be selected */
-    $base_tmp = $this->base;
-    plugin::save_object();
-    $this->netConfigDNS->save_object();
-
-    /* Get base selection */
-    $tmp = $this->get_allowed_bases();
-    if(isset($_POST['base'])){
-      if($tmp[$_POST['base']]){
-        $this->base = $_POST['base'];
-      }else{
-        $this->base = $base_tmp;
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-    $message= array_merge($message, $this->netConfigDNS->check());
-    $this->dn= "cn=".$this->cn.",".get_ou('serverou').$this->base;
-
-    /* must: cn */
-    if ($this->cn == ""){
-      $message[]= _("The required field 'Server name' is not set.");
-    }
-    
-    /* Check if given name is a valid host/dns name */
-    if(!tests::is_dns_name($this->cn)){
-      $message[] = _("Please specify a valid name for this object.");
-    }
-
-    if ($this->orig_dn != $this->dn){
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd ($this->base);
-      $ldap->search ("(cn=".$this->cn.")", array("cn"));
-      if ($ldap->count() != 0){
-        while ($attrs= $ldap->fetch()){
-          if ($attrs['dn'] != $this->orig_dn){
-            if(!preg_match("/cn=dhcp,/",$attrs['dn']) && !preg_match("/,".get_ou('incomingou')."/",$attrs['dn']) && preg_match("/,".get_ou('serverou')."/",$attrs['dn'])){
-              $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
-              break;
-            }
-          }
-        }
-      }
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    /* Remove all empty values */
-    if ($this->orig_dn == 'new'){
-      $attrs= array();
-      foreach ($this->attrs as $key => $val){
-        if (is_array($val) && count($val) == 0){
-          continue;
-        }
-        $attrs[$key]= $val;
-      }
-      $this->attrs= $attrs;
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    if ($this->orig_dn == 'new'){
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $mode= "add";
-    } else {
-   
-      /* cn is not case sensitive for ldap, but for php it is!! */ 
-      if($this->config->current['DNMODE'] == "cn"){
-        if (strtolower($this->orig_dn) != (strtolower($this->dn))){
-          $this->recursive_move($this->orig_dn, $this->dn);
-          plugin::save();
-        }
-      }else{
-        if ($this->orig_dn != $this->dn){
-          $this->recursive_move($this->orig_dn, $this->dn);
-          plugin::save();
-        }
-      }
-  
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-      $mode= "modify";
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/generic with dn '%s' failed."),$this->dn)); 
-    $this->netConfigDNS->cn = $this->cn;
-    $this->netConfigDNS->save();
-
-    /* Optionally execute a command after we're done */
-    if(!$this->didAction){
-      $this->handle_post_events($mode,array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-    }
-  }
-
-
-  /* Display generic part for server copy & paste */
-  function getCopyDialog()
-  {
-    $vars = array("cn");
-
-    $smarty = get_smarty();
-    $smarty->assign("cn" ,$this->cn);
-    $smarty->assign("object","server");
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-  }
-
-  
-  function PrepareForCopyPaste($source)  
-  {
-    plugin::PrepareForCopyPaste($source);
-    if(isset($source['macAddress'][0])){
-      $this->netConfigDNS->macAddress = $source['macAddress'][0];
-    }
-    if(isset($source['ipHostNumber'][0])){
-      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
-    }
-
-  }
-  
-
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array( 
-          "plShortName"   => _("Generic"),
-          "plDescription" => _("Server generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 1,
-          "plSection"     => array("administration"),           
-          "plCategory"    => array("server" => array("description"  => _("Server"),
-                                                     "objectClass"  => "goServer")),
-          "plProvidedAcls"=> array(
-            "cn"           => _("Name"),
-            "description"  => _("Description"),
-            "gotoMode"     => _("Goto mode"),
-            "base"         => _("Base"),
-            "FAIstate"     => _("Action flag"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/class_serverService.inc b/gosa-core/plugins/admin/systems/class_serverService.inc
deleted file mode 100644 (file)
index 338052b..0000000
+++ /dev/null
@@ -1,442 +0,0 @@
-<?php
-
-define("START_SERVICE",1);
-define("STOP_SERVICE",2);
-define("RESTART_SERVICE",3);
-
-define("SERVICE_STOPPED",_("Stop"));
-define("SERVICE_STARTED",_("Start"));
-define("SERVICE_RESTARTED",_("Restart"));
-
-define("ALL_SERVICES",100);
-
-class ServerService extends plugin
-{
-  /* CLI vars */
-  var $cli_summary      = "Manage server services";
-  var $cli_description  = "Managing services by adding,removing and configuring services. Allows to start/stop used services.";
-  var $cli_parameters   = array("config"=>"Config object" , "dn"=>"Object dn");
-
-  /* attribute list for save action */
-  var $ignore_account   = TRUE;
-  var $attributes       = array();
-  var $objectclasses    = array();
-
-  var $divList          = NULL;
-
-  var $plugins          = array();
-  var $pluign_names     = array();
-
-  var $current          = "";
-  var $backup           = NULL;
-  var $acl              ;
-  var $cn;
-
-  function ServerService (&$config, $dn)
-  {
-    plugin::plugin($config);
-    $this->dn= $dn;
-    foreach ($config->data['TABS']['SERVERSERVICE'] as $plug){
-      $name= $plug['CLASS'];
-      $this->plugin_names[]= $name;
-      $this->plugins[$name]= new $name($config, $dn);
-      /* Capture all service objectClases, necessary for acl handling */ 
-      if(isset($this->plugins[$name]->objectclasses)){
-        foreach($this->plugins[$name]->objectclasses as $oc){
-          $this->objectclasses[] = $oc;
-        }
-      }
-    }
-    $this->divList = new divListSystemService($config,$this);
-       }
-
-  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);
-    }
-  }
-
-  function execute()
-  {
-    /* Variable initialisation */  
-    $s_action = "";
-    $s_entry  = "";
-
-    /* Walk through posts and check if there are some introductions for us */
-    $PossiblePosts = array("addNewService"  => "", 
-                           "startServices"  => "",
-                           "stopServices"   => "",
-                           "restartServices"  => "",
-                           "removeServices" => "",
-
-                           "StartSingleService"  => "/^StartSingleService_(.*)_[xy]$/",
-                           "StopSingleService"   => "/^StopSingleService_(.*)_[xy]$/",
-                           "RestartSingleService"  => "/^RestartSingleService_(.*)_[xy]$/",
-                           "RemoveSingleService" => "/^RemoveSingleService_(.*)_[xy]$/",
-                           "EditSingleService"   => "/^EditSingleService_(.*)_[xy]$/");
-
-  
-    $once = true;
-    foreach($_POST as $name => $value){
-      foreach($PossiblePosts as $pregCheck => $idPreg) {
-        if(preg_match("/^".$pregCheck."/",$name) && $once){
-          $once     = false;
-          $s_action = $pregCheck;
-          
-          if(!empty($idPreg)){
-            $s_entry = preg_replace($idPreg,"\\1",$name);
-          }
-        }
-      }
-    }
-
-
-    /* Handle state changes for services */
-    $map =  array(    "startServices"         => array("type" => START_SERVICE ,   "service" => ALL_SERVICES),
-                      "stopServices"          => array("type" => STOP_SERVICE  ,   "service" => ALL_SERVICES),
-                      "restartServices"       => array("type" => RESTART_SERVICE , "service" => ALL_SERVICES),                 
-                      "StartSingleService"    => array("type" => START_SERVICE ,   "service" => $s_entry),
-                      "StopSingleService"     => array("type" => STOP_SERVICE ,    "service" => $s_entry),
-                      "RestartSingleService"  => array("type" => RESTART_SERVICE , "service" => $s_entry));
-    if(isset($map[$s_action])){
-      $type     = $map[$s_action]['type'];
-      $service  = $map[$s_action]['service'];
-      $this->ServiceStatusUpdate($type,$service);
-    }
-
-    /* Handle actions linked via href */
-    if(isset($_GET['act']) && $_GET['act'] == "open" && isset($_GET['id'])){
-      $id = $_GET['id'];
-      if(isset($this->plugins[$id])){
-        $s_entry = $id;
-        $s_action = "EditSingleService";
-      } 
-    }
-
-    /* Open service add dialog */
-    if($s_action == "addNewService"){
-      $this->dialog = new ServiceAddDialog($this->config,$this->dn,$this);
-    }
-
-
-    /* Remove service */
-    if($s_action == "RemoveSingleService"){
-
-      /* Create resetted obj */
-      $new_obj = new $s_entry($this->config,$this->dn);
-      $new_obj -> set_acl_base($this->acl_base);
-      $new_obj -> set_acl_category(preg_replace("/\/$/","",$this->acl_category));
-      $tmp     = $new_obj->getListEntry();
-
-      if($tmp['AllowRemove']){
-
-        /* Check if we are allowed to remove this service
-         */
-        $str = $this->plugins[$s_entry]->allow_remove();
-
-        if(empty($str)){
-          $this->plugins[$s_entry] = $new_obj;
-          $this->plugins[$s_entry]->is_account = false;
-        }else{
-          print_red($str);
-        }
-      }
-    }
-
-
-    /* Edit a service and make a backup from all attributes, 
-       to be able to restore old values after aborting dialog */ 
-    if($s_action == "EditSingleService"){
-      $this->backup   = get_object_vars($this->plugins[$s_entry]);
-      $this->dialog   = $this->plugins[$s_entry];
-      $this->current  = $s_entry;
-    }
-
-   
-    /* Abort service add */
-    if(isset($_POST['CancelServiceAdd'])){
-      $this->dialog   = FALSE;
-      $this->backup   = NULL;
-      $this->current  = "";
-    }
-
-    /* Abort dialog 
-       Restore vars with values before editing */
-    if(isset($_POST['CancelService']) && !empty($this->current)){
-      if($this->backup == NULL){
-        $this->plugins[$this->current] = new $this->current($this->config,$this->dn);
-        $this->plugins[$this->current]-> set_acl_base($this->acl_base);
-        $this->plugins[$this->current]-> set_acl_category(preg_replace("/\/$/","",$this->acl_category));
-
-      }else{
-        foreach($this->backup as $name => $value){
-          $this->plugins[$this->current]->$name = $value;
-        }
-      }
-      $this->dialog   = FALSE;
-      $this->backup   = NULL;
-      $this->current  = ""; 
-    }
-  
-
-    /* Abort dialog */
-    if(isset($_POST['SaveService']) && is_object($this->dialog)){
-      $this->dialog->save_object();
-      $msgs = $this->dialog->check();
-      if(count($msgs)){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-        $this->plugins[$this->current] = $this->dialog;
-        $tmp  = get_object_vars($this->dialog);
-        foreach($tmp as $name => $value){
-          $this->plugins[$this->current]->$name = $value;
-        }
-        $this->current = "";
-        $this->dialog = FALSE;
-        $this->backup = NULL;
-      }
-    }
-
-
-    /* Abort dialog */
-    if((isset($_POST['SaveServiceAdd'])) && (!empty($_POST['ServiceName']))){
-      $serv = $_POST['ServiceName'];    
-      $this->plugins[$serv]->is_account = true;
-      $this->dialog  = $this->plugins[$serv];
-      $this->current = $serv;
-    }
-
-
-    /* There is currently a subdialog open, display this dialog */
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-
-
-    /* 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>");
-  }
-
-
-  /* Get all used services 
-      CLASSNAME => _($this->plugins[*]->DisplayName);   */
-  function getAllUsedServices()
-  {
-    $ret = array();
-    foreach($this->plugins as $name => $obj){
-      if($obj->is_account){
-        if(isset($obj->DisplayName)){
-          $ret[$name] = $obj->DisplayName;
-        }else{
-          $ret[$name] = $name;
-        }
-      }
-    }
-    return($ret);
-  }
-
-
-  /* Get all unused services 
-      CLASSNAME => _($this->plugins[*]->DisplayName);  */
-  function getAllUnusedServices()
-  {
-    $tmp = $this->getAllUsedServices();
-    $pool_of_ocs =array();
-    foreach($tmp as $name => $value){
-      if(isset($this->plugins[$name]->conflicts)){
-        $pool_of_ocs[]= get_class($this->plugins[$name]);
-      }
-    }
-   
-    $ret = array();
-    foreach($this->plugins as $name => $obj){
-
-      /* Skip all pluigns that will lead into conflicts */
-      $skip = false;
-      if(isset($obj->conflicts)){
-        foreach($obj->conflicts as $oc){
-          if(in_array_ics($oc,$pool_of_ocs)){
-            $skip = true;
-          }
-        }
-      }
-
-      /* Only show createable services */
-      if(!$obj->acl_is_createable()){
-        $skip = true;
-      }
-
-      if(!$skip){
-        if(isset($obj->DisplayName)){
-          $ret[$name] = $obj->DisplayName;
-        }else{
-          $ret[$name] = $name;
-        }
-      }
-    }
-    return($ret);
-  }
-  /* This function sets the status var for each used 
-     service && calls an external hook if specified in gosa.conf*/
-  function ServiceStatusUpdate($method , $service)
-  {
-    /* Skip if this is a new server */
-    if($this->dn == "new"){
-      print_red(_("Can't set status while this server is not saved."));
-      return;
-    }
-
-    $action = "";
-    if($method == START_SERVICE){
-      $action = SERVICE_STARTED;
-    }elseif($method== STOP_SERVICE){
-      $action = SERVICE_STOPPED;
-    }elseif($method == RESTART_SERVICE){
-      $action = SERVICE_RESTARTED;
-    }else{
-      print_red(sprintf(_("The specified method '%s' can't executed for services."),$action));
-      return;
-    }
-    
-    $caseVars = array("cn","dn");
-    if($service == ALL_SERVICES){
-      foreach($this->plugins as $name => $obj){
-        foreach($caseVars as $var){
-          if(isset($this->$var)){
-            $this->plugins[$name]->$var = $this->$var;  
-          }
-        }
-
-        /* check if services can be restarted */
-        $map =array(SERVICE_STARTED=> "AllowStart" ,
-                    SERVICE_STOPPED => "AllowStop",
-                    SERVICE_RESTARTED => "AllowRestart");
-
-        /* get plugins informations, restart/start/stop actions allowed ?*/
-        $tmp = $this->plugins[$name]->getListEntry();
-
-        /* Check if given action is allowed for this service */
-        if($tmp[$map[$action]]){
-          if($this->plugins[$name]->initially_was_account && $this->plugins[$name]->is_account){
-            $this->plugins[$name]->setStatus($action);
-          }
-        }
-      }
-    }else{
-      foreach($caseVars as $var){
-        if(isset($this->$var)){
-          $this->plugins[$service]->$var = $this->$var;  
-        }
-      }
-      if($this->plugins[$service]->is_account){
-        $this->plugins[$service]->setStatus($action);
-      }
-    }
-  }
-
-
-  function check()
-  {
-    $message = plugin::check();
-    return $message;
-  }
-
-
-  function save_object()
-  {
-    foreach($this->plugins as $name => $obj){
-      if($obj->is_account){
-        $this->plugins[$name]->save_object();
-      }
-    }
-  }
-
-
-  function remove_from_parent()
-  {
-    $caseVars = array("cn","dn");
-    foreach($this->plugins as $name => $obj){
-      foreach($caseVars as $var){
-        if(isset($this->$var)){
-          $this->plugins[$name]->$var = $this->$var;  
-        }
-      }
-      if($this->plugins[$name]->initially_was_account){
-        $this->plugins[$name]->remove_from_parent();
-      }
-    }
-  }
-
-
-  function save()
-  {
-    $caseVars = array("cn","dn");
-    foreach($this->plugins as $name => $obj){
-
-      foreach($caseVars as $var){
-        if(isset($this->$var)){
-          $this->plugins[$name]->$var = $this->$var;
-        }
-      }
-
-      if($this->plugins[$name]->is_account){
-        $this->plugins[$name]->save();
-      }else{
-        if($this->plugins[$name]->initially_was_account){
-          $this->plugins[$name]->remove_from_parent();
-        }
-      }
-    }
-  }
-
-  
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    foreach($this->plugins as $name => $plugin){
-      $this->plugins[$name]->PrepareForCopyPaste($source);
-    }
-  }
-
-
-  /* Check if all plugins allow a remove ..  */
-  function allow_remove()
-  {
-    foreach($this->plugins as $name => $obj){
-      $str = $obj->allow_remove();
-      if(!empty($str)){
-        return($str);
-      }
-    }
-  }
-  
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/class_systemManagement.inc b/gosa-core/plugins/admin/systems/class_systemManagement.inc
deleted file mode 100644 (file)
index 00f39f4..0000000
+++ /dev/null
@@ -1,1404 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003  Cajus Pollmeier
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-class systems extends plugin
-{
-  /* Definitions */
-  var $plHeadline     = "Systems";
-  var $plDescription  = "This does something";
-  var $departments    = array();
-
-  /* Dialog attributes */
-  var $systab   = NULL;
-  var $terminals= array();
-  var $ui       = NULL;
-  var $DivListSystem;
-  var $start_pasting_copied_objects = FALSE;
-  var $CopyPasteHandler   = NULL;
-
-  /* Arp hanlding activated */
-  var $arp_handling_active = FALSE;
-
-  function systems (&$config, $ui)
-  {
-    /* Save configuration for internal use */
-    $this->config= $config;
-    $this->ui= $ui;
-
-    /* Creat dialog object */
-    $this->DivListSystem = new divListSystem($this->config,$this);
-
-    /* Copy & Paste enabled ?*/
-    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
-      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
-    }
-
-    /* Check whether the arp handling active or not */
-    if($this->config->search("ArpNewDevice","CLASS",array('tabs')) != ""){
-      $this->arp_handling_active = TRUE;
-    }
-
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    session::set('LOCK_VARS_TO_USE',array("/^system_edit_/i","/^system_del_/","/^act/","/^id/","/^item_selected/","/^remove_multiple_systems/"));
-
-    /********************
-      Check for functional posts, edit|delete|add|... system devices 
-     ********************/
-    $s_action     = "";                       // Contains the action to proceed
-    $s_entry      = "";                       // The value for s_action
-    $base_back    = "";                       // The Link for Backbutton
-    $smarty       = get_smarty();
-
-    /* Test Posts */
-    foreach($_POST as $key => $val){
-      // Post for delete
-      if(preg_match("/system_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/system_del_/i","",$key);
-        // Post for edit
-      }elseif(preg_match("/system_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/system_edit_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/system_new.*/",$key)){
-        $s_action="new";
-      }elseif(preg_match("/system_tplnew.*/i",$key)){
-        $s_action="new_tpl";
-      }elseif(preg_match("/system_setpwd_.*/i",$key)){
-        $s_action="change_pw";
-        $s_entry  = preg_replace("/system_setpwd_/i","",$key);
-      }elseif(preg_match("/gen_cd_.*/i",$key)){
-        $s_action="gen_cd";
-        $s_entry  = preg_replace("/gen_cd_/i","",$key);
-      }elseif(preg_match("/^copy_.*/",$key)){
-        $s_action="copy";
-        $s_entry  = preg_replace("/^copy_/i","",$key);
-      }elseif(preg_match("/^cut_.*/",$key)){
-        $s_action="cut";
-        $s_entry  = preg_replace("/^cut_/i","",$key);
-      }
-    }
-   
-    /* Incoming handling  
-     * If someone made a systemtype and ogroup selection 
-     * Display the new requested entry type ... servtab  in case of server and so on.
-     */
-    if(isset($_POST['SystemTypeChoosen'])){
-      $SelectedSystemType = session::get('SelectedSystemType');
-      $s_action = "SelectedSystemType";
-      $s_entry  = $_POST['SystemType'];
-      $SelectedSystemType['ogroup'] = $_POST['ObjectGroup'];
-      $this->systab = NULL;
-      session::set('SelectedSystemType',$SelectedSystemType);
-    }
-
-    /* remove image tags from posted entry  (posts looks like this 'name_x')*/
-    $s_entry  = preg_replace("/_.$/","",$s_entry);
-
-    /* Edit was requested by pressing the name(link) of an item */
-    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
-      $s_action ="edit";
-      $s_entry  = $_GET['id'];
-    }
-    /* Create options */
-    if(isset($_POST['menu_action']) && preg_match("/^newsystem_/",$_POST['menu_action'])){
-      $s_action = "newsystem";
-      $s_entry  = preg_replace("/^newsystem_/","",$_POST['menu_action']);
-    }
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-    
-
-    /* Check for exeeded sizelimit */
-    if (($message= check_sizelimit()) != ""){
-      return($message);
-    }
-
-    /* Try to get informations about what kind of system to create */
-    if ($s_action=="new") {
-      return ($smarty->fetch(get_template_path('chooser.tpl', TRUE)));
-    }
-
-
-    /********************
-      Copy & Paste Handling  ...
-     ********************/
-
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-  
-
-    /********************
-      Create FAI CD ...   
-     ********************/
-    if ($s_action=="gen_cd"){
-      $this->dn= $this->terminals[$s_entry]['dn'];
-      session::set('objectinfo',$this->dn);
-      return ($smarty->fetch(get_template_path('gencd.tpl', TRUE)));
-    }
-
-
-    /* Start CD-Creation */
-    if ((isset($_POST["cd_create"])) && !empty($this->dn)){
-      $smarty->assign("src", "?plug=".$_GET['plug']."&amp;PerformIsoCreation");
-      return ($smarty->fetch(get_template_path('gencd_frame.tpl', TRUE)));
-    }
-
-
-    if ($this->dn != "" && isset($_GET['PerformIsoCreation'])){
-
-      $return_button   = "<form method='get' action='main.php' target='_parent'>
-        <input type='submit' value='"._("Back")."'>
-        <input type='hidden' name='plug' value='".$_GET['plug']."'/>
-        </form>";
-
-      $dsc             = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
-
-      /* Get and check command */
-      $command= $this->config->search("workgeneric", "ISOCMD",array('tabs'));
-      
-      if (check_command($command)){
-        @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
-
-        /* Print out html introduction */
-        echo '  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-          <html>
-          <head>
-          <title></title>
-          <style type="text/css">@import url("themes/default/style.css");</style>
-          <script language="javascript" src="include/focus.js" type="text/javascript"></script>
-          </head>
-          <body style="background: none; margin:4px;" id="body" >
-          <pre>';
-
-        /* Open process handle and check if it is a valid process */
-        $process= proc_open($command." '".$this->dn."'", $dsc, $pipes);
-        if (is_resource($process)) {
-          fclose($pipes[0]);
-
-          /* Print out returned lines && write JS to scroll down each line */
-          while (!feof($pipes[1])){
-            $cur_dat = fgets($pipes[1], 1024);
-            echo $cur_dat;
-            echo '<script language="javascript" type="text/javascript">scrollDown2();</script>' ;
-            flush();
-          }
-        }
-
-        /* Get error string && close streams */
-        $buffer= stream_get_contents($pipes[2]);
-
-        fclose($pipes[1]);
-        fclose($pipes[2]);
-        echo "</pre>";
-
-        /* Check return code */
-        $ret= proc_close($process);
-        if ($ret != 0){
-          echo "<h1 style='color:red'>"._("Creating the image failed. Please see the report below.")."</h1>";
-          echo "<pre style='color:red'>$buffer</pre>";
-        }
-
-
-
-        echo $return_button."<br>";
-
-      } else {
-        $tmp= "<h1 style='color:red'>".sprintf(_("Command '%s', specified for ISO creation doesn't seem to exist."), $command)."</h1>";
-        echo $tmp;
-      }
-
-      /* Scroll down completly */
-      echo '<script language="javascript" type="text/javascript">scrollDown2();</script>' ;
-      echo '</body></html>';
-      flush();
-      exit;
-    }
-
-
-    /********************
-      Create new system ...   
-     ********************/
-    /* Create new default terminal 
-     * Or create specified object of selected system type, from given incoming object  
-     */
-
-    $save_object_directly = false;
-    if(($s_action == "SelectedSystemType") && (isset($_POST['ObjectGroup']) && ($_POST['ObjectGroup'] != "none"))){
-      $save_object_directly = true;
-    }
-
-    if (isset($_POST['create_system'])||$s_action=="newsystem"||$s_action == "SelectedSystemType") {
-
-      /* If the current entry is an incoming object 
-       * $sw = System type as posted in new incoming handling dialog 
-       */ 
-      if($s_action == "SelectedSystemType") {
-        $sw         = $s_entry;
-      }else{
-        if(isset($_POST['system'])){
-          $sw = $_POST['system'];
-        }else{
-          $sw = $s_entry;
-        }
-        $this->dn= "new";
-      }
-
-      $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABNAME"=>"termgeneric",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABNAME"=>"workgeneric",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"),
-          "server"      => array("CLASS"=>"SERVTABS",     "TABNAME"=>"servgeneric",     "TABCLASS" =>"servtabs",      "ACL"=> "server"),
-          "printer"     => array("CLASS"=>"PRINTTABS",    "TABNAME"=>"printgeneric",    "TABCLASS" =>"printtabs",     "ACL"=> "printer"),
-          "phone"       => array("CLASS"=>"PHONETABS",    "TABNAME"=>"phoneGeneric",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone"),
-          "component"   => array("CLASS"=>"COMPONENTTABS","TABNAME"=>"componentGeneric","TABCLASS" =>"componenttabs", "ACL"=> "component"));
-
-      if(isset($tabs[$sw])){
-        $class    = $tabs[$sw]["CLASS"];
-        $tabname  = $tabs[$sw]["TABNAME"];
-        $tabclass = $tabs[$sw]["TABCLASS"];
-        $acl_cat  = $tabs[$sw]["ACL"];
-
-        /* Load permissions for selected 'dn' and check if
-           we're allowed to remove this 'dn' */
-        $ui       = get_userinfo();
-        $tabacl   = $ui->get_permissions($this->DivListSystem->selectedBase,$acl_cat."/".$tabname);
-        if(preg_match("/c/",$tabacl)){
-          $this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn,$sw);
-          $this->systab->set_acl_base($this->DivListSystem->selectedBase);
-          $this->systab->by_object[$tabname]->base = $this->DivListSystem->selectedBase;
-          $this->systab->base = $this->DivListSystem->selectedBase;
-        }else{
-          print_red(_("You are not allowed to create a new object of this type."));
-        }
-      }
-    }
-
-    /********************
-      Edit system ...   
-     ********************/
-
-    /* User wants to edit data? */
-    if (($s_action == "edit") && (!isset($this->systab->config))){
-
-      $this->dn= $this->terminals[$s_entry]['dn'];
-
-      /* Check locking, save current plugin in 'back_plugin', so
-         the dialog knows where to return. */
-      if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($user, $this->dn));
-      }
-
-      /* Find out more about the object type */
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cat($this->dn, array('objectClass','gotoMode'));
-      $attrs= $ldap->fetch();
-      $type= $this->get_system_type($attrs);
-
-      /* Lock the current entry, so everyone will get the
-         above dialog */
-      $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"),
-          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server"),
-          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer"),
-          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone"),
-          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation"),
-          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component"));
-
-
-      if($type == "ArpNewDevice"){
-        $this->systab = new ArpNewDeviceTabs($this->config,$this->config->data['TABS']['ARPNEWDEVICETABS'],$this->dn);
-      }elseif($type == "NewDevice"){
-        $this->systab = new SelectDeviceType($this->config,$this->dn) ;
-      }elseif(isset($tabs[$type])){
-
-        $class    = $tabs[$type]["CLASS"];
-        $acl_cat  = $tabs[$type]["ACL"];
-        $tabclass = $tabs[$type]["TABCLASS"];
-
-        $this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn,$acl_cat);
-        $this->systab->set_acl_base($this->dn);
-        session::set('objectinfo',$this->dn);
-        add_lock ($this->dn, $this->ui->dn);
-      }else{ 
-        print_red (_("You can't edit this object type yet!"));
-        del_lock($this->dn);
-      }
-    }
-
-
-    /********************
-      Change password ...   
-     ********************/
-
-    /* Set terminals root password */
-    if ($s_action=="change_pw"){
-      $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABNAME"=>"termgeneric",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABNAME"=>"workgeneric",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"));
-
-      $type = $this->get_system_type($this->terminals[$s_entry]);
-      $class    = $tabs[$type]["CLASS"];
-      $tabname  = $tabs[$type]["TABNAME"];
-      $acl_cat  = $tabs[$type]["ACL"];
-      $tabclass = $tabs[$type]["TABCLASS"];
-      $ui       = get_userinfo();
-      $tabacl   = $ui->get_permissions($this->DivListSystem->selectedBase,$acl_cat."/".$tabname,"gotoRootPasswd");
-      if(preg_match("/w/",$tabacl)){
-        $this->dn= $this->terminals[$s_entry]['dn'];
-        session::set('objectinfo',$this->dn);
-        return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
-      }else{
-        print_red(_("You are not allowed to change the password for this object."));
-      }
-    }
-
-
-    /********************
-      Password change finish, but check if entered data is ok 
-     ********************/
-
-    /* Correctly specified? */
-    if (isset($_POST['password_finish'])){
-      if ($_POST['new_password'] != $_POST['repeated_password']){
-        print_red (_("Passwords entered as new and repeated do not match!"));
-        return($smarty->fetch(get_template_path('password.tpl', TRUE)));
-      }
-    }
-
-    /********************
-      Password change finish
-     ********************/
-
-    /* Change terminal password */
-    if (isset($_POST['password_finish']) && 
-        $_POST['new_password'] == $_POST['repeated_password']){
-
-      /* Check if user is allowed to set password */
-      $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABNAME"=>"termgeneric",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABNAME"=>"workgeneric",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"));
-
-      /* Detect object type */
-      $type = "";
-      foreach($this->terminals as $terminal){
-        if($terminal['dn'] == $this->dn){
-          $type = $this->get_system_type($terminal);
-          break;
-        } 
-      }
-
-      /* Type detected */
-      if(!empty($type)){
-
-        /* Get infos */
-        $class    = $tabs[$type]["CLASS"];
-        $tabname  = $tabs[$type]["TABNAME"];
-        $acl_cat  = $tabs[$type]["ACL"];
-        $tabclass = $tabs[$type]["TABCLASS"];
-    
-        /* Get acls */
-        $ui       = get_userinfo();
-        $tabacl   = $ui->get_permissions($this->DivListSystem->selectedBase,$acl_cat."/".$tabname,"gotoRootPasswd");
-
-        /* Check acls */
-        if(preg_match("/w/",$tabacl)){
-          $ldap = $this->config->get_ldap_link();
-          $ldap->cd($this->dn);
-
-          $attrs= array();
-          if ($_POST['new_password'] == ""){
-            $attrs['gotoRootPasswd']= array();
-          } else {
-            $attrs['gotoRootPasswd']= crypt($_POST['new_password'],substr(session_id(),0,2));
-          }
-          $ldap->modify($attrs);
-          new log("security","systems/".get_class($this),$this->dn,array_keys($attrs),$ldap->get_error());
-        }else{
-          print_red(_("You are not allowed to change the password for this object."));
-        }
-      }else{
-        print_red(_("Can't detect object to change password."));
-      }
-      session::un_set('objectinfo');
-    }
-
-
-    /********************
-      Delete system cancel
-     ********************/
-
-    /* Delete terminal canceled? */
-    if (isset($_POST['delete_cancel']) || isset($_POST['password_cancel'])){
-      del_lock ($this->dn);
-      session::un_set('objectinfo');
-    }
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-
-    if ($s_action=="del_multiple"){
-      $this->dns = array();
-      $ids = $this->list_get_selected_items();
-
-      if(count($ids)){
-
-        foreach($ids as $id){
-          $dn = $this->terminals[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        if (count($this->dns) == 1){
-          $smarty->assign("warning",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
-        } else {
-          $smarty->assign("warning",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
-        }
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. Users should be deleted. */
-    if (isset($_POST['delete_multiple_system_confirm'])){
-
-      $ui = get_userinfo();
-      $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
-          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
-          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
-          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
-          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
-          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
-
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-
-        /* Get 'dn' from posted termlinst */
-        $attrs    = $this->terminals[$key];
-        $type= $this->get_system_type($attrs);
-
-        /* get object type */
-        $tabtype  = "termtabs";
-        $tabobj   = "TERMTABS";
-        $tabacl   = "";
-        if(isset($tabs[$type])){
-          $tabtype = $tabs[$type]['TABCLASS'];
-          $tabobj  = $tabs[$type]['CLASS'];
-          $tabacl  = $ui->get_permissions($dn,$tabs[$type]['ACL']);
-
-          /* Load permissions for selected 'dn' and check if
-             we're allowed to remove this 'dn' */
-          if(preg_match("/d/",$tabacl)){ 
-
-            /* Delete request is permitted, perform LDAP action */
-            if($tabtype=="phonetabs"){
-              $this->systab= new $tabtype($this->config, $this->config->data['TABS'][$tabobj], $dn,$type);
-              $this->systab->set_acl_base($dn);
-              $this->systab->by_object['phoneGeneric']->remove_from_parent ();
-            }else{
-              $this->systab= new $tabtype($this->config,$this->config->data['TABS'][$tabobj], $dn,$type);
-              $this->systab->set_acl_base($dn);
-              $this->systab->delete();
-            }
-            unset ($this->systab);
-            $this->systab= NULL;
-
-          } else {
-            /* Normally this shouldn't be reached, send some extra
-               logs to notify the administrator */
-            print_red (_("You are not allowed to delete this component!"));
-            new log("security","systems/".get_class($this),$dn,array(),"Tried to trick deletion.");
-          }
-          /* Remove lock file after successfull deletion */
-          del_lock ($dn);
-          unset($this->dns[$key]);
-        }
-      }
-    }
-
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
-
-    /* Remove lock */
-   if(isset($_POST['delete_multiple_system_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /********************
-      Delete system, confirm dialog
-     ********************/
-
-    /* Remove terminal was requested */
-    if ($s_action=="del"){
-
-      /* Get 'dn' from posted termlinst */
-      $this->dn = $this->terminals[$s_entry]['dn'];
-      $attrs    = $this->terminals[$s_entry];
-
-      $type= $this->get_system_type($attrs);
-      $ui = get_userinfo();
-      $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
-          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
-          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
-          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
-          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
-          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
-
-
-      /* get object type */
-      $tabtype  = "termtabs";
-      $tabobj   = "TERMTABS";
-      $tabacl   = "";
-      if(isset($tabs[$type])){
-        $tabtype = $tabs[$type]['TABCLASS'];
-        $tabobj  = $tabs[$type]['CLASS'];
-        $tabacl  = $ui->get_permissions($this->dn,$tabs[$type]['ACL']);
-      }
-
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-      if(preg_match("/d/",$tabacl)){ 
-
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($user= get_lock($this->dn)) != ""){
-          return(gen_locked_message ($user, $this->dn));
-        }
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty->assign("warning", sprintf(_("You're about to delete all information about the component at '%s'."), @LDAP::fix($this->dn)));
-        $smarty->assign("multiple", false);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      } else {
-
-        /* Obviously the user isn't allowed to delete. Show message and
-           clean session. */
-        print_red (_("You are not allowed to delete this component!"));
-      }
-    }
-
-
-    /********************
-      Delete system, confirmed
-     ********************/
-    /* Confirmation for deletion has been passed. Terminal should be deleted. */
-    if (isset($_POST['delete_terminal_confirm'])){
-
-      /* Find out more about the object type */
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cat($this->dn, array('objectClass'));
-      $attrs= $ldap->fetch();
-      $type= $this->get_system_type($attrs);
-
-      $ui = get_userinfo();
-
-      $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
-          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
-          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
-          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
-          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
-          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
-
-      /* get object type */
-      $tabtype  = "termtabs";
-      $tabobj   = "TERMTABS";
-      $tabacl   = "";
-      if(isset($tabs[$type])){
-        $tabtype = $tabs[$type]['TABCLASS'];
-        $tabobj  = $tabs[$type]['CLASS'];
-        $tabacl  = $ui->get_permissions($this->dn,$tabs[$type]['ACL']);
-      }
-
-      /* Check if we are allowed to remove this object */
-      if(preg_match("/d/",$tabacl)){
-
-        /* Delete request is permitted, perform LDAP action */
-        if($tabtype=="phonetabs"){
-          $this->systab= new $tabtype($this->config, $this->config->data['TABS'][$tabobj], $this->dn,$type);
-          $this->systab->set_acl_base($this->dn);
-          $this->systab->by_object['phoneGeneric']->remove_from_parent ();
-        }else{  
-          $this->systab= new $tabtype($this->config,$this->config->data['TABS'][$tabobj], $this->dn,$type);
-          $this->systab->set_acl_base($this->dn);
-          $this->systab->delete();
-        }
-        unset ($this->systab);
-        $this->systab= NULL;
-
-        /* Terminal list has changed, reload it. */
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this component!"));
-        new log("security","systems/".get_class($this),$dn,array(),"Tried to trick deletion.");
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-    }
-
-
-
-
-
-
-
-
-
-   /********************
-      Edit system type finished, check if everything went ok
-     ********************/
-    /* Finish user edit is triggered by the tabulator dialog, so
-       the user wants to save edited data. Check and save at this
-       point. */
-    if ((isset($_POST['edit_finish'])) && (isset($this->systab->config)) || $save_object_directly){
-
-      /* Check tabs, will feed message array */
-      $message = array();
-      if(!$save_object_directly){
-        $message = $this->systab->check();
-      }else{
-        $found = false;
-
-        /* Set gotoMode to active if we there was an ogroup selected . (save_object_directly) */
-        foreach(array("workgeneric"=>"active","servgeneric"=>"active","termgeneric"=>"graphic") as $tab => $value){
-          if(isset($this->systab->by_object[$tab]->gotoMode)) {
-            $found = true;
-            $this->systab->by_object[$tab]->gotoMode = $value;
-          }
-        }
-        if(!$found){
-          print_red(sprintf(_("Can't set gotoMode to status 'active', the current object couldn't be identified.")));
-        }
-
-      }
-      /* Save, or display error message? */
-      if (count($message) == 0){
-
-        /* Incoming behavior; you can select a system type and an ogroup membership.
-         * If this object is an Incoming object, session::get('SelectedSystemType') isset.
-         * Check if we must add the new object to an object group.
-         *
-         * If this is done, delete the old incoming entry... it is still there, because this is a new
-         * entry and not an edited one, so we will delete it.
-         *
-         */
-
-        if(session::is_set('SelectedSystemType')){
-          $SelectedSystemType = session::get('SelectedSystemType');
-          if($SelectedSystemType['ogroup'] != "none"){
-            $og = new ogroup($this->config,$SelectedSystemType['ogroup']);
-            if($og){
-              $og->AddDelMembership($this->systab->dn);
-              $og->save();
-            }
-          }
-        }
-
-        /* Save terminal data to ldap */
-        $SelectedSystemType = session::get('SelectedSystemType');
-        if(isset($SelectedSystemType['ogroup']) && $SelectedSystemType['ogroup'] != 'none'){
-          foreach (array("workservice", "termservice") as $cls){
-            if (isset($this->systab->by_object[$cls])){
-              $this->systab->by_object[$cls]->gotoXMouseport= "";
-              $this->systab->by_object[$cls]->gotoXMouseType= "";
-              $this->systab->by_object[$cls]->gotoXResolution= "";
-              $this->systab->by_object[$cls]->gotoXColordepth= "";
-            }
-          }
-        }
-
-        $this->systab->save();
-
-        if(session::is_set('SelectedSystemType')){
-          session::un_set('SelectedSystemType');
-          if(!isset($ldap)){
-            $ldap = $this->config->get_ldap_link();
-          }
-          $ldap->cd ($this->dn);
-          $ldap->cat($this->dn, array('dn'));
-          if(count($ldap->fetch())){
-            $ldap->cd($this->dn);
-            $ldap->rmDir($this->dn);
-          }
-          $ldap->cd($this->config->current['BASE']);
-        }
-
-        /* Terminal has been saved successfully, remove lock from
-           LDAP. */
-        if ($this->dn != "new"){
-          del_lock ($this->dn);
-        }
-
-        unset ($this->systab);
-        $this->systab= NULL;
-        session::un_set('objectinfo');
-      } else {
-        /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        show_errors($message);
-      }
-    }
-
-
-    /********************
-      Edit system was canceled 
-     ********************/
-    /* Cancel dialogs */
-    if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel']) || isset($_POST['SystemTypeAborted'])){
-      if (isset($this->systab)){
-        del_lock ($this->systab->dn);
-        unset ($this->systab);
-      }
-      $this->systab= NULL;
-      session::un_set('objectinfo');
-
-      /* Remove ogroup selection, which was set while editing a new incoming entry */
-      if(session::is_set('SelectedSystemType')){
-        session::un_set('SelectedSystemType');
-      }
-    }
-
-    /********************
-      Display edit dialog, or some other
-     ********************/
-
-    /* Show tab dialog if object is present */
-    if (isset($this->systab->config)){
-      $display= $this->systab->execute();
-
-      /* Don't show buttons if tab dialog requests this */
-
-      $dialog     = FALSE;
-      $hide_apply = $this->dn == "new";
-      if(is_object($this->systab) && !isset($this->systab->by_object)){
-        $dialog = TRUE;
-        $hide_apply = TRUE;
-      }elseif(isset($this->systab->by_object[$this->systab->current]->dialog)){
-        $dia = $this->systab->by_object[$this->systab->current]->dialog;
-        if($dia === TRUE || is_object($dia)){
-          $dialog = TRUE;
-        }  
-      }
-      if(isset($this->systab->by_object[$this->systab->current]->netConfigDNS) && 
-        $this->systab->by_object[$this->systab->current]->netConfigDNS->dialog){
-        $dialog = TRUE;
-      }
-
-      if (!$dialog){
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-        $display.= "&nbsp;\n";
-        if (!$hide_apply){
-          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-          $display.= "&nbsp;\n";
-        }
-        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-        $display.= "</p>";
-      }
-      return ($display);
-    }
-
-    /* Check if there is a snapshot dialog open */
-    $base = $this->DivListSystem->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
-      return($str);
-    }
-
-    /* Display dialog with system list */
-    $this->DivListSystem->parent = $this;
-    $this->DivListSystem->execute();
-
-    /* Add departments if subsearch is disabled */
-    if(!$this->DivListSystem->SubSearch){
-      $this->DivListSystem->AddDepartments($this->DivListSystem->selectedBase,3,1);
-    }
-    $this->reload();
-    $this->DivListSystem->setEntries($this->terminals);
-    return($this->DivListSystem->Draw());
-  }
-
-
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases()
-  {
-    $tmp = array();
-
-    /* Check acls, if we are not allowed to create and write each plugin tab, skip this object */
-
-    $tabs = array(
-        "terminal"        => get_ou('terminalou'),
-        "workstation"     => get_ou('workstationou'),
-        "incoming"        => get_ou('incomingou'),
-        "server"          => get_ou('serverou'),
-        "printer"         => get_ou('printerou'),
-        "phone"           => get_ou('phoneou'),
-        "winworkstation"  => get_winstations_ou(),
-        "component"       => get_ou('componentou')
-        ); 
-
-    foreach($tabs as $acl_cat => $dn){
-
-      $acl_all = $this->ui->has_complete_category_acls($dn.$this->DivListSystem->selectedBase,$acl_cat);
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $tmp[] = $dn.$this->DivListSystem->selectedBase;
-      }
-    }
-    return($tmp); 
-  }
-
-
-  function remove_from_parent()
-  {
-    /* Optionally execute a command after we're done */
-    $this->postremove();
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    $this->DivListSystem->save_object();
-  }
-
-
-  /* Check values */
-  function check()
-  {
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-  }
-
-  function adapt_from_template($dn)
-  {
-  }
-
-  function password_change_needed()
-  {
-  }
-
-  function reload()
-  {
-    /* some var init */
-    $ui = get_userinfo();
-    $res              = array();
-    $this->terminals  = array();
-    $userregex        = "";
-
-    /* Set base for all searches */
-    $base=  $this->DivListSystem->selectedBase;
-
-    /* Prepare samba class name */
-    $samba  ="";
-    if ($this->DivListSystem->ShowWinWorkstations){
-      if ($this->config->current['SAMBAVERSION'] == "3"){
-        $samba= "sambaSamAccount";
-      } else {
-        $samba= "sambaAccount";
-      }
-    }
-
-    /* This array represents the combination between checkboxes and search filters */
-    $objs = array( 
-        "ShowServers"        => array("CLASS" => "goServer"        ,"TREE" => get_ou('serverou')),
-        "ShowTerminals"      => array("CLASS" => "gotoTerminal"    ,"TREE" => get_ou('terminalou')),
-        "ShowPrinters"       => array("CLASS" => "gotoPrinter"     ,"TREE" => get_ou('printerou')),
-        "ShowDevices"        => array("CLASS" => "ieee802Device"   ,"TREE" => get_ou('componentou')),
-        "ShowPhones"         => array("CLASS" => "goFonHardware"   ,"TREE" => get_ou('phoneou')),
-        "ShowWorkstations"   => array("CLASS" => "gotoWorkstation" ,"TREE" => get_ou('workstationou')),
-        "ShowWinWorkstations"=> array("CLASS" => $samba            ,"TREE" => get_winstations_ou() ));
-
-    /* Include the 'Display Systems of user' attribute */ 
-    if ((!empty($this->DivListSystem->UserRegex)) && ($this->DivListSystem->UserRegex!= "*")){
-      $userregex = "(gotoLastUser=".$this->DivListSystem->UserRegex.")";
-    }
-
-    /* Attributes to fetch */
-    $sys_attrs        = array("cn", "description", "macAddress", "objectClass", "sambaDomainName","gotoMode");
-    $sys_categories   = array("terminal", "workstation", "server", "phone" ,"printer");
-
-    /* Add FAIstate to attributes if FAI is activated */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)){
-      $sys_attrs[] = "FAIstate";
-    }    
-
-    /* Walk through all possible search combinations, and search for some objects if the checkbox is enabled  */
-    foreach($objs as $checkBox => $oc){
-      if($this->DivListSystem->$checkBox){
-        if($this->DivListSystem->SubSearch){
-          if($oc['CLASS'] != ""){
-            $filter = "(&".$userregex."(objectClass=".$oc['CLASS'].")(cn=".$this->DivListSystem->Regex."))";
-            $new_res = get_sub_list($filter, $sys_categories ,preg_replace("/,.*$/","",$base), $base,$sys_attrs, GL_NONE | GL_SUBSEARCH | GL_SIZELIMIT);
-      
-            /* Remove all objects that are not in the expected sub department */
-            foreach($new_res as $key => $obj){
-              if(preg_match("/^[^,]+,".normalizePreg($oc['TREE'])."/",$obj['dn'])){
-                $res[$obj['dn']] = $obj;
-              }
-            }
-          }
-        }else{
-          /* User filter? */
-          if($oc['CLASS'] != ""){
-            $filter = "(&".$userregex."(objectClass=".$oc['CLASS'].")(cn=".$this->DivListSystem->Regex."))";
-            $res = array_merge($res,get_list($filter,$sys_categories,$oc['TREE'].$base, $sys_attrs, GL_NONE | GL_SIZELIMIT));
-          }
-        }
-      } 
-    }
-
-    /* Search for incoming objects */ 
-    $filter = "(|(&".$userregex."(objectClass=goHard)(cn=".$this->DivListSystem->Regex.")))";
-    $res = array_merge($res,get_list($filter,$sys_categories, get_ou('incomingou'),get_ou('incomingou').$base,$sys_attrs, GL_NONE | GL_SIZELIMIT));
-
-    /* Get all gotoTerminal's */
-    foreach ($res as $value){
-
-      $tmp= $value['dn'];
-      $add= "";
-
-      /* Extract base */
-      foreach($objs as $obj){
-        if(preg_match("/,".$obj['TREE']."/i",$value['dn'])){
-          $tmp = trim( preg_replace("/^[^,]+,[^o]*".$obj['TREE']."/i","",$value['dn']));
-        }
-      }
-
-      /* Create a string containing the last part of the department. */
-      $dn_name = preg_replace("#^([^/]+/)*#","",convert_department_dn(@LDAP::fix($tmp)));
-      if(empty($dn_name)){
-        $dn_name = "/";
-      }
-
-      /* check if current object is a new one */
-      if (preg_match ("/,".get_ou('incomingou')."/i", $tmp)){
-        if (in_array_ics('gotoTerminal', $value['objectClass'])){
-          $add= "- "._("New terminal");
-        }elseif (in_array_ics('gotoWorkstation', $value['objectClass'])){
-          $add= "- "._("New workstation");
-        }elseif (in_array_ics('GOhard', $value['objectClass']) && !isset($value['gotoMode'])){
-          $add= "- "._("Unknown device");
-        }elseif (in_array_ics('GOhard', $value['objectClass'])){
-          $add= "- "._("New Device");
-        }
-      } 
-
-      /* Detect type of object and create an entry for $this->terminals */
-      $terminal = array();
-
-      if (in_array_ics('gotoTerminal', $value["objectClass"])){
-
-        /* check acl */
-        $acl = $ui->get_permissions($value['dn'],"terminal/termgeneric");
-        if($add != "" || preg_match("/r/",$acl)) {
-          if (isset($value["macAddress"][0]) && $value["macAddress"][0] != "-"){
-            $terminal             = $value;
-            $terminal['type']     = "T";
-            $terminal['is_new']   = $add;
-          } else {
-            $terminal             = $value;
-            $terminal['type']     = "D";
-            $terminal['message']  = _("Terminal template for")."&nbsp;'".$dn_name."'&nbsp;";
-            $terminal['location'] = array_search($tmp, $this->config->departments); 
-          }
-        }
-      } elseif (in_array_ics('gotoWorkstation', $value["objectClass"])){
-
-        $acl = $ui->get_permissions($value['dn'],"workstation/workgeneric");
-        if($add != "" || preg_match("/r/",$acl)) {
-          if (isset($value["macAddress"][0]) &&  $value["macAddress"][0] != "-"){
-            $terminal             = $value;
-            $terminal['type']     = "L";
-            $terminal['is_new']   = $add;
-          } else {
-            $terminal             = $value;
-            $terminal['type']     = "D";
-            $terminal['location'] = array_search($tmp, $this->config->departments);
-            $terminal['message']  = _("Workstation template for")."&nbsp;'".$dn_name."'&nbsp;";
-          }
-          if (isset($value["FAIstate"][0])){
-            $terminal['type']= $this->getState($terminal['type'], $value["FAIstate"][0]);
-          }
-        }
-      } elseif (in_array_ics('gotoPrinter', $value["objectClass"])){
-       
-   
-        $acl = $ui->get_permissions($value['dn'],"printer/printgeneric");
-        if($add != "" || preg_match("/r/",$acl)) {
-
-          $terminal             = $value;
-          $terminal['type']     = "P";
-        }
-      } elseif (in_array_ics('goServer', $value["objectClass"])){
-
-        $acl = $ui->get_permissions($value['dn'],"server/servgeneric");
-        if($add != "" || preg_match("/r/",$acl)) {
-
-          $terminal             = $value;
-          $terminal['type']     = "S";
-          if (isset($value["FAIstate"][0])){
-            $terminal['type']= $this->getState($terminal['type'], $value["FAIstate"][0]);
-          }
-        }
-      } elseif (in_array_ics('goFonHardware', $value["objectClass"])){
-
-        $acl = $ui->get_permissions($value['dn'],"phone/phoneGeneric");
-        if($add != "" || preg_match("/r/",$acl)) {
-
-          $terminal             = $value;
-          $terminal['type']     = "F";
-        }
-      }elseif (in_array_ics("GOhard",$value['objectClass'])){
-
-        $acl =  $ui->get_permissions($value['dn'],"server/servgeneric"). 
-                $ui->get_permissions($value['dn'],"terminal/termgeneric").
-                $ui->get_permissions($value['dn'],"workstation/workgeneric");
-        if($add != "" || preg_match("/r/",$acl)) {
-
-          $terminal = $value;
-          $terminal['type']   = "Q";
-          $terminal['is_new'] = $add;
-        }
-      } elseif (in_array_ics('ieee802Device', $value["objectClass"])){
-
-        $acl = $ui->get_permissions($value['dn'],"component/componentGeneric");
-        if($add != "" || preg_match("/r/",$acl)) {
-
-          $terminal             = $value;
-          $terminal['type']     = "C";
-        }
-      } else{
-
-        $name= preg_replace('/\$$/', '', $value['cn'][0]);
-        if (isset($value['sambaDomainName'])){
-          $domain= " [".$value['sambaDomainName'][0]."]";
-        } else {
-          $domain= "";
-        }
-        $terminal=$value;
-        $terminal['type']     ="W";
-        $terminal['domain']   = $name.$domain;
-      }
-
-      if(count($terminal)){
-        $this->terminals[]=$terminal;
-      }
-    }
-
-    $tmp  =array();
-    $tmp2 =array();
-    foreach($this->terminals as $tkey => $val ){
-      $tmp[strtolower($val['cn'][0]).$val['dn']]=$val;
-      $tmp2[strtolower($val['cn'][0]).$val['dn']] = strtolower($val['cn'][0]).$val['dn'];
-    }
-    natcasesort($tmp2);
-    $this->terminals=array();
-    foreach($tmp2 as $val){
-      $this->terminals[]=$tmp[$val];
-    }
-    reset ($this->terminals);
-  }
-
-  function remove_lock()
-  {
-    if (isset($this->systab->dn)){
-      del_lock ($this->systab->dn);
-    }
-  }
-
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-
-    $tabs = array(
-        "terminal"    => array( "CLASS"     =>"TERMTABS",     "TABNAME" =>"termgeneric",     
-          "TABCLASS"  =>"termtabs",     "ACL"     =>"terminal"),
-        "workstation" => array( "CLASS"     =>"WORKTABS",     "TABNAME" =>"workgeneric",     
-          "TABCLASS"  =>"worktabs",     "ACL"     =>"workstation"),
-        "server"      => array( "CLASS"     =>"SERVTABS",     "TABNAME" =>"servgeneric",     
-          "TABCLASS"  =>"servtabs",     "ACL"     =>"server"),
-        "printer"     => array( "CLASS"     =>"PRINTTABS",    "TABNAME" =>"printgeneric",    
-          "TABCLASS"  =>"printtabs",    "ACL"     =>"printer"),
-        "phone"       => array( "CLASS"     =>"PHONETABS",    "TABNAME" =>"phoneGeneric",    
-          "TABCLASS"  =>"phonetabs",    "ACL"     =>"phone"),
-        "component"   => array( "CLASS"     =>"COMPONENTTABS","TABNAME" =>"componentGeneric",
-          "TABCLASS"  =>"componenttabs","ACL"     =>"component"));
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $dn     = $this->terminals[$s_entry]['dn'];
-      $oc     = $this->terminals[$s_entry]['objectClass'];
-      $type   = $this->get_system_type($this->terminals[$s_entry]);
-
-      $tab_o  = $tabs[$type]['CLASS'];
-      $tab_c  = $tabs[$type]['TABCLASS'];
-      $acl    = $tabs[$type]['ACL'];
-
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,$tab_c,$tab_o,$acl);
-    }
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->terminals[$id]['dn'];
-        $oc = $this->terminals[$id]['objectClass']; 
-        $type = $this->get_system_type($this->terminals[$id]);
-
-        if(isset($tabs[$type])){
-          $tab_o  = $tabs[$type]['CLASS'];
-          $tab_c  = $tabs[$type]['TABCLASS'];
-          $acl    = $tabs[$type]['ACL'];
-
-          if($s_action == "copy_multiple"){
-            $this->CopyPasteHandler->add_to_queue($dn,"copy",$tab_c,$tab_o,$acl);
-          }
-          if($s_action == "cut_multiple"){
-            $this->CopyPasteHandler->add_to_queue($dn,"cut",$tab_c,$tab_o,$acl);
-          }
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-  
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-    
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListSystem->selectedBase);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */
-    if(!$this->CopyPasteHandler->entries_queued()){
-      $this->start_pasting_copied_objects = FALSE;
-    }
-    return("");
-  }
-
-
-  function get_system_type($attrs)
-  {
-    $classes = $attrs['objectClass'];
-
-    $type= "";
-    if (in_array_ics('ieee802Device', $classes)){
-      $type= "component";
-    }elseif (in_array_ics('gotoTerminal', $classes)){
-      $type= "terminal";
-    }elseif (in_array_ics('gotoWorkstation', $classes)){
-      $type= "workstation";
-    }elseif (in_array_ics('gotoPrinter', $classes)){
-      $type= "printer";
-    }elseif (in_array_ics('goFonHardware', $classes)){
-      $type= "phone";
-    }elseif (in_array_ics('goServer', $classes)){
-      $type= "server";
-    }elseif (in_array_ics('GOhard', $classes) && !isset($attrs['gotoMode']) && $this->arp_handling_active){
-      $type= "ArpNewDevice";
-    }elseif (in_array_ics('GOhard', $classes)){
-      $type= "NewDevice";
-    }elseif (in_array_ics('sambaAccount', $classes) ||
-        in_array_ics('sambaSamAccount', $classes)){
-      $type= "winstation";
-    }
-    return ($type);
-  }
-
-
-  function convert_list($input)
-  {
-    $temp= "";
-    $conv= array(      
-        "NQ" => array("select_newsystem.png",_("New System from incoming")),
-        "D" => array("select_default.png",_("Template")),
-        "T" => array("select_terminal.png",_("Terminal")),
-        "L" => array("select_workstation.png",_("Workstation")),
-        "GL" => array("select_workstation_green.png",_("Workstation is installing")),
-        "YL" => array("select_workstation_yellow.png",_("Workstation is waiting for action")),
-        "RL" => array("select_workstation_red.png",_("Workstation installation failed")),
-        "F" => array("select_phone.png",_("Phone")),
-        "S" => array("select_server.png",_("Server")),
-        "GS" => array("select_server_green.png",_("Server is installing")),
-        "YS" => array("select_server_yellow.png",_("Server is waiting for action")),
-        "RS" => array("select_server_red.png",_("Server installation failed")),
-        "W" => array("select_winstation.png",_("Winstation")),
-        "C" => array("select_component.png",_("Network Device")),
-        "NT"=> array("select_new_terminal.png",_("New Terminal")),
-        "NL"=> array("select_new_workstation.png",_("New Workstation")),
-        "P" => array("select_printer.png",_("Printer")));
-
-    if((isset($input['is_new']))&&(!empty($input['is_new']))){
-      $input['type']="N".$input['type'];
-    }
-    foreach ($conv  as $key => $value){
-      if($input['type']==$key){
-        $tmp['img'] ="<img class='center' src='images/".$value[0]."' alt='".$key."' title='".$value['1']."'>";
-        $tmp['class']=$key;
-        return $tmp;
-      }
-    }
-  }
-
-  
-  function getState($type, $state)
-  {
-    switch (preg_replace('/:.*$/', '', $state)) {
-      case 'installing':
-                $type= 'G'.$type;
-                break;
-      case 'error':
-                $type= 'R'.$type;
-                break;
-      case 'install':
-      case 'sysinfo':
-      case 'softupdate':
-      case 'scheduledupdate':
-                $type= 'Y'.$type;
-                break;
-    }
-
-
-    return ($type);
-  }
-
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  /* !! Incoming dummy acls, required to defined acls for incoming objects
-   */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Incoming objects"),
-          "plDescription" => _("Incoming objects"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 99,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("incoming"   => array( "description"  => _("Incoming"),
-                                                          "objectClass"  => "")),
-          "plProvidedAcls"=> array()
-            
-          ));
-  }
-
-
-  
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/class_termDNS.inc b/gosa-core/plugins/admin/systems/class_termDNS.inc
deleted file mode 100644 (file)
index 526eefc..0000000
+++ /dev/null
@@ -1,1013 +0,0 @@
-<?php
-
-class termDNS extends plugin
-{
-  /* attribute list for save action */
-  var $ignore_account = true;
-  var $autonet        = false;
-
-  /* Basic informations 
-   */
-  var $attributes     = array("ipHostNumber","macAddress");
-  var $objectclasses  = array("whatever");
-
-  var $ipHostNumber   = "";    // IP address 
-  var $macAddress     = "";    // Mac address 
-
-  var $orig_ipHostNumber   = "";    // IP address 
-  var $orig_macAddress     = "";    // Mac address 
-
-  var $cn             = "";    // CN of currently edited device 
-  var $OrigCn         = "";    // Initial cn
-  var $IPisMust       = false;
-  var $MACisMust      = false;
-  var $dialog;
-
-  /* DCHP Attributes 
-   */
-  var $dhcpAttributes           = array("dhcpParentNode");
-  var $dhcpEnabled              = FALSE;
-  var $dhcp_is_Account          = FALSE;
-  var $dhcpParentNodes          = array();
-  var $dhcpParentNode           = "";
-  var $dhcpHostEntry            = array();
-  var $initial_dhcpParentNode   = "";
-  var $initial_dhcpHostEntry    = array();
-  var $initial_dhcp_is_Account  = FALSE;
-
-  var $used_ip_mac              = array();  
-
-  /* DNS attributes  
-   */
-  var $DNSattributes            = array("dNSClass","zoneName","dNSTTL");
-  var $DNS_is_account           = false;
-  var $initially_was_account = false;
-  var $dnsEntry                 = array();
-  var $DNSenabled               = false;
-  var $hide_dns_check_box       = FALSE;
-
-  /*  Terminal dns 
-   */
-  function termDNS (&$config, $parent,$objectClasses,$IPisMust = false)
-  {
-    /* We need to know which objectClasses are used, to store the ip/mac
-     * Because of different type of devices   
-     */ 
-    $this->parent         = $parent;
-    $this->objectclasses  =  $objectClasses;
-    $this->IPisMust       = $IPisMust;
-
-    plugin::plugin ($config, $parent->dn);
-
-    if(isset($this->attrs['cn'][0])){
-      $this->OrigCn = preg_replace("/\\\$\$/","",$this->attrs['cn'][0]);
-      $this->cn = preg_replace("/\\\$\$/","",$this->attrs['cn'][0]);
-    }
-
-    /************
-     * DHCP 
-     ************/
-
-    /* Hide all dhcp specific code, if dhcp plugin is not present in config */
-    $dhcpEnabled = FALSE;
-    if($this->config->search("servdhcp","class",array("tabs"))){
-      $this->dhcpEnabled = TRUE;
-    }
-    if($this->dhcpEnabled){
-      $this->dhcpParentNodes = $this->get_dhcp_parent_nodes();
-      $this->dhcpParentNode  = $this->get_dhcp_parent_node();
-      if($this->dhcpParentNode){
-        $this->dhcp_is_Account = TRUE;
-        $this->initial_dhcp_is_Account = TRUE;
-        $this->dhcpHostEntry  = $this->get_dhcp_host_entry();    
-      }
-      $this->initial_dhcpHostEntry = $this->dhcpHostEntry;
-      $this->initial_dhcpParentNode= $this->dhcpParentNode;
-    }
-
-
-    /************
-     * Autonetwork hook 
-     ************/
-    /* Do we have autonet support? */
-    if (isset($this->config->data['MAIN']['AUTO_NETWORK_HOOK'])){
-      $this->autonet= true;
-    }
-
-
-    /************
-     * DNS
-     ************/
-    /* Hide all dns specific code, if dns is not available 
-     */
-    $DNSenabled = false;
-    foreach($this->config->data['TABS']['SERVERSERVICE'] as $tab){
-      if(preg_match("/^servdns$/",$tab['CLASS'])){
-        $this->DNSenabled = true;
-      }
-    }
-    if(!$this->DNSenabled){
-      $this->DNS_is_account = false;
-      return;
-    }
-
-    if($this->DNSenabled){
-
-      /* Get Zones  
-       */
-      $this->Zones        = DNS::getAvailableZones($config);
-
-      /* Get Entry 
-       */
-      $this->dnsEntry     = DNS::getDNSHostEntries($config,$this->OrigCn);
-
-      /* Remove A record which equals $this->ipHostNumber
-       */
-      $ptr = $this->get_pTRRecord();
-      foreach($this->dnsEntry['RECORDS'] as $key => $rec){
-        if(($rec['type'] == "aRecord") && ($rec['value'] == $this->ipHostNumber)){
-          unset($this->dnsEntry['RECORDS'][$key]);
-        }
-        if(($rec['type'] == "pTRRecord") && ($rec['value'] == $ptr)){
-          unset($this->dnsEntry['RECORDS'][$key]);
-        }
-      }
-
-      /* Get Record types 
-       */
-      $this->RecordTypes  = DNS::getDnsRecordTypes();
-
-      /* If there is at least one entry in this -> types, we have DNS enabled 
-       */
-      if($this->dnsEntry['exists']){
-        $this->DNS_is_account = true;
-      }else{
-        $this->DNS_is_account = false;
-      }
-    }
-
-    /* Create a list of used mac and ip addresses */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(|(macAddress=*)(ipHostNumber=*))",array("macAddress","ipHostNumber"));
-    while($attrs = $ldap->fetch()){
-      if(isset($attrs['ipHostNumber'][0])){
-        $this->used_ip_mac["ip:".$attrs['ipHostNumber'][0]] = "ip:".$attrs['ipHostNumber'][0];
-      }
-      if(isset($attrs['macAddress'][0])){
-        $this->used_ip_mac["mac:".$attrs['macAddress'][0]] = "mac:".$attrs['macAddress'][0];
-      }
-    } 
-
-    /* Save initial ip and mac values, to be able 
-        check if the used values are already in use */ 
-    $this->orig_ipHostNumber   = $this->ipHostNumber;  
-    $this->orig_macAddress     = $this->macAddress;
-    /* Store initally account settings 
-     */
-    $this->initially_was_account = $this->DNS_is_account;
-
-    if($this->DNS_is_account){
-      new log("view","unknown/".get_class($this),$this->dn);
-    }
-  }
-
-
-  function netmaskIsCoherent($idZone) 
-  {
-    $netmask = DNS::FlipIp(str_replace(".in-addr.arpa","",DNS::getNameFromMix($idZone)));
-    if(!strstr($this->ipHostNumber, $netmask)){
-      return false;
-    }else{
-      return true;
-    }
-  }
-
-
-  function getVarsForSaving($attrs) 
-  {
-    foreach($this->attributes as $attr){
-      if(!empty($this->$attr)){
-        $attrs[$attr] = $this->$attr;
-      }
-    }
-    return($attrs); 
-  }
-
-  function execute()
-  {
-         /* Call parent execute */
-    $smarty= get_smarty();
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    $display= "";
-
-    $smarty->assign("staticAddress", ""); 
-    $smarty->assign("autonet", $this->autonet);
-    /* Check for autonet button */
-    if ($this->autonet && isset($_POST['autonet'])){
-      $cmd= $this->config->data['MAIN']['AUTO_NETWORK_HOOK'];
-      if(!empty($cmd) && $this->cn != ""){
-        $res = shell_exec($cmd." ".$this->cn);
-        if(!$res){
-          print_red(sprintf(_("Can't execute specified AUTO_NETWORK_HOOK '%s'. Please check your gosa.conf."),$cmd));
-        } else {
-          $res= split(';', trim($res));
-          if (isset($res[0]) && $res[0] != ""){
-            $this->ipHostNumber= $res[0];
-          }
-          if (isset($res[1]) && $res[1] != ""){
-            $this->macAddress= $res[1];
-          }
-        }
-      }
-    }
-    
-  
-    /**********
-     * DHCP Handling
-     **********/
-    if(isset($_POST['dhcpEditOptions'])){
-
-      if(count($this->dhcpHostEntry) == 0){
-        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
-      }else{
-        $this->dialog = new dhcpHost($this->dhcpHostEntry,TRUE);
-      }
-      $this->dialog->cn = $this->cn; 
-      $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress; 
-      if(!empty($this->ipHostNumber)){
-        $this->dialog->statements['fixed-address'] = $this->ipHostNumber; 
-      }
-    }
-
-    if(isset($_POST['cancel_dhcp'])){
-      $this->dialog = FALSE; 
-    }
-
-    if(isset($_POST['save_dhcp'])){
-      $this->dialog->save_object();
-      
-      $msgs = $this->dialog->check(array());
-      if(count($msgs)){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-        $this->dhcpHostEntry = $this->dialog->save();
-        $this->dialog = FALSE; 
-      }
-    }
-
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-    $smarty->assign("dhcpEnabled",    $this->dhcpEnabled);
-    $smarty->assign("dhcp_is_Account",$this->dhcp_is_Account);
-    $smarty->assign("dhcpParentNode", $this->dhcpParentNode);
-    $smarty->assign("dhcpParentNodes",$this->dhcpParentNodes);
-    $smarty->assign("dhcpParentNodeCnt",count($this->dhcpParentNodes));
-
-
-    /**********
-     * DNS Handling
-     **********/
-
-    /* There is no dns available
-     */
-    if($this->DNSenabled == false){
-
-      /* Is IP address must ? */
-      $smarty->assign("DNS_is_account",false);
-      $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
-
-      /* Assign smarty all non DNs attributes */
-      foreach($this->attributes as $attr){
-        $smarty->assign($attr,$this->$attr);
-      }
-      $smarty->assign("staticAddress","<font class=\"must\">*</font>");
-
-      $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
-    }else{
-      $smarty->assign("DNS_is_account",true);
-
-      /* Add new empty array to our record list */
-      if(isset($_POST['AddNewRecord'])){
-        $this->dnsEntry['RECORDS'][]  =array("type"=>"aRecord","value"=>"");
-      }
-
-      /* propose_ip */
-      if(isset($_POST['propose_ip'])){
-        foreach($this->Zones as $key => $name){
-          if($name == $this->dnsEntry['zoneName']){
-            $net = DNS::FlipIp(str_replace(".in-addr.arpa","",DNS::getNameFromMix($key)));
-            $this->ipHostNumber = $this->generateRandomIp($net);
-          }
-        }
-      }
-
-      /* Handle all posts */
-      $only_once =true;
-      foreach($_POST as $name => $value){
-
-        /* Check if we have to delete a record entry */
-        if((preg_match("/RemoveRecord_/",$name))&&($only_once)) {
-
-          /* Avoid performing this once again */
-          $only_once = false;
-
-          /* Extract id for specified entry */
-          $id = preg_replace("/RemoveRecord_/","",$name);
-          $id = preg_replace("/_.*$/","",$id);
-
-          /* Delete this record, mark edited entries to be able to delete them */
-          if(isset($this->dnsEntry['RECORDS'][$id])){
-            unset($this->dnsEntry['RECORDS'][$id]);
-          }
-        }
-      }
-      /* Assign smarty all non DNs attributes */
-      foreach($this->attributes as $attr){
-        $smarty->assign($attr,$this->$attr);
-      }
-
-      /* Assign smarty all DNS attributes */
-      foreach($this->DNSattributes as $attr){
-        $smarty->assign($attr,$this->dnsEntry[$attr]);
-      }
-
-      /* Assign all needed vars */
-      $smarty->assign("DNSAccount",$this->DNS_is_account);
-      $smarty->assign("hide_dns_check_box",$this->hide_dns_check_box);
-  
-      $smarty->assign("Zones",$this->Zones);
-      $smarty->assign("ZoneCnt",count($this->Zones));
-      $smarty->assign("ZoneKeys",($this->Zones));
-      $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
-
-      /* Create zone array */
-      $idZones = array();
-      foreach($this->Zones as $id => $zone){
-        if($this->netmaskIsCoherent($id)) {
-          $idZones[$id] = $zone;
-        }else{
-          $idZones[$id] = $zone."&nbsp;("._("Not matching").")";
-        }
-      }
-      $smarty->assign("Zones",$idZones);
-      $smarty->assign("ZoneKeys", $this->Zones);
-
-      $tmp = $this->generateRecordsList();
-
-      $changeStateForRecords = $tmp['changeStateForRecords'];
-
-      $smarty->assign("records",$tmp['str']);
-      $smarty->assign("changeStateForRecords",$changeStateForRecords);
-      $smarty->assign("staticAddress","<font class=\"must\">*</font>");
-
-      $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
-    }
-    return($display);
-  }
-
-
-  function remove_from_parent()
-  {
-    if($this->initially_was_account){
-
-      $ldap = $this->config->get_ldap_link();
-
-      $tmp = array();
-      $this->dnsEntry['exists'] = false;
-      $tmp = DNS::getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn);
-
-      /* Delete dns */
-      foreach($tmp['del'] as $dn => $del){
-        $ldap->cd($dn);
-        $ldap->rmdir_recursive($dn);
-        new log("remove","unknown/".get_class($this),$dn);
-      }
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-
-    if(isset($_POST['network_tpl_posted'])){
-
-      /* Save all posted vars */
-      plugin::save_object();
-
-      /* Handle DHCP Posts*/
-      if($this->dhcpEnabled && isset($_POST['network_tpl_posted'])){
-        foreach($this->dhcpAttributes as $attr){
-          if(isset($_POST[$attr])){
-            $this->$attr = $_POST[$attr];
-          }
-        }
-        if(isset($_POST['dhcp_is_Account'])){
-          $this->dhcp_is_Account = TRUE;
-        }else{
-          $this->dhcp_is_Account = FALSE;
-        }
-      }
-
-      /* Ge all non dns attributes (IP/MAC)*/
-      foreach($this->attributes as $attr){
-        if(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
-          $this->$attr = $_POST[$attr];
-        }
-      }
-
-      /* Check if DNS should be enabled / disabled */
-      if($this->DNS_is_account && $this->acl_is_removeable() && !isset($_POST['DNS_is_account'])){
-        $this->DNS_is_account = false;
-      }elseif(!$this->DNS_is_account && $this->acl_is_createable() && isset($_POST['DNS_is_account'])){
-        $this->DNS_is_account = true;
-      }
-
-      /* Get dns attributes */
-      if(($this->DNSenabled) && (isset($_POST['network_tpl_posted']))){
-
-        /* Check for posted record changes */
-        if(is_array($this->dnsEntry['RECORDS']) && $this->acl_is_writeable("Records")){
-          foreach($this->dnsEntry['RECORDS'] as $key => $value){
-
-            /* Check if type has changed */
-            if(isset($_POST['RecordTypeSelectedFor_'.$key])){
-              $this->dnsEntry['RECORDS'][$key]['type'] = $_POST['RecordTypeSelectedFor_'.$key];
-            }
-            /* Check if value has changed */
-            if(isset($_POST['RecordValue_'.$key])){
-              $this->dnsEntry['RECORDS'][$key]['value'] = $_POST['RecordValue_'.$key];
-            }
-          }
-        }
-        /* Get all basic DNS attributes (TTL, Clas ..)*/
-        foreach($this->DNSattributes as $attr){
-          if(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
-            $this->dnsEntry[$attr] = $_POST[$attr];
-          }
-        }
-
-
-      }
-      if($this->hide_dns_check_box){
-        $this->DNS_is_account = true;
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if($this->dhcpEnabled && $this->dhcp_is_Account && $this->dhcpParentNode != "" && count($this->dhcpHostEntry) == 0){
-#      $message[] =_("You have not configured your dhcp settings yet.");
-    }
-    
-    /* Check if mac and ip are already used */
-    if(!empty($this->ipHostNumber) && $this->DNS_is_account && 
-        $this->ipHostNumber != $this->orig_ipHostNumber && 
-        in_array("ip:".$this->ipHostNumber,$this->used_ip_mac)){
-      $message[] =_("The specified IP address is already in use.");
-    }
-    if(!empty($this->macAddress) && $this->dhcp_is_Account && 
-        $this->macAddress != $this->orig_macAddress && 
-        in_array("mac:".$this->macAddress,$this->used_ip_mac)){
-      print_red(sprintf(_("The specified MAC address '%s' for this system '%s' is already in use."),$this->macAddress,$this->cn));
-    }
-
-    /* Check if ip must be given
-     */  
-    if(($this->IPisMust)||($this->DNS_is_account)){
-      if (empty($this->ipHostNumber)){
-        $message[]= _("The required field 'IP-address' is not set.");
-      }
-
-      if (!tests::is_ip($this->ipHostNumber)){
-        $message[]= _("Wrong IP format in field IP-address.");
-      }
-    }
-
-    /* Check if mac is empty 
-     */
-    if ($this->macAddress == "" ){
-      $message[]= _("The required field 'MAC-address' is not set.");
-    }
-    if(!tests::is_mac($this->macAddress)){
-      $message[]=(_("The given macaddress is invalid. There must be 6 2byte segments seperated by ':'."));
-    }
-
-    /* only perfrom this checks if this is a valid DNS account */
-    if($this->DNS_is_account){
-
-      $checkArray = array();
-      $onlyOnce   = array();
-
-      //  $onlyOnce['cNAMERecord'] = 0;
-       $tmp = array_flip($this->Zones);
-       $tmp2 = $tmp[$this->dnsEntry['zoneName']];
-       if(!$this->netmaskIsCoherent($tmp2)){ //this->dnsEntry['zoneName'])){
-         $tmp2 = preg_replace("/^.*\//","",$tmp2);
-         $message[] =sprintf(_("The specified IP address '%s' is not matching the selected reverse zone entry '%s'."),$this->ipHostNumber,$tmp2);
-       }
-
-      /* Walk through all entries and detect duplicates or mismatches
-       */  
-      foreach($this->dnsEntry['RECORDS'] as $name => $values){
-
-        /* Count record values, to detect duplicate entries for a specific record
-         */
-        if(!isset($checkArray[$values['type']][$values['value']])){
-          $checkArray[$values['type']][$values['value']] = 0;
-        }else{
-          $message[] = sprintf(_("Found duplicate value for record type '%s'."),$values['type']);
-        }
-
-        /* Check if given entries in $onlyOnce are used more than once
-         */
-        if(isset($onlyOnce[$values['type']])){
-          $onlyOnce[$values['type']] ++;
-          if($onlyOnce[$values['type']] > 1){
-            $message[] = sprintf(_("Found more than one entry for the uniqe record type '%s'."),$values['type']);
-          }
-        }
-
-        /* Skip txt record ... 
-         */
-        if($values['type'] == "tXTRecord") continue;
-
-        /* Check if there is an aRecord defined which uses the same IP as used in IPhostAddress 
-         */
-        if(($values['type'] == "aRecord")&&($values['value'] == $this->ipHostNumber)){
-          $message[]=sprintf(_("The device IP '%s' is added as 'A Record', this will be done automatically, please remove the record."), 
-               $this->ipHostNumber);
-        }
-
-        /* only lower-case is allowed in record entries ... 
-         */
-        if($values['value'] != strtolower($values['value'])){
-          $message[] = sprintf(_("Only lowercase is allowed, please check your '%ss'."),$values['type']);
-        }
-      }
-    }
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    $ldap= $this->config->get_ldap_link();
-  
-    $dn = $this->parent->dn;
-    /*******************/ 
-    /* IP-MAC HANDLING */
-    /*******************/ 
-
-    /* $dn was posted as parameter */
-    $this->dn = $dn;
-    
-    /* Save DNS setting & ip/Mac*/
-    plugin::save();
-
-    /* Write back to ldap */
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    /****************/ 
-    /* DHCP HANDLING */
-    /****************/ 
-  
-    /* New entry */
-    if($this->dhcpEnabled){
-
-      if(count($this->dhcpHostEntry) == 0){
-        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
-        $this->dialog->cn = $this->cn;
-        $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress;
-        if(!empty($this->ipHostNumber)){
-          $this->dialog->statements['fixed-address'] = $this->ipHostNumber;
-        }
-        $this->dialog->execute();
-        $this->dialog->save_object(); 
-        $this->dhcpHostEntry = $this->dialog->save();
-        if(count($this->dhcpHostEntry['dhcpOption']) == 0){
-          $this->dhcpHostEntry['dhcpOption']= array("host-name ".$this->cn);
-        }
-      }
-
-      if(count($this->dhcpHostEntry) == 0){
-        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
-        $this->dialog->cn = $this->cn;
-        $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress;
-        if(!empty($this->ipHostNumber)){
-          $this->dialog->statements['fixed-address'] = $this->ipHostNumber;
-        }
-        $this->dialog->execute();
-        $this->dialog->save_object(); 
-        $this->dhcpHostEntry = $this->dialog->save();
-        if(count($this->dhcpHostEntry['dhcpOption']) == 0){
-          $this->dhcpHostEntry['dhcpOption']= array("host-name ".$this->cn);
-        }
-      }
-
-      /* Write mac address to dhcp settings */
-      if($this->dhcp_is_Account){
-        if(!isset($this->dhcpHostEntry['dhcpHWAddress'][0]) || 
-            !preg_match("/ethernet ".$this->macAddress."/",$this->dhcpHostEntry['dhcpHWAddress'][0])){
-          $this->dhcpHostEntry['dhcpHWAddress'] = array("ethernet ".$this->macAddress);
-          $this->dhcpHostEntry['MODIFIED'] = TRUE;
-        }
-      }
-  
-
-      /* Unset dhcpStatements if this attribute is empty  */
-      if(isset($this->dhcpHostEntry['dhcpStatements']) && 
-          ($this->dhcpHostEntry['dhcpStatements'] == "" || count($this->dhcpHostEntry['dhcpStatements']) == 0) ){
-        unset($this->dhcpHostEntry['dhcpStatements']);
-      }
-  
-      /* DHCP removed */
-      if($this->initial_dhcp_is_Account && !$this->dhcp_is_Account){
-        $ldap->rmdir_recursive($this->dhcpHostEntry['dn']);
-        show_ldap_error($ldap->get_error(),_("Removing dhcp entry for this object failed."));
-
-        $tmp = new servdhcp($this->config,$this->dhcpParentNode);
-        $tmp->handle_post_events("remove");
-      }
-
-      /* DHCP Added */
-      if(!$this->initial_dhcp_is_Account && $this->dhcp_is_Account){
-        $attrs = $this->dhcpHostEntry;
-        unset($attrs['MODIFIED']);
-        unset($attrs['dn']);
-        $ldap->cd("cn=".$this->cn.",".$this->dhcpParentNode);
-        $res = $ldap->add($attrs);
-
-        $tmp = new servdhcp($this->config,$this->dhcpParentNode);
-        $tmp->handle_post_events("add");
-
-        show_ldap_error($ldap->get_error(),_("Tried to add new dhcp entry failed."));
-      }
-
-      /* DHCP still activated */
-      if($this->initial_dhcp_is_Account && $this->dhcp_is_Account){
-
-        /* DHCP node changed */
-        if(($this->initial_dhcpParentNode != $this->dhcpParentNode) || 
-           ($this->cn != $this->OrigCn)){
-          $attrs = $this->dhcpHostEntry;
-          $attrs['cn'] = $this->cn;
-          unset($attrs['dn']);
-          unset($attrs['MODIFIED']);
-          $ldap->cd("cn=".$this->cn.",".$this->dhcpParentNode);
-          $res = $ldap->add($attrs);
-
-          $tmp = new servdhcp($this->config,$this->dhcpParentNode);
-          $tmp->handle_post_events("modify");
-
-          show_ldap_error($ldap->get_error(),_("Tried to add new dhcp entry failed."));
-          if($res){
-            $ldap->rmdir_recursive($this->dhcpHostEntry['dn']);
-            show_ldap_error($ldap->get_error(),_("Removing old dhcp entry failed."));
-          }
-        }
-         
-        /* SAME node but modified */ 
-        if(isset($this->dhcpHostEntry['MODIFIED']) && $this->dhcpHostEntry['MODIFIED'] == 1  && 
-            $this->initial_dhcpParentNode == $this->dhcpParentNode){
-          $attrs = $this->dhcpHostEntry;
-          unset($attrs['dn']);
-          unset($attrs['MODIFIED']);
-          $ldap->cd($this->dhcpHostEntry['dn']);
-          $ldap->modify($attrs);
-          
-          $tmp = new servdhcp($this->config,$this->dhcpParentNode);
-          $tmp->handle_post_events("modify");
-
-          show_ldap_error($ldap->get_error(),_("Modifying dhcp entry failed."));
-        }    
-      }
-    }
-      
-
-    /****************/ 
-    /* DNS HANDLING */
-    /****************/ 
-
-    /* If isn't DNS account but initially was DNS account 
-       remove all DNS entries 
-     */ 
-    if((!$this->DNSenabled) || ((!$this->DNS_is_account)&&(!$this->initially_was_account))){
-      return;
-    }else{
-
-      /* Add ipHostNumber to aRecords
-       */
-      $backup_dnsEntry = $this->dnsEntry;
-      if(!empty($this->ipHostNumber)){
-        $this->dnsEntry['RECORDS'][] = array("type"=>"aRecord","value"=>$this->ipHostNumber);
-        $ptr = $this->get_pTRRecord();
-        if(!empty($ptr)){
-          $this->dnsEntry['RECORDS'][] = array("type"=>"pTRRecord","value"=>$ptr);
-        } 
-      }
-
-      /* Create diff and follow instructions 
-       * If Account was disabled, remove account by setting exists to false
-       */
-      if((!$this->DNS_is_account)&&($this->initially_was_account)){  
-        $this->dnsEntry['exists'] = false;
-        $tmp = DNS::getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn);
-      }else{
-        $this->dnsEntry['exists'] = $this->DNS_is_account;
-        $tmp = DNS::getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn);
-      }   
-
-      /* move follwoing entries 
-       */
-      foreach($tmp['move'] as $src => $dst){
-        $this->recursive_move($src,$dst);
-      }
-
-      /* Delete dns */
-      foreach($tmp['del'] as $dn => $del){
-        $ldap->cd($dn);
-        $ldap->rmdir_recursive($dn);
-        new log("modify","unknown/".get_class($this),$dn,array("*"),$ldap->get_error());
-      }
-
-      /* Add || Update new DNS entries 
-       */
-      foreach($tmp['add'] as $dn => $attrs){
-        $ldap->cd($dn);
-        $ldap->cat($dn, array('dn'));
-        if(count($ldap->fetch())){
-          $ldap->cd($dn);
-          $ldap->modify ($attrs); 
-        }else{
-          $ldap->cd($dn);
-          $ldap->add($attrs);
-        }
-        new log("modify","unknown/".get_class($this),$dn,array_keys($attrs),$ldap->get_error());
-      }
-
-
-      /* Display errors 
-       */
-      if($ldap->get_error() != "Success"){
-        show_ldap_error($ldap->get_error(), sprintf(_("Saving of terminal/dns account with dn '%s' failed."),$this->dn));
-      }
-
-      $tmp2 = new servdns($this->config,$this->dn);
-      $tmp2->handle_post_events("modify");
-
-      $this->dnsEntry =  $backup_dnsEntry;
-    }
-  }
-
-  /*  Create html table with all used record types
-   */
-  function generateRecordsList()
-  {
-    $changeStateForRecords = "";
-    
-    if(!$this->DNS_is_account) {
-      $str = "<input type='submit' value='"._("Add")."' name='AddNewRecord' id='AddNewRecord' disabled='disabled'>";
-      return(array("str" => $str, "changeStateForRecords"=> ""));
-    }
-    $str = "<table summary='' width='100%'>";
-    foreach($this->dnsEntry['RECORDS'] as $key => $entry){
-
-        $changeStateForRecords.= "changeState('RecordTypeSelectedFor_".$key."');\n";
-        $changeStateForRecords.= "changeState('RecordValue_".$key."');\n";
-        $changeStateForRecords.= "changeState('RemoveRecord_".$key."');\n";
-
-        $str.=" <tr>".
-          "   <td>".$this->generateRecordListBox($entry['type'],"RecordTypeSelectedFor_".$key)."</td>".
-          "   <td><input type='text' value='".$entry['value']."' name='RecordValue_".$key."' id='RecordValue_".$key."'></td>".
-          "   <td><input type='submit' name='RemoveRecord_".$key."' value='"._("Delete")."' id='RemoveRecord_".$key."'></td>".
-          "</tr>";
-    }
-
-    $str.= "  <tr>".
-           "    <td colspan=2 width='50%'></td><td>".
-           "      <input type='submit' value='"._("Add")."' name='AddNewRecord' id='AddNewRecord'>".
-           "    </td>".
-           "  </tr>".
-           "</table>";
-     $ret =  array("str" => $str, "changeStateForRecords" => $changeStateForRecords);
-    return($ret);
-  }
-
-
-  /* Create a html select box which allows us to select different types of records 
-   */
-  function generateRecordListBox($selected,$name)
-  {
-    $str = "<select name='".$name."' id='".$name."'>";
-    foreach($this->RecordTypes as $type => $value){
-      $use = "";
-      if($type == $selected){
-        $use = " selected ";
-      }
-      $str.="\n <option value='".$type."' ".$use.">".strtoupper(preg_replace("/record/i","",$type))."</option>";
-    }
-    $str.="</select>";
-    return($str); 
-  }
-
-
-  /* Return plugin informations for acl handling  */ 
-  static function plInfo()
-  {
-    $tmp =  array(
-        "plShortName"   => _("DNS"),
-        "plDescription" => _("DNS settings"),
-        "plSelfModify"  => FALSE,
-        "plDepends"     => array(),
-        "plPriority"    => 5,
-        "plSection"     => array("administration"),
-        "plCategory"    => array("workstation","terminal","phone","server","component","printer","winworkstation"),
-
-        "plProvidedAcls"=> array(
-          "ipHostNumber"  => _("IP address"),
-          "macAddress"    => _("MAC address"))
-        );
-
-    /* Hide all dns specific code, if dns is not available
-     */
-    $config = session::get('config');
-    foreach($config->data['TABS']['SERVERSERVICE'] as $tab){
-      if(preg_match("/^servdns$/",$tab['CLASS'])){
-        $tmp['plProvidedAcls']["Records"]        = _("DNS records");
-        $tmp['plProvidedAcls']["zoneName"]       = _("Zone name");
-        $tmp['plProvidedAcls']["dNSTTL"]         = _("TTL");
-        break;
-      }
-    }
-    return($tmp);
-  }
-
-  
-  function get_dhcp_host_entry()
-  {
-    $attrs = array();
-    $dn = $this->get_dhcp_host_entry_dn();
-    if($dn){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->cat($dn,array("*"));
-      if($ldap->count()){
-        $attrs = $ldap->fetch();
-        foreach($attrs as $key => $value){
-          if(is_numeric($key) || ($key == "count")){
-            unset($attrs[$key]);
-          }
-          if(is_array($value) && isset($value['count'])){
-            unset($attrs[$key]['count']);
-          }
-        }
-      }
-    }
-    return($attrs);
-  }
-
-
-  function get_dhcp_host_entry_dn()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=dhcpHost)(cn=".$this->cn."))",array("cn","dn"));
-
-    if($ldap->count()){
-      $attr = $ldap->fetch();
-      return($attr['dn']);
-    }else{
-      return("");
-    }
-  }  
-
-
-  function get_dhcp_parent_node()
-  {
-    return(preg_replace("/^cn=".normalizePreg($this->cn).",/","",$this->get_dhcp_host_entry_dn()));
-  }
-
-
-  function get_dhcp_parent_nodes()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(objectClass=dhcpService)",array("dhcpPrimaryDN"));
-    
-    $dhcp_dns = array();
-    while($attr = $ldap->fetch()){
-      $dhcp_dns[$attr['dn']] = $attr['dhcpPrimaryDN'][0];
-    }
-    foreach($dhcp_dns as $key => $pri_dns){
-      $ldap->cat($pri_dns,array("cn"));
-      $tmp = $ldap->fetch();
-      if(isset($tmp['cn'][0])){
-        $dhcp_dns[$key] = $tmp['cn'][0];
-      }else{
-        unset($dhcp_dns[$key]);
-      }
-    }
-
-    $tmp = $tmp2 = array();
-    foreach($dhcp_dns as $dn => $cn){
-      $ldap->cd($dn);
-      $ldap->search("(|(objectClass=dhcpService)(objectClass=dhcpGroup)".
-                    "(objectClass=dhcpSubnet)(objectClass=dhcpSharedNetwork))",array("cn"));
-      while($attr = $ldap->fetch()){
-        $tmp[$attr['dn']] = $attr['cn'][0];
-      }
-      $tmp2 = array_merge($tmp2,$this->create_tree($tmp,preg_replace("/^[^,]+,/i","",$dn),"(".$cn.")&nbsp;"));
-    }
-    return($tmp2);
-  }
-
-  
-  /* this function returns the default ptr record entry */
-  function get_pTRRecord()
-  {
-    if(!empty($this->ipHostNumber) && isset($this->dnsEntry['zoneName']) && !empty($this->dnsEntry['zoneName'])){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cat(DNS::getDNSZoneDN($this->config,$this->dnsEntry['zoneName']));
-      $attrs = $ldap->fetch();
-      $tmp = array_flip($this->Zones);
-      $tmp = preg_replace("/^[^\/]*+\//","",$tmp[$this->dnsEntry['zoneName']]);
-      $tmp = trim(preg_replace("/\.in-addr.arpa$/","",$tmp));
-      $ptr = preg_replace("/^".normalizePreg(DNS::FlipIp($tmp))."\./","",$this->ipHostNumber);
-      return($ptr);
-    }else{
-      return(FALSE);
-    }
-  }
-
-  
-  function generateRandomIP($net = "")
-  {
-    $str = $net;
-    $cnt = 4;
-    while(substr_count($str,".") < 3 && $cnt > 0){
-      $str .= ".".rand(0,255);
-      $str = preg_replace("/\.\.*/",".",$str);
-      $str = trim($str,". ");
-      $cnt --;
-    }
-    return($str);
-  }
-
-  
-  function create_tree($arr,$base,$current = "")
-  {
-    $ret = array();
-    foreach($arr as $r => $name){
-      $base_part = str_replace($base,"",$r);
-      if(preg_match("/^[a-z]*=".normalizePreg($name)."(|,)$/i",$base_part)){
-        $ret[$r] = $current.$name;
-        $tmp = $this->create_tree($arr,$r,$current.".&nbsp;");
-        foreach($tmp as $sub_key => $sub_name){
-          $ret[$sub_key] = $sub_name;
-        }
-      } 
-    }
-    return($ret);
-  }
-
-  function force_dns()
-  {
-    if($this->DNSenabled){
-      $this->DNS_is_account  = TRUE;
-      $this->hide_dns_check_box = TRUE;
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/component.tpl b/gosa-core/plugins/admin/systems/component.tpl
deleted file mode 100644 (file)
index 3ddd506..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<table summary="" width="100%">
- <tr>
-  <td style="vertical-align:top; width:50%; border-right:1px solid #A0A0A0">
-       <table summary="">
-        <tr>
-         <td><LABEL for="cn">{t}Device name{/t}</LABEL>{$must}</td>
-         <td>
-{render acl=$cnACL}
-          <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-{/render}
-         </td>
-        </tr>
-        <tr>
-          <td colspan=2>&nbsp;</td>
-        </tr>
-        <tr>
-         <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
-         <td>
-{render acl=$baseACL}
-           <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
-            {html_options options=$bases selected=$base_select}
-           </select>
-{/render}
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-
-          </td>
-         </tr>
-       </table>
-  </td>
-  <td style="vertical-align:top">
-       <table summary="">
-        <tr>
-         <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-         <td>  
-{render acl=$descriptionACL}
-          <input id="description" name="description" size=25 maxlength=80 value="{$description}">
-{/render}
-          </td>
-        </tr>
-       </table>
-  </td>
- </tr>
-</table>
-
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-
-{$netconfig}
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
diff --git a/gosa-core/plugins/admin/systems/contents.tpl b/gosa-core/plugins/admin/systems/contents.tpl
deleted file mode 100644 (file)
index 001d50d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{$Kekse} sind gesund
diff --git a/gosa-core/plugins/admin/systems/main.inc b/gosa-core/plugins/admin/systems/main.inc
deleted file mode 100644 (file)
index a43df09..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2003  Cajus Pollmeier
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-if ($remove_lock){
-        if(session::is_set('systems')){
-                $systems = session::get('systems');
-                $systems->remove_lock();
-                del_lock ($ui->dn);
-                session::un_set ('systems');
-        }
-} else {
-       /* Create usermanagement object on demand */
-       if (!session::is_set('systems') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               session::set('systems',new systems($config, $ui));
-       }
-       $systems = session::get('systems');
-       $systems->save_object();
-       $output= $systems->execute();
-
-       /* Reset requested? */
-       if (isset($_GET['reset']) && $_GET['reset'] == 1){
-               del_lock ($ui->dn);
-               session::un_set ('systems');
-       }
-
-       /* Page header*/
-       if (session::is_set('objectinfo')){
-               $display= print_header(get_template_path('images/system.png'), _("System management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix(session::get('objectinfo')));
-       } else {
-               $display= print_header(get_template_path('images/system.png'), _("System management"));
-       }
-
-       /* Show and save dialog */
-       $display.= $output;
-       session::set('systems',$systems);
-}
-
-?>
diff --git a/gosa-core/plugins/admin/systems/network.tpl b/gosa-core/plugins/admin/systems/network.tpl
deleted file mode 100644 (file)
index 7cb6b3f..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-<h2><img       class="center"  alt=""  align="middle"  src="images/network.png">       {t}Network      settings{/t}</h2>
-
-
-<table summary=""      width="100%" cellspacing=0 cellpadding=0>
-       <tr>
-               <td     style="width:50%; vertical-align: top;">
-                       <table  summary="">
-                               <tr>
-                                       <td><LABEL      for="ipHostNumber">{t}IP-address{/t}{if $IPisMust}{$staticAddress}{/if}</LABEL></td>
-                                       <td>
-{render acl=$ipHostNumberACL}
-            <input     id="ipHostNumber"       name="ipHostNumber"     size=25 maxlength=80    value="{$ipHostNumber}">
-{/render}
-{render acl=$ipHostNumberACL}
-{if $DNSAccount == true}
-      <input id="propose_ip" type="submit" name="propose_ip" value="{t}Propose ip{/t}" style="visibility:visible;">
-      {else}
-      <input id="propose_ip" type="submit" name="propose_ip" value="{t}Propose ip{/t}" style="visibility:hidden;">
-      {/if}
-{/render}
-          </td>
-                               </tr>
-                               <tr>
-                                       <td><LABEL      for="macAddress">{t}MAC-address{/t}</LABEL>{$staticAddress}</td>
-                                       <td>
-{render acl=$macAddressACL}
-            <input     name="macAddress"       id="macAddress" size=25 maxlength=80    value="{$macAddress}">
-{/render}
-            {if $autonet==true}
-                                           <input type="submit" name="autonet" value="{t}Autodetect{/t}">
-            {/if}
-          </td>
-                               </tr>
-        {if $dhcpEnabled}
-        <tr>
-          <td colspan=2 style='padding-top:12px;'>
-            <table>
-              {if $dhcpParentNodeCnt}
-              <tr>
-                <td>
-                  <input onClick='document.mainform.submit();'
-                    {if $dhcp_is_Account} checked {/if} type='checkbox' name='dhcp_is_Account' class='center'>
-                </td>
-                <td>
-                  {t}Enable DHCP for this device{/t}
-                  <input type='image' src='images/list_reload.png' class='center'>
-                </td>
-              </tr>
-              {else}
-              <tr>
-                <td>
-                  <input type='checkbox' name='dummy' class='center' disabled>
-                  {t}Enable DHCP for this device{/t} ({t}not configured{/t})
-                  <input type='image' src='images/list_reload.png' class='center'>
-                </td>
-              </tr>
-              {/if}
-              {if $dhcp_is_Account}
-              <tr>
-                <td>&nbsp;</td>
-                <td>
-                  {t}Parent node{/t}
-                  <select name='dhcpParentNode'>      
-                    {html_options options=$dhcpParentNodes selected=$dhcpParentNode}
-                  </select>
-                  &nbsp;
-                  <input type='submit' name='dhcpEditOptions' value='{t}Edit settings{/t}'>
-                </td>
-              </tr>
-              {/if}
-            </table>
-          </td>
-        </tr>
-        {/if}
-      </table> 
-    </td>
-    {if $DNS_is_account==true}
-               <td     style="width:50%;vertical-align:top;border-left:1px solid #b0b0b0;" valign="top">
-
-    {if $ZoneCnt}
-      {if $DNSAccount == true}
-      <input type="checkbox" name="DNS_is_account" value="1"  
-        checked="checked"
-        onclick="toggle('test2');
-          changeState('zoneName');
-          changeState('dNSTTL');
-          toggle('propose_ip');
-          changeState('AddNewRecord');
-          {$changeStateForRecords}"/>
-        {else}
-      <input type="checkbox" name="DNS_is_account" value="1"  
-        onclick="toggle('test2');
-          changeState('zoneName');
-          changeState('dNSTTL');
-          toggle('propose_ip');
-          changeState('AddNewRecord');"/>
-        {/if}
-
-      {t}Enable DNS for this device{/t}
-      <input type='image' src='images/list_reload.png' class='center' name="reloadThisDNSStuff" >
-      {if $DNSAccount == true}
-      <div style="padding-left:20px;visibility:visible;" id="test2">
-      {else}
-      <div style="padding-left:20px;visibility:hidden;" id="test2">
-      {/if}
-                       <table summary="">
-                               <tr>
-                                       <td><LABEL      for="zoneName">{t}Zone{/t}</LABEL></td>
-                                       <td>
-{render acl=$zoneNameACL}
-              <select name="zoneName" id="zoneName" {if $DNSAccount == false} disabled {/if}>
-                {html_options values=$ZoneKeys output=$Zones selected=$zoneName}
-              </select>
-{/render}
-          </td>
-        </tr>
-        <tr>
-          <td>{t}TTL{/t}</td>
-          <td>
-{render acl=$dNSTTLACL}
-            <input type="text" name="dNSTTL" value="{$dNSTTL}" id="dNSTTL" {if $DNSAccount == false} disabled {/if}>
-{/render}
-          </td>
-        </tr>
-        <tr>
-          <td valign="top">{t}Dns records{/t}</td>
-          <td>
-            {if $DNS_is_account == true}
-{render acl=$RecordsACL}
-              {$records}
-{/render}
-            {/if}
-          </td>
-                               </tr>
-                       </table>
-      </div>
-    {else}        
-      <input type="checkbox" name="dummy" value="1" disabled class='center'>
-      {t}Enable DNS for this device{/t} ({t}not configured{/t})
-      <input type='image' src='images/list_reload.png' class='center'>
-    {/if}
-
-               </td>
-    {/if}
-    
-       </tr>
-</table>
-<input type="hidden" name="network_tpl_posted" value="1">
-
-<!--
-vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
--->
diff --git a/gosa-core/plugins/admin/systems/password.tpl b/gosa-core/plugins/admin/systems/password.tpl
deleted file mode 100644 (file)
index 734a4ae..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<p>
- {t}To change the terminal root password use the fields below. The changes take effect during the next reboot. Please memorize the new password, because you wouldn't be able to log in.{/t}
-</p>
-<p>
- <b>{t}Leave fields blank for password inheritance from default entries.{/t}</b>
-</p>
-
-<p>
- {t}Changing the password impinges on authentification only.{/t}
-</p>
-
-<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
-  <tr>
-    <td><b><LABEL for="new_password">{t}New password{/t}</LABEL></b></td>
-    <td><input id="new_password" type="password" name="new_password" size="30" maxlength="40"
-               onFocus="nextfield= 'repeated_password';"></td>
-  </tr>
-  <tr>
-    <td><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
-    <td><input type="password" id="repeated_password" name="repeated_password" size="30" maxlength="40"
-               onFocus="nextfield= 'password_finish';"></td>
-  </tr>
-</table>
-
-<br>
-
-<p class="plugbottom">
-  <input type=submit name="password_finish" value="{t}Set password{/t}">
-  &nbsp;
-  <input type=submit name="password_cancel" value="{t}Cancel{/t}">
-</p>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       nextfield= 'new_password';
-       focus_field('new_password');
-  -->
-</script>
diff --git a/gosa-core/plugins/admin/systems/paste_generic.tpl b/gosa-core/plugins/admin/systems/paste_generic.tpl
deleted file mode 100644 (file)
index b15920a..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-{if $object == "server"}
-    <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}Server name{/t}</LABEL>{$must}</td>
-      <td>
-       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-      </td>
-     </tr>
-       </table>
-{/if}
-{if $object == "workstation"}
-    <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}workstation name{/t}</LABEL>{$must}</td>
-      <td>
-       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-      </td>
-     </tr>
-       </table>
-{/if}
-{if $object == "terminal"}
-    <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}Terminal name{/t}</LABEL>{$must}</td>
-      <td>
-       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-      </td>
-     </tr>
-       </table>
-{/if}
-{if $object == "printer"}
-    <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}Printer name{/t}</LABEL>{$must}</td>
-      <td>
-       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-      </td>
-     </tr>
-       </table>
-{/if}
-{if $object == "phone"}
-    <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}Phone name{/t}</LABEL>{$must}</td>
-      <td>
-       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-      </td>
-     </tr>
-       </table>
-{/if}
-{if $object == "component"}
-    <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}Component name{/t}</LABEL>{$must}</td>
-      <td>
-       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-      </td>
-     </tr>
-       </table>
-{/if}
diff --git a/gosa-core/plugins/admin/systems/remove.tpl b/gosa-core/plugins/admin/systems/remove.tpl
deleted file mode 100644 (file)
index dc5dbb2..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<div style="font-size:18px;">
-<img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
- {$warning}
- {t}This includes all system and setup informations. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
-</p>
-
-<p>
- {t}Best thing to do before performing this action would be to save the current contents of your LDAP tree in a file. So - if you've done so - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-       {if $multiple}
-               <input type=submit name="delete_multiple_system_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_multiple_system_cancel" value="{t}Cancel{/t}">
-       {else}
-               <input type=submit name="delete_terminal_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-       {/if}
-</p>
diff --git a/gosa-core/plugins/admin/systems/server.tpl b/gosa-core/plugins/admin/systems/server.tpl
deleted file mode 100644 (file)
index 4e2d9b6..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-<table summary="" width="100%">
- <tr>
-  <td style="vertical-align:top; width:50%;">
-       <table summary="">
-        <tr>
-         <td><LABEL for="cn">{t}Server name{/t}</LABEL>{$must}</td>
-         <td>
-{render acl=$cnACL}
-          <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-{/render}
-         </td>
-        </tr>
-        <tr>
-         <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-         <td>
-{render acl=$descriptionACL}
-           <input name="description" id="description" size=25 maxlength=80 value="{$description}">
-{/render}
-          </td>
-        </tr>
-        <tr>
-         <td><br><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
-         <td>
-          <br>
-{render acl=$baseACL}
-      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
-       {html_options options=$bases selected=$base_select}
-      </select>
-{/render}
-
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-          </td>
-         </tr>
-       </table>
-  </td>
-  <td  style="vertical-align:top;border-left:1px solid #A0A0A0;">
-       <table summary="">
-       <tr>
-     <td>{t}Mode{/t}</td>
-     <td>
-{render acl=$gotoModeACL}
-      <select name="gotoMode" title="{t}Select terminal mode{/t}">
-       {html_options options=$modes selected=$gotoMode}
-      </select>
-{/render}
-     </td>
-    </tr>
-       </table>
-  </td>
- </tr>
-</table>
-
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-
-{$netconfig}
-
-{if $fai_activated}
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-
-<h2><img class="center" alt="" align="middle" src="images/rocket.png"> {t}Action{/t}</h2>
-<table summary="">
- <tr>
-  <td>
-{render acl=$FAIstateACL}
-   <select size="1" name="saction" title="{t}Select action to execute for this server{/t}">
-    <option disabled>&nbsp;</option>
-    {html_options options=$actions}
-   </select>
-{/render}
-  </td>
-  <td>
-   <input type=submit name="action" value="{t}Execute{/t}">
-  </td>
- </tr>
-</table>
-{/if}
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
diff --git a/gosa-core/plugins/admin/systems/services/ServiceAddDialog.tpl b/gosa-core/plugins/admin/systems/services/ServiceAddDialog.tpl
deleted file mode 100644 (file)
index f055f33..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<div style="height:5px">&nbsp;</div>
-<div style="font-size:18px;">
-       {t}Adding a new service to the current server{/t}
-</div>
-<br>
-<p class="seperator">
-{t}This dialog allows you to add new services to the currenty edited server object. The box below shows all available but not already used services.{/t}
-<br>
-<br>
-</p>
-{if $Services} 
-<br>
-<br>{t}Service to add{/t} &nbsp;
-       <select name="ServiceName" >
-               <option value="" >&nbsp;</option>
-               {html_options options=$Services }
-       </select>
-{else}
-       <br>
-       {t}All available services are already in use.{/t}
-       <br>
-{/if}
-<br>
-<br>
-<br>
-<p class="seperator">
-<div style="width:100%; text-align:right;padding-top:8px;padding-bottom:3px;">
-    <input type='submit' name='SaveServiceAdd' value='{t}Continue{/t}' {if !$Services} disabled {/if}>
-    &nbsp;
-    <input type='submit' name='CancelServiceAdd' value='{t}Cancel{/t}'>
-</div>
-
diff --git a/gosa-core/plugins/admin/systems/services/class_ServiceAddDialog.inc b/gosa-core/plugins/admin/systems/services/class_ServiceAddDialog.inc
deleted file mode 100644 (file)
index 47e9701..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-class ServiceAddDialog extends plugin{
-
-  var $cli_summary      = "This dialog is used to add services";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("config"=>"Config object" , "dn"=>"Object dn");
-
-  /* This plugin does not have any ocs */
-  var $objectclasses    = array();
-  var $parent           = NULL;
-
-  function ServiceAddDialog(&$config,$dn,$parent)
-  {
-    plugin::plugin($config);
-    $this->parent = $parent;
-  }
-
-  function execute()
-  {
-    $smarty = get_smarty();
-    $services = $this->parent->getAllUnusedServices();
-    natcasesort($services);
-    $smarty->assign("Services",$services);
-    return($smarty->fetch(get_template_path("ServiceAddDialog.tpl", TRUE,dirname(__FILE__))));
- }
-
-  function check(){ return array();}
-  function save_object(){;}
-  function save(){}
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/services/class_goService.inc b/gosa-core/plugins/admin/systems/services/class_goService.inc
deleted file mode 100644 (file)
index edfd3d7..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-<?php
-
-class goService extends plugin{
-       
-  var $cli_summary      = "This plugin is used within the ServerService plugin.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array();
-  var $attributes       = array();
-  var $StatusFlag       = "";
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts            = array();
-  var $dn                   = NULL;
-  var $cn                   = "";
-  var $DisplayName          = "";
-  var $view_logged  =FALSE;
-
-   
-  /* Construcktion */ 
-  function goService(&$config,$dn)
-  {
-    plugin::plugin($config,$dn);
-    $this->DisplayName = _("Empty service");
-  }
-
-  
-  /* Create content */
-  function execute()
-  {
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    $str ="<div style='width:100%; text-align:right;'>".
-          "  <input type='submit' name='SaveService' value='"._("Save")."'>&nbsp;".
-          "  <input type='submit' name='CancelService' value='"._("Cancel")."'>".
-          "</div>";
-    return($str);
-  }
-
-
-  /* Get service information for serverService plugin */
-  function getListEntry()
-  {
-    
-    $this->updateStatusState();
-
-    /* Assign status flag */
-    if(!empty($this->StatusFlag)){
-      $flag                   = $this->StatusFlag;
-      $fields['Status']       = $this->$flag;
-    }else{
-      $fields['Status']       = "";
-    }
-
-    /* Name displayed in service overview */
-    $fields['Message']      = _("Empty service");
-
-    /* Allow/disallow some functions */
-    $fields['AllowStart']   = $this->acl_is_writeable("start");
-    $fields['AllowStop']    = $this->acl_is_writeable("stop");
-    $fields['AllowRestart'] = $this->acl_is_writeable("restart");
-    $fields['AllowRemove']  = $this->acl_is_removeable();
-    $fields['AllowEdit']    = true;
-    return($fields);
-  }
-
-
-  /* Remove service */
-  function remove_from_parent()
-  {
-    if(!$this->initially_was_account || !$this->acl_is_removeable()){
-      return;
-    }
-    
-    plugin::remove_from_parent();
-
-    /* Remove status flag, it is not a memeber of 
-        this->attributes, so ensure that it is deleted too */
-    if(!empty($this->StatusFlag)){
-      $this->attrs[$this->StatusFlag] = array();
-    }
-
-    /* Check if this is a new entry ... add/modify */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cat($this->dn,array("objectClass"));
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      
-    }
-
-    new log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of server services/".get_class($this)." - (".$this->DisplayName.") with dn '%s' failed."),$this->dn));
-    $this->handle_post_events("remove");
-  }
-
-
-  /* Save service */
-  function save()
-  {
-    plugin::save();
-    /* Check if this is a new entry ... add/modify */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cat($this->dn,array("objectClass"));
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    if($this->initially_was_account){
-      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("modify");
-    }else{
-      $this->handle_post_events("add");
-      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of server services/".get_class($this)." - (".$this->DisplayName.") with dn '%s' failed."),$this->dn));
-  }
-
-
-  /* Directly save new status flag */
-  function setStatus($value)
-  {
-    if($value == "none") return;
-
-    /* Can't set status flag for new services (Object doesn't exists in ldap tree) */
-    if(!$this->initially_was_account) return;
-
-    /* Can't set status flag, if no flag is specified  */
-    if(empty($this->StatusFlag)){
-      return;
-    }
-
-    /* Get object (server), update status flag and save changes */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $ldap->cat($this->dn,array("objectClass"));
-    if($ldap->count()){
-
-      $tmp = $ldap->fetch();
-      for($i = 0; $i < $tmp['objectClass']['count']; $i ++){
-        $attrs['objectClass'][] = $tmp['objectClass'][$i];
-      }
-      $flag = $this->StatusFlag;
-      $attrs[$flag] = $value;
-      $this->$flag = $value;
-      $ldap->modify($attrs);
-      show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for server services/".get_class($this)." - (".$this->DisplayName.") with dn '%s' failed."),$this->dn));
-      $this->action_hook();
-    }
-  }
-
-
-  function check()
-  { 
-    $message = plugin::check();
-    return($message);
-  }
-  
-
-  function save_object()
-  {
-    plugin::save_object();
-  }  
-
-  
-  function action_hook($add_attrs= array())
-  {
-    /* Find postcreate entries for this class */
-    $command= $this->config->search(get_class($this), "ACTION_HOOK",array('menu','tabs'));
-    if ($command != ""){
-
-      /* Walk through attribute list */
-      foreach ($this->attributes as $attr){
-        if (!is_array($this->$attr)){
-          $command= preg_replace("/%$attr/", $this->$attr, $command);
-        }
-      }
-      $command= preg_replace("/%dn/", $this->dn, $command);
-
-      /* Additional attributes */
-      foreach ($add_attrs as $name => $value){
-        $command= preg_replace("/%$name/", $value, $command);
-      }
-
-      /* If there are still some %.. in our command, try to fill these with some other class vars */
-      if(preg_match("/%/",$command)){
-        $attrs = get_object_vars($this);
-        foreach($attrs as $name => $value){
-          if(!is_string($value)) continue;
-          $command= preg_replace("/%$name/", $value, $command);
-        }
-      }
-
-      if (check_command($command)){
-        @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
-            $command, "Execute");
-
-        exec($command);
-      } else {
-        $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this));
-        print_red ($message);
-      }
-    }
-  }
-
-
-  /* Get updates for status flag */
-  function updateStatusState()
-  {
-    if(empty($this->StatusFlag)) return;
-
-    $attrs = array();
-    $flag = $this->StatusFlag;
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->cn);
-    $ldap->cat($this->dn,array($flag));
-    if($ldap->count()){
-      $attrs = $ldap->fetch();
-    }
-    if(isset($attrs[$flag][0])){
-      $this->$flag = $attrs[$flag][0];
-    }
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/tabs_arpnewdevice.inc b/gosa-core/plugins/admin/systems/tabs_arpnewdevice.inc
deleted file mode 100644 (file)
index fe12b40..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-class ArpNewDeviceTabs extends tabs
-{
-
-  function save($ignore_account= FALSE)
-  {
-    tabs::save($ignore_account);
-  }
-
-  function execute()
-  {
-    tabs::execute(); 
-    return($this->by_object[$this->current]->execute());
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/tabs_component.inc b/gosa-core/plugins/admin/systems/tabs_component.inc
deleted file mode 100644 (file)
index ff0c69d..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-class componenttabs extends tabs
-{
-
-  function componenttabs($config, $data, $dn,$category)
-  {
-    tabs::tabs($config, $data, $dn,$category);
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function save_object($save_current= FALSE)
-  {
-    tabs::save_object($save_current);
-  }
-
-
-  function save($ignore_account= FALSE)
-  {
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $baseobject= $this->by_object['componentGeneric'];
-    $this->dn= "cn=$baseobject->cn,".get_ou('componentou').$baseobject->base;
-    $baseobject->dn= $this->dn;
-
-    foreach ($this->by_object as $key => $obj){
-      $this->by_object[$key]->dn= $this->dn;
-    }
-
-    tabs::save(TRUE);
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/tabs_server.inc b/gosa-core/plugins/admin/systems/tabs_server.inc
deleted file mode 100644 (file)
index 322851b..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-class servtabs extends tabs
-{
-
-  function servtabs($config, $data, $dn,$category)
-  {
-    /* Save dn */
-    $this->dn= $dn;
-    $this->config= $config;
-
-    $baseobject= NULL;
-
-    foreach ($data as $tab){
-      $this->by_name[$tab['CLASS']]= $tab['NAME'];
-
-      if ($baseobject === NULL){
-        $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
-        $this->by_object[$tab['CLASS']]= $baseobject;
-      } else {
-        $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
-      }
-
-      $this->by_object[$tab['CLASS']]->parent= &$this;
-      $this->by_object[$tab['CLASS']]->set_acl_category($category);
-
-      /* Initialize current */
-      if ($this->current == ""){
-        $this->current= $tab['CLASS'];
-      }
-    }
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function save_object($save_current= FALSE)
-  {
-    tabs::save_object($save_current);
-  }
-
-
-  function save($ignore_account= FALSE)
-  {
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $baseobject= $this->by_object['servgeneric'];
-    $this->dn= "cn=$baseobject->cn,".get_ou('serverou').$baseobject->base;
-    $baseobject->dn= $this->dn;
-
-    foreach ($this->by_object as $key => $obj){
-      $this->by_object[$key]->dn= $this->dn;
-      $this->by_object[$key]->cn= $baseobject->cn;
-    }
-
-    tabs::save(FALSE);
-
-    /* Reload server settings after saving */
-    $config = session::get('config');
-    $config->load_servers();
-    session::set('config',$config);
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/systems/admin/systems/class_baseSelectDialog.inc b/gosa-plugins/systems/admin/systems/class_baseSelectDialog.inc
new file mode 100644 (file)
index 0000000..04275e0
--- /dev/null
@@ -0,0 +1,197 @@
+<?php
+
+class baseSelectDialog extends MultiSelectWindow
+{
+  var $selectedBase        = ""; // Used for navigation 
+  var $base_selection_regex = "*"; // Used regex ... 
+  var $BaseToUse         = false;  // used to specify the selected base, 
+                                      // false if none is selected
+
+  var $allowedBases         = array();
+  var $parent               = NULL;
+  function baseSelectDialog (&$config,$parent,$onlyAllowThisBases = array())
+  {
+    $module= "all";
+    MultiSelectWindow::MultiSelectWindow($config, "BASEselectWindow", $module);
+   
+    $this->parent = $parent;
+    $this->selectedBase = $config->current['BASE'];
+    $this->allowedBases  = $onlyAllowThisBases;
+
+    $this->SetTitle("Base");
+    $this->SetSummary(_("Choose a base"));
+    $this->SetListHeader("<div style='background:#F0F0F9;padding:5px;'>".
+        " <input class='center' type='image' src='images/list_root.png' align='middle'
+        title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
+        " <input class='center' type='image' align='middle' src='images/list_back.png'
+        title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'>&nbsp;".
+        " <input class='center' type='image' align='middle' src='images/list_home.png'
+        title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'>&nbsp;".
+        " <input class='center' type='image' src='images/list_reload.png' align='middle' title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
+        "</div>");
+
+    $this->SetInformation(_("Step in the prefered tree and click save to use the current subtree as base. Or click the image at the end of each entry."));
+
+    $this->EnableAplhabet   (true);
+    $this->EnableCloseButton(true);
+    $this->EnableSaveButton (true);
+
+    $this->SetSaveButtonString(_("Use"));
+    $this->SetCloseButtonString(_("Cancel"));
+
+    $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>_("Base")));
+    $this->AddHeader(array("string"=>_("Action"),"attach"=>"style='width:50px;border-right:0px;'"));
+
+    /*                  Text        ,Value    ,Name         ,Is selected */
+//  $this->AddCheckBox("Doesnothing","servers","Doesnothing",true);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("base_selection_regex",_("Filter entries with this syntax"),"*"      , true);
+  }
+
+  function execute()
+  {
+    $this->setEntries();
+    return($this->Draw());
+  }
+
+  function setEntries()
+  {
+    $this->ClearElementsList();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->selectedBase);
+    $ldap->ls("(&(objectClass=gosaDepartment)
+                 (|(ou=".$this->base_selection_regex.")
+                   (cn=".$this->base_selection_regex.")
+                   (description=".$this->base_selection_regex.")))",
+              $this->selectedBase,array("ou","description","cn"));
+
+    $link = "<a href='?plug=".$_GET['plug']."&open_dep=%s'>%s</a>";
+
+    $base_back          = preg_replace("/^[^,]+,/","",$this->selectedBase);
+    $base_back          = convert_department_dn($base_back);
+  
+    /* Add departments, to be able to switch into them
+     */
+    while($attrs = $ldap->fetch()){
+      $key = $attrs['dn']  ;
+      $val = $attrs['ou'][0];
+    
+      if(count($this->allowedBases) != 0){
+        if(!isset($this->allowedBases[$key])){
+          continue;
+          break;
+        }
+      }
+      /* Append description */ 
+      if(isset($attrs['description'][0])){
+        $val.=" [".$attrs['description'][0]."]";
+      }
+
+      /* Add missing entries ... */
+      if(!isset($this->config->departments[trim($key)])){
+        $this->config->departments[trim($key)]="";
+      }
+
+      /* check if this department contains sub-departments
+         Display different image in this case
+       */
+      $non_empty="";
+      $keys= str_replace("/","\/",$key);
+      foreach($this->config->departments as $keyd ){
+        if(preg_match("/,".$keys."/",$keyd)){
+          $non_empty="full";
+        }
+      }
+
+      /* Add to divlist */
+      $field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>", 
+                      "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($link,base64_encode($key),$val), "attach" => "style=''");
+      $field3 = array("string" => sprintf("&nbsp;<input title='"._("Select this base")."' type='image' img src='images/save.png' name='usebase_%s'>",base64_encode($key)), 
+                      "attach" => "style='width:50px;border-right:0px;text-align:right;'");
+      $this->AddElement(array($field1,$field2,$field3));
+    }
+  }
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+    $this->BaseToUse = $this->selectedBase;
+  }
+
+  function isSelected() 
+  {
+    return($this->BaseToUse);
+  }
+
+  function setCurrentBase($base)
+  {
+    $this->selectedBase = $base;
+  }
+
+  function save_object()
+  {
+    /* Save current base */
+    $old_base = $this->selectedBase;
+  
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow::save_object();   
+    
+    if(isset($_GET['open_dep'])){
+      $this->selectedBase = base64_decode($_GET['open_dep']);
+    } 
+
+    $s_action ="";
+    foreach($_POST as $key => $value){
+      if(preg_match("/^dep_back.*/i",$key)){
+        $s_action="back";
+      }elseif(preg_match("/^dep_root.*/",$key)){
+        $s_action="root";
+      }elseif(preg_match("/^dep_home.*/i",$key)){
+        $s_action="home";
+      }elseif(preg_match("/^usebase_/",$key)){
+        $tmp = preg_replace("/^usebase_/","",$key);
+        $tmp = preg_replace("/_.*$/","",$tmp);
+        $tmp = base64_decode($tmp);
+        $this->BaseToUse = $tmp;
+      }
+    }
+
+    $ui= get_userinfo();
+    /* Homebutton is posted */
+    if($s_action=="home"){
+      $this->selectedBase=(preg_replace("/^[^,]+,/","",$ui->dn));
+      $this->selectedBase=(preg_replace("/^[^,]+,/","",$this->selectedBase));
+    }
+
+    /* back to the roots ^^ */
+    if($s_action=="root"){
+      $this->selectedBase=($this->config->current['BASE']);
+    }
+
+    /* If Backbutton is Posted */
+    if($s_action=="back"){
+      $base_back          = preg_replace("/^[^,]+,/","",$this->selectedBase);
+      $base_back          = convert_department_dn($base_back);
+
+      if(isset($this->config->departments[trim($base_back)])){
+        $this->selectedBase= $this->config->departments[trim($base_back)];
+      }else{
+        $this->selectedBase= $this->config->departments["/"];
+      }
+    }
+
+    /* Restore old base, if selected base is not allowed */
+    if(count($this->allowedBases) && !isset($this->allowedBases[$this->selectedBase])){
+      $this->selectedBase = $old_base;
+    }
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/systems/admin/systems/class_componentGeneric.inc b/gosa-plugins/systems/admin/systems/class_componentGeneric.inc
new file mode 100644 (file)
index 0000000..5836251
--- /dev/null
@@ -0,0 +1,331 @@
+<?php
+
+class componentGeneric extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage component base objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Generic terminal attributes */
+  var $interfaces= array();
+  var $ignore_account= TRUE;
+
+  /* Needed values and lists */
+  var $base= "";
+  var $cn= "";
+  var $description= "";
+  var $orig_dn= "";
+
+  /* attribute list for save action */
+  var $attributes= array("cn", "description");
+  var $objectclasses= array("top", "device", "ipHost", "ieee802Device");
+  var $netConfigDNS;
+  var $view_logged  = FALSE;
+
+  function componentGeneric (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    /* Set base */
+    if ($this->dn == "new"){
+      $ui= get_userinfo();
+      $this->base= dn2base($ui->dn);
+      $this->cn= "";
+    } else {
+      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
+    }
+    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses, true);
+    /* Save dn for later references */
+    $this->orig_dn= $this->dn;
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","component/".get_class($this),$this->dn);
+    }
+
+    /* Do we represent a valid phone? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+        _("This 'dn' has no network features.")."</b>";
+      return($display);
+    }
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+
+        /* A new base was selected, check if it is a valid one */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $smarty->assign("bases", $this->config->idepartments);
+
+    /* Set acls */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $smarty->assign("bases", $this->get_allowed_bases());
+
+    /* Assign attributes */
+    foreach ($this->attributes as $attr){
+      $smarty->assign("$attr", $this->$attr);
+    }
+    $smarty->assign("base_select", $this->base);
+
+    /* Show main page */
+    $str = $this->netConfigDNS->execute();
+    if(is_object($this->netConfigDNS->dialog)){
+      return($str);
+    }
+    $smarty->assign("netconfig", $str);
+    return($smarty->fetch (get_template_path('component.tpl', TRUE)));
+  }
+
+  function set_acl_base($base)
+  {
+    plugin::set_acl_base($base);
+    $this->netConfigDNS->set_acl_base($base);
+  }
+
+  function set_acl_category($cat)
+  {
+    plugin::set_acl_category($cat);
+    $this->netConfigDNS->set_acl_category($cat);
+  }
+
+  function remove_from_parent()
+  {
+    $ldap= $this->config->get_ldap_link();
+    $this->netConfigDNS->remove_from_parent();
+    $ldap->rmdir($this->dn);
+    
+    new log("remove","component/".get_class($this),$this->dn,$this->attributes,$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of system component/generic with dn '%s' failed."),$this->dn));
+    $this->handle_post_events(array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
+    while ($ldap->fetch()){
+      $og= new ogroup($this->config, $ldap->getDN());
+      unset($og->member[$this->dn]);
+      $og->save ();
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    
+    /* Create a base backup and reset the
+       base directly after calling plugin::save_object();
+       Base will be set seperatly a few lines below */
+    $base_tmp = $this->base;
+    plugin::save_object();
+    $this->base = $base_tmp;
+
+    $this->netConfigDNS->save_object();
+
+    /* Set new base if allowed */
+    $tmp = $this->get_allowed_bases();
+    if(isset($_POST['base'])){
+      if(isset($tmp[$_POST['base']])){
+        $this->base= $_POST['base'];
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    $message= array_merge($message,$this->netConfigDNS->check());
+
+    $this->dn= "cn=".$this->cn.",".get_ou('componentou').$this->base;
+
+    if ($this->cn == "" ){
+      $message[]= _("The required field 'Component name' is not set.");
+    }
+
+    /* Check if given name is a valid host/dns name */
+    if(!tests::is_dns_name($this->cn)){
+      $message[] = _("Please specify a valid name for this object.");
+    }
+
+    /* To check for valid ip*/
+    if($this->netConfigDNS->ipHostNumber == ""){
+       $message[]= _("The required field IP address is empty.");
+    } else {
+      if (!tests::is_ip($this->netConfigDNS->ipHostNumber)){
+        $message[]= _("The field IP address contains an invalid address.");
+      }
+    }
+
+    if ($this->orig_dn != $this->dn){
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd ($this->base);
+      $ldap->search ("(cn=".$this->cn.")", array("cn"));
+      if ($ldap->count() != 0){
+        while ($attrs= $ldap->fetch()){
+          if(preg_match("/cn=dhcp,/",$attrs['dn'])){
+            continue;
+          }
+          if ($attrs['dn'] != $this->orig_dn){
+            $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
+            break;
+          }
+        }
+      }
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Remove all empty values */
+    if ($this->orig_dn == 'new'){
+      $attrs= array();
+      foreach ($this->attrs as $key => $val){
+        if (is_array($val) && count($val) == 0){
+          continue;
+        }
+        $attrs[$key]= $val;
+      }
+      $this->attrs= $attrs;
+    }
+
+    /* If this is a new Object IP & Mac aren't set.
+         IP & Mac are msut attributes, so we set this values by here. */
+    if($this->orig_dn == 'new'){
+      $this->attrs['ipHostNumber'] = $this->netConfigDNS->ipHostNumber;
+      $this->attrs['macAddress']  = $this->netConfigDNS->macAddress;
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    if ($this->orig_dn == 'new'){
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      new log("create","component/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+      
+    } else {
+      if ($this->orig_dn != $this->dn){
+        $this->move($this->orig_dn, $this->dn);
+      }
+
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+      new log("modify","component/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+    }
+
+    $this->netConfigDNS->cn = $this->cn;
+    $this->netConfigDNS->save();
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system component/generic with dn '%s' failed."),$this->dn));
+  }
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Component generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 1,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("component" => array("description"  => _("Network device"),
+                                                        "objectClass"  => array("device", "ipHost", "ieee802Device"))),
+          "plProvidedAcls"=> array(
+            "cn"                  => _("Name"),
+            "base"                => _("Base"),
+            "description"         => _("Description"))
+          ));
+  }
+
+  /* Display generic part for server copy & paste */
+  function getCopyDialog()
+  {
+    $vars = array("cn");
+    $smarty = get_smarty();
+    $smarty->assign("cn" ,$this->cn);
+    $smarty->assign("object","component");
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    if(isset($source['macAddress'][0])){
+      $this->netConfigDNS->macAddress = $source['macAddress'][0];
+    }
+    if(isset($source['ipHostNumber'][0])){
+      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/systems/admin/systems/class_divListSystem.inc b/gosa-plugins/systems/admin/systems/class_divListSystem.inc
new file mode 100644 (file)
index 0000000..61871b7
--- /dev/null
@@ -0,0 +1,468 @@
+<?php
+
+class divListSystem extends MultiSelectWindow
+{
+
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+
+  /* Regex */
+  var $Regex              = "*";
+  var $UserRegex          = "*";
+
+  /* CheckBoxes, to change default values modify $this->AddCheckBox */
+  var $ShowServers;
+  var $ShowTerminals;
+  var $ShowWorkstations;
+  var $ShowWinWorkstations;
+  var $ShowPrinters;
+  var $ShowDevices;
+  var $ShowPhones;
+
+  /* Subsearch checkbox */
+  var $SubSearch;
+
+  var $parent             ;
+  var $ui                 ;
+
+  function divListSystem (&$config,$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config, "System", array("server",
+                                                                  "workstation",
+                                                                  "terminal",
+                                                                  "phone",
+                                                                  "incoming",
+                                                                  "printer"));
+
+    $this->parent       = $parent;
+    $this->ui           = get_userinfo();
+
+    /* Set list strings */
+    $this->SetTitle(_("List of systems"));
+    $this->SetSummary(_("List of systems"));
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->SetInformation(_("This menu allows you to add, remove and change the properties of specific systems. You can only add systems which have already been started once."));
+
+    $this->EnableAplhabet   (true);
+
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 110;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>_("System / Department")));
+    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:".$action_col_size."px;border-right:0px;'"));
+
+    /*                  Text        ,Value    ,Name         ,Is selected */
+    $this->AddCheckBox("ShowServers",         _("Select to see servers"),            _("Show servers"),          true);
+    $this->AddCheckBox("ShowTerminals",       _("Select to see Linux terminals"),    _("Show terminals") ,       true);
+    $this->AddCheckBox("ShowWorkstations",    _("Select to see Linux workstations"), _("Show workstations"),     true);
+    $this->AddCheckBox("ShowWinWorkstations", _("Select to see MicroSoft Windows based workstations"), _("Show windows based workstations"),true);
+    $this->AddCheckBox("ShowPrinters",        _("Select to see network printers"),    _("Show network printers") ,true);
+    $this->AddCheckBox("ShowPhones",          _("Select to see VOIP phones"),         _("Show phones") ,          true);
+    $this->AddCheckBox("ShowDevices",         _("Select to see network devices"),     _("Show network devices"),  true);
+
+    /* Add SubSearch checkbox */
+    $this->AddCheckBox(SEPERATOR);
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Display systems matching"),"*" , true);
+    $this->AddRegex   ("UserRegex", _("Display systems of user"), "*" , false, "images/search_user.png");
+  }
+
+  function GenHeader()
+  {
+   /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $first = "";
+    $found = FALSE;
+    $department = $departments = array();
+    foreach($this->module as $module){
+      $d = $ui->get_module_departments($module);      
+      foreach($d as $department){
+        $departments[$department] = $department;
+      }
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $departments)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* If there is at least one c (Create) and one w (Write) acl in this combination
+        display the snapshot paste icon. BUT check the correct acls in the management plugin */
+    $all_module_acls = "";
+    foreach($this->module as $module){
+      $all_module_acls .= $ui->has_complete_category_acls($this->selectedBase,$module);
+    }
+
+    /* Must we add an additional seperator */
+    $add_sep = false;
+   
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+
+    /* Add base selection */
+    $listhead .= _("Base")."&nbsp; <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+      " <input class='center' type='image' src='images/list_submit.png' align='middle'
+      title='"._("Submit department")."' name='submit_department' alt='".           _("Submit")."'>&nbsp;";
+
+    /* Handle create icons */ 
+    $s = ".|"._("Actions")."|\n";
+    $s.= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"terminal/termgeneric"))){
+      $s.= "...|<img src='images/select_terminal.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Terminal")."|"."newsystem_terminal|\n";
+    }
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"workstation/workgeneric"))){
+      $s.= "...|<img src='images/select_workstation.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Workstation")."|"."newsystem_workstation|\n";
+    }
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"workstation/workgeneric"))){
+      $s.= "...|<img src='images/select_server.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Server")."|"."newsystem_server|\n";
+    }
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"phone/phoneGeneric"))){
+      $s.= "...|<img src='images/select_phone.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Phone")."|"."newsystem_phone|\n";
+    }
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"printer/printgeneric"))){
+      $s.= "...|<img src='images/select_printer.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Printer")."|"."newsystem_printer|\n";
+    }
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"component/componentGeneric"))){
+      $s.= "...|<img src='images/select_component.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Component")."|"."newsystem_component|\n";
+    }
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+    }
+
+    /* Get copy & paste icon */
+    $Copy_Paste ="";
+    if(preg_match("/(c.*w|w.*c)/",$all_module_acls) &&  $this->parent->CopyPasteHandler){
+      $s .= "..|---|\n";
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$all_module_acls)){
+      $s .= "..|---|\n";
+      $s .= $this->get_snapshot_header(TRUE);
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+    $this->SetListHeader($listhead);
+  }
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+  function setEntries($terminals)
+  {
+    $img1  = "<img class='center' src='images/printer.png'            alt='C' title='"._("Cups Server")  ."'>";
+    $img2  = "<img class='center' src='images/scanner.png'            alt='L' title='"._("Log Db") ."'>";
+    $img3  = "<img class='center' src='images/select_terminal.png'    alt='L' title='"._("Syslog Server") ."'>";
+    $img4  = "<img class='center' src='images/mailto.png'             alt='M' title='"._("Mail Server")  ."'>";
+    $img5  = "<img class='center' src='images/select_phone.png'       alt='I' title='"._("Imap Server") ."'>";
+    $img6  = "<img class='center' src='images/fax_small.png'          alt='F' title='"._("Nfs Server")   ."'>";
+    $img7  = "<img class='center' src='images/select_winstation.png'  alt='K' title='"._("Kerberos Server") ."'>";
+    $img8  = "<img class='center' src='images/select_phone.png'       alt='A' title='"._("Asterisk Server") ."'>";
+    $img9  = "<img class='center' src='images/fax_small.png'          alt='F' title='"._("Fax Server") ."'>";
+    $img10 = "<img class='center' src='images/save.png'               alt='L' title='"._("Ldap Server") ."'>";
+
+    $empty    ="<img src='images/empty.png' style='width:16px ; height: 16px;' class='center' alt=''>";
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 110;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    // User and Template  Images
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+
+    /* ACL mapping */
+    $ui = get_userinfo();
+    $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
+          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
+          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
+          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
+          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
+          "incoming"    => array("CLASS"=>"",             "TABCLASS" =>"",              "ACL"=> "incoming/systems"),
+          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
+
+
+    $cnts = array("component" => 0 , "terminal" => 0 , "workstation" => 0 , 
+                  "printer" => 0 , "phone" => 0 , "server" => 0,
+                  "NewDevice" => 0, "winstation"=> 0);
+
+    // Test Every Entry and generate divlist Array
+    foreach($terminals as $key => $val){
+
+      /* Get system type, it is used to fetch the acls for the current object.
+          "winstation" acls are stored as 2winworkstation", so we have to map this here */
+      $type     = $this->parent->get_system_type($val);
+      if($type == "winstation") {
+        $acl_type = "winworkstation";
+      }else{
+        $acl_type = $type;
+      }
+
+      /* Map NewDevice acls to workstation acls */
+      if($type == "NewDevice" || $type == "ArpNewDevice"){
+        $type     = "incoming";
+        $acl_type = "incoming";
+      }
+
+      /* Get complete category acls */
+      $acl_all  = $ui->has_complete_category_acls($val['dn'],$acl_type) ;
+  
+      /* Get specific generic acls */
+      $acl      = $ui->get_permissions($val['dn'],$tabs[$type]['ACL']);
+
+      $action ="";
+      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $action.= "<input class='center' type='image'
+          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        $action.= "<input class='center' type='image'
+          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }
+      $action.= "<input class='center' type='image' src='images/edit.png' 
+                    alt='"._("edit")."'     name='system_edit_%KEY%' title='"._("Edit system")."'>";
+      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $action.= $this->GetSnapShotActions($val['dn']);
+      }else{
+        $action.= $empty."&nbsp;".$empty."&nbsp;";
+      }
+
+
+      if(preg_match("/d/",$acl)){
+        $action.= "<input class='center' type='image' src='images/edittrash.png' 
+          alt='"._("delete")."'   name='system_del_%KEY%' title='"._("Delete system")."'>";
+      }else{
+        $action.= $empty;    
+      }
+
+      /* Generate picture list, which is currently disabled */
+      if(in_array("goCupsServer"    ,$val['objectClass'])) $cups    = $img1;   else $cups  =$empty;
+      if(in_array("goLogDBServer"   ,$val['objectClass'])) $logdb   = $img2;   else $logdb =$empty;
+      if(in_array("goSyslogServer"  ,$val['objectClass'])) $syslog  = $img3;   else $syslog=$empty;
+      if(in_array("goImapServer"    ,$val['objectClass'])) $imap    = $img4;   else $imap  =$empty;
+      if(in_array("sambaSamAccount" ,$val['objectClass'])) $samba   = $img5;   else $samba =$empty;
+      if(in_array("goShareServer"   ,$val['objectClass'])) $nfs     = $img6;   else $nfs   =$empty;
+      if(in_array("goKrbServer"     ,$val['objectClass'])) $krb     = $img7;   else $krb   =$empty;
+      if(in_array("goFonServer"     ,$val['objectClass'])) $fon     = $img8;   else $fon   =$empty;
+      if(in_array("goFaxServer"     ,$val['objectClass'])) $fax     = $img9;   else $fax   =$empty;
+      if(in_array("goLdapServer"    ,$val['objectClass'])) $ldap     = $img10;   else $ldap   =$empty;
+
+      $pics = $cups.$logdb.$syslog.$imap.$samba.$nfs.$krb.$fon.$fax.$ldap;
+      $pics = ""; // Pictures currently hidden
+
+      $val['cn'][0]= preg_replace('/\$$/', '', $val['cn'][0]);
+
+      // Generate Array to Add
+      $dsc= "";
+      if (isset($val['description'][0])){
+        $dsc= " [".$val['description'][0]."]";
+      }
+      if((isset($val['is_new']))&&(!empty($val['is_new']))){
+        $display= $val["cn"][0]." ".$val['is_new'].$dsc;
+      }else{
+        $display= $val["cn"][0].$dsc;
+      }
+
+     
+      /* Check if this is a terminal/workstation && if we are allowed to change the gotoRootPasswd */
+      $pwd_acl =""; 
+      if(in_array("gotoWorkstation",$val['objectClass'])){
+        $pwd_acl = $ui->get_permissions($val['dn'],"workstation/workgeneric","gotoRootPasswd");
+      }    
+      if(in_array("gotoTerminal",$val['objectClass'])){
+        $pwd_acl = $ui->get_permissions($val['dn'],"terminal/termgeneric","gotoRootPasswd");
+      }    
+      if(preg_match("/w/",$pwd_acl)){
+        $action2 = "<input class='center' type='image' src='images/certs.png' alt='"._("Password")."'   name='system_setpwd_%KEY%' title='"._("Set root password")."'>";
+      }else{
+        $action2 = $empty;
+      }
+
+
+      if(in_array("gotoWorkstation",$val['objectClass'])){
+        $action2= "<input class='center' type='image' src='images/cdrom.png' alt='"._("Create CD")."'   
+                      name='gen_cd_%KEY%' title='"._("Create FAI CD")."'>&nbsp;".$action2;
+      }else{
+        $action2= $empty.$action2;
+      }
+
+      if(isset($val['message'])){
+        $display.= "  (".$val['message'].")";
+      }
+
+      $img    = $this->parent->convert_list($val);
+
+      /* Cutted objects should be displayed in light grey */
+      if($this->parent->CopyPasteHandler){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $val['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+
+      $type = $this->parent->get_system_type($val);
+      if($type == "ArpNewDevice"){
+        $type = "NewDevice";
+      }
+      $cnts[$type] ++;
+
+
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+                      "attach" => "style='width:20px;'");
+
+      $field1 = array("string" => sprintf($img['img'],$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
+      $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+      $this->AddElement( array($field0,$field1,$field2,$field3));
+    }
+
+    /* Create summary string for list footer */
+    $num_deps=0;
+    if(!$this->SubSearch){
+      $num_deps = count($this->Added_Departments);
+    }
+
+    $num_ser_str = _("Number of listed servers");
+    $num_ws_str  = _("Number of listed workstations");
+    $num_ter_str = _("Number of listed terminals");
+    $num_pho_str = _("Number of listed phones");
+    $num_prt_str = _("Number of listed printers");
+    $num_com_str = _("Number of listed network components");
+    $num_new_str = _("Number of listed new devices");
+    $num_wws_str = _("Number of listed windows workstations");
+    $num_dep_str = _("Number of listed departments");
+
+    $str = "<img class='center' src='images/select_server.png'
+      title='".$num_ser_str."' alt='".$num_ser_str."'>&nbsp;".$cnts['server']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/select_workstation.png'
+      title='".$num_ws_str."' alt='".$num_ws_str."'>&nbsp;".$cnts['workstation']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/select_terminal.png'
+      title='".$num_ter_str."' alt='".$num_ter_str."'>&nbsp;".$cnts['terminal']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/select_phone.png'
+      title='".$num_pho_str."' alt='".$num_pho_str."'>&nbsp;".$cnts['phone']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/select_printer.png'
+      title='".$num_prt_str."' alt='".$num_prt_str."'>&nbsp;".$cnts['printer']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/select_component.png'
+      title='".$num_com_str."' alt='".$num_com_str."'>&nbsp;".$cnts['component']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/select_newsystem.png'
+      title='".$num_new_str."' alt='".$num_new_str."'>&nbsp;".$cnts['NewDevice']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/select_winstation.png'
+      title='".$num_wws_str."' alt='".$num_wws_str."'>&nbsp;".$cnts['winstation']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/folder.png'
+      title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+
+    $this->set_List_Bottom_Info($str);
+  }
+
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+  }
+
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow :: save_object();  
+
+
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/systems/admin/systems/class_divListSystemService.inc b/gosa-plugins/systems/admin/systems/class_divListSystemService.inc
new file mode 100644 (file)
index 0000000..ca31601
--- /dev/null
@@ -0,0 +1,152 @@
+<?php
+
+class divListSystemService extends MultiSelectWindow
+{
+  /* CheckBoxes, to change default values modify $this->AddCheckBox */
+  var $parent             ;
+  var $ui                 ;
+
+  function divListSystemService ($config,$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config,"SystemService", "server");
+    
+    $this->parent       = $parent;
+    $this->ui           = get_userinfo();
+    $this->EnableJSLeaveMsg(TRUE);
+
+    /* Set list strings */
+    $this->SetTitle(_("Installed services"));
+    $this->SetSummary(_("Installed services"));
+
+    /* Result page will look like a headpage */
+    $this->SetInformation(_("This menu allows you to add, remove and configure the properties of a specific service."));
+
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* set Page header */
+    $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>_("Service name")));
+    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:100px;border-right:0px;'"));
+    $this->HideFilterPart();
+  }
+
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $listhead = "<div style='background:#F0F0F9;height:16px;padding:0px;'>".
+    " <input type='image' align='middle' src='images/select_new_server.png' class='center' 
+        name='addNewService' alt='"._("Add service")."' title='"._("Add new service")."'>&nbsp;".
+    " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
+    " <input type='image' align='middle' src='images/status_start_all.png' class='center'
+        name='startServices' alt='"._("Start all")."' title='"._("Start all services")."'>&nbsp;".
+    " <input type='image' align='middle' src='images/status_stop_all.png'  class='center'   
+        name='stopServices' alt='"._("Stop service")."' title='"._("Stop all services")."'>&nbsp;".
+    " <input type='image' align='middle' src='images/status_restart_all.png'    class='center'
+        name='restartServices' alt='"._("Restart service")."' title='"._("Restart all services")."'>&nbsp;".
+    "</div>";
+    $this->SetListHeader($listhead);
+  }
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+  function setEntries($list)
+  {
+    $tmp = array();
+    foreach($list as $name => $entry){
+      $tmp[$name] = $entry['Message']; 
+    }
+
+    natcasesort($tmp);
+    $tmp2 = array();
+    foreach($tmp as $name => $value){
+      $tmp2[$name] = $list[$name];
+    }
+
+    $ui = get_userinfo();
+
+    foreach($tmp2 as $name => $entry){
+      switch($entry['Status']){
+        case ''      : $str ="&nbsp;";break;
+        case SERVICE_STOPPED  : $str ="<img src='images/status_stopped.png' title='"._("Stopped")."'>"; break;
+        case SERVICE_STARTED  : $str ="<img src='images/status_running.png' title='"._("Started")."'>"; break;
+        case SERVICE_RESTARTED : $str ="<img src='images/status_restarting.png' title='"._("Restarting")."' alt='R'>"; break;
+        default: $str= "<img src='images/select_user.png' alt='".$entry['Status']."' title='"._("User status")." : ".$entry['Status']."'>";
+      }
+
+      /* Get acls */
+      $acl = $ui->get_permissions($this->parent->dn,"server/".$name);
+      if(preg_match("/w/i",$acl) && !preg_match("/r/i",$acl)){
+        continue;
+      }
+  
+      $WasAccount = $this->parent->plugins[$name] -> initially_was_account;    
+  
+      $plug = $_GET['plug'];
+      $link = "<a href='?plug=".$plug."&amp;act=open&amp;id=".$name."'>".$entry['Message']."</a>";
+
+      $field1 = array("string" => $str ,"attach" => "style='width:20px;'");
+      $field2 = array("string" => $link);
+
+      $actions ="";
+      if($entry['AllowStart'] && $WasAccount){
+        $actions .= "&nbsp;<input type='image' name='StartSingleService_".$name."' src='images/status_start.png'
+                            title='"._("Start service")."'>";
+      }else{
+        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
+      }
+      if($entry['AllowStart'] && $WasAccount){
+        $actions .= "&nbsp;<input type='image' name='StopSingleService_".$name."' src='images/status_stop.png'
+                            title='"._("Stop service")."'>";
+      }else{
+        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
+      }
+      if($entry['AllowStart'] && $WasAccount){
+        $actions .= "&nbsp;<input type='image' name='RestartSingleService_".$name."' src='images/status_restart.png'
+                            title='"._("Restart service")."'>";
+      }else{
+        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
+      }
+
+      /* Check if edit is enabled and allowed for current service */
+      if($entry['AllowEdit'] && preg_match("/(r|w)/i",$acl)){
+        $actions .= "&nbsp;<input type='image' name='EditSingleService_".$name."' src='images/edit.png'
+                            title='"._("Edit service")."'>";
+      }else{
+        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
+      }
+
+      /* Check if remove is enabled and allowed for current service */
+      if($entry['AllowRemove'] && preg_match("/d/i",$acl)){
+        $actions .= "&nbsp;<input type='image' name='RemoveSingleService_".$name."' src='images/edittrash.png'
+                            title='"._("Remove service")."'>";
+      }else{
+        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
+      }
+
+      $field3 = array("string" => $actions ,"attach" => "style='width:100px;border-right:0px;'");
+      $this->AddElement(array($field1,$field2,$field3));
+    }
+  }
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow :: save_object();   
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/systems/admin/systems/class_servGeneric.inc b/gosa-plugins/systems/admin/systems/class_servGeneric.inc
new file mode 100644 (file)
index 0000000..91eec68
--- /dev/null
@@ -0,0 +1,444 @@
+<?php
+
+class servgeneric extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage server base objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Generic terminal attributes */
+  var $ignore_account= TRUE;
+  var $interfaces= array();
+
+  /* Needed values and lists */
+  var $base= "";
+  var $cn= "";
+  var $l= "";
+  var $description= "";
+  var $orig_dn= "";
+  var $didAction= FALSE;
+
+  /* attribute list for save action */
+  var $attributes= array("cn", "description","gotoMode");
+  var $objectclasses= array("top", "GOhard", "goServer");
+
+  var $gotoMode= "locked";
+
+  var $netConfigDNS;
+  var $modes = array();
+  var $ui   ;
+  var $mapActions   = array("reboot"          => "",
+                            "instant_update"  => "softupdate",
+                            "localboot"       => "localboot",
+                            "update"          => "sceduledupdate",
+                            "reinstall"       => "install",
+                            "rescan"          => "",
+                            "memcheck"        => "memcheck",
+                            "sysinfo"         => "sysinfo");
+
+  var $fai_activated  =FALSE;
+  var $view_logged = FALSE;
+
+  function servgeneric (&$config, $dn= NULL, $parent= NULL)
+  {
+    /* Check if FAI is activated */
+    $tmp = $config->search("faiManagement", "CLASS",array('menu','tabs'));
+    
+    if(!empty($tmp)){
+      $this->fai_activated = TRUE;
+    }
+
+    plugin::plugin ($config, $dn, $parent);
+
+    $this->ui = get_userinfo();
+    $this->modes["active"]= _("Activated");
+    $this->modes["locked"]= _("Locked");
+
+    /* Set base */
+    if ($this->dn == "new"){
+      $ui= get_userinfo();
+      $this->base= dn2base($ui->dn);
+      $this->cn= "";
+    } else {
+      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
+    }
+    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
+    $this->netConfigDNS->set_acl_category("server");
+    $this->netConfigDNS->set_acl_base($this->base);
+       
+    /* Save dn for later references */
+    $this->orig_dn= $this->dn;
+  }
+
+
+  function set_acl_base($base)
+  {
+    plugin::set_acl_base($base);
+    $this->netConfigDNS->set_acl_base($base);
+  }
+
+
+  function set_acl_category($cat)
+  {
+    plugin::set_acl_category($cat);
+    $this->netConfigDNS->set_acl_category($cat);
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    /* Do we represent a valid server? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+        _("This 'dn' has no server features.")."</b>";
+      return($display);
+    }
+
+    /* Check for action */
+    if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate")){
+      $cmd = $this->config->search("workgeneric", "ACTIONCMD",array('tabs'));
+      if ($cmd == ""){
+        print_red(_("No ACTIONCMD definition found in your gosa.conf"));
+      } else {
+
+        exec ($cmd." ".$this->netConfigDNS->macAddress." ".escapeshellarg($_POST['saction']), $dummy, $retval);
+        if ($retval != 0){
+          print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
+        } else {
+          $this->didAction= TRUE;
+
+          /* Set FAIstate */
+          if($this->fai_activated && $this->dn != "new"){
+            $ldap = $this->config->get_ldap_link();
+            $ldap->cd($this->config->current['BASE']);
+            $ldap->cat($this->dn,array("objectClass"));
+            $res = $ldap->fetch();
+
+            $attrs = array();
+            $attrs['FAIstate'] = "";
+            if(isset($this->mapActions[$_POST['saction']])){
+              $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']];
+            }
+
+            for($i = 0; $i < $res['objectClass']['count'] ; $i ++){
+              $attrs['objectClass'][] = $res['objectClass'][$i];
+            }
+
+            if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
+              $attrs['objectClass'][] = "FAIobject";
+            }
+
+            if($attrs['FAIstate'] == ""){
+#FIXME we should check if FAIobject is used anymore
+              $attrs['FAIstate'] = array();
+            }
+
+            $ldap->cd($this->dn);
+            $ldap->modify($attrs);
+          }
+          show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/generic (FAIstate) with dn '%s' failed."),$this->dn)); 
+        }
+      }
+    }
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once ){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+  
+        /* Only accept allowed bases */
+        $tmp = $this->get_allowed_bases();
+        if($tmp[$this->dialog->isSelected()]){
+          $this->base = $this->dialog->isSelected();
+        }
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    /* Assign base ACL */
+    $smarty->assign("bases"   , $this->get_allowed_bases());
+
+    /* Assign attributes */
+    foreach ($this->attributes as $attr){
+      $smarty->assign("$attr", $this->$attr);
+    }
+
+    $smarty->assign("staticAddress", "");
+    $smarty->assign("base_select", $this->base);
+
+    /* Assign status */
+    $query= "fping -q -r 1 -t 500 ".$this->cn;
+    exec ($query, $dummy, $retval);
+
+    /* Offline */
+    if ($retval == 0){
+      $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"),
+                                       "instant_update" => _("Instant update"),
+                                       "update" => _("Scheduled update"),
+                                       "reinstall" => _("Reinstall"),
+                                       "rescan" => _("Rescan hardware"),
+                                       "memcheck" => _("Memory test"),
+                                       "localboot" => _("Force localboot"),
+                                       "sysinfo"  => _("System analysis")));
+    } else {
+      $smarty->assign("actions", array("wake" => _("Wake up"),
+                                       "reinstall" => _("Reinstall"),
+                                       "update" => _("Scheduled update"),
+                                       "memcheck" => _("Memory test"),
+                                       "localboot" => _("Force localboot"),
+                                       "sysinfo"  => _("System analysis")));
+    }
+
+    /* Show main page */
+    $smarty->assign("fai_activated",$this->fai_activated);
+
+    $str = $this->netConfigDNS->execute();
+    if(is_object($this->netConfigDNS->dialog)){
+      return($str);
+    }
+    $smarty->assign("netconfig", $str);
+    $smarty->assign("modes", $this->modes);
+
+    return($smarty->fetch (get_template_path('server.tpl', TRUE)));
+  }
+
+  function remove_from_parent()
+  {
+    /* Cancel if there's nothing to do here */
+    if ((!$this->initially_was_account) || (!$this->acl_is_removeable())){
+      return;
+    }
+
+    $this->netConfigDNS->remove_from_parent();
+    $ldap= $this->config->get_ldap_link();
+    $ldap->rmdir($this->dn);
+
+    new log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of system server/generic with dn '%s' failed."),$this->dn)); 
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
+    while ($ldap->fetch()){
+      $og= new ogroup($this->config, $ldap->getDN());
+      unset($og->member[$this->dn]);
+      $og->save ();
+    }
+    $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Save current base, to be able to revert to last base, 
+        if new base is invalid or not allowed to be selected */
+    $base_tmp = $this->base;
+    plugin::save_object();
+    $this->netConfigDNS->save_object();
+
+    /* Get base selection */
+    $tmp = $this->get_allowed_bases();
+    if(isset($_POST['base'])){
+      if($tmp[$_POST['base']]){
+        $this->base = $_POST['base'];
+      }else{
+        $this->base = $base_tmp;
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    $message= array_merge($message, $this->netConfigDNS->check());
+    $this->dn= "cn=".$this->cn.",".get_ou('serverou').$this->base;
+
+    /* must: cn */
+    if ($this->cn == ""){
+      $message[]= _("The required field 'Server name' is not set.");
+    }
+    
+    /* Check if given name is a valid host/dns name */
+    if(!tests::is_dns_name($this->cn)){
+      $message[] = _("Please specify a valid name for this object.");
+    }
+
+    if ($this->orig_dn != $this->dn){
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd ($this->base);
+      $ldap->search ("(cn=".$this->cn.")", array("cn"));
+      if ($ldap->count() != 0){
+        while ($attrs= $ldap->fetch()){
+          if ($attrs['dn'] != $this->orig_dn){
+            if(!preg_match("/cn=dhcp,/",$attrs['dn']) && !preg_match("/,".get_ou('incomingou')."/",$attrs['dn']) && preg_match("/,".get_ou('serverou')."/",$attrs['dn'])){
+              $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
+              break;
+            }
+          }
+        }
+      }
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Remove all empty values */
+    if ($this->orig_dn == 'new'){
+      $attrs= array();
+      foreach ($this->attrs as $key => $val){
+        if (is_array($val) && count($val) == 0){
+          continue;
+        }
+        $attrs[$key]= $val;
+      }
+      $this->attrs= $attrs;
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    if ($this->orig_dn == 'new'){
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $mode= "add";
+    } else {
+   
+      /* cn is not case sensitive for ldap, but for php it is!! */ 
+      if($this->config->current['DNMODE'] == "cn"){
+        if (strtolower($this->orig_dn) != (strtolower($this->dn))){
+          $this->recursive_move($this->orig_dn, $this->dn);
+          plugin::save();
+        }
+      }else{
+        if ($this->orig_dn != $this->dn){
+          $this->recursive_move($this->orig_dn, $this->dn);
+          plugin::save();
+        }
+      }
+  
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+      $mode= "modify";
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/generic with dn '%s' failed."),$this->dn)); 
+    $this->netConfigDNS->cn = $this->cn;
+    $this->netConfigDNS->save();
+
+    /* Optionally execute a command after we're done */
+    if(!$this->didAction){
+      $this->handle_post_events($mode,array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+    }
+  }
+
+
+  /* Display generic part for server copy & paste */
+  function getCopyDialog()
+  {
+    $vars = array("cn");
+
+    $smarty = get_smarty();
+    $smarty->assign("cn" ,$this->cn);
+    $smarty->assign("object","server");
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+
+  
+  function PrepareForCopyPaste($source)  
+  {
+    plugin::PrepareForCopyPaste($source);
+    if(isset($source['macAddress'][0])){
+      $this->netConfigDNS->macAddress = $source['macAddress'][0];
+    }
+    if(isset($source['ipHostNumber'][0])){
+      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
+    }
+
+  }
+  
+
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array( 
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Server generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 1,
+          "plSection"     => array("administration"),           
+          "plCategory"    => array("server" => array("description"  => _("Server"),
+                                                     "objectClass"  => "goServer")),
+          "plProvidedAcls"=> array(
+            "cn"           => _("Name"),
+            "description"  => _("Description"),
+            "gotoMode"     => _("Goto mode"),
+            "base"         => _("Base"),
+            "FAIstate"     => _("Action flag"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/systems/admin/systems/class_serverService.inc b/gosa-plugins/systems/admin/systems/class_serverService.inc
new file mode 100644 (file)
index 0000000..338052b
--- /dev/null
@@ -0,0 +1,442 @@
+<?php
+
+define("START_SERVICE",1);
+define("STOP_SERVICE",2);
+define("RESTART_SERVICE",3);
+
+define("SERVICE_STOPPED",_("Stop"));
+define("SERVICE_STARTED",_("Start"));
+define("SERVICE_RESTARTED",_("Restart"));
+
+define("ALL_SERVICES",100);
+
+class ServerService extends plugin
+{
+  /* CLI vars */
+  var $cli_summary      = "Manage server services";
+  var $cli_description  = "Managing services by adding,removing and configuring services. Allows to start/stop used services.";
+  var $cli_parameters   = array("config"=>"Config object" , "dn"=>"Object dn");
+
+  /* attribute list for save action */
+  var $ignore_account   = TRUE;
+  var $attributes       = array();
+  var $objectclasses    = array();
+
+  var $divList          = NULL;
+
+  var $plugins          = array();
+  var $pluign_names     = array();
+
+  var $current          = "";
+  var $backup           = NULL;
+  var $acl              ;
+  var $cn;
+
+  function ServerService (&$config, $dn)
+  {
+    plugin::plugin($config);
+    $this->dn= $dn;
+    foreach ($config->data['TABS']['SERVERSERVICE'] as $plug){
+      $name= $plug['CLASS'];
+      $this->plugin_names[]= $name;
+      $this->plugins[$name]= new $name($config, $dn);
+      /* Capture all service objectClases, necessary for acl handling */ 
+      if(isset($this->plugins[$name]->objectclasses)){
+        foreach($this->plugins[$name]->objectclasses as $oc){
+          $this->objectclasses[] = $oc;
+        }
+      }
+    }
+    $this->divList = new divListSystemService($config,$this);
+       }
+
+  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);
+    }
+  }
+
+  function execute()
+  {
+    /* Variable initialisation */  
+    $s_action = "";
+    $s_entry  = "";
+
+    /* Walk through posts and check if there are some introductions for us */
+    $PossiblePosts = array("addNewService"  => "", 
+                           "startServices"  => "",
+                           "stopServices"   => "",
+                           "restartServices"  => "",
+                           "removeServices" => "",
+
+                           "StartSingleService"  => "/^StartSingleService_(.*)_[xy]$/",
+                           "StopSingleService"   => "/^StopSingleService_(.*)_[xy]$/",
+                           "RestartSingleService"  => "/^RestartSingleService_(.*)_[xy]$/",
+                           "RemoveSingleService" => "/^RemoveSingleService_(.*)_[xy]$/",
+                           "EditSingleService"   => "/^EditSingleService_(.*)_[xy]$/");
+
+  
+    $once = true;
+    foreach($_POST as $name => $value){
+      foreach($PossiblePosts as $pregCheck => $idPreg) {
+        if(preg_match("/^".$pregCheck."/",$name) && $once){
+          $once     = false;
+          $s_action = $pregCheck;
+          
+          if(!empty($idPreg)){
+            $s_entry = preg_replace($idPreg,"\\1",$name);
+          }
+        }
+      }
+    }
+
+
+    /* Handle state changes for services */
+    $map =  array(    "startServices"         => array("type" => START_SERVICE ,   "service" => ALL_SERVICES),
+                      "stopServices"          => array("type" => STOP_SERVICE  ,   "service" => ALL_SERVICES),
+                      "restartServices"       => array("type" => RESTART_SERVICE , "service" => ALL_SERVICES),                 
+                      "StartSingleService"    => array("type" => START_SERVICE ,   "service" => $s_entry),
+                      "StopSingleService"     => array("type" => STOP_SERVICE ,    "service" => $s_entry),
+                      "RestartSingleService"  => array("type" => RESTART_SERVICE , "service" => $s_entry));
+    if(isset($map[$s_action])){
+      $type     = $map[$s_action]['type'];
+      $service  = $map[$s_action]['service'];
+      $this->ServiceStatusUpdate($type,$service);
+    }
+
+    /* Handle actions linked via href */
+    if(isset($_GET['act']) && $_GET['act'] == "open" && isset($_GET['id'])){
+      $id = $_GET['id'];
+      if(isset($this->plugins[$id])){
+        $s_entry = $id;
+        $s_action = "EditSingleService";
+      } 
+    }
+
+    /* Open service add dialog */
+    if($s_action == "addNewService"){
+      $this->dialog = new ServiceAddDialog($this->config,$this->dn,$this);
+    }
+
+
+    /* Remove service */
+    if($s_action == "RemoveSingleService"){
+
+      /* Create resetted obj */
+      $new_obj = new $s_entry($this->config,$this->dn);
+      $new_obj -> set_acl_base($this->acl_base);
+      $new_obj -> set_acl_category(preg_replace("/\/$/","",$this->acl_category));
+      $tmp     = $new_obj->getListEntry();
+
+      if($tmp['AllowRemove']){
+
+        /* Check if we are allowed to remove this service
+         */
+        $str = $this->plugins[$s_entry]->allow_remove();
+
+        if(empty($str)){
+          $this->plugins[$s_entry] = $new_obj;
+          $this->plugins[$s_entry]->is_account = false;
+        }else{
+          print_red($str);
+        }
+      }
+    }
+
+
+    /* Edit a service and make a backup from all attributes, 
+       to be able to restore old values after aborting dialog */ 
+    if($s_action == "EditSingleService"){
+      $this->backup   = get_object_vars($this->plugins[$s_entry]);
+      $this->dialog   = $this->plugins[$s_entry];
+      $this->current  = $s_entry;
+    }
+
+   
+    /* Abort service add */
+    if(isset($_POST['CancelServiceAdd'])){
+      $this->dialog   = FALSE;
+      $this->backup   = NULL;
+      $this->current  = "";
+    }
+
+    /* Abort dialog 
+       Restore vars with values before editing */
+    if(isset($_POST['CancelService']) && !empty($this->current)){
+      if($this->backup == NULL){
+        $this->plugins[$this->current] = new $this->current($this->config,$this->dn);
+        $this->plugins[$this->current]-> set_acl_base($this->acl_base);
+        $this->plugins[$this->current]-> set_acl_category(preg_replace("/\/$/","",$this->acl_category));
+
+      }else{
+        foreach($this->backup as $name => $value){
+          $this->plugins[$this->current]->$name = $value;
+        }
+      }
+      $this->dialog   = FALSE;
+      $this->backup   = NULL;
+      $this->current  = ""; 
+    }
+  
+
+    /* Abort dialog */
+    if(isset($_POST['SaveService']) && is_object($this->dialog)){
+      $this->dialog->save_object();
+      $msgs = $this->dialog->check();
+      if(count($msgs)){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+        $this->plugins[$this->current] = $this->dialog;
+        $tmp  = get_object_vars($this->dialog);
+        foreach($tmp as $name => $value){
+          $this->plugins[$this->current]->$name = $value;
+        }
+        $this->current = "";
+        $this->dialog = FALSE;
+        $this->backup = NULL;
+      }
+    }
+
+
+    /* Abort dialog */
+    if((isset($_POST['SaveServiceAdd'])) && (!empty($_POST['ServiceName']))){
+      $serv = $_POST['ServiceName'];    
+      $this->plugins[$serv]->is_account = true;
+      $this->dialog  = $this->plugins[$serv];
+      $this->current = $serv;
+    }
+
+
+    /* There is currently a subdialog open, display this dialog */
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+
+
+    /* 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>");
+  }
+
+
+  /* Get all used services 
+      CLASSNAME => _($this->plugins[*]->DisplayName);   */
+  function getAllUsedServices()
+  {
+    $ret = array();
+    foreach($this->plugins as $name => $obj){
+      if($obj->is_account){
+        if(isset($obj->DisplayName)){
+          $ret[$name] = $obj->DisplayName;
+        }else{
+          $ret[$name] = $name;
+        }
+      }
+    }
+    return($ret);
+  }
+
+
+  /* Get all unused services 
+      CLASSNAME => _($this->plugins[*]->DisplayName);  */
+  function getAllUnusedServices()
+  {
+    $tmp = $this->getAllUsedServices();
+    $pool_of_ocs =array();
+    foreach($tmp as $name => $value){
+      if(isset($this->plugins[$name]->conflicts)){
+        $pool_of_ocs[]= get_class($this->plugins[$name]);
+      }
+    }
+   
+    $ret = array();
+    foreach($this->plugins as $name => $obj){
+
+      /* Skip all pluigns that will lead into conflicts */
+      $skip = false;
+      if(isset($obj->conflicts)){
+        foreach($obj->conflicts as $oc){
+          if(in_array_ics($oc,$pool_of_ocs)){
+            $skip = true;
+          }
+        }
+      }
+
+      /* Only show createable services */
+      if(!$obj->acl_is_createable()){
+        $skip = true;
+      }
+
+      if(!$skip){
+        if(isset($obj->DisplayName)){
+          $ret[$name] = $obj->DisplayName;
+        }else{
+          $ret[$name] = $name;
+        }
+      }
+    }
+    return($ret);
+  }
+  /* This function sets the status var for each used 
+     service && calls an external hook if specified in gosa.conf*/
+  function ServiceStatusUpdate($method , $service)
+  {
+    /* Skip if this is a new server */
+    if($this->dn == "new"){
+      print_red(_("Can't set status while this server is not saved."));
+      return;
+    }
+
+    $action = "";
+    if($method == START_SERVICE){
+      $action = SERVICE_STARTED;
+    }elseif($method== STOP_SERVICE){
+      $action = SERVICE_STOPPED;
+    }elseif($method == RESTART_SERVICE){
+      $action = SERVICE_RESTARTED;
+    }else{
+      print_red(sprintf(_("The specified method '%s' can't executed for services."),$action));
+      return;
+    }
+    
+    $caseVars = array("cn","dn");
+    if($service == ALL_SERVICES){
+      foreach($this->plugins as $name => $obj){
+        foreach($caseVars as $var){
+          if(isset($this->$var)){
+            $this->plugins[$name]->$var = $this->$var;  
+          }
+        }
+
+        /* check if services can be restarted */
+        $map =array(SERVICE_STARTED=> "AllowStart" ,
+                    SERVICE_STOPPED => "AllowStop",
+                    SERVICE_RESTARTED => "AllowRestart");
+
+        /* get plugins informations, restart/start/stop actions allowed ?*/
+        $tmp = $this->plugins[$name]->getListEntry();
+
+        /* Check if given action is allowed for this service */
+        if($tmp[$map[$action]]){
+          if($this->plugins[$name]->initially_was_account && $this->plugins[$name]->is_account){
+            $this->plugins[$name]->setStatus($action);
+          }
+        }
+      }
+    }else{
+      foreach($caseVars as $var){
+        if(isset($this->$var)){
+          $this->plugins[$service]->$var = $this->$var;  
+        }
+      }
+      if($this->plugins[$service]->is_account){
+        $this->plugins[$service]->setStatus($action);
+      }
+    }
+  }
+
+
+  function check()
+  {
+    $message = plugin::check();
+    return $message;
+  }
+
+
+  function save_object()
+  {
+    foreach($this->plugins as $name => $obj){
+      if($obj->is_account){
+        $this->plugins[$name]->save_object();
+      }
+    }
+  }
+
+
+  function remove_from_parent()
+  {
+    $caseVars = array("cn","dn");
+    foreach($this->plugins as $name => $obj){
+      foreach($caseVars as $var){
+        if(isset($this->$var)){
+          $this->plugins[$name]->$var = $this->$var;  
+        }
+      }
+      if($this->plugins[$name]->initially_was_account){
+        $this->plugins[$name]->remove_from_parent();
+      }
+    }
+  }
+
+
+  function save()
+  {
+    $caseVars = array("cn","dn");
+    foreach($this->plugins as $name => $obj){
+
+      foreach($caseVars as $var){
+        if(isset($this->$var)){
+          $this->plugins[$name]->$var = $this->$var;
+        }
+      }
+
+      if($this->plugins[$name]->is_account){
+        $this->plugins[$name]->save();
+      }else{
+        if($this->plugins[$name]->initially_was_account){
+          $this->plugins[$name]->remove_from_parent();
+        }
+      }
+    }
+  }
+
+  
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    foreach($this->plugins as $name => $plugin){
+      $this->plugins[$name]->PrepareForCopyPaste($source);
+    }
+  }
+
+
+  /* Check if all plugins allow a remove ..  */
+  function allow_remove()
+  {
+    foreach($this->plugins as $name => $obj){
+      $str = $obj->allow_remove();
+      if(!empty($str)){
+        return($str);
+      }
+    }
+  }
+  
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/systems/admin/systems/class_systemManagement.inc b/gosa-plugins/systems/admin/systems/class_systemManagement.inc
new file mode 100644 (file)
index 0000000..00f39f4
--- /dev/null
@@ -0,0 +1,1404 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2003  Cajus Pollmeier
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+class systems extends plugin
+{
+  /* Definitions */
+  var $plHeadline     = "Systems";
+  var $plDescription  = "This does something";
+  var $departments    = array();
+
+  /* Dialog attributes */
+  var $systab   = NULL;
+  var $terminals= array();
+  var $ui       = NULL;
+  var $DivListSystem;
+  var $start_pasting_copied_objects = FALSE;
+  var $CopyPasteHandler   = NULL;
+
+  /* Arp hanlding activated */
+  var $arp_handling_active = FALSE;
+
+  function systems (&$config, $ui)
+  {
+    /* Save configuration for internal use */
+    $this->config= $config;
+    $this->ui= $ui;
+
+    /* Creat dialog object */
+    $this->DivListSystem = new divListSystem($this->config,$this);
+
+    /* Copy & Paste enabled ?*/
+    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
+      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
+    }
+
+    /* Check whether the arp handling active or not */
+    if($this->config->search("ArpNewDevice","CLASS",array('tabs')) != ""){
+      $this->arp_handling_active = TRUE;
+    }
+
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    session::set('LOCK_VARS_TO_USE',array("/^system_edit_/i","/^system_del_/","/^act/","/^id/","/^item_selected/","/^remove_multiple_systems/"));
+
+    /********************
+      Check for functional posts, edit|delete|add|... system devices 
+     ********************/
+    $s_action     = "";                       // Contains the action to proceed
+    $s_entry      = "";                       // The value for s_action
+    $base_back    = "";                       // The Link for Backbutton
+    $smarty       = get_smarty();
+
+    /* Test Posts */
+    foreach($_POST as $key => $val){
+      // Post for delete
+      if(preg_match("/system_del.*/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/system_del_/i","",$key);
+        // Post for edit
+      }elseif(preg_match("/system_edit_.*/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/system_edit_/i","",$key);
+        // Post for new
+      }elseif(preg_match("/system_new.*/",$key)){
+        $s_action="new";
+      }elseif(preg_match("/system_tplnew.*/i",$key)){
+        $s_action="new_tpl";
+      }elseif(preg_match("/system_setpwd_.*/i",$key)){
+        $s_action="change_pw";
+        $s_entry  = preg_replace("/system_setpwd_/i","",$key);
+      }elseif(preg_match("/gen_cd_.*/i",$key)){
+        $s_action="gen_cd";
+        $s_entry  = preg_replace("/gen_cd_/i","",$key);
+      }elseif(preg_match("/^copy_.*/",$key)){
+        $s_action="copy";
+        $s_entry  = preg_replace("/^copy_/i","",$key);
+      }elseif(preg_match("/^cut_.*/",$key)){
+        $s_action="cut";
+        $s_entry  = preg_replace("/^cut_/i","",$key);
+      }
+    }
+   
+    /* Incoming handling  
+     * If someone made a systemtype and ogroup selection 
+     * Display the new requested entry type ... servtab  in case of server and so on.
+     */
+    if(isset($_POST['SystemTypeChoosen'])){
+      $SelectedSystemType = session::get('SelectedSystemType');
+      $s_action = "SelectedSystemType";
+      $s_entry  = $_POST['SystemType'];
+      $SelectedSystemType['ogroup'] = $_POST['ObjectGroup'];
+      $this->systab = NULL;
+      session::set('SelectedSystemType',$SelectedSystemType);
+    }
+
+    /* remove image tags from posted entry  (posts looks like this 'name_x')*/
+    $s_entry  = preg_replace("/_.$/","",$s_entry);
+
+    /* Edit was requested by pressing the name(link) of an item */
+    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+      $s_action ="edit";
+      $s_entry  = $_GET['id'];
+    }
+    /* Create options */
+    if(isset($_POST['menu_action']) && preg_match("/^newsystem_/",$_POST['menu_action'])){
+      $s_action = "newsystem";
+      $s_entry  = preg_replace("/^newsystem_/","",$_POST['menu_action']);
+    }
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+    
+
+    /* Check for exeeded sizelimit */
+    if (($message= check_sizelimit()) != ""){
+      return($message);
+    }
+
+    /* Try to get informations about what kind of system to create */
+    if ($s_action=="new") {
+      return ($smarty->fetch(get_template_path('chooser.tpl', TRUE)));
+    }
+
+
+    /********************
+      Copy & Paste Handling  ...
+     ********************/
+
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+  
+
+    /********************
+      Create FAI CD ...   
+     ********************/
+    if ($s_action=="gen_cd"){
+      $this->dn= $this->terminals[$s_entry]['dn'];
+      session::set('objectinfo',$this->dn);
+      return ($smarty->fetch(get_template_path('gencd.tpl', TRUE)));
+    }
+
+
+    /* Start CD-Creation */
+    if ((isset($_POST["cd_create"])) && !empty($this->dn)){
+      $smarty->assign("src", "?plug=".$_GET['plug']."&amp;PerformIsoCreation");
+      return ($smarty->fetch(get_template_path('gencd_frame.tpl', TRUE)));
+    }
+
+
+    if ($this->dn != "" && isset($_GET['PerformIsoCreation'])){
+
+      $return_button   = "<form method='get' action='main.php' target='_parent'>
+        <input type='submit' value='"._("Back")."'>
+        <input type='hidden' name='plug' value='".$_GET['plug']."'/>
+        </form>";
+
+      $dsc             = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
+
+      /* Get and check command */
+      $command= $this->config->search("workgeneric", "ISOCMD",array('tabs'));
+      
+      if (check_command($command)){
+        @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
+
+        /* Print out html introduction */
+        echo '  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+          <html>
+          <head>
+          <title></title>
+          <style type="text/css">@import url("themes/default/style.css");</style>
+          <script language="javascript" src="include/focus.js" type="text/javascript"></script>
+          </head>
+          <body style="background: none; margin:4px;" id="body" >
+          <pre>';
+
+        /* Open process handle and check if it is a valid process */
+        $process= proc_open($command." '".$this->dn."'", $dsc, $pipes);
+        if (is_resource($process)) {
+          fclose($pipes[0]);
+
+          /* Print out returned lines && write JS to scroll down each line */
+          while (!feof($pipes[1])){
+            $cur_dat = fgets($pipes[1], 1024);
+            echo $cur_dat;
+            echo '<script language="javascript" type="text/javascript">scrollDown2();</script>' ;
+            flush();
+          }
+        }
+
+        /* Get error string && close streams */
+        $buffer= stream_get_contents($pipes[2]);
+
+        fclose($pipes[1]);
+        fclose($pipes[2]);
+        echo "</pre>";
+
+        /* Check return code */
+        $ret= proc_close($process);
+        if ($ret != 0){
+          echo "<h1 style='color:red'>"._("Creating the image failed. Please see the report below.")."</h1>";
+          echo "<pre style='color:red'>$buffer</pre>";
+        }
+
+
+
+        echo $return_button."<br>";
+
+      } else {
+        $tmp= "<h1 style='color:red'>".sprintf(_("Command '%s', specified for ISO creation doesn't seem to exist."), $command)."</h1>";
+        echo $tmp;
+      }
+
+      /* Scroll down completly */
+      echo '<script language="javascript" type="text/javascript">scrollDown2();</script>' ;
+      echo '</body></html>';
+      flush();
+      exit;
+    }
+
+
+    /********************
+      Create new system ...   
+     ********************/
+    /* Create new default terminal 
+     * Or create specified object of selected system type, from given incoming object  
+     */
+
+    $save_object_directly = false;
+    if(($s_action == "SelectedSystemType") && (isset($_POST['ObjectGroup']) && ($_POST['ObjectGroup'] != "none"))){
+      $save_object_directly = true;
+    }
+
+    if (isset($_POST['create_system'])||$s_action=="newsystem"||$s_action == "SelectedSystemType") {
+
+      /* If the current entry is an incoming object 
+       * $sw = System type as posted in new incoming handling dialog 
+       */ 
+      if($s_action == "SelectedSystemType") {
+        $sw         = $s_entry;
+      }else{
+        if(isset($_POST['system'])){
+          $sw = $_POST['system'];
+        }else{
+          $sw = $s_entry;
+        }
+        $this->dn= "new";
+      }
+
+      $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABNAME"=>"termgeneric",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABNAME"=>"workgeneric",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"),
+          "server"      => array("CLASS"=>"SERVTABS",     "TABNAME"=>"servgeneric",     "TABCLASS" =>"servtabs",      "ACL"=> "server"),
+          "printer"     => array("CLASS"=>"PRINTTABS",    "TABNAME"=>"printgeneric",    "TABCLASS" =>"printtabs",     "ACL"=> "printer"),
+          "phone"       => array("CLASS"=>"PHONETABS",    "TABNAME"=>"phoneGeneric",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone"),
+          "component"   => array("CLASS"=>"COMPONENTTABS","TABNAME"=>"componentGeneric","TABCLASS" =>"componenttabs", "ACL"=> "component"));
+
+      if(isset($tabs[$sw])){
+        $class    = $tabs[$sw]["CLASS"];
+        $tabname  = $tabs[$sw]["TABNAME"];
+        $tabclass = $tabs[$sw]["TABCLASS"];
+        $acl_cat  = $tabs[$sw]["ACL"];
+
+        /* Load permissions for selected 'dn' and check if
+           we're allowed to remove this 'dn' */
+        $ui       = get_userinfo();
+        $tabacl   = $ui->get_permissions($this->DivListSystem->selectedBase,$acl_cat."/".$tabname);
+        if(preg_match("/c/",$tabacl)){
+          $this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn,$sw);
+          $this->systab->set_acl_base($this->DivListSystem->selectedBase);
+          $this->systab->by_object[$tabname]->base = $this->DivListSystem->selectedBase;
+          $this->systab->base = $this->DivListSystem->selectedBase;
+        }else{
+          print_red(_("You are not allowed to create a new object of this type."));
+        }
+      }
+    }
+
+    /********************
+      Edit system ...   
+     ********************/
+
+    /* User wants to edit data? */
+    if (($s_action == "edit") && (!isset($this->systab->config))){
+
+      $this->dn= $this->terminals[$s_entry]['dn'];
+
+      /* Check locking, save current plugin in 'back_plugin', so
+         the dialog knows where to return. */
+      if (($user= get_lock($this->dn)) != ""){
+        return(gen_locked_message ($user, $this->dn));
+      }
+
+      /* Find out more about the object type */
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cat($this->dn, array('objectClass','gotoMode'));
+      $attrs= $ldap->fetch();
+      $type= $this->get_system_type($attrs);
+
+      /* Lock the current entry, so everyone will get the
+         above dialog */
+      $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"),
+          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server"),
+          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer"),
+          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone"),
+          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation"),
+          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component"));
+
+
+      if($type == "ArpNewDevice"){
+        $this->systab = new ArpNewDeviceTabs($this->config,$this->config->data['TABS']['ARPNEWDEVICETABS'],$this->dn);
+      }elseif($type == "NewDevice"){
+        $this->systab = new SelectDeviceType($this->config,$this->dn) ;
+      }elseif(isset($tabs[$type])){
+
+        $class    = $tabs[$type]["CLASS"];
+        $acl_cat  = $tabs[$type]["ACL"];
+        $tabclass = $tabs[$type]["TABCLASS"];
+
+        $this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn,$acl_cat);
+        $this->systab->set_acl_base($this->dn);
+        session::set('objectinfo',$this->dn);
+        add_lock ($this->dn, $this->ui->dn);
+      }else{ 
+        print_red (_("You can't edit this object type yet!"));
+        del_lock($this->dn);
+      }
+    }
+
+
+    /********************
+      Change password ...   
+     ********************/
+
+    /* Set terminals root password */
+    if ($s_action=="change_pw"){
+      $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABNAME"=>"termgeneric",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABNAME"=>"workgeneric",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"));
+
+      $type = $this->get_system_type($this->terminals[$s_entry]);
+      $class    = $tabs[$type]["CLASS"];
+      $tabname  = $tabs[$type]["TABNAME"];
+      $acl_cat  = $tabs[$type]["ACL"];
+      $tabclass = $tabs[$type]["TABCLASS"];
+      $ui       = get_userinfo();
+      $tabacl   = $ui->get_permissions($this->DivListSystem->selectedBase,$acl_cat."/".$tabname,"gotoRootPasswd");
+      if(preg_match("/w/",$tabacl)){
+        $this->dn= $this->terminals[$s_entry]['dn'];
+        session::set('objectinfo',$this->dn);
+        return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
+      }else{
+        print_red(_("You are not allowed to change the password for this object."));
+      }
+    }
+
+
+    /********************
+      Password change finish, but check if entered data is ok 
+     ********************/
+
+    /* Correctly specified? */
+    if (isset($_POST['password_finish'])){
+      if ($_POST['new_password'] != $_POST['repeated_password']){
+        print_red (_("Passwords entered as new and repeated do not match!"));
+        return($smarty->fetch(get_template_path('password.tpl', TRUE)));
+      }
+    }
+
+    /********************
+      Password change finish
+     ********************/
+
+    /* Change terminal password */
+    if (isset($_POST['password_finish']) && 
+        $_POST['new_password'] == $_POST['repeated_password']){
+
+      /* Check if user is allowed to set password */
+      $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABNAME"=>"termgeneric",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABNAME"=>"workgeneric",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"));
+
+      /* Detect object type */
+      $type = "";
+      foreach($this->terminals as $terminal){
+        if($terminal['dn'] == $this->dn){
+          $type = $this->get_system_type($terminal);
+          break;
+        } 
+      }
+
+      /* Type detected */
+      if(!empty($type)){
+
+        /* Get infos */
+        $class    = $tabs[$type]["CLASS"];
+        $tabname  = $tabs[$type]["TABNAME"];
+        $acl_cat  = $tabs[$type]["ACL"];
+        $tabclass = $tabs[$type]["TABCLASS"];
+    
+        /* Get acls */
+        $ui       = get_userinfo();
+        $tabacl   = $ui->get_permissions($this->DivListSystem->selectedBase,$acl_cat."/".$tabname,"gotoRootPasswd");
+
+        /* Check acls */
+        if(preg_match("/w/",$tabacl)){
+          $ldap = $this->config->get_ldap_link();
+          $ldap->cd($this->dn);
+
+          $attrs= array();
+          if ($_POST['new_password'] == ""){
+            $attrs['gotoRootPasswd']= array();
+          } else {
+            $attrs['gotoRootPasswd']= crypt($_POST['new_password'],substr(session_id(),0,2));
+          }
+          $ldap->modify($attrs);
+          new log("security","systems/".get_class($this),$this->dn,array_keys($attrs),$ldap->get_error());
+        }else{
+          print_red(_("You are not allowed to change the password for this object."));
+        }
+      }else{
+        print_red(_("Can't detect object to change password."));
+      }
+      session::un_set('objectinfo');
+    }
+
+
+    /********************
+      Delete system cancel
+     ********************/
+
+    /* Delete terminal canceled? */
+    if (isset($_POST['delete_cancel']) || isset($_POST['password_cancel'])){
+      del_lock ($this->dn);
+      session::un_set('objectinfo');
+    }
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+
+    if ($s_action=="del_multiple"){
+      $this->dns = array();
+      $ids = $this->list_get_selected_items();
+
+      if(count($ids)){
+
+        foreach($ids as $id){
+          $dn = $this->terminals[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        if (count($this->dns) == 1){
+          $smarty->assign("warning",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
+        } else {
+          $smarty->assign("warning",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
+        }
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+    /* Confirmation for deletion has been passed. Users should be deleted. */
+    if (isset($_POST['delete_multiple_system_confirm'])){
+
+      $ui = get_userinfo();
+      $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
+          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
+          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
+          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
+          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
+          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
+
+
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
+
+        /* Get 'dn' from posted termlinst */
+        $attrs    = $this->terminals[$key];
+        $type= $this->get_system_type($attrs);
+
+        /* get object type */
+        $tabtype  = "termtabs";
+        $tabobj   = "TERMTABS";
+        $tabacl   = "";
+        if(isset($tabs[$type])){
+          $tabtype = $tabs[$type]['TABCLASS'];
+          $tabobj  = $tabs[$type]['CLASS'];
+          $tabacl  = $ui->get_permissions($dn,$tabs[$type]['ACL']);
+
+          /* Load permissions for selected 'dn' and check if
+             we're allowed to remove this 'dn' */
+          if(preg_match("/d/",$tabacl)){ 
+
+            /* Delete request is permitted, perform LDAP action */
+            if($tabtype=="phonetabs"){
+              $this->systab= new $tabtype($this->config, $this->config->data['TABS'][$tabobj], $dn,$type);
+              $this->systab->set_acl_base($dn);
+              $this->systab->by_object['phoneGeneric']->remove_from_parent ();
+            }else{
+              $this->systab= new $tabtype($this->config,$this->config->data['TABS'][$tabobj], $dn,$type);
+              $this->systab->set_acl_base($dn);
+              $this->systab->delete();
+            }
+            unset ($this->systab);
+            $this->systab= NULL;
+
+          } else {
+            /* Normally this shouldn't be reached, send some extra
+               logs to notify the administrator */
+            print_red (_("You are not allowed to delete this component!"));
+            new log("security","systems/".get_class($this),$dn,array(),"Tried to trick deletion.");
+          }
+          /* Remove lock file after successfull deletion */
+          del_lock ($dn);
+          unset($this->dns[$key]);
+        }
+      }
+    }
+
+    /********************
+      Delete MULTIPLE entries Canceled
+     ********************/
+
+    /* Remove lock */
+   if(isset($_POST['delete_multiple_system_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /********************
+      Delete system, confirm dialog
+     ********************/
+
+    /* Remove terminal was requested */
+    if ($s_action=="del"){
+
+      /* Get 'dn' from posted termlinst */
+      $this->dn = $this->terminals[$s_entry]['dn'];
+      $attrs    = $this->terminals[$s_entry];
+
+      $type= $this->get_system_type($attrs);
+      $ui = get_userinfo();
+      $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
+          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
+          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
+          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
+          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
+          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
+
+
+      /* get object type */
+      $tabtype  = "termtabs";
+      $tabobj   = "TERMTABS";
+      $tabacl   = "";
+      if(isset($tabs[$type])){
+        $tabtype = $tabs[$type]['TABCLASS'];
+        $tabobj  = $tabs[$type]['CLASS'];
+        $tabacl  = $ui->get_permissions($this->dn,$tabs[$type]['ACL']);
+      }
+
+      /* Load permissions for selected 'dn' and check if
+         we're allowed to remove this 'dn' */
+      if(preg_match("/d/",$tabacl)){ 
+
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($user= get_lock($this->dn)) != ""){
+          return(gen_locked_message ($user, $this->dn));
+        }
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty->assign("warning", sprintf(_("You're about to delete all information about the component at '%s'."), @LDAP::fix($this->dn)));
+        $smarty->assign("multiple", false);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      } else {
+
+        /* Obviously the user isn't allowed to delete. Show message and
+           clean session. */
+        print_red (_("You are not allowed to delete this component!"));
+      }
+    }
+
+
+    /********************
+      Delete system, confirmed
+     ********************/
+    /* Confirmation for deletion has been passed. Terminal should be deleted. */
+    if (isset($_POST['delete_terminal_confirm'])){
+
+      /* Find out more about the object type */
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cat($this->dn, array('objectClass'));
+      $attrs= $ldap->fetch();
+      $type= $this->get_system_type($attrs);
+
+      $ui = get_userinfo();
+
+      $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
+          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
+          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
+          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
+          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
+          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
+
+      /* get object type */
+      $tabtype  = "termtabs";
+      $tabobj   = "TERMTABS";
+      $tabacl   = "";
+      if(isset($tabs[$type])){
+        $tabtype = $tabs[$type]['TABCLASS'];
+        $tabobj  = $tabs[$type]['CLASS'];
+        $tabacl  = $ui->get_permissions($this->dn,$tabs[$type]['ACL']);
+      }
+
+      /* Check if we are allowed to remove this object */
+      if(preg_match("/d/",$tabacl)){
+
+        /* Delete request is permitted, perform LDAP action */
+        if($tabtype=="phonetabs"){
+          $this->systab= new $tabtype($this->config, $this->config->data['TABS'][$tabobj], $this->dn,$type);
+          $this->systab->set_acl_base($this->dn);
+          $this->systab->by_object['phoneGeneric']->remove_from_parent ();
+        }else{  
+          $this->systab= new $tabtype($this->config,$this->config->data['TABS'][$tabobj], $this->dn,$type);
+          $this->systab->set_acl_base($this->dn);
+          $this->systab->delete();
+        }
+        unset ($this->systab);
+        $this->systab= NULL;
+
+        /* Terminal list has changed, reload it. */
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        print_red (_("You are not allowed to delete this component!"));
+        new log("security","systems/".get_class($this),$dn,array(),"Tried to trick deletion.");
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+    }
+
+
+
+
+
+
+
+
+
+   /********************
+      Edit system type finished, check if everything went ok
+     ********************/
+    /* Finish user edit is triggered by the tabulator dialog, so
+       the user wants to save edited data. Check and save at this
+       point. */
+    if ((isset($_POST['edit_finish'])) && (isset($this->systab->config)) || $save_object_directly){
+
+      /* Check tabs, will feed message array */
+      $message = array();
+      if(!$save_object_directly){
+        $message = $this->systab->check();
+      }else{
+        $found = false;
+
+        /* Set gotoMode to active if we there was an ogroup selected . (save_object_directly) */
+        foreach(array("workgeneric"=>"active","servgeneric"=>"active","termgeneric"=>"graphic") as $tab => $value){
+          if(isset($this->systab->by_object[$tab]->gotoMode)) {
+            $found = true;
+            $this->systab->by_object[$tab]->gotoMode = $value;
+          }
+        }
+        if(!$found){
+          print_red(sprintf(_("Can't set gotoMode to status 'active', the current object couldn't be identified.")));
+        }
+
+      }
+      /* Save, or display error message? */
+      if (count($message) == 0){
+
+        /* Incoming behavior; you can select a system type and an ogroup membership.
+         * If this object is an Incoming object, session::get('SelectedSystemType') isset.
+         * Check if we must add the new object to an object group.
+         *
+         * If this is done, delete the old incoming entry... it is still there, because this is a new
+         * entry and not an edited one, so we will delete it.
+         *
+         */
+
+        if(session::is_set('SelectedSystemType')){
+          $SelectedSystemType = session::get('SelectedSystemType');
+          if($SelectedSystemType['ogroup'] != "none"){
+            $og = new ogroup($this->config,$SelectedSystemType['ogroup']);
+            if($og){
+              $og->AddDelMembership($this->systab->dn);
+              $og->save();
+            }
+          }
+        }
+
+        /* Save terminal data to ldap */
+        $SelectedSystemType = session::get('SelectedSystemType');
+        if(isset($SelectedSystemType['ogroup']) && $SelectedSystemType['ogroup'] != 'none'){
+          foreach (array("workservice", "termservice") as $cls){
+            if (isset($this->systab->by_object[$cls])){
+              $this->systab->by_object[$cls]->gotoXMouseport= "";
+              $this->systab->by_object[$cls]->gotoXMouseType= "";
+              $this->systab->by_object[$cls]->gotoXResolution= "";
+              $this->systab->by_object[$cls]->gotoXColordepth= "";
+            }
+          }
+        }
+
+        $this->systab->save();
+
+        if(session::is_set('SelectedSystemType')){
+          session::un_set('SelectedSystemType');
+          if(!isset($ldap)){
+            $ldap = $this->config->get_ldap_link();
+          }
+          $ldap->cd ($this->dn);
+          $ldap->cat($this->dn, array('dn'));
+          if(count($ldap->fetch())){
+            $ldap->cd($this->dn);
+            $ldap->rmDir($this->dn);
+          }
+          $ldap->cd($this->config->current['BASE']);
+        }
+
+        /* Terminal has been saved successfully, remove lock from
+           LDAP. */
+        if ($this->dn != "new"){
+          del_lock ($this->dn);
+        }
+
+        unset ($this->systab);
+        $this->systab= NULL;
+        session::un_set('objectinfo');
+      } else {
+        /* Ok. There seem to be errors regarding to the tab data,
+           show message and continue as usual. */
+        show_errors($message);
+      }
+    }
+
+
+    /********************
+      Edit system was canceled 
+     ********************/
+    /* Cancel dialogs */
+    if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel']) || isset($_POST['SystemTypeAborted'])){
+      if (isset($this->systab)){
+        del_lock ($this->systab->dn);
+        unset ($this->systab);
+      }
+      $this->systab= NULL;
+      session::un_set('objectinfo');
+
+      /* Remove ogroup selection, which was set while editing a new incoming entry */
+      if(session::is_set('SelectedSystemType')){
+        session::un_set('SelectedSystemType');
+      }
+    }
+
+    /********************
+      Display edit dialog, or some other
+     ********************/
+
+    /* Show tab dialog if object is present */
+    if (isset($this->systab->config)){
+      $display= $this->systab->execute();
+
+      /* Don't show buttons if tab dialog requests this */
+
+      $dialog     = FALSE;
+      $hide_apply = $this->dn == "new";
+      if(is_object($this->systab) && !isset($this->systab->by_object)){
+        $dialog = TRUE;
+        $hide_apply = TRUE;
+      }elseif(isset($this->systab->by_object[$this->systab->current]->dialog)){
+        $dia = $this->systab->by_object[$this->systab->current]->dialog;
+        if($dia === TRUE || is_object($dia)){
+          $dialog = TRUE;
+        }  
+      }
+      if(isset($this->systab->by_object[$this->systab->current]->netConfigDNS) && 
+        $this->systab->by_object[$this->systab->current]->netConfigDNS->dialog){
+        $dialog = TRUE;
+      }
+
+      if (!$dialog){
+        $display.= "<p style=\"text-align:right\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+        $display.= "&nbsp;\n";
+        if (!$hide_apply){
+          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+          $display.= "&nbsp;\n";
+        }
+        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+        $display.= "</p>";
+      }
+      return ($display);
+    }
+
+    /* Check if there is a snapshot dialog open */
+    $base = $this->DivListSystem->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+      return($str);
+    }
+
+    /* Display dialog with system list */
+    $this->DivListSystem->parent = $this;
+    $this->DivListSystem->execute();
+
+    /* Add departments if subsearch is disabled */
+    if(!$this->DivListSystem->SubSearch){
+      $this->DivListSystem->AddDepartments($this->DivListSystem->selectedBase,3,1);
+    }
+    $this->reload();
+    $this->DivListSystem->setEntries($this->terminals);
+    return($this->DivListSystem->Draw());
+  }
+
+
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases()
+  {
+    $tmp = array();
+
+    /* Check acls, if we are not allowed to create and write each plugin tab, skip this object */
+
+    $tabs = array(
+        "terminal"        => get_ou('terminalou'),
+        "workstation"     => get_ou('workstationou'),
+        "incoming"        => get_ou('incomingou'),
+        "server"          => get_ou('serverou'),
+        "printer"         => get_ou('printerou'),
+        "phone"           => get_ou('phoneou'),
+        "winworkstation"  => get_winstations_ou(),
+        "component"       => get_ou('componentou')
+        ); 
+
+    foreach($tabs as $acl_cat => $dn){
+
+      $acl_all = $this->ui->has_complete_category_acls($dn.$this->DivListSystem->selectedBase,$acl_cat);
+      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $tmp[] = $dn.$this->DivListSystem->selectedBase;
+      }
+    }
+    return($tmp); 
+  }
+
+
+  function remove_from_parent()
+  {
+    /* Optionally execute a command after we're done */
+    $this->postremove();
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    $this->DivListSystem->save_object();
+  }
+
+
+  /* Check values */
+  function check()
+  {
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+  }
+
+  function adapt_from_template($dn)
+  {
+  }
+
+  function password_change_needed()
+  {
+  }
+
+  function reload()
+  {
+    /* some var init */
+    $ui = get_userinfo();
+    $res              = array();
+    $this->terminals  = array();
+    $userregex        = "";
+
+    /* Set base for all searches */
+    $base=  $this->DivListSystem->selectedBase;
+
+    /* Prepare samba class name */
+    $samba  ="";
+    if ($this->DivListSystem->ShowWinWorkstations){
+      if ($this->config->current['SAMBAVERSION'] == "3"){
+        $samba= "sambaSamAccount";
+      } else {
+        $samba= "sambaAccount";
+      }
+    }
+
+    /* This array represents the combination between checkboxes and search filters */
+    $objs = array( 
+        "ShowServers"        => array("CLASS" => "goServer"        ,"TREE" => get_ou('serverou')),
+        "ShowTerminals"      => array("CLASS" => "gotoTerminal"    ,"TREE" => get_ou('terminalou')),
+        "ShowPrinters"       => array("CLASS" => "gotoPrinter"     ,"TREE" => get_ou('printerou')),
+        "ShowDevices"        => array("CLASS" => "ieee802Device"   ,"TREE" => get_ou('componentou')),
+        "ShowPhones"         => array("CLASS" => "goFonHardware"   ,"TREE" => get_ou('phoneou')),
+        "ShowWorkstations"   => array("CLASS" => "gotoWorkstation" ,"TREE" => get_ou('workstationou')),
+        "ShowWinWorkstations"=> array("CLASS" => $samba            ,"TREE" => get_winstations_ou() ));
+
+    /* Include the 'Display Systems of user' attribute */ 
+    if ((!empty($this->DivListSystem->UserRegex)) && ($this->DivListSystem->UserRegex!= "*")){
+      $userregex = "(gotoLastUser=".$this->DivListSystem->UserRegex.")";
+    }
+
+    /* Attributes to fetch */
+    $sys_attrs        = array("cn", "description", "macAddress", "objectClass", "sambaDomainName","gotoMode");
+    $sys_categories   = array("terminal", "workstation", "server", "phone" ,"printer");
+
+    /* Add FAIstate to attributes if FAI is activated */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)){
+      $sys_attrs[] = "FAIstate";
+    }    
+
+    /* Walk through all possible search combinations, and search for some objects if the checkbox is enabled  */
+    foreach($objs as $checkBox => $oc){
+      if($this->DivListSystem->$checkBox){
+        if($this->DivListSystem->SubSearch){
+          if($oc['CLASS'] != ""){
+            $filter = "(&".$userregex."(objectClass=".$oc['CLASS'].")(cn=".$this->DivListSystem->Regex."))";
+            $new_res = get_sub_list($filter, $sys_categories ,preg_replace("/,.*$/","",$base), $base,$sys_attrs, GL_NONE | GL_SUBSEARCH | GL_SIZELIMIT);
+      
+            /* Remove all objects that are not in the expected sub department */
+            foreach($new_res as $key => $obj){
+              if(preg_match("/^[^,]+,".normalizePreg($oc['TREE'])."/",$obj['dn'])){
+                $res[$obj['dn']] = $obj;
+              }
+            }
+          }
+        }else{
+          /* User filter? */
+          if($oc['CLASS'] != ""){
+            $filter = "(&".$userregex."(objectClass=".$oc['CLASS'].")(cn=".$this->DivListSystem->Regex."))";
+            $res = array_merge($res,get_list($filter,$sys_categories,$oc['TREE'].$base, $sys_attrs, GL_NONE | GL_SIZELIMIT));
+          }
+        }
+      } 
+    }
+
+    /* Search for incoming objects */ 
+    $filter = "(|(&".$userregex."(objectClass=goHard)(cn=".$this->DivListSystem->Regex.")))";
+    $res = array_merge($res,get_list($filter,$sys_categories, get_ou('incomingou'),get_ou('incomingou').$base,$sys_attrs, GL_NONE | GL_SIZELIMIT));
+
+    /* Get all gotoTerminal's */
+    foreach ($res as $value){
+
+      $tmp= $value['dn'];
+      $add= "";
+
+      /* Extract base */
+      foreach($objs as $obj){
+        if(preg_match("/,".$obj['TREE']."/i",$value['dn'])){
+          $tmp = trim( preg_replace("/^[^,]+,[^o]*".$obj['TREE']."/i","",$value['dn']));
+        }
+      }
+
+      /* Create a string containing the last part of the department. */
+      $dn_name = preg_replace("#^([^/]+/)*#","",convert_department_dn(@LDAP::fix($tmp)));
+      if(empty($dn_name)){
+        $dn_name = "/";
+      }
+
+      /* check if current object is a new one */
+      if (preg_match ("/,".get_ou('incomingou')."/i", $tmp)){
+        if (in_array_ics('gotoTerminal', $value['objectClass'])){
+          $add= "- "._("New terminal");
+        }elseif (in_array_ics('gotoWorkstation', $value['objectClass'])){
+          $add= "- "._("New workstation");
+        }elseif (in_array_ics('GOhard', $value['objectClass']) && !isset($value['gotoMode'])){
+          $add= "- "._("Unknown device");
+        }elseif (in_array_ics('GOhard', $value['objectClass'])){
+          $add= "- "._("New Device");
+        }
+      } 
+
+      /* Detect type of object and create an entry for $this->terminals */
+      $terminal = array();
+
+      if (in_array_ics('gotoTerminal', $value["objectClass"])){
+
+        /* check acl */
+        $acl = $ui->get_permissions($value['dn'],"terminal/termgeneric");
+        if($add != "" || preg_match("/r/",$acl)) {
+          if (isset($value["macAddress"][0]) && $value["macAddress"][0] != "-"){
+            $terminal             = $value;
+            $terminal['type']     = "T";
+            $terminal['is_new']   = $add;
+          } else {
+            $terminal             = $value;
+            $terminal['type']     = "D";
+            $terminal['message']  = _("Terminal template for")."&nbsp;'".$dn_name."'&nbsp;";
+            $terminal['location'] = array_search($tmp, $this->config->departments); 
+          }
+        }
+      } elseif (in_array_ics('gotoWorkstation', $value["objectClass"])){
+
+        $acl = $ui->get_permissions($value['dn'],"workstation/workgeneric");
+        if($add != "" || preg_match("/r/",$acl)) {
+          if (isset($value["macAddress"][0]) &&  $value["macAddress"][0] != "-"){
+            $terminal             = $value;
+            $terminal['type']     = "L";
+            $terminal['is_new']   = $add;
+          } else {
+            $terminal             = $value;
+            $terminal['type']     = "D";
+            $terminal['location'] = array_search($tmp, $this->config->departments);
+            $terminal['message']  = _("Workstation template for")."&nbsp;'".$dn_name."'&nbsp;";
+          }
+          if (isset($value["FAIstate"][0])){
+            $terminal['type']= $this->getState($terminal['type'], $value["FAIstate"][0]);
+          }
+        }
+      } elseif (in_array_ics('gotoPrinter', $value["objectClass"])){
+       
+   
+        $acl = $ui->get_permissions($value['dn'],"printer/printgeneric");
+        if($add != "" || preg_match("/r/",$acl)) {
+
+          $terminal             = $value;
+          $terminal['type']     = "P";
+        }
+      } elseif (in_array_ics('goServer', $value["objectClass"])){
+
+        $acl = $ui->get_permissions($value['dn'],"server/servgeneric");
+        if($add != "" || preg_match("/r/",$acl)) {
+
+          $terminal             = $value;
+          $terminal['type']     = "S";
+          if (isset($value["FAIstate"][0])){
+            $terminal['type']= $this->getState($terminal['type'], $value["FAIstate"][0]);
+          }
+        }
+      } elseif (in_array_ics('goFonHardware', $value["objectClass"])){
+
+        $acl = $ui->get_permissions($value['dn'],"phone/phoneGeneric");
+        if($add != "" || preg_match("/r/",$acl)) {
+
+          $terminal             = $value;
+          $terminal['type']     = "F";
+        }
+      }elseif (in_array_ics("GOhard",$value['objectClass'])){
+
+        $acl =  $ui->get_permissions($value['dn'],"server/servgeneric"). 
+                $ui->get_permissions($value['dn'],"terminal/termgeneric").
+                $ui->get_permissions($value['dn'],"workstation/workgeneric");
+        if($add != "" || preg_match("/r/",$acl)) {
+
+          $terminal = $value;
+          $terminal['type']   = "Q";
+          $terminal['is_new'] = $add;
+        }
+      } elseif (in_array_ics('ieee802Device', $value["objectClass"])){
+
+        $acl = $ui->get_permissions($value['dn'],"component/componentGeneric");
+        if($add != "" || preg_match("/r/",$acl)) {
+
+          $terminal             = $value;
+          $terminal['type']     = "C";
+        }
+      } else{
+
+        $name= preg_replace('/\$$/', '', $value['cn'][0]);
+        if (isset($value['sambaDomainName'])){
+          $domain= " [".$value['sambaDomainName'][0]."]";
+        } else {
+          $domain= "";
+        }
+        $terminal=$value;
+        $terminal['type']     ="W";
+        $terminal['domain']   = $name.$domain;
+      }
+
+      if(count($terminal)){
+        $this->terminals[]=$terminal;
+      }
+    }
+
+    $tmp  =array();
+    $tmp2 =array();
+    foreach($this->terminals as $tkey => $val ){
+      $tmp[strtolower($val['cn'][0]).$val['dn']]=$val;
+      $tmp2[strtolower($val['cn'][0]).$val['dn']] = strtolower($val['cn'][0]).$val['dn'];
+    }
+    natcasesort($tmp2);
+    $this->terminals=array();
+    foreach($tmp2 as $val){
+      $this->terminals[]=$tmp[$val];
+    }
+    reset ($this->terminals);
+  }
+
+  function remove_lock()
+  {
+    if (isset($this->systab->dn)){
+      del_lock ($this->systab->dn);
+    }
+  }
+
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+
+    $tabs = array(
+        "terminal"    => array( "CLASS"     =>"TERMTABS",     "TABNAME" =>"termgeneric",     
+          "TABCLASS"  =>"termtabs",     "ACL"     =>"terminal"),
+        "workstation" => array( "CLASS"     =>"WORKTABS",     "TABNAME" =>"workgeneric",     
+          "TABCLASS"  =>"worktabs",     "ACL"     =>"workstation"),
+        "server"      => array( "CLASS"     =>"SERVTABS",     "TABNAME" =>"servgeneric",     
+          "TABCLASS"  =>"servtabs",     "ACL"     =>"server"),
+        "printer"     => array( "CLASS"     =>"PRINTTABS",    "TABNAME" =>"printgeneric",    
+          "TABCLASS"  =>"printtabs",    "ACL"     =>"printer"),
+        "phone"       => array( "CLASS"     =>"PHONETABS",    "TABNAME" =>"phoneGeneric",    
+          "TABCLASS"  =>"phonetabs",    "ACL"     =>"phone"),
+        "component"   => array( "CLASS"     =>"COMPONENTTABS","TABNAME" =>"componentGeneric",
+          "TABCLASS"  =>"componenttabs","ACL"     =>"component"));
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $dn     = $this->terminals[$s_entry]['dn'];
+      $oc     = $this->terminals[$s_entry]['objectClass'];
+      $type   = $this->get_system_type($this->terminals[$s_entry]);
+
+      $tab_o  = $tabs[$type]['CLASS'];
+      $tab_c  = $tabs[$type]['TABCLASS'];
+      $acl    = $tabs[$type]['ACL'];
+
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,$tab_c,$tab_o,$acl);
+    }
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->terminals[$id]['dn'];
+        $oc = $this->terminals[$id]['objectClass']; 
+        $type = $this->get_system_type($this->terminals[$id]);
+
+        if(isset($tabs[$type])){
+          $tab_o  = $tabs[$type]['CLASS'];
+          $tab_c  = $tabs[$type]['TABCLASS'];
+          $acl    = $tabs[$type]['ACL'];
+
+          if($s_action == "copy_multiple"){
+            $this->CopyPasteHandler->add_to_queue($dn,"copy",$tab_c,$tab_o,$acl);
+          }
+          if($s_action == "cut_multiple"){
+            $this->CopyPasteHandler->add_to_queue($dn,"cut",$tab_c,$tab_o,$acl);
+          }
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+  
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+    
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListSystem->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
+  }
+
+
+  function get_system_type($attrs)
+  {
+    $classes = $attrs['objectClass'];
+
+    $type= "";
+    if (in_array_ics('ieee802Device', $classes)){
+      $type= "component";
+    }elseif (in_array_ics('gotoTerminal', $classes)){
+      $type= "terminal";
+    }elseif (in_array_ics('gotoWorkstation', $classes)){
+      $type= "workstation";
+    }elseif (in_array_ics('gotoPrinter', $classes)){
+      $type= "printer";
+    }elseif (in_array_ics('goFonHardware', $classes)){
+      $type= "phone";
+    }elseif (in_array_ics('goServer', $classes)){
+      $type= "server";
+    }elseif (in_array_ics('GOhard', $classes) && !isset($attrs['gotoMode']) && $this->arp_handling_active){
+      $type= "ArpNewDevice";
+    }elseif (in_array_ics('GOhard', $classes)){
+      $type= "NewDevice";
+    }elseif (in_array_ics('sambaAccount', $classes) ||
+        in_array_ics('sambaSamAccount', $classes)){
+      $type= "winstation";
+    }
+    return ($type);
+  }
+
+
+  function convert_list($input)
+  {
+    $temp= "";
+    $conv= array(      
+        "NQ" => array("select_newsystem.png",_("New System from incoming")),
+        "D" => array("select_default.png",_("Template")),
+        "T" => array("select_terminal.png",_("Terminal")),
+        "L" => array("select_workstation.png",_("Workstation")),
+        "GL" => array("select_workstation_green.png",_("Workstation is installing")),
+        "YL" => array("select_workstation_yellow.png",_("Workstation is waiting for action")),
+        "RL" => array("select_workstation_red.png",_("Workstation installation failed")),
+        "F" => array("select_phone.png",_("Phone")),
+        "S" => array("select_server.png",_("Server")),
+        "GS" => array("select_server_green.png",_("Server is installing")),
+        "YS" => array("select_server_yellow.png",_("Server is waiting for action")),
+        "RS" => array("select_server_red.png",_("Server installation failed")),
+        "W" => array("select_winstation.png",_("Winstation")),
+        "C" => array("select_component.png",_("Network Device")),
+        "NT"=> array("select_new_terminal.png",_("New Terminal")),
+        "NL"=> array("select_new_workstation.png",_("New Workstation")),
+        "P" => array("select_printer.png",_("Printer")));
+
+    if((isset($input['is_new']))&&(!empty($input['is_new']))){
+      $input['type']="N".$input['type'];
+    }
+    foreach ($conv  as $key => $value){
+      if($input['type']==$key){
+        $tmp['img'] ="<img class='center' src='images/".$value[0]."' alt='".$key."' title='".$value['1']."'>";
+        $tmp['class']=$key;
+        return $tmp;
+      }
+    }
+  }
+
+  
+  function getState($type, $state)
+  {
+    switch (preg_replace('/:.*$/', '', $state)) {
+      case 'installing':
+                $type= 'G'.$type;
+                break;
+      case 'error':
+                $type= 'R'.$type;
+                break;
+      case 'install':
+      case 'sysinfo':
+      case 'softupdate':
+      case 'scheduledupdate':
+                $type= 'Y'.$type;
+                break;
+    }
+
+
+    return ($type);
+  }
+
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  /* !! Incoming dummy acls, required to defined acls for incoming objects
+   */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Incoming objects"),
+          "plDescription" => _("Incoming objects"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 99,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("incoming"   => array( "description"  => _("Incoming"),
+                                                          "objectClass"  => "")),
+          "plProvidedAcls"=> array()
+            
+          ));
+  }
+
+
+  
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/systems/admin/systems/class_termDNS.inc b/gosa-plugins/systems/admin/systems/class_termDNS.inc
new file mode 100644 (file)
index 0000000..526eefc
--- /dev/null
@@ -0,0 +1,1013 @@
+<?php
+
+class termDNS extends plugin
+{
+  /* attribute list for save action */
+  var $ignore_account = true;
+  var $autonet        = false;
+
+  /* Basic informations 
+   */
+  var $attributes     = array("ipHostNumber","macAddress");
+  var $objectclasses  = array("whatever");
+
+  var $ipHostNumber   = "";    // IP address 
+  var $macAddress     = "";    // Mac address 
+
+  var $orig_ipHostNumber   = "";    // IP address 
+  var $orig_macAddress     = "";    // Mac address 
+
+  var $cn             = "";    // CN of currently edited device 
+  var $OrigCn         = "";    // Initial cn
+  var $IPisMust       = false;
+  var $MACisMust      = false;
+  var $dialog;
+
+  /* DCHP Attributes 
+   */
+  var $dhcpAttributes           = array("dhcpParentNode");
+  var $dhcpEnabled              = FALSE;
+  var $dhcp_is_Account          = FALSE;
+  var $dhcpParentNodes          = array();
+  var $dhcpParentNode           = "";
+  var $dhcpHostEntry            = array();
+  var $initial_dhcpParentNode   = "";
+  var $initial_dhcpHostEntry    = array();
+  var $initial_dhcp_is_Account  = FALSE;
+
+  var $used_ip_mac              = array();  
+
+  /* DNS attributes  
+   */
+  var $DNSattributes            = array("dNSClass","zoneName","dNSTTL");
+  var $DNS_is_account           = false;
+  var $initially_was_account = false;
+  var $dnsEntry                 = array();
+  var $DNSenabled               = false;
+  var $hide_dns_check_box       = FALSE;
+
+  /*  Terminal dns 
+   */
+  function termDNS (&$config, $parent,$objectClasses,$IPisMust = false)
+  {
+    /* We need to know which objectClasses are used, to store the ip/mac
+     * Because of different type of devices   
+     */ 
+    $this->parent         = $parent;
+    $this->objectclasses  =  $objectClasses;
+    $this->IPisMust       = $IPisMust;
+
+    plugin::plugin ($config, $parent->dn);
+
+    if(isset($this->attrs['cn'][0])){
+      $this->OrigCn = preg_replace("/\\\$\$/","",$this->attrs['cn'][0]);
+      $this->cn = preg_replace("/\\\$\$/","",$this->attrs['cn'][0]);
+    }
+
+    /************
+     * DHCP 
+     ************/
+
+    /* Hide all dhcp specific code, if dhcp plugin is not present in config */
+    $dhcpEnabled = FALSE;
+    if($this->config->search("servdhcp","class",array("tabs"))){
+      $this->dhcpEnabled = TRUE;
+    }
+    if($this->dhcpEnabled){
+      $this->dhcpParentNodes = $this->get_dhcp_parent_nodes();
+      $this->dhcpParentNode  = $this->get_dhcp_parent_node();
+      if($this->dhcpParentNode){
+        $this->dhcp_is_Account = TRUE;
+        $this->initial_dhcp_is_Account = TRUE;
+        $this->dhcpHostEntry  = $this->get_dhcp_host_entry();    
+      }
+      $this->initial_dhcpHostEntry = $this->dhcpHostEntry;
+      $this->initial_dhcpParentNode= $this->dhcpParentNode;
+    }
+
+
+    /************
+     * Autonetwork hook 
+     ************/
+    /* Do we have autonet support? */
+    if (isset($this->config->data['MAIN']['AUTO_NETWORK_HOOK'])){
+      $this->autonet= true;
+    }
+
+
+    /************
+     * DNS
+     ************/
+    /* Hide all dns specific code, if dns is not available 
+     */
+    $DNSenabled = false;
+    foreach($this->config->data['TABS']['SERVERSERVICE'] as $tab){
+      if(preg_match("/^servdns$/",$tab['CLASS'])){
+        $this->DNSenabled = true;
+      }
+    }
+    if(!$this->DNSenabled){
+      $this->DNS_is_account = false;
+      return;
+    }
+
+    if($this->DNSenabled){
+
+      /* Get Zones  
+       */
+      $this->Zones        = DNS::getAvailableZones($config);
+
+      /* Get Entry 
+       */
+      $this->dnsEntry     = DNS::getDNSHostEntries($config,$this->OrigCn);
+
+      /* Remove A record which equals $this->ipHostNumber
+       */
+      $ptr = $this->get_pTRRecord();
+      foreach($this->dnsEntry['RECORDS'] as $key => $rec){
+        if(($rec['type'] == "aRecord") && ($rec['value'] == $this->ipHostNumber)){
+          unset($this->dnsEntry['RECORDS'][$key]);
+        }
+        if(($rec['type'] == "pTRRecord") && ($rec['value'] == $ptr)){
+          unset($this->dnsEntry['RECORDS'][$key]);
+        }
+      }
+
+      /* Get Record types 
+       */
+      $this->RecordTypes  = DNS::getDnsRecordTypes();
+
+      /* If there is at least one entry in this -> types, we have DNS enabled 
+       */
+      if($this->dnsEntry['exists']){
+        $this->DNS_is_account = true;
+      }else{
+        $this->DNS_is_account = false;
+      }
+    }
+
+    /* Create a list of used mac and ip addresses */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(|(macAddress=*)(ipHostNumber=*))",array("macAddress","ipHostNumber"));
+    while($attrs = $ldap->fetch()){
+      if(isset($attrs['ipHostNumber'][0])){
+        $this->used_ip_mac["ip:".$attrs['ipHostNumber'][0]] = "ip:".$attrs['ipHostNumber'][0];
+      }
+      if(isset($attrs['macAddress'][0])){
+        $this->used_ip_mac["mac:".$attrs['macAddress'][0]] = "mac:".$attrs['macAddress'][0];
+      }
+    } 
+
+    /* Save initial ip and mac values, to be able 
+        check if the used values are already in use */ 
+    $this->orig_ipHostNumber   = $this->ipHostNumber;  
+    $this->orig_macAddress     = $this->macAddress;
+    /* Store initally account settings 
+     */
+    $this->initially_was_account = $this->DNS_is_account;
+
+    if($this->DNS_is_account){
+      new log("view","unknown/".get_class($this),$this->dn);
+    }
+  }
+
+
+  function netmaskIsCoherent($idZone) 
+  {
+    $netmask = DNS::FlipIp(str_replace(".in-addr.arpa","",DNS::getNameFromMix($idZone)));
+    if(!strstr($this->ipHostNumber, $netmask)){
+      return false;
+    }else{
+      return true;
+    }
+  }
+
+
+  function getVarsForSaving($attrs) 
+  {
+    foreach($this->attributes as $attr){
+      if(!empty($this->$attr)){
+        $attrs[$attr] = $this->$attr;
+      }
+    }
+    return($attrs); 
+  }
+
+  function execute()
+  {
+         /* Call parent execute */
+    $smarty= get_smarty();
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $display= "";
+
+    $smarty->assign("staticAddress", ""); 
+    $smarty->assign("autonet", $this->autonet);
+    /* Check for autonet button */
+    if ($this->autonet && isset($_POST['autonet'])){
+      $cmd= $this->config->data['MAIN']['AUTO_NETWORK_HOOK'];
+      if(!empty($cmd) && $this->cn != ""){
+        $res = shell_exec($cmd." ".$this->cn);
+        if(!$res){
+          print_red(sprintf(_("Can't execute specified AUTO_NETWORK_HOOK '%s'. Please check your gosa.conf."),$cmd));
+        } else {
+          $res= split(';', trim($res));
+          if (isset($res[0]) && $res[0] != ""){
+            $this->ipHostNumber= $res[0];
+          }
+          if (isset($res[1]) && $res[1] != ""){
+            $this->macAddress= $res[1];
+          }
+        }
+      }
+    }
+    
+  
+    /**********
+     * DHCP Handling
+     **********/
+    if(isset($_POST['dhcpEditOptions'])){
+
+      if(count($this->dhcpHostEntry) == 0){
+        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
+      }else{
+        $this->dialog = new dhcpHost($this->dhcpHostEntry,TRUE);
+      }
+      $this->dialog->cn = $this->cn; 
+      $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress; 
+      if(!empty($this->ipHostNumber)){
+        $this->dialog->statements['fixed-address'] = $this->ipHostNumber; 
+      }
+    }
+
+    if(isset($_POST['cancel_dhcp'])){
+      $this->dialog = FALSE; 
+    }
+
+    if(isset($_POST['save_dhcp'])){
+      $this->dialog->save_object();
+      
+      $msgs = $this->dialog->check(array());
+      if(count($msgs)){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+        $this->dhcpHostEntry = $this->dialog->save();
+        $this->dialog = FALSE; 
+      }
+    }
+
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+    $smarty->assign("dhcpEnabled",    $this->dhcpEnabled);
+    $smarty->assign("dhcp_is_Account",$this->dhcp_is_Account);
+    $smarty->assign("dhcpParentNode", $this->dhcpParentNode);
+    $smarty->assign("dhcpParentNodes",$this->dhcpParentNodes);
+    $smarty->assign("dhcpParentNodeCnt",count($this->dhcpParentNodes));
+
+
+    /**********
+     * DNS Handling
+     **********/
+
+    /* There is no dns available
+     */
+    if($this->DNSenabled == false){
+
+      /* Is IP address must ? */
+      $smarty->assign("DNS_is_account",false);
+      $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
+
+      /* Assign smarty all non DNs attributes */
+      foreach($this->attributes as $attr){
+        $smarty->assign($attr,$this->$attr);
+      }
+      $smarty->assign("staticAddress","<font class=\"must\">*</font>");
+
+      $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
+    }else{
+      $smarty->assign("DNS_is_account",true);
+
+      /* Add new empty array to our record list */
+      if(isset($_POST['AddNewRecord'])){
+        $this->dnsEntry['RECORDS'][]  =array("type"=>"aRecord","value"=>"");
+      }
+
+      /* propose_ip */
+      if(isset($_POST['propose_ip'])){
+        foreach($this->Zones as $key => $name){
+          if($name == $this->dnsEntry['zoneName']){
+            $net = DNS::FlipIp(str_replace(".in-addr.arpa","",DNS::getNameFromMix($key)));
+            $this->ipHostNumber = $this->generateRandomIp($net);
+          }
+        }
+      }
+
+      /* Handle all posts */
+      $only_once =true;
+      foreach($_POST as $name => $value){
+
+        /* Check if we have to delete a record entry */
+        if((preg_match("/RemoveRecord_/",$name))&&($only_once)) {
+
+          /* Avoid performing this once again */
+          $only_once = false;
+
+          /* Extract id for specified entry */
+          $id = preg_replace("/RemoveRecord_/","",$name);
+          $id = preg_replace("/_.*$/","",$id);
+
+          /* Delete this record, mark edited entries to be able to delete them */
+          if(isset($this->dnsEntry['RECORDS'][$id])){
+            unset($this->dnsEntry['RECORDS'][$id]);
+          }
+        }
+      }
+      /* Assign smarty all non DNs attributes */
+      foreach($this->attributes as $attr){
+        $smarty->assign($attr,$this->$attr);
+      }
+
+      /* Assign smarty all DNS attributes */
+      foreach($this->DNSattributes as $attr){
+        $smarty->assign($attr,$this->dnsEntry[$attr]);
+      }
+
+      /* Assign all needed vars */
+      $smarty->assign("DNSAccount",$this->DNS_is_account);
+      $smarty->assign("hide_dns_check_box",$this->hide_dns_check_box);
+  
+      $smarty->assign("Zones",$this->Zones);
+      $smarty->assign("ZoneCnt",count($this->Zones));
+      $smarty->assign("ZoneKeys",($this->Zones));
+      $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
+
+      /* Create zone array */
+      $idZones = array();
+      foreach($this->Zones as $id => $zone){
+        if($this->netmaskIsCoherent($id)) {
+          $idZones[$id] = $zone;
+        }else{
+          $idZones[$id] = $zone."&nbsp;("._("Not matching").")";
+        }
+      }
+      $smarty->assign("Zones",$idZones);
+      $smarty->assign("ZoneKeys", $this->Zones);
+
+      $tmp = $this->generateRecordsList();
+
+      $changeStateForRecords = $tmp['changeStateForRecords'];
+
+      $smarty->assign("records",$tmp['str']);
+      $smarty->assign("changeStateForRecords",$changeStateForRecords);
+      $smarty->assign("staticAddress","<font class=\"must\">*</font>");
+
+      $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
+    }
+    return($display);
+  }
+
+
+  function remove_from_parent()
+  {
+    if($this->initially_was_account){
+
+      $ldap = $this->config->get_ldap_link();
+
+      $tmp = array();
+      $this->dnsEntry['exists'] = false;
+      $tmp = DNS::getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn);
+
+      /* Delete dns */
+      foreach($tmp['del'] as $dn => $del){
+        $ldap->cd($dn);
+        $ldap->rmdir_recursive($dn);
+        new log("remove","unknown/".get_class($this),$dn);
+      }
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+
+    if(isset($_POST['network_tpl_posted'])){
+
+      /* Save all posted vars */
+      plugin::save_object();
+
+      /* Handle DHCP Posts*/
+      if($this->dhcpEnabled && isset($_POST['network_tpl_posted'])){
+        foreach($this->dhcpAttributes as $attr){
+          if(isset($_POST[$attr])){
+            $this->$attr = $_POST[$attr];
+          }
+        }
+        if(isset($_POST['dhcp_is_Account'])){
+          $this->dhcp_is_Account = TRUE;
+        }else{
+          $this->dhcp_is_Account = FALSE;
+        }
+      }
+
+      /* Ge all non dns attributes (IP/MAC)*/
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
+          $this->$attr = $_POST[$attr];
+        }
+      }
+
+      /* Check if DNS should be enabled / disabled */
+      if($this->DNS_is_account && $this->acl_is_removeable() && !isset($_POST['DNS_is_account'])){
+        $this->DNS_is_account = false;
+      }elseif(!$this->DNS_is_account && $this->acl_is_createable() && isset($_POST['DNS_is_account'])){
+        $this->DNS_is_account = true;
+      }
+
+      /* Get dns attributes */
+      if(($this->DNSenabled) && (isset($_POST['network_tpl_posted']))){
+
+        /* Check for posted record changes */
+        if(is_array($this->dnsEntry['RECORDS']) && $this->acl_is_writeable("Records")){
+          foreach($this->dnsEntry['RECORDS'] as $key => $value){
+
+            /* Check if type has changed */
+            if(isset($_POST['RecordTypeSelectedFor_'.$key])){
+              $this->dnsEntry['RECORDS'][$key]['type'] = $_POST['RecordTypeSelectedFor_'.$key];
+            }
+            /* Check if value has changed */
+            if(isset($_POST['RecordValue_'.$key])){
+              $this->dnsEntry['RECORDS'][$key]['value'] = $_POST['RecordValue_'.$key];
+            }
+          }
+        }
+        /* Get all basic DNS attributes (TTL, Clas ..)*/
+        foreach($this->DNSattributes as $attr){
+          if(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
+            $this->dnsEntry[$attr] = $_POST[$attr];
+          }
+        }
+
+
+      }
+      if($this->hide_dns_check_box){
+        $this->DNS_is_account = true;
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if($this->dhcpEnabled && $this->dhcp_is_Account && $this->dhcpParentNode != "" && count($this->dhcpHostEntry) == 0){
+#      $message[] =_("You have not configured your dhcp settings yet.");
+    }
+    
+    /* Check if mac and ip are already used */
+    if(!empty($this->ipHostNumber) && $this->DNS_is_account && 
+        $this->ipHostNumber != $this->orig_ipHostNumber && 
+        in_array("ip:".$this->ipHostNumber,$this->used_ip_mac)){
+      $message[] =_("The specified IP address is already in use.");
+    }
+    if(!empty($this->macAddress) && $this->dhcp_is_Account && 
+        $this->macAddress != $this->orig_macAddress && 
+        in_array("mac:".$this->macAddress,$this->used_ip_mac)){
+      print_red(sprintf(_("The specified MAC address '%s' for this system '%s' is already in use."),$this->macAddress,$this->cn));
+    }
+
+    /* Check if ip must be given
+     */  
+    if(($this->IPisMust)||($this->DNS_is_account)){
+      if (empty($this->ipHostNumber)){
+        $message[]= _("The required field 'IP-address' is not set.");
+      }
+
+      if (!tests::is_ip($this->ipHostNumber)){
+        $message[]= _("Wrong IP format in field IP-address.");
+      }
+    }
+
+    /* Check if mac is empty 
+     */
+    if ($this->macAddress == "" ){
+      $message[]= _("The required field 'MAC-address' is not set.");
+    }
+    if(!tests::is_mac($this->macAddress)){
+      $message[]=(_("The given macaddress is invalid. There must be 6 2byte segments seperated by ':'."));
+    }
+
+    /* only perfrom this checks if this is a valid DNS account */
+    if($this->DNS_is_account){
+
+      $checkArray = array();
+      $onlyOnce   = array();
+
+      //  $onlyOnce['cNAMERecord'] = 0;
+       $tmp = array_flip($this->Zones);
+       $tmp2 = $tmp[$this->dnsEntry['zoneName']];
+       if(!$this->netmaskIsCoherent($tmp2)){ //this->dnsEntry['zoneName'])){
+         $tmp2 = preg_replace("/^.*\//","",$tmp2);
+         $message[] =sprintf(_("The specified IP address '%s' is not matching the selected reverse zone entry '%s'."),$this->ipHostNumber,$tmp2);
+       }
+
+      /* Walk through all entries and detect duplicates or mismatches
+       */  
+      foreach($this->dnsEntry['RECORDS'] as $name => $values){
+
+        /* Count record values, to detect duplicate entries for a specific record
+         */
+        if(!isset($checkArray[$values['type']][$values['value']])){
+          $checkArray[$values['type']][$values['value']] = 0;
+        }else{
+          $message[] = sprintf(_("Found duplicate value for record type '%s'."),$values['type']);
+        }
+
+        /* Check if given entries in $onlyOnce are used more than once
+         */
+        if(isset($onlyOnce[$values['type']])){
+          $onlyOnce[$values['type']] ++;
+          if($onlyOnce[$values['type']] > 1){
+            $message[] = sprintf(_("Found more than one entry for the uniqe record type '%s'."),$values['type']);
+          }
+        }
+
+        /* Skip txt record ... 
+         */
+        if($values['type'] == "tXTRecord") continue;
+
+        /* Check if there is an aRecord defined which uses the same IP as used in IPhostAddress 
+         */
+        if(($values['type'] == "aRecord")&&($values['value'] == $this->ipHostNumber)){
+          $message[]=sprintf(_("The device IP '%s' is added as 'A Record', this will be done automatically, please remove the record."), 
+               $this->ipHostNumber);
+        }
+
+        /* only lower-case is allowed in record entries ... 
+         */
+        if($values['value'] != strtolower($values['value'])){
+          $message[] = sprintf(_("Only lowercase is allowed, please check your '%ss'."),$values['type']);
+        }
+      }
+    }
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    $ldap= $this->config->get_ldap_link();
+  
+    $dn = $this->parent->dn;
+    /*******************/ 
+    /* IP-MAC HANDLING */
+    /*******************/ 
+
+    /* $dn was posted as parameter */
+    $this->dn = $dn;
+    
+    /* Save DNS setting & ip/Mac*/
+    plugin::save();
+
+    /* Write back to ldap */
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    /****************/ 
+    /* DHCP HANDLING */
+    /****************/ 
+  
+    /* New entry */
+    if($this->dhcpEnabled){
+
+      if(count($this->dhcpHostEntry) == 0){
+        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
+        $this->dialog->cn = $this->cn;
+        $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress;
+        if(!empty($this->ipHostNumber)){
+          $this->dialog->statements['fixed-address'] = $this->ipHostNumber;
+        }
+        $this->dialog->execute();
+        $this->dialog->save_object(); 
+        $this->dhcpHostEntry = $this->dialog->save();
+        if(count($this->dhcpHostEntry['dhcpOption']) == 0){
+          $this->dhcpHostEntry['dhcpOption']= array("host-name ".$this->cn);
+        }
+      }
+
+      if(count($this->dhcpHostEntry) == 0){
+        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
+        $this->dialog->cn = $this->cn;
+        $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress;
+        if(!empty($this->ipHostNumber)){
+          $this->dialog->statements['fixed-address'] = $this->ipHostNumber;
+        }
+        $this->dialog->execute();
+        $this->dialog->save_object(); 
+        $this->dhcpHostEntry = $this->dialog->save();
+        if(count($this->dhcpHostEntry['dhcpOption']) == 0){
+          $this->dhcpHostEntry['dhcpOption']= array("host-name ".$this->cn);
+        }
+      }
+
+      /* Write mac address to dhcp settings */
+      if($this->dhcp_is_Account){
+        if(!isset($this->dhcpHostEntry['dhcpHWAddress'][0]) || 
+            !preg_match("/ethernet ".$this->macAddress."/",$this->dhcpHostEntry['dhcpHWAddress'][0])){
+          $this->dhcpHostEntry['dhcpHWAddress'] = array("ethernet ".$this->macAddress);
+          $this->dhcpHostEntry['MODIFIED'] = TRUE;
+        }
+      }
+  
+
+      /* Unset dhcpStatements if this attribute is empty  */
+      if(isset($this->dhcpHostEntry['dhcpStatements']) && 
+          ($this->dhcpHostEntry['dhcpStatements'] == "" || count($this->dhcpHostEntry['dhcpStatements']) == 0) ){
+        unset($this->dhcpHostEntry['dhcpStatements']);
+      }
+  
+      /* DHCP removed */
+      if($this->initial_dhcp_is_Account && !$this->dhcp_is_Account){
+        $ldap->rmdir_recursive($this->dhcpHostEntry['dn']);
+        show_ldap_error($ldap->get_error(),_("Removing dhcp entry for this object failed."));
+
+        $tmp = new servdhcp($this->config,$this->dhcpParentNode);
+        $tmp->handle_post_events("remove");
+      }
+
+      /* DHCP Added */
+      if(!$this->initial_dhcp_is_Account && $this->dhcp_is_Account){
+        $attrs = $this->dhcpHostEntry;
+        unset($attrs['MODIFIED']);
+        unset($attrs['dn']);
+        $ldap->cd("cn=".$this->cn.",".$this->dhcpParentNode);
+        $res = $ldap->add($attrs);
+
+        $tmp = new servdhcp($this->config,$this->dhcpParentNode);
+        $tmp->handle_post_events("add");
+
+        show_ldap_error($ldap->get_error(),_("Tried to add new dhcp entry failed."));
+      }
+
+      /* DHCP still activated */
+      if($this->initial_dhcp_is_Account && $this->dhcp_is_Account){
+
+        /* DHCP node changed */
+        if(($this->initial_dhcpParentNode != $this->dhcpParentNode) || 
+           ($this->cn != $this->OrigCn)){
+          $attrs = $this->dhcpHostEntry;
+          $attrs['cn'] = $this->cn;
+          unset($attrs['dn']);
+          unset($attrs['MODIFIED']);
+          $ldap->cd("cn=".$this->cn.",".$this->dhcpParentNode);
+          $res = $ldap->add($attrs);
+
+          $tmp = new servdhcp($this->config,$this->dhcpParentNode);
+          $tmp->handle_post_events("modify");
+
+          show_ldap_error($ldap->get_error(),_("Tried to add new dhcp entry failed."));
+          if($res){
+            $ldap->rmdir_recursive($this->dhcpHostEntry['dn']);
+            show_ldap_error($ldap->get_error(),_("Removing old dhcp entry failed."));
+          }
+        }
+         
+        /* SAME node but modified */ 
+        if(isset($this->dhcpHostEntry['MODIFIED']) && $this->dhcpHostEntry['MODIFIED'] == 1  && 
+            $this->initial_dhcpParentNode == $this->dhcpParentNode){
+          $attrs = $this->dhcpHostEntry;
+          unset($attrs['dn']);
+          unset($attrs['MODIFIED']);
+          $ldap->cd($this->dhcpHostEntry['dn']);
+          $ldap->modify($attrs);
+          
+          $tmp = new servdhcp($this->config,$this->dhcpParentNode);
+          $tmp->handle_post_events("modify");
+
+          show_ldap_error($ldap->get_error(),_("Modifying dhcp entry failed."));
+        }    
+      }
+    }
+      
+
+    /****************/ 
+    /* DNS HANDLING */
+    /****************/ 
+
+    /* If isn't DNS account but initially was DNS account 
+       remove all DNS entries 
+     */ 
+    if((!$this->DNSenabled) || ((!$this->DNS_is_account)&&(!$this->initially_was_account))){
+      return;
+    }else{
+
+      /* Add ipHostNumber to aRecords
+       */
+      $backup_dnsEntry = $this->dnsEntry;
+      if(!empty($this->ipHostNumber)){
+        $this->dnsEntry['RECORDS'][] = array("type"=>"aRecord","value"=>$this->ipHostNumber);
+        $ptr = $this->get_pTRRecord();
+        if(!empty($ptr)){
+          $this->dnsEntry['RECORDS'][] = array("type"=>"pTRRecord","value"=>$ptr);
+        } 
+      }
+
+      /* Create diff and follow instructions 
+       * If Account was disabled, remove account by setting exists to false
+       */
+      if((!$this->DNS_is_account)&&($this->initially_was_account)){  
+        $this->dnsEntry['exists'] = false;
+        $tmp = DNS::getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn);
+      }else{
+        $this->dnsEntry['exists'] = $this->DNS_is_account;
+        $tmp = DNS::getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn);
+      }   
+
+      /* move follwoing entries 
+       */
+      foreach($tmp['move'] as $src => $dst){
+        $this->recursive_move($src,$dst);
+      }
+
+      /* Delete dns */
+      foreach($tmp['del'] as $dn => $del){
+        $ldap->cd($dn);
+        $ldap->rmdir_recursive($dn);
+        new log("modify","unknown/".get_class($this),$dn,array("*"),$ldap->get_error());
+      }
+
+      /* Add || Update new DNS entries 
+       */
+      foreach($tmp['add'] as $dn => $attrs){
+        $ldap->cd($dn);
+        $ldap->cat($dn, array('dn'));
+        if(count($ldap->fetch())){
+          $ldap->cd($dn);
+          $ldap->modify ($attrs); 
+        }else{
+          $ldap->cd($dn);
+          $ldap->add($attrs);
+        }
+        new log("modify","unknown/".get_class($this),$dn,array_keys($attrs),$ldap->get_error());
+      }
+
+
+      /* Display errors 
+       */
+      if($ldap->get_error() != "Success"){
+        show_ldap_error($ldap->get_error(), sprintf(_("Saving of terminal/dns account with dn '%s' failed."),$this->dn));
+      }
+
+      $tmp2 = new servdns($this->config,$this->dn);
+      $tmp2->handle_post_events("modify");
+
+      $this->dnsEntry =  $backup_dnsEntry;
+    }
+  }
+
+  /*  Create html table with all used record types
+   */
+  function generateRecordsList()
+  {
+    $changeStateForRecords = "";
+    
+    if(!$this->DNS_is_account) {
+      $str = "<input type='submit' value='"._("Add")."' name='AddNewRecord' id='AddNewRecord' disabled='disabled'>";
+      return(array("str" => $str, "changeStateForRecords"=> ""));
+    }
+    $str = "<table summary='' width='100%'>";
+    foreach($this->dnsEntry['RECORDS'] as $key => $entry){
+
+        $changeStateForRecords.= "changeState('RecordTypeSelectedFor_".$key."');\n";
+        $changeStateForRecords.= "changeState('RecordValue_".$key."');\n";
+        $changeStateForRecords.= "changeState('RemoveRecord_".$key."');\n";
+
+        $str.=" <tr>".
+          "   <td>".$this->generateRecordListBox($entry['type'],"RecordTypeSelectedFor_".$key)."</td>".
+          "   <td><input type='text' value='".$entry['value']."' name='RecordValue_".$key."' id='RecordValue_".$key."'></td>".
+          "   <td><input type='submit' name='RemoveRecord_".$key."' value='"._("Delete")."' id='RemoveRecord_".$key."'></td>".
+          "</tr>";
+    }
+
+    $str.= "  <tr>".
+           "    <td colspan=2 width='50%'></td><td>".
+           "      <input type='submit' value='"._("Add")."' name='AddNewRecord' id='AddNewRecord'>".
+           "    </td>".
+           "  </tr>".
+           "</table>";
+     $ret =  array("str" => $str, "changeStateForRecords" => $changeStateForRecords);
+    return($ret);
+  }
+
+
+  /* Create a html select box which allows us to select different types of records 
+   */
+  function generateRecordListBox($selected,$name)
+  {
+    $str = "<select name='".$name."' id='".$name."'>";
+    foreach($this->RecordTypes as $type => $value){
+      $use = "";
+      if($type == $selected){
+        $use = " selected ";
+      }
+      $str.="\n <option value='".$type."' ".$use.">".strtoupper(preg_replace("/record/i","",$type))."</option>";
+    }
+    $str.="</select>";
+    return($str); 
+  }
+
+
+  /* Return plugin informations for acl handling  */ 
+  static function plInfo()
+  {
+    $tmp =  array(
+        "plShortName"   => _("DNS"),
+        "plDescription" => _("DNS settings"),
+        "plSelfModify"  => FALSE,
+        "plDepends"     => array(),
+        "plPriority"    => 5,
+        "plSection"     => array("administration"),
+        "plCategory"    => array("workstation","terminal","phone","server","component","printer","winworkstation"),
+
+        "plProvidedAcls"=> array(
+          "ipHostNumber"  => _("IP address"),
+          "macAddress"    => _("MAC address"))
+        );
+
+    /* Hide all dns specific code, if dns is not available
+     */
+    $config = session::get('config');
+    foreach($config->data['TABS']['SERVERSERVICE'] as $tab){
+      if(preg_match("/^servdns$/",$tab['CLASS'])){
+        $tmp['plProvidedAcls']["Records"]        = _("DNS records");
+        $tmp['plProvidedAcls']["zoneName"]       = _("Zone name");
+        $tmp['plProvidedAcls']["dNSTTL"]         = _("TTL");
+        break;
+      }
+    }
+    return($tmp);
+  }
+
+  
+  function get_dhcp_host_entry()
+  {
+    $attrs = array();
+    $dn = $this->get_dhcp_host_entry_dn();
+    if($dn){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->cat($dn,array("*"));
+      if($ldap->count()){
+        $attrs = $ldap->fetch();
+        foreach($attrs as $key => $value){
+          if(is_numeric($key) || ($key == "count")){
+            unset($attrs[$key]);
+          }
+          if(is_array($value) && isset($value['count'])){
+            unset($attrs[$key]['count']);
+          }
+        }
+      }
+    }
+    return($attrs);
+  }
+
+
+  function get_dhcp_host_entry_dn()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=dhcpHost)(cn=".$this->cn."))",array("cn","dn"));
+
+    if($ldap->count()){
+      $attr = $ldap->fetch();
+      return($attr['dn']);
+    }else{
+      return("");
+    }
+  }  
+
+
+  function get_dhcp_parent_node()
+  {
+    return(preg_replace("/^cn=".normalizePreg($this->cn).",/","",$this->get_dhcp_host_entry_dn()));
+  }
+
+
+  function get_dhcp_parent_nodes()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(objectClass=dhcpService)",array("dhcpPrimaryDN"));
+    
+    $dhcp_dns = array();
+    while($attr = $ldap->fetch()){
+      $dhcp_dns[$attr['dn']] = $attr['dhcpPrimaryDN'][0];
+    }
+    foreach($dhcp_dns as $key => $pri_dns){
+      $ldap->cat($pri_dns,array("cn"));
+      $tmp = $ldap->fetch();
+      if(isset($tmp['cn'][0])){
+        $dhcp_dns[$key] = $tmp['cn'][0];
+      }else{
+        unset($dhcp_dns[$key]);
+      }
+    }
+
+    $tmp = $tmp2 = array();
+    foreach($dhcp_dns as $dn => $cn){
+      $ldap->cd($dn);
+      $ldap->search("(|(objectClass=dhcpService)(objectClass=dhcpGroup)".
+                    "(objectClass=dhcpSubnet)(objectClass=dhcpSharedNetwork))",array("cn"));
+      while($attr = $ldap->fetch()){
+        $tmp[$attr['dn']] = $attr['cn'][0];
+      }
+      $tmp2 = array_merge($tmp2,$this->create_tree($tmp,preg_replace("/^[^,]+,/i","",$dn),"(".$cn.")&nbsp;"));
+    }
+    return($tmp2);
+  }
+
+  
+  /* this function returns the default ptr record entry */
+  function get_pTRRecord()
+  {
+    if(!empty($this->ipHostNumber) && isset($this->dnsEntry['zoneName']) && !empty($this->dnsEntry['zoneName'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cat(DNS::getDNSZoneDN($this->config,$this->dnsEntry['zoneName']));
+      $attrs = $ldap->fetch();
+      $tmp = array_flip($this->Zones);
+      $tmp = preg_replace("/^[^\/]*+\//","",$tmp[$this->dnsEntry['zoneName']]);
+      $tmp = trim(preg_replace("/\.in-addr.arpa$/","",$tmp));
+      $ptr = preg_replace("/^".normalizePreg(DNS::FlipIp($tmp))."\./","",$this->ipHostNumber);
+      return($ptr);
+    }else{
+      return(FALSE);
+    }
+  }
+
+  
+  function generateRandomIP($net = "")
+  {
+    $str = $net;
+    $cnt = 4;
+    while(substr_count($str,".") < 3 && $cnt > 0){
+      $str .= ".".rand(0,255);
+      $str = preg_replace("/\.\.*/",".",$str);
+      $str = trim($str,". ");
+      $cnt --;
+    }
+    return($str);
+  }
+
+  
+  function create_tree($arr,$base,$current = "")
+  {
+    $ret = array();
+    foreach($arr as $r => $name){
+      $base_part = str_replace($base,"",$r);
+      if(preg_match("/^[a-z]*=".normalizePreg($name)."(|,)$/i",$base_part)){
+        $ret[$r] = $current.$name;
+        $tmp = $this->create_tree($arr,$r,$current.".&nbsp;");
+        foreach($tmp as $sub_key => $sub_name){
+          $ret[$sub_key] = $sub_name;
+        }
+      } 
+    }
+    return($ret);
+  }
+
+  function force_dns()
+  {
+    if($this->DNSenabled){
+      $this->DNS_is_account  = TRUE;
+      $this->hide_dns_check_box = TRUE;
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/systems/admin/systems/component.tpl b/gosa-plugins/systems/admin/systems/component.tpl
new file mode 100644 (file)
index 0000000..3ddd506
--- /dev/null
@@ -0,0 +1,56 @@
+<table summary="" width="100%">
+ <tr>
+  <td style="vertical-align:top; width:50%; border-right:1px solid #A0A0A0">
+       <table summary="">
+        <tr>
+         <td><LABEL for="cn">{t}Device name{/t}</LABEL>{$must}</td>
+         <td>
+{render acl=$cnACL}
+          <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+{/render}
+         </td>
+        </tr>
+        <tr>
+          <td colspan=2>&nbsp;</td>
+        </tr>
+        <tr>
+         <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+         <td>
+{render acl=$baseACL}
+           <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
+            {html_options options=$bases selected=$base_select}
+           </select>
+{/render}
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+
+          </td>
+         </tr>
+       </table>
+  </td>
+  <td style="vertical-align:top">
+       <table summary="">
+        <tr>
+         <td><LABEL for="description">{t}Description{/t}</LABEL></td>
+         <td>  
+{render acl=$descriptionACL}
+          <input id="description" name="description" size=25 maxlength=80 value="{$description}">
+{/render}
+          </td>
+        </tr>
+       </table>
+  </td>
+ </tr>
+</table>
+
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+
+{$netconfig}
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-plugins/systems/admin/systems/contents.tpl b/gosa-plugins/systems/admin/systems/contents.tpl
new file mode 100644 (file)
index 0000000..001d50d
--- /dev/null
@@ -0,0 +1 @@
+{$Kekse} sind gesund
diff --git a/gosa-plugins/systems/admin/systems/main.inc b/gosa-plugins/systems/admin/systems/main.inc
new file mode 100644 (file)
index 0000000..a43df09
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2003  Cajus Pollmeier
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+if ($remove_lock){
+        if(session::is_set('systems')){
+                $systems = session::get('systems');
+                $systems->remove_lock();
+                del_lock ($ui->dn);
+                session::un_set ('systems');
+        }
+} else {
+       /* Create usermanagement object on demand */
+       if (!session::is_set('systems') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               session::set('systems',new systems($config, $ui));
+       }
+       $systems = session::get('systems');
+       $systems->save_object();
+       $output= $systems->execute();
+
+       /* Reset requested? */
+       if (isset($_GET['reset']) && $_GET['reset'] == 1){
+               del_lock ($ui->dn);
+               session::un_set ('systems');
+       }
+
+       /* Page header*/
+       if (session::is_set('objectinfo')){
+               $display= print_header(get_template_path('images/system.png'), _("System management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix(session::get('objectinfo')));
+       } else {
+               $display= print_header(get_template_path('images/system.png'), _("System management"));
+       }
+
+       /* Show and save dialog */
+       $display.= $output;
+       session::set('systems',$systems);
+}
+
+?>
diff --git a/gosa-plugins/systems/admin/systems/network.tpl b/gosa-plugins/systems/admin/systems/network.tpl
new file mode 100644 (file)
index 0000000..7cb6b3f
--- /dev/null
@@ -0,0 +1,152 @@
+<h2><img       class="center"  alt=""  align="middle"  src="images/network.png">       {t}Network      settings{/t}</h2>
+
+
+<table summary=""      width="100%" cellspacing=0 cellpadding=0>
+       <tr>
+               <td     style="width:50%; vertical-align: top;">
+                       <table  summary="">
+                               <tr>
+                                       <td><LABEL      for="ipHostNumber">{t}IP-address{/t}{if $IPisMust}{$staticAddress}{/if}</LABEL></td>
+                                       <td>
+{render acl=$ipHostNumberACL}
+            <input     id="ipHostNumber"       name="ipHostNumber"     size=25 maxlength=80    value="{$ipHostNumber}">
+{/render}
+{render acl=$ipHostNumberACL}
+{if $DNSAccount == true}
+      <input id="propose_ip" type="submit" name="propose_ip" value="{t}Propose ip{/t}" style="visibility:visible;">
+      {else}
+      <input id="propose_ip" type="submit" name="propose_ip" value="{t}Propose ip{/t}" style="visibility:hidden;">
+      {/if}
+{/render}
+          </td>
+                               </tr>
+                               <tr>
+                                       <td><LABEL      for="macAddress">{t}MAC-address{/t}</LABEL>{$staticAddress}</td>
+                                       <td>
+{render acl=$macAddressACL}
+            <input     name="macAddress"       id="macAddress" size=25 maxlength=80    value="{$macAddress}">
+{/render}
+            {if $autonet==true}
+                                           <input type="submit" name="autonet" value="{t}Autodetect{/t}">
+            {/if}
+          </td>
+                               </tr>
+        {if $dhcpEnabled}
+        <tr>
+          <td colspan=2 style='padding-top:12px;'>
+            <table>
+              {if $dhcpParentNodeCnt}
+              <tr>
+                <td>
+                  <input onClick='document.mainform.submit();'
+                    {if $dhcp_is_Account} checked {/if} type='checkbox' name='dhcp_is_Account' class='center'>
+                </td>
+                <td>
+                  {t}Enable DHCP for this device{/t}
+                  <input type='image' src='images/list_reload.png' class='center'>
+                </td>
+              </tr>
+              {else}
+              <tr>
+                <td>
+                  <input type='checkbox' name='dummy' class='center' disabled>
+                  {t}Enable DHCP for this device{/t} ({t}not configured{/t})
+                  <input type='image' src='images/list_reload.png' class='center'>
+                </td>
+              </tr>
+              {/if}
+              {if $dhcp_is_Account}
+              <tr>
+                <td>&nbsp;</td>
+                <td>
+                  {t}Parent node{/t}
+                  <select name='dhcpParentNode'>      
+                    {html_options options=$dhcpParentNodes selected=$dhcpParentNode}
+                  </select>
+                  &nbsp;
+                  <input type='submit' name='dhcpEditOptions' value='{t}Edit settings{/t}'>
+                </td>
+              </tr>
+              {/if}
+            </table>
+          </td>
+        </tr>
+        {/if}
+      </table> 
+    </td>
+    {if $DNS_is_account==true}
+               <td     style="width:50%;vertical-align:top;border-left:1px solid #b0b0b0;" valign="top">
+
+    {if $ZoneCnt}
+      {if $DNSAccount == true}
+      <input type="checkbox" name="DNS_is_account" value="1"  
+        checked="checked"
+        onclick="toggle('test2');
+          changeState('zoneName');
+          changeState('dNSTTL');
+          toggle('propose_ip');
+          changeState('AddNewRecord');
+          {$changeStateForRecords}"/>
+        {else}
+      <input type="checkbox" name="DNS_is_account" value="1"  
+        onclick="toggle('test2');
+          changeState('zoneName');
+          changeState('dNSTTL');
+          toggle('propose_ip');
+          changeState('AddNewRecord');"/>
+        {/if}
+
+      {t}Enable DNS for this device{/t}
+      <input type='image' src='images/list_reload.png' class='center' name="reloadThisDNSStuff" >
+      {if $DNSAccount == true}
+      <div style="padding-left:20px;visibility:visible;" id="test2">
+      {else}
+      <div style="padding-left:20px;visibility:hidden;" id="test2">
+      {/if}
+                       <table summary="">
+                               <tr>
+                                       <td><LABEL      for="zoneName">{t}Zone{/t}</LABEL></td>
+                                       <td>
+{render acl=$zoneNameACL}
+              <select name="zoneName" id="zoneName" {if $DNSAccount == false} disabled {/if}>
+                {html_options values=$ZoneKeys output=$Zones selected=$zoneName}
+              </select>
+{/render}
+          </td>
+        </tr>
+        <tr>
+          <td>{t}TTL{/t}</td>
+          <td>
+{render acl=$dNSTTLACL}
+            <input type="text" name="dNSTTL" value="{$dNSTTL}" id="dNSTTL" {if $DNSAccount == false} disabled {/if}>
+{/render}
+          </td>
+        </tr>
+        <tr>
+          <td valign="top">{t}Dns records{/t}</td>
+          <td>
+            {if $DNS_is_account == true}
+{render acl=$RecordsACL}
+              {$records}
+{/render}
+            {/if}
+          </td>
+                               </tr>
+                       </table>
+      </div>
+    {else}        
+      <input type="checkbox" name="dummy" value="1" disabled class='center'>
+      {t}Enable DNS for this device{/t} ({t}not configured{/t})
+      <input type='image' src='images/list_reload.png' class='center'>
+    {/if}
+
+               </td>
+    {/if}
+    
+       </tr>
+</table>
+<input type="hidden" name="network_tpl_posted" value="1">
+
+<!--
+vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+-->
diff --git a/gosa-plugins/systems/admin/systems/password.tpl b/gosa-plugins/systems/admin/systems/password.tpl
new file mode 100644 (file)
index 0000000..734a4ae
--- /dev/null
@@ -0,0 +1,39 @@
+<p>
+ {t}To change the terminal root password use the fields below. The changes take effect during the next reboot. Please memorize the new password, because you wouldn't be able to log in.{/t}
+</p>
+<p>
+ <b>{t}Leave fields blank for password inheritance from default entries.{/t}</b>
+</p>
+
+<p>
+ {t}Changing the password impinges on authentification only.{/t}
+</p>
+
+<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
+  <tr>
+    <td><b><LABEL for="new_password">{t}New password{/t}</LABEL></b></td>
+    <td><input id="new_password" type="password" name="new_password" size="30" maxlength="40"
+               onFocus="nextfield= 'repeated_password';"></td>
+  </tr>
+  <tr>
+    <td><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
+    <td><input type="password" id="repeated_password" name="repeated_password" size="30" maxlength="40"
+               onFocus="nextfield= 'password_finish';"></td>
+  </tr>
+</table>
+
+<br>
+
+<p class="plugbottom">
+  <input type=submit name="password_finish" value="{t}Set password{/t}">
+  &nbsp;
+  <input type=submit name="password_cancel" value="{t}Cancel{/t}">
+</p>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       nextfield= 'new_password';
+       focus_field('new_password');
+  -->
+</script>
diff --git a/gosa-plugins/systems/admin/systems/paste_generic.tpl b/gosa-plugins/systems/admin/systems/paste_generic.tpl
new file mode 100644 (file)
index 0000000..b15920a
--- /dev/null
@@ -0,0 +1,60 @@
+{if $object == "server"}
+    <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}Server name{/t}</LABEL>{$must}</td>
+      <td>
+       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+      </td>
+     </tr>
+       </table>
+{/if}
+{if $object == "workstation"}
+    <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}workstation name{/t}</LABEL>{$must}</td>
+      <td>
+       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+      </td>
+     </tr>
+       </table>
+{/if}
+{if $object == "terminal"}
+    <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}Terminal name{/t}</LABEL>{$must}</td>
+      <td>
+       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+      </td>
+     </tr>
+       </table>
+{/if}
+{if $object == "printer"}
+    <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}Printer name{/t}</LABEL>{$must}</td>
+      <td>
+       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+      </td>
+     </tr>
+       </table>
+{/if}
+{if $object == "phone"}
+    <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}Phone name{/t}</LABEL>{$must}</td>
+      <td>
+       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+      </td>
+     </tr>
+       </table>
+{/if}
+{if $object == "component"}
+    <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}Component name{/t}</LABEL>{$must}</td>
+      <td>
+       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+      </td>
+     </tr>
+       </table>
+{/if}
diff --git a/gosa-plugins/systems/admin/systems/remove.tpl b/gosa-plugins/systems/admin/systems/remove.tpl
new file mode 100644 (file)
index 0000000..dc5dbb2
--- /dev/null
@@ -0,0 +1,23 @@
+<div style="font-size:18px;">
+<img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$warning}
+ {t}This includes all system and setup informations. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+
+<p>
+ {t}Best thing to do before performing this action would be to save the current contents of your LDAP tree in a file. So - if you've done so - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+       {if $multiple}
+               <input type=submit name="delete_multiple_system_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_multiple_system_cancel" value="{t}Cancel{/t}">
+       {else}
+               <input type=submit name="delete_terminal_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+       {/if}
+</p>
diff --git a/gosa-plugins/systems/admin/systems/server.tpl b/gosa-plugins/systems/admin/systems/server.tpl
new file mode 100644 (file)
index 0000000..4e2d9b6
--- /dev/null
@@ -0,0 +1,85 @@
+<table summary="" width="100%">
+ <tr>
+  <td style="vertical-align:top; width:50%;">
+       <table summary="">
+        <tr>
+         <td><LABEL for="cn">{t}Server name{/t}</LABEL>{$must}</td>
+         <td>
+{render acl=$cnACL}
+          <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+{/render}
+         </td>
+        </tr>
+        <tr>
+         <td><LABEL for="description">{t}Description{/t}</LABEL></td>
+         <td>
+{render acl=$descriptionACL}
+           <input name="description" id="description" size=25 maxlength=80 value="{$description}">
+{/render}
+          </td>
+        </tr>
+        <tr>
+         <td><br><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+         <td>
+          <br>
+{render acl=$baseACL}
+      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
+       {html_options options=$bases selected=$base_select}
+      </select>
+{/render}
+
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+          </td>
+         </tr>
+       </table>
+  </td>
+  <td  style="vertical-align:top;border-left:1px solid #A0A0A0;">
+       <table summary="">
+       <tr>
+     <td>{t}Mode{/t}</td>
+     <td>
+{render acl=$gotoModeACL}
+      <select name="gotoMode" title="{t}Select terminal mode{/t}">
+       {html_options options=$modes selected=$gotoMode}
+      </select>
+{/render}
+     </td>
+    </tr>
+       </table>
+  </td>
+ </tr>
+</table>
+
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+
+{$netconfig}
+
+{if $fai_activated}
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+
+<h2><img class="center" alt="" align="middle" src="images/rocket.png"> {t}Action{/t}</h2>
+<table summary="">
+ <tr>
+  <td>
+{render acl=$FAIstateACL}
+   <select size="1" name="saction" title="{t}Select action to execute for this server{/t}">
+    <option disabled>&nbsp;</option>
+    {html_options options=$actions}
+   </select>
+{/render}
+  </td>
+  <td>
+   <input type=submit name="action" value="{t}Execute{/t}">
+  </td>
+ </tr>
+</table>
+{/if}
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-plugins/systems/admin/systems/services/ServiceAddDialog.tpl b/gosa-plugins/systems/admin/systems/services/ServiceAddDialog.tpl
new file mode 100644 (file)
index 0000000..f055f33
--- /dev/null
@@ -0,0 +1,32 @@
+<div style="height:5px">&nbsp;</div>
+<div style="font-size:18px;">
+       {t}Adding a new service to the current server{/t}
+</div>
+<br>
+<p class="seperator">
+{t}This dialog allows you to add new services to the currenty edited server object. The box below shows all available but not already used services.{/t}
+<br>
+<br>
+</p>
+{if $Services} 
+<br>
+<br>{t}Service to add{/t} &nbsp;
+       <select name="ServiceName" >
+               <option value="" >&nbsp;</option>
+               {html_options options=$Services }
+       </select>
+{else}
+       <br>
+       {t}All available services are already in use.{/t}
+       <br>
+{/if}
+<br>
+<br>
+<br>
+<p class="seperator">
+<div style="width:100%; text-align:right;padding-top:8px;padding-bottom:3px;">
+    <input type='submit' name='SaveServiceAdd' value='{t}Continue{/t}' {if !$Services} disabled {/if}>
+    &nbsp;
+    <input type='submit' name='CancelServiceAdd' value='{t}Cancel{/t}'>
+</div>
+
diff --git a/gosa-plugins/systems/admin/systems/services/class_ServiceAddDialog.inc b/gosa-plugins/systems/admin/systems/services/class_ServiceAddDialog.inc
new file mode 100644 (file)
index 0000000..47e9701
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+class ServiceAddDialog extends plugin{
+
+  var $cli_summary      = "This dialog is used to add services";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("config"=>"Config object" , "dn"=>"Object dn");
+
+  /* This plugin does not have any ocs */
+  var $objectclasses    = array();
+  var $parent           = NULL;
+
+  function ServiceAddDialog(&$config,$dn,$parent)
+  {
+    plugin::plugin($config);
+    $this->parent = $parent;
+  }
+
+  function execute()
+  {
+    $smarty = get_smarty();
+    $services = $this->parent->getAllUnusedServices();
+    natcasesort($services);
+    $smarty->assign("Services",$services);
+    return($smarty->fetch(get_template_path("ServiceAddDialog.tpl", TRUE,dirname(__FILE__))));
+ }
+
+  function check(){ return array();}
+  function save_object(){;}
+  function save(){}
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/systems/admin/systems/services/class_goService.inc b/gosa-plugins/systems/admin/systems/services/class_goService.inc
new file mode 100644 (file)
index 0000000..edfd3d7
--- /dev/null
@@ -0,0 +1,238 @@
+<?php
+
+class goService extends plugin{
+       
+  var $cli_summary      = "This plugin is used within the ServerService plugin.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array();
+  var $attributes       = array();
+  var $StatusFlag       = "";
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts            = array();
+  var $dn                   = NULL;
+  var $cn                   = "";
+  var $DisplayName          = "";
+  var $view_logged  =FALSE;
+
+   
+  /* Construcktion */ 
+  function goService(&$config,$dn)
+  {
+    plugin::plugin($config,$dn);
+    $this->DisplayName = _("Empty service");
+  }
+
+  
+  /* Create content */
+  function execute()
+  {
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    $str ="<div style='width:100%; text-align:right;'>".
+          "  <input type='submit' name='SaveService' value='"._("Save")."'>&nbsp;".
+          "  <input type='submit' name='CancelService' value='"._("Cancel")."'>".
+          "</div>";
+    return($str);
+  }
+
+
+  /* Get service information for serverService plugin */
+  function getListEntry()
+  {
+    
+    $this->updateStatusState();
+
+    /* Assign status flag */
+    if(!empty($this->StatusFlag)){
+      $flag                   = $this->StatusFlag;
+      $fields['Status']       = $this->$flag;
+    }else{
+      $fields['Status']       = "";
+    }
+
+    /* Name displayed in service overview */
+    $fields['Message']      = _("Empty service");
+
+    /* Allow/disallow some functions */
+    $fields['AllowStart']   = $this->acl_is_writeable("start");
+    $fields['AllowStop']    = $this->acl_is_writeable("stop");
+    $fields['AllowRestart'] = $this->acl_is_writeable("restart");
+    $fields['AllowRemove']  = $this->acl_is_removeable();
+    $fields['AllowEdit']    = true;
+    return($fields);
+  }
+
+
+  /* Remove service */
+  function remove_from_parent()
+  {
+    if(!$this->initially_was_account || !$this->acl_is_removeable()){
+      return;
+    }
+    
+    plugin::remove_from_parent();
+
+    /* Remove status flag, it is not a memeber of 
+        this->attributes, so ensure that it is deleted too */
+    if(!empty($this->StatusFlag)){
+      $this->attrs[$this->StatusFlag] = array();
+    }
+
+    /* Check if this is a new entry ... add/modify */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      
+    }
+
+    new log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of server services/".get_class($this)." - (".$this->DisplayName.") with dn '%s' failed."),$this->dn));
+    $this->handle_post_events("remove");
+  }
+
+
+  /* Save service */
+  function save()
+  {
+    plugin::save();
+    /* Check if this is a new entry ... add/modify */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    if($this->initially_was_account){
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("modify");
+    }else{
+      $this->handle_post_events("add");
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of server services/".get_class($this)." - (".$this->DisplayName.") with dn '%s' failed."),$this->dn));
+  }
+
+
+  /* Directly save new status flag */
+  function setStatus($value)
+  {
+    if($value == "none") return;
+
+    /* Can't set status flag for new services (Object doesn't exists in ldap tree) */
+    if(!$this->initially_was_account) return;
+
+    /* Can't set status flag, if no flag is specified  */
+    if(empty($this->StatusFlag)){
+      return;
+    }
+
+    /* Get object (server), update status flag and save changes */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+
+      $tmp = $ldap->fetch();
+      for($i = 0; $i < $tmp['objectClass']['count']; $i ++){
+        $attrs['objectClass'][] = $tmp['objectClass'][$i];
+      }
+      $flag = $this->StatusFlag;
+      $attrs[$flag] = $value;
+      $this->$flag = $value;
+      $ldap->modify($attrs);
+      show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for server services/".get_class($this)." - (".$this->DisplayName.") with dn '%s' failed."),$this->dn));
+      $this->action_hook();
+    }
+  }
+
+
+  function check()
+  { 
+    $message = plugin::check();
+    return($message);
+  }
+  
+
+  function save_object()
+  {
+    plugin::save_object();
+  }  
+
+  
+  function action_hook($add_attrs= array())
+  {
+    /* Find postcreate entries for this class */
+    $command= $this->config->search(get_class($this), "ACTION_HOOK",array('menu','tabs'));
+    if ($command != ""){
+
+      /* Walk through attribute list */
+      foreach ($this->attributes as $attr){
+        if (!is_array($this->$attr)){
+          $command= preg_replace("/%$attr/", $this->$attr, $command);
+        }
+      }
+      $command= preg_replace("/%dn/", $this->dn, $command);
+
+      /* Additional attributes */
+      foreach ($add_attrs as $name => $value){
+        $command= preg_replace("/%$name/", $value, $command);
+      }
+
+      /* If there are still some %.. in our command, try to fill these with some other class vars */
+      if(preg_match("/%/",$command)){
+        $attrs = get_object_vars($this);
+        foreach($attrs as $name => $value){
+          if(!is_string($value)) continue;
+          $command= preg_replace("/%$name/", $value, $command);
+        }
+      }
+
+      if (check_command($command)){
+        @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
+            $command, "Execute");
+
+        exec($command);
+      } else {
+        $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this));
+        print_red ($message);
+      }
+    }
+  }
+
+
+  /* Get updates for status flag */
+  function updateStatusState()
+  {
+    if(empty($this->StatusFlag)) return;
+
+    $attrs = array();
+    $flag = $this->StatusFlag;
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->cn);
+    $ldap->cat($this->dn,array($flag));
+    if($ldap->count()){
+      $attrs = $ldap->fetch();
+    }
+    if(isset($attrs[$flag][0])){
+      $this->$flag = $attrs[$flag][0];
+    }
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/systems/admin/systems/tabs_arpnewdevice.inc b/gosa-plugins/systems/admin/systems/tabs_arpnewdevice.inc
new file mode 100644 (file)
index 0000000..fe12b40
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+class ArpNewDeviceTabs extends tabs
+{
+
+  function save($ignore_account= FALSE)
+  {
+    tabs::save($ignore_account);
+  }
+
+  function execute()
+  {
+    tabs::execute(); 
+    return($this->by_object[$this->current]->execute());
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/systems/admin/systems/tabs_component.inc b/gosa-plugins/systems/admin/systems/tabs_component.inc
new file mode 100644 (file)
index 0000000..ff0c69d
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+class componenttabs extends tabs
+{
+
+  function componenttabs($config, $data, $dn,$category)
+  {
+    tabs::tabs($config, $data, $dn,$category);
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function save_object($save_current= FALSE)
+  {
+    tabs::save_object($save_current);
+  }
+
+
+  function save($ignore_account= FALSE)
+  {
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $baseobject= $this->by_object['componentGeneric'];
+    $this->dn= "cn=$baseobject->cn,".get_ou('componentou').$baseobject->base;
+    $baseobject->dn= $this->dn;
+
+    foreach ($this->by_object as $key => $obj){
+      $this->by_object[$key]->dn= $this->dn;
+    }
+
+    tabs::save(TRUE);
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/systems/admin/systems/tabs_server.inc b/gosa-plugins/systems/admin/systems/tabs_server.inc
new file mode 100644 (file)
index 0000000..322851b
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+
+class servtabs extends tabs
+{
+
+  function servtabs($config, $data, $dn,$category)
+  {
+    /* Save dn */
+    $this->dn= $dn;
+    $this->config= $config;
+
+    $baseobject= NULL;
+
+    foreach ($data as $tab){
+      $this->by_name[$tab['CLASS']]= $tab['NAME'];
+
+      if ($baseobject === NULL){
+        $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
+        $this->by_object[$tab['CLASS']]= $baseobject;
+      } else {
+        $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
+      }
+
+      $this->by_object[$tab['CLASS']]->parent= &$this;
+      $this->by_object[$tab['CLASS']]->set_acl_category($category);
+
+      /* Initialize current */
+      if ($this->current == ""){
+        $this->current= $tab['CLASS'];
+      }
+    }
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function save_object($save_current= FALSE)
+  {
+    tabs::save_object($save_current);
+  }
+
+
+  function save($ignore_account= FALSE)
+  {
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $baseobject= $this->by_object['servgeneric'];
+    $this->dn= "cn=$baseobject->cn,".get_ou('serverou').$baseobject->base;
+    $baseobject->dn= $this->dn;
+
+    foreach ($this->by_object as $key => $obj){
+      $this->by_object[$key]->dn= $this->dn;
+      $this->by_object[$key]->cn= $baseobject->cn;
+    }
+
+    tabs::save(FALSE);
+
+    /* Reload server settings after saving */
+    $config = session::get('config');
+    $config->load_servers();
+    session::set('config',$config);
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>