From: hickert Date: Fri, 17 Mar 2006 07:19:37 +0000 (+0000) Subject: Added copy & paste for groups X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b7479d8f6c50ebfe3f10a9a3df6137b94082f43e;p=gosa.git Added copy & paste for groups git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2855 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/applications/class_applicationManagement.inc b/plugins/admin/applications/class_applicationManagement.inc index ef27ae053..9ccd6cba0 100644 --- a/plugins/admin/applications/class_applicationManagement.inc +++ b/plugins/admin/applications/class_applicationManagement.inc @@ -41,15 +41,12 @@ class applicationManagement extends plugin $this->config= $config; $this->ui= $ui; - if( (isset($this->config->data['MAIN']['ENABLECOPYPASTE'])) && (preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE'] ))){ $this->enableCopyPaste = true; } - - $this->CopyPasteHandler = new CopyPasteHandler($this->config); /* Get global filter config */ diff --git a/plugins/admin/groups/class_groupGeneric.inc b/plugins/admin/groups/class_groupGeneric.inc index 9d2145c63..d009a6f1e 100644 --- a/plugins/admin/groups/class_groupGeneric.inc +++ b/plugins/admin/groups/class_groupGeneric.inc @@ -809,6 +809,59 @@ class group extends plugin } } + function getCopyDialog() + { + $vars = array("cn"); + + if($this ->force_gid){ + $used = " checked "; + $dis = ""; + }else{ + $used = ""; + $dis = " disabled "; + } + + $str =" + + + + + + + + +
". + _("Group name"). + " + +
+ "._("Force GID")." +   + +
"; + + return($str); + } + + function saveCopyDialog() + { + if(isset($_POST['cn'])){ + $this->cn = $_POST['cn']; + } + if(isset($_POST['force_gid'])){ + $this->force_gid = true; + $this->gidNumber= $_POST['gidNumber']; + }else{ + $this->force_gid = false; + $this->gidNumber = false; + } + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/plugins/admin/groups/class_groupMail.inc b/plugins/admin/groups/class_groupMail.inc index a3a3cc957..64bf1be72 100644 --- a/plugins/admin/groups/class_groupMail.inc +++ b/plugins/admin/groups/class_groupMail.inc @@ -942,6 +942,35 @@ I: Only insider delivery */ return ($name); } + function getCopyDialog() + { + if(!$this->is_account) return(""); + + $str =" + + + + +
". + _("Primary mail address"). + " + +
"; + + return($str); + } + + function saveCopyDialog() + { + if(!$this->is_account) return; + if(isset($_POST['mail'])){ + $this->mail = $_POST['mail']; + } + } + + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc index 6bf78f154..0636d6c44 100644 --- a/plugins/admin/groups/class_groupManagement.inc +++ b/plugins/admin/groups/class_groupManagement.inc @@ -32,12 +32,20 @@ class groupManagement extends plugin var $ui= NULL; var $acl= ""; + var $CopyPasteHandler ; + var $enableCopyPaste = false; + function groupManagement ($config, $ui) { /* Save configuration for internal use */ $this->config= $config; $this->ui= $ui; + if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){ + $this->enableCopyPaste = true; + } + $this->CopyPasteHandler = new CopyPasteHandler($this->config); + /* Get global filter config */ if (!is_global("groupfilter")){ $base= get_base_from_people($ui->dn); @@ -66,7 +74,6 @@ class groupManagement extends plugin $s_action = ""; $s_entry = ""; - if (!isset($this->grouptab)){ foreach( array("depselect", "guser", "regex") as $type){ if (isset($_POST[$type])){ @@ -124,6 +131,14 @@ class groupManagement extends plugin $s_action="edit"; $s_entry = preg_replace("/".$type."_group_edit_/i","",$key); $_POST['arg'] = $type; + }elseif(preg_match("/^editPaste.*/i",$key)){ + $s_action="editPaste"; + }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); } } $s_entry = preg_replace("/_.$/","",$s_entry); @@ -179,6 +194,51 @@ class groupManagement extends plugin return($message); } + /* Only perform copy / paste if it is enabled + */ + if($this->enableCopyPaste){ + + /* Paste copied/cutted object in here + */ + if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){ + $this->CopyPasteHandler->save_object(); + $this->CopyPasteHandler->SetVar("base",$groupfilter['depselect']); + return($this->CopyPasteHandler->execute()); + } + + + /* Copy current object to CopyHandler + */ + if($s_action == "copy"){ + $this->CopyPasteHandler->Clear(); + + $dn = $this->grouplist[trim($s_entry)]['dn']; + $acl = get_permissions ($dn, $this->ui->subtreeACL); + + $obj = new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn); + $objNew = new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], "new"); + $obj->set_acl($acl); + $objNew->set_acl($acl); + + $this->CopyPasteHandler->Copy($obj,$objNew); + } + + + /* Copy current object to CopyHandler + */ + if($s_action == "cut"){ + $this->CopyPasteHandler->Clear(); + $dn = $this->grouplist[trim($s_entry)]['dn']; + $acl= get_permissions ($dn, $this->ui->subtreeACL); + + $obj= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn); + $obj->set_acl($acl); + + $this->CopyPasteHandler->Cut($obj); + } + } + + /* New group? */ if ($s_action=="new"){ @@ -358,6 +418,25 @@ class groupManagement extends plugin } } + /* Create paste icon + */ + if($this->enableCopyPaste){ + $Copy_Paste = "  "; + if($this->CopyPasteHandler->isCurrentObjectPastAble()){ + if($this->CopyPasteHandler->isCurrentCutted()){ + $img = "images/cutpaste.png"; + }else{ + $img = "images/copypaste.png"; + } + $Copy_Paste .= " "; + }else{ + $Copy_Paste .= ""._("Can "; + } + }else{ + $Copy_Paste =""; + } + // Managment $listhead = "
". "  ". @@ -365,14 +444,29 @@ class groupManagement extends plugin "  ". "  ". "  ". + $Copy_Paste. "  ". _("Base")." ". "  ". "
"; - $actions = ""; - $actions.= ""; + if($this->enableCopyPaste){ + $actions = " "; + $actions.= " "; + $actions.= ""; + $actions.= ""; + }else{ + $actions = ""; + $actions.= ""; + } + // Defining Links $linkopen = "%s"; @@ -419,7 +513,7 @@ class groupManagement extends plugin array("string" => " ", "attach" => "style='text-align:center;width:20px;'"), array("string" => _("Groupname")." / "._("Department"), "attach" => "style=''"), array("string" => _("Properties"), "attach" => "style='width:136px;'"), - array("string" => _("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'") + array("string" => _("Actions"), "attach" => "style='width:80px;border-right:0px;text-align:right;'") )); $divlist->SetSummary(_("This table displays all groups, in the selected tree.")); @@ -443,7 +537,7 @@ class groupManagement extends plugin $field1 = array("string" => "department", "attach" => "style='text-align:center;width:20px;'"); $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style=''"); $field3 = array("string" => " ", "attach" => "style='width:136px;'"); - $field4 = array("string" => " ", "attach" => "style='width:60px;border-right:0px;text-align:right;'"); + $field4 = array("string" => " ", "attach" => "style='width:80px;border-right:0px;text-align:right;'"); $divlist->AddEntry(array($field1,$field2,$field3,$field4)); } @@ -471,7 +565,7 @@ class groupManagement extends plugin $field1 = array("string" => sprintf($userimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'"); $field2 = array("string" => sprintf($editlink,$key,($val['cn']['0'].$desc)), "attach" => "style='' ".$title); $field3 = array("string" => preg_replace("/%KEY%/", $key, $posix." ".$enviro." ".$mail." ".$samba." ".$appl." ".$phone), "attach" => "style='width:136px;'"); - $field4 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:60px;border-right:0px;text-align:right;'"); + $field4 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:80px;border-right:0px;text-align:right;'"); $divlist->AddEntry(array($field1,$field2,$field3,$field4)); }