summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1d54104)
raw | patch | inline | side by side (parent: 1d54104)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 14 Jun 2007 07:55:28 +0000 (07:55 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 14 Jun 2007 07:55:28 +0000 (07:55 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6582 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/acl/class_aclManagement.inc | patch | blob | history | |
plugins/admin/acl/class_divListACL.inc | patch | blob | history |
index ab61375a1b3c8aafb4b0025500a55efb8c0066d4..04839ad30215654ffd92e6ff3b14f2a8197ff505 100644 (file)
var $DivListACL = NULL;
var $CopyPasteHandler;
+ var $start_pasting_copied_objects = FALSE;
function aclManagement($config, $ui)
{
"edit_role" =>"^list_acl_role_edit",
"copy" =>"^copy",
"cut" =>"^cut",
+ "copy_multiple"=> "^multiple_copy_objects",
+ "cut_multiple" => "^multiple_cut_objects",
"editPaste" =>"^editPaste",
"addrole" =>"^new_acl_role");
Copy & Paste Handling ...
********************/
- /* Only perform copy&paste requests if it is enabled
- */
- if($this->CopyPasteHandler){
- if($str = $this->copyPasteHandling($s_action,$s_entry)){
- return $str;
- }
+ /* Display the copy & paste dialog, if it is currently open */
+ $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+ if($ret){
+ return($ret);
}
/* Add departments if subsearch is disabled */
if(!$this->DivListACL->SubSearch){
- $this->DivListACL->AddDepartments($this->DivListACL->selectedBase,3);
+ $this->DivListACL->AddDepartments($this->DivListACL->selectedBase,3,1);
}
$this->reload();
$this->DivListACL->setEntries($this->list);
}
- /* Perform copy & paste requests
- If copy&paste is in progress this returns a dialog to fix required attributes
- */
- function copyPasteHandling($s_action,$s_entry)
+ function copyPasteHandling_from_queue($s_action,$s_entry)
{
- /* Paste copied/cutted object in here
- */
- $ui = get_userinfo();
- if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){
- $this->CopyPasteHandler->save_object();
- $this->CopyPasteHandler->SetVar("base",$this->DivListGroup->selectedBase);
- if($str = $this->CopyPasteHandler->execute()){
- return( $str);
- };
- /* Ensure that the new object is shown in the list now */
- $this->reload();
+ /* Check if Copy & Paste is disabled */
+ if(!is_object($this->CopyPasteHandler)){
+ return("");
}
+ /* Add a single entry to queue */
+ if($s_action == "cut" || $s_action == "copy"){
+
+ /* Cleanup object queue */
+ $this->CopyPasteHandler->cleanup_queue();
+ $dn = $this->list[$s_entry]['dn'];
+
+ if(isset($this->list[$s_entry]['objectClass']) && in_array("gosaRole",$this->list[$s_entry]['objectClass'])){
+ $this->CopyPasteHandler->add_to_queue($dn,$s_action,"aclroletab","ACLROLETAB","aclroles");
+ }
+ }
- /* Copy current object to CopyHandler
- */
- if($s_action == "copy"){
+ /* Add entries to queue */
+ if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
- $dn = $this->list[trim($s_entry)]['dn'];
- $acl_all = $ui->has_complete_category_acls($this->DivListACL->selectedBase,"acl") ;
- if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+ /* Cleanup object queue */
+ $this->CopyPasteHandler->cleanup_queue();
- $this->CopyPasteHandler->Clear();
- $obj = new acl($this->config, NULL, $dn, TRUE);
- $obj->set_acl_base($dn);
- $objNew = new acl($this->config, NULL,"new", TRUE);
- $objNew->set_acl_base($dn);
+ /* Add new entries to CP queue */
+ foreach($this->list_get_selected_items() as $id){
+ $dn = $this->list[$id]['dn'];
- $this->CopyPasteHandler->Copy($obj,$objNew);
- }else{
- print_red("You are not allowed to copy this entry.");
+ if(isset($this->list[$id]['objectClass']) && in_array("gosaRole",$this->list[$id]['objectClass'])){
+
+ if($s_action == "copy_multiple"){
+ $this->CopyPasteHandler->add_to_queue($dn,"copy","aclroletab","ACLROLETAB","aclroles");
+ }
+ if($s_action == "cut_multiple"){
+ $this->CopyPasteHandler->add_to_queue($dn,"cut","aclroletab","ACLROLETAB","aclroles");
+ }
+ }
}
}
- /* Copy current object to CopyHandler
- */
- if($s_action == "cut"){
+ /* Start pasting entries */
+ if($s_action == "editPaste"){
+ $this->start_pasting_copied_objects = TRUE;
+ }
+ /* Return C&P dialog */
+ if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
- $dn = $this->list[trim($s_entry)]['dn'];
- $acl_all = $ui->has_complete_category_acls($this->DivListACL->selectedBase,"acl") ;
- if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+ /* Load entry from queue and set base */
+ $this->CopyPasteHandler->load_entry_from_queue();
+ $this->CopyPasteHandler->SetVar("base",$this->DivListACL->selectedBase);
- $this->CopyPasteHandler->Clear();
- $obj= new acl($this->config,NULL, $dn, TRUE);
- $obj->set_acl_base($dn);
- $this->CopyPasteHandler->Cut($obj);
- }else{
- print_red("You are not allowed to cut this entry.");
+ /* Get dialog */
+ $data = $this->CopyPasteHandler->execute();
+
+ /* Return dialog data */
+ if(!empty($data)){
+ return($data);
+ }
+ }
+
+ /* Automatically disable status for pasting */
+ if(!$this->CopyPasteHandler->entries_queued()){
+ $this->start_pasting_copied_objects = FALSE;
+ }
+ return("");
+ }
+
+
+ function list_get_selected_items()
+ {
+ $ids = array();
+ foreach($_POST as $name => $value){
+ if(preg_match("/^item_selected_[0-9]*$/",$name)){
+ $id = preg_replace("/^item_selected_/","",$name);
+ $ids[$id] = $id;
}
}
+ return($ids);
}
index b20002053bf91002ae2391e378b00307497ccc5c..a09716fcc93015db38b88b0855d00125d701ed5e 100644 (file)
/* Dynamic action col */
$this->action_col_size = 120;
+ /* Toggle all selected / deselected */
+ $chk = "<input type='checkbox' id='select_all' name='select_all'
+ onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
/* set Page header */
+ $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
$this->AddHeader(array("string"=>" ", "attach"=>"style='width:20px;'"));
$this->AddHeader(array("string"=>_("Summary")));
$this->AddHeader(array("string"=>_("Actions"), "attach" => "style='width:".$this->action_col_size."px;border-right:0px;text-align:right;'"));
title='"._("Submit department")."' name='submit_department' alt='". _("Submit")."'> ".
"</div>";
+ /* Add multiple copy & cut icons */
+ if(is_object($this->parent->CopyPasteHandler)){
+ $listhead .= " <input class='center' type='image' align='middle' src='images/editcopy.png'
+ title='"._("Copy selected objects")."' alt='"._("Copy objects")."' name='multiple_copy_objects'> ";
+ $listhead .= " <input class='center' type='image' align='middle' src='images/editcut.png'
+ title='"._("cut selected objects")."' alt='"._("Cut objects")."' name='multiple_cut_objects'> ";
+ $listhead .= "</div>";
+ }
+
+
$this->SetListHeader($listhead);
}
}
}
+ if(in_array("gosaRole",$acl_entry['objectClass'])){
+ $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+ "attach" => "style='width:20px;'");
+ }else{
+ $field0 = array("string" => "", "attach" => "style='width:20px;'");
+ }
+
$field1 = array("string" => $list_left_icon, "attach"=> "style='text-align:center;width:20px;'");
$field2 = array("string" => sprintf($editlink,$key,$cn)." ","attach" => "");
$field3 = array("string" => preg_replace("/%KEY%/",$key,$action), "attach"=> "style='text-align:right;width:".$this->action_col_size."px;border-right:0px;'");
- $this->AddElement(array($field1,$field2,$field3));
+ $this->AddElement(array($field0,$field1,$field2,$field3));
}
}