diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc
index 6bf78f1545b001fa94d68605f8923a3467ff036a..0636d6c4460fff0caad0c82bb1b6409caae6506c 100644 (file)
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);
$s_action = "";
$s_entry = "";
-
if (!isset($this->grouptab)){
foreach( array("depselect", "guser", "regex") as $type){
if (isset($_POST[$type])){
$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);
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"){
}
}
+ /* Create paste icon
+ */
+ if($this->enableCopyPaste){
+ $Copy_Paste = " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ";
+ if($this->CopyPasteHandler->isCurrentObjectPastAble()){
+ if($this->CopyPasteHandler->isCurrentCutted()){
+ $img = "images/cutpaste.png";
+ }else{
+ $img = "images/copypaste.png";
+ }
+ $Copy_Paste .= "<input type='image' name='editPaste' class='center'
+ src='".$img."' alt='"._("Paste")."' title='".$this->CopyPasteHandler->GetCurrentDn()."'> ";
+ }else{
+ $Copy_Paste .= "<img class='center' src='images/cant_editpaste.png' alt='"._("Can't paste")."'> ";
+ }
+ }else{
+ $Copy_Paste ="";
+ }
+
// Managment
$listhead = "<div style='background:#F0F0F9;padding:5px;'>".
" <input type='image' class='center' src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
" <input type='image' class='center' src='images/list_home.png' title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
" <img class='center' src='images/list_seperator.png' alt='' height='16' width='1'> ".
" <input type='image' class='center' src='images/list_new_group.png' title='"._("Create new group")."' alt='"._("New")."' name='group_new'> ".
+ $Copy_Paste.
" <img class='center' src='images/list_seperator.png' alt='' height='16' width='1'> ".
_("Base")." <select name='depselect' onChange='mainform.submit()' class='center'>$options</select>".
" <input type='image' class='center' src='images/list_submit.png' title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ".
"</div>";
- $actions = "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
- $actions.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
+ if($this->enableCopyPaste){
+ $actions = "<input class='center' type='image'
+ src='images/editdelete.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'> ";
+ $actions.= "<input class='center' type='image'
+ src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'> ";
+ $actions.= "<input class='center' type='image'
+ src='images/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
+ $actions.= "<input class='center' type='image'
+ src='images/edittrash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
+ }else{
+ $actions = "<input class='center' type='image'
+ src='images/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
+ $actions.= "<input class='center' type='image'
+ src='images/edittrash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
+ }
+
// Defining Links
$linkopen = "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
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."));
$field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='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));
}
$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));
}