From 01f6af464bd891d7e84c3bdfb1075e17fae9d2ec Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 14 Sep 2010 07:10:55 +0000 Subject: [PATCH] Updated ogroup handling -Added option to copy and paste do avoid copying the members git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19654 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../plugins/admin/ogroups/class_ogroup.inc | 18 ++++++++++++++++++ .../plugins/admin/ogroups/paste_generic.tpl | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/gosa-core/plugins/admin/ogroups/class_ogroup.inc index 69b32e23f..aff73709d 100644 --- a/gosa-core/plugins/admin/ogroups/class_ogroup.inc +++ b/gosa-core/plugins/admin/ogroups/class_ogroup.inc @@ -65,6 +65,8 @@ class ogroup extends plugin var $objectSelect= FALSE; var $view_logged = FALSE; + var $copyMembers = TRUE; + var $baseSelector; /* Already assigned Workstations. Will be hidden in selection. @@ -700,6 +702,10 @@ class ogroup extends plugin { plugin::save(); + // Do not save members if we don't want to. + // This may be the case if we've copied an ogroup containing systems! + if(!$this->copyMembers) $this->member = array(); + /* Move members to target array */ $this->attrs['member'] =array(); foreach ($this->member as $key => $desc){ @@ -777,6 +783,16 @@ class ogroup extends plugin { plugin::PrepareForCopyPaste($source); + // Preselect "Copy members" state. + // If we've terminals, workstations or servers in our members list, + // then disable this option by default, to avoid problems with + // inheritance of ogroup values. + if (preg_match("/[STW]/", $this->gosaGroupObjects) || !isset($source['member'])) { + $this->copyMembers = FALSE; + } else { + $this->copyMembers = TRUE; + } + /* Reload tabs */ $this->parent->reload($this->gosaGroupObjects ); @@ -800,6 +816,7 @@ class ogroup extends plugin { $smarty = get_smarty(); $smarty->assign("cn", set_post($this->cn)); + $smarty->assign("copyMembers", $this->copyMembers); $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__))); $ret = array(); $ret['string'] = $str; @@ -812,6 +829,7 @@ class ogroup extends plugin if(isset($_POST['cn'])){ $this->cn = get_post('cn'); } + $this->copyMembers = isset($_POST['copyMembers']); } diff --git a/gosa-core/plugins/admin/ogroups/paste_generic.tpl b/gosa-core/plugins/admin/ogroups/paste_generic.tpl index 5086e4a2c..32495d82d 100644 --- a/gosa-core/plugins/admin/ogroups/paste_generic.tpl +++ b/gosa-core/plugins/admin/ogroups/paste_generic.tpl @@ -9,6 +9,12 @@ + + + + -- 2.30.2