From: hickert Date: Wed, 13 Jun 2007 12:46:11 +0000 (+0000) Subject: Added copy & paste for conferences X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b64c5c430d1e96c8070745681e696e71f13a1e66;p=gosa.git Added copy & paste for conferences git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6577 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/gofon/conference/class_divListConferences.inc b/plugins/gofon/conference/class_divListConferences.inc index 7819f6761..feafc1a3f 100755 --- a/plugins/gofon/conference/class_divListConferences.inc +++ b/plugins/gofon/conference/class_divListConferences.inc @@ -42,7 +42,7 @@ class divListConference extends MultiSelectWindow $this->EnableSaveButton (false); /* Dynamic action col, depending on snapshot icons */ - $action_col_size = 60; + $action_col_size = 100; if($this->parent->snapshotEnabled()){ $action_col_size += 20; } @@ -128,6 +128,20 @@ class divListConference extends MultiSelectWindow /* Add default header */ $listhead = MultiSelectWindow::get_default_header(); + /* Get copy & paste icon */ + $Copy_Paste =""; + if(preg_match("/(c.*w|w.*c)/",$acls) && $this->parent->CopyPasteHandler){ + $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon(); + $addsep = true; + } + + + /* Only display snapshot settings if we are able to write && create new entries */ + if(preg_match("/(c.*w|w.*c)/",$acl_all)){ + $listhead .= $this->get_snapshot_header($this->selectedBase); + } + $listhead .= $Copy_Paste; + /* Only display create new conference if we are allowed to create new confe... */ if(preg_match("/c/",$acls)){ $listhead .="  ". @@ -135,11 +149,6 @@ class divListConference extends MultiSelectWindow title='"._("Create new conference")."' alt='"._("New conference")."' name='conference_new'> ". "  "; } - - /* Only display snapshot settings if we are able to write && create new entries */ - if(preg_match("/(c.*w|w.*c)/",$acl_all)){ - $listhead .= $this->get_snapshot_header($this->selectedBase); - } /* Add the rest (base select ....)*/ $listhead .= _("Base")." ". @@ -150,6 +159,15 @@ class divListConference extends MultiSelectWindow $listhead .= "  "; + /* Add multiple copy & cut icons */ + if(is_object($this->parent->CopyPasteHandler)){ + $listhead .= "  "; + $listhead .= "  "; + $listhead .= ""; + } + $listhead .=""; $this->SetListHeader($listhead); @@ -169,7 +187,7 @@ class divListConference extends MultiSelectWindow $editlink = "%s"; /* Dynamic action col, depending on snapshot icons */ - $action_col_size = 60; + $action_col_size = 100; if($this->parent->snapshotEnabled()){ $action_col_size += 20; } @@ -186,8 +204,16 @@ class divListConference extends MultiSelectWindow continue; } + $actions =""; + if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){ + $actions.= " "; + $actions.= " "; + } + /* Add edit icon - This is allowed when we have at least read access. */ - $actions= ""; /* Add snapshot icon - This is allowed when we have create and write access for the current entry */ diff --git a/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/plugins/gofon/conference/class_phoneConferenceGeneric.inc index 4eba32b46..1714edca3 100644 --- a/plugins/gofon/conference/class_phoneConferenceGeneric.inc +++ b/plugins/gofon/conference/class_phoneConferenceGeneric.inc @@ -387,6 +387,12 @@ class conference extends plugin $message[] = $str; } + $ldap = $this->config->get_ldap_link(); + $ldap->cd("ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->base); + $ldap->search("(&(objectClass=goFonConference)(cn=".$this->cn."))",array("cn")); + if($ldap->count()){ + $message[] =_("There is already a conference with this name in the current tree."); + } return $message; } @@ -684,6 +690,31 @@ class conference extends plugin $this->postcreate(); } + + function getCopyDialog() + { + $smarty = get_smarty(); + $smarty->assign("cn" ,$this->cn); + $smarty->assign("telephoneNumber" ,$this->telephoneNumber); + $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); + } + + + function saveCopyDialog() + { + if(isset($_POST['cn'])){ + $this->cn = $_POST['cn']; + } + if(isset($_POST['telephoneNumber'])){ + $this->telephoneNumber = $_POST['telephoneNumber']; + } + } + + /* Return plugin informations for acl handling */ function plInfo() { diff --git a/plugins/gofon/conference/class_phoneConferenceManagment.inc b/plugins/gofon/conference/class_phoneConferenceManagment.inc index 715e5fe4a..c79968277 100644 --- a/plugins/gofon/conference/class_phoneConferenceManagment.inc +++ b/plugins/gofon/conference/class_phoneConferenceManagment.inc @@ -39,6 +39,9 @@ class phoneConferenceManagment extends plugin var $ui = NULL; var $DivListConference = NULL; + var $CopyPasteHandler = NULL; + var $start_pasting_copied_objects = FALSE; + /* Initialise Class */ function phoneConferenceManagment ($config, $ui) { @@ -46,6 +49,11 @@ class phoneConferenceManagment extends plugin $this->dn = ""; $this->config = $config; $this->DivListConference = new divListConference($this->config,$this); + + /* Copy & Paste enabled ?*/ + if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){ + $this->CopyPasteHandler = new CopyPasteHandler($this->config); + } } @@ -87,6 +95,20 @@ class phoneConferenceManagment extends plugin $s_entry = preg_replace("/_.*$/","",$s_entry); }elseif(preg_match("/^remove_multiple_conferences/",$key)){ $s_action="del_multiple"; + }elseif(preg_match("/^editPaste.*/i",$key)){ + $s_action="editPaste"; + }elseif(preg_match("/^copy_.*/",$key)){ + $s_action="copy"; + $s_entry = preg_replace("/^copy_/i","",$key); + $s_entry = preg_replace("/_.$/","",$s_entry); + }elseif(preg_match("/^cut_.*/",$key)){ + $s_action="cut"; + $s_entry = preg_replace("/^cut_/i","",$key); + $s_entry = preg_replace("/_.$/","",$s_entry); + }elseif(preg_match("/^multiple_copy_objects/",$key)){ + $s_action = "copy_multiple"; + }elseif(preg_match("/^multiple_cut_objects/",$key)){ + $s_action = "cut_multiple"; } } @@ -114,6 +136,16 @@ class phoneConferenceManagment extends plugin } + /******************** + Copy & Paste Handling ... + ********************/ + + /* Display the copy & paste dialog, if it is currently open */ + $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry); + if($ret){ + return($ret); + } + /******************** Delete MULTIPLE entries requested, display confirm dialog @@ -407,6 +439,70 @@ class phoneConferenceManagment extends plugin } + + function copyPasteHandling_from_queue($s_action,$s_entry) + { + /* 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->conferences[$s_entry]['dn']; + $this->CopyPasteHandler->add_to_queue($dn,$s_action,"conferencetabs","CONFERENCETABS","gofonconference"); + } + + /* Add entries to queue */ + if($s_action == "copy_multiple" || $s_action == "cut_multiple"){ + + /* Cleanup object queue */ + $this->CopyPasteHandler->cleanup_queue(); + + /* Add new entries to CP queue */ + foreach($this->list_get_selected_items() as $id){ + $dn = $this->conferences[$id]['dn']; + + if($s_action == "copy_multiple"){ + $this->CopyPasteHandler->add_to_queue($dn,"copy","conferencetabs","CONFERENCETABS","gofonconference"); + } + if($s_action == "cut_multiple"){ + $this->CopyPasteHandler->add_to_queue($dn,"cut","conferencetabs","CONFERENCETABS","gofonconference"); + } + } + } + + /* 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()){ + + /* Load entry from queue and set base */ + $this->CopyPasteHandler->load_entry_from_queue(); + $this->CopyPasteHandler->SetVar("base",$this->DivListConference->selectedBase); + + /* 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 save_object() { $this->DivListConference->save_object();