From e7a9785c01a72325e6a618ad9e30f2e8e6b347f5 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 8 Aug 2006 10:50:21 +0000 Subject: [PATCH] Added new system fix. If ogroup is selected, save directly. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4425 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_systemManagement.inc | 26 +++++++++++++++++-- .../admin/systems/class_terminalGeneric.inc | 2 +- .../systems/class_workstationGeneric.inc | 3 +-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/plugins/admin/systems/class_systemManagement.inc b/plugins/admin/systems/class_systemManagement.inc index 5cff78e0a..10df0550f 100644 --- a/plugins/admin/systems/class_systemManagement.inc +++ b/plugins/admin/systems/class_systemManagement.inc @@ -125,6 +125,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 @@ -386,11 +392,27 @@ class systems extends plugin /* 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))){ + 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","servgeneric") as $tab){ + if(isset($this->systab->by_object[$tab]->gotoMode)) { + $found = true; + $this->systab->by_object[$tab]->gotoMode = "active"; + } + } + 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){ diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index 7f07d2e8e..b3b38ac5f 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -408,7 +408,7 @@ class termgeneric extends plugin /* Strip out 'default' values */ foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){ - if ($this->attrs[$val] == "default"){ + if (!isset($this->attrs[$val]) || $this->attrs[$val] == "default"){ $this->attrs[$val]= array(); } } diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc index 237919660..75c6f9626 100644 --- a/plugins/admin/systems/class_workstationGeneric.inc +++ b/plugins/admin/systems/class_workstationGeneric.inc @@ -368,8 +368,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(); } } -- 2.30.2