Code

Updated some plugins.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 23 Jan 2007 08:16:01 +0000 (08:16 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 23 Jan 2007 08:16:01 +0000 (08:16 +0000)
-Fixed incoming handling, was not equal to 2.5 behaviour.
-Added ogroup member add, undefined index.
-Removed debug output from goFonServer

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

include/class_ldap.inc
plugins/admin/ogroups/class_ogroup.inc
plugins/admin/systems/class_divListSystem.inc
plugins/admin/systems/class_goFonServer.inc
plugins/admin/systems/class_servGeneric.inc
plugins/admin/systems/class_systemManagement.inc
plugins/admin/systems/class_workstationGeneric.inc

index d50b78d55f058dfa0a7d747833f1865986aed398..a93aa96c060f6376ce8bcbaf52aaf58100358618 100644 (file)
@@ -549,6 +549,7 @@ class LDAP{
           unset($attr['dn']);
 
           if((!in_array("gosaApplication" , $attr['objectClass'])) && (!in_array("gotoMimeType", $attr['objectClass']))){
+            $attr['FAIdebianRelease'] = $destinationName;
             if($type=="branch"){
               $attr['FAIstate'] ="branch";
             }elseif($type=="freeze"){
index 463ee0e2ccb8443dc586e99e77fefb1d82b69e41..bc1012c97fb367fb1992db9485ea730845d8c4c1 100644 (file)
@@ -100,12 +100,15 @@ class ogroup extends plugin
   function AddDelMembership($NewMember = false){
 
     if($NewMember){
-      $this->memberList[$NewMember]= $this->objcache[$NewMember];
+
+      /* Add member and force reload */
       $this->member[$NewMember]= $NewMember;
+      $this->reload(); 
+
+      $this->memberList[$NewMember]= $this->objcache[$NewMember];
       unset ($this->objects[$NewMember]);
       uasort ($this->memberList, 'sort_list');
       reset ($this->memberList);
-      $this->reload();
     }else{
       /* Delete objects from group */
       if (isset($_POST['delete_membership']) && isset($_POST['members'])){
index 488e882f66c4aebc76d4957a47c35573cebcac3c..7ec5ec944287921e748adc031afb701053c24c75 100644 (file)
@@ -32,6 +32,7 @@ class divListSystem extends MultiSelectWindow
                                                                   "workstation",
                                                                   "terminal",
                                                                   "phone",
+                                                                  "incoming",
                                                                   "printer"));
 
     $this->parent       = $parent;
@@ -231,6 +232,7 @@ class divListSystem extends MultiSelectWindow
           "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"));
 
 
@@ -246,6 +248,12 @@ class divListSystem extends MultiSelectWindow
         $acl_type = $type;
       }
 
+      /* Map NewDevice acls to workstation acls */
+      if($type == "NewDevice"){
+        $type     = "incoming";
+        $acl_type = "incoming";
+      }
+
       /* Get complete category acls */
       $acl_all  = $ui->has_complete_category_acls($val['dn'],$acl_type) ;
   
index 5f23e21620d7e01286038543cca892bf9d67b2fa..b8878786f0fb0aa35ba990f34e9fd0027ac6d5c2 100644 (file)
@@ -114,7 +114,6 @@ class goFonServer extends goService{
         }
       }
     }
-    return("fa");
   }
 
  
index 9a47614b9874dd4694077ba2460cdc7dfce2b6cb..27c4541315641df6af7f74ee51f2a17d8643e389 100644 (file)
@@ -68,6 +68,21 @@ class servgeneric extends plugin
     $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 */
index ac36a2034057729f02f3d917f9962884c62053dd..7adac6abc999605cd92b9abcae71e6bf919842bd 100644 (file)
@@ -215,6 +215,12 @@ class systems extends plugin
     /* 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 
@@ -540,22 +546,45 @@ class systems extends plugin
     }
 
 
-    /********************
-      Edit system type finished, check if everything went ok 
+
+
+
+
+
+
+
+   /********************
+      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($_POST['edit_apply'])) && (isset($this->systab->config))){
+    if ((isset($_POST['edit_finish'])) && (isset($this->systab->config)) || $save_object_directly){
 
       /* Check tabs, will feed message array */
-      $message= $this->systab->check();
+      $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 'avtice', the current object couldn't be identified.")));
+        }
 
+      }
       /* Save, or display error message? */
       if (count($message) == 0){
 
         /* Save terminal data to ldap */
-        if(isset($_SESSION['SelectedSystemType']['ogroup'])){
+        if(isset($_SESSION['SelectedSystemType']['ogroup']) && $_SESSION['SelectedSystemType']['ogroup'] != 'none'){
           foreach (array("workservice", "termservice") as $cls){
             if (isset($this->systab->by_object[$cls])){
               $this->systab->by_object[$cls]->gotoXMouseport= "";
@@ -565,15 +594,17 @@ class systems extends plugin
             }
           }
         }
+
         $this->systab->save();
         gosa_log ("System object'".$this->dn."' has been saved");
 
-        /* Incoming behavior; you can select a system type and an ogroup membership. 
+        /* Incoming behavior; you can select a system type and an ogroup membership.
          * If this object is an Incoming object, $_SESSION['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 
+         *
+         * 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(isset($_SESSION['SelectedSystemType'])){
@@ -590,7 +621,7 @@ class systems extends plugin
             $ldap = $this->config->get_ldap_link();
           }
           $ldap->cd ($this->dn);
-          $ldap->cat($this->dn, array('dn'));  
+          $ldap->cat($this->dn, array('dn'));
           if(count($ldap->fetch())){
             $ldap->cd($this->dn);
             $ldap->rmDir($this->dn);
@@ -598,17 +629,15 @@ class systems extends plugin
           $ldap->cd($this->config->current['BASE']);
         }
 
-        if (!isset($_POST['edit_apply'])){
-          /* Terminal has been saved successfully, remove lock from
-             LDAP. */
-          if ($this->dn != "new"){
-            del_lock ($this->dn);
-          }
-
-          unset ($this->systab);
-          $this->systab= NULL;
-          unset($_SESSION['objectinfo']);
+        /* Terminal has been saved successfully, remove lock from
+           LDAP. */
+        if ($this->dn != "new"){
+          del_lock ($this->dn);
         }
+
+        unset ($this->systab);
+        $this->systab= NULL;
+        unset($_SESSION['objectinfo']);
       } else {
         /* Ok. There seem to be errors regarding to the tab data,
            show message and continue as usual. */
@@ -616,6 +645,7 @@ class systems extends plugin
       }
     }
 
+
     /********************
       Edit system was canceled 
      ********************/
@@ -687,6 +717,7 @@ class systems extends plugin
     $tabs = array(
         "terminal"        => "ou=terminals,ou=systems,",
         "workstation"     => "ou=workstations,ou=systems,",
+        "incoming"        => "ou=incoming,",
         "server"          => "ou=servers,ou=systems,",
         "printer"         => "ou=printers,ou=systems,",
         "phone"           => "ou=phones,ou=systems,",
@@ -1048,6 +1079,28 @@ class systems extends plugin
     return ($type);
   }
 
+
+  /* !! Incoming dummy acls, required to defined acls for incoming objects
+   */
+  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:
index 45efd16dafed2501d6ed25dafd60dbd5fab24ef9..36c9d3eb3a25cb641cab64df0a6d075df128df85 100644 (file)
@@ -436,7 +436,7 @@ class workgeneric extends plugin
     /* Strip out 'default' values */
     foreach (array("gotoSyslogServer") as $val){
 
-      if ($this->attrs[$val] == "default"){
+      if (isset($this->attrs[$val]) && $this->attrs[$val] == "default"){
         $this->attrs[$val]= array();
       }
     }
@@ -505,8 +505,6 @@ class workgeneric extends plugin
       }
     }
 
-    print_a($this->attrs);
-
     /* cn=default and macAddress=- indicates that this is a template */
     if($this->cn == "wdefault"){
       $this->netConfigDNS->macAddress = "-";