summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9a7f2e6)
raw | patch | inline | side by side (parent: 9a7f2e6)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 13 Jun 2007 12:15:00 +0000 (12:15 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 13 Jun 2007 12:15:00 +0000 (12:15 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6576 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/gofon/macro/class_divListMacros.inc b/plugins/gofon/macro/class_divListMacros.inc
index 8fc64b956806c2f1598214661e0010f9b248bb03..0c16a67ecc62c3de213bf2d983a66a5e1b6c6dc8 100755 (executable)
$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;
}
/* 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;
+ }
+
if(preg_match("/w/",$acls) && preg_match("/c/",$acls)){
$listhead .= $this->get_snapshot_header($this->selectedBase);
}
+
+ $listhead .= $Copy_Paste;
+
if(preg_match("/c/",$acls)){
$listhead .= " <input class='center' type='image' align='middle' src='images/list_new_macro.png'
title='"._("Create new phone macro")."' alt='"._("New")."' name='goFonMacro_new'> ";
$listhead .= " <input class='center' type='image' align='middle' src='images/edittrash.png'
title='"._("Remove selected macros")."' alt='"._("Remove macros")."' name='remove_multiple_macros'> ";
+ /* 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>";
+ }
+
$listhead .="</div>";
$this->SetListHeader($listhead);
}
$editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=edit_entry'>%s</a>";
/* Dynamic action col, depending on snapshot icons */
- $action_col_size = 60;
+ $action_col_size = 100;
if($this->parent->snapshotEnabled()){
$action_col_size += 20;
}
continue;
}
+ if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$sacl)){
+ $action.= "<input class='center' type='image'
+ src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'> ";
+ $action.= "<input class='center' type='image'
+ src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'> ";
+ }
+
$action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'
name='goFonMacro_edit_%KEY%' title='"._("Edit macro")."'>";
index 05f761b0d2afdc17f026506bc409b5afba73a9d2..7078cf998efc6af5a0214dc1a379b7a728ef1e43 100755 (executable)
}
+ function getCopyDialog()
+ {
+ $smarty = get_smarty();
+ $smarty->assign("cn" ,$this->cn);
+ $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'];
+ }
+ }
+
+
function plInfo()
{
return (array(
diff --git a/plugins/gofon/macro/class_gofonMacroManagement.inc b/plugins/gofon/macro/class_gofonMacroManagement.inc
index f7a0e337f04a4e1c71a6393c190d24b696f11fbd..d51135a015acf23f074fb0217965315c8cab4044 100755 (executable)
var $ui = NULL;
var $DivListMacro = NULL;
+ var $CopyPasteHandler = NULL;
+ var $start_pasting_copied_objects = FALSE;
+
function gofonMacro($config, $ui)
{
/* Save configuration for internal use */
$this->ui= $ui;
$this->DivListMacro = new divListMacro($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);
+ }
}
function execute()
$s_action="new";
}elseif(preg_match("/^remove_multiple_macros/",$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);
+ }elseif(preg_match("/^cut_.*/",$key)){
+ $s_action="cut";
+ $s_entry = preg_replace("/^cut_/i","",$key);
+ }elseif(preg_match("/^multiple_copy_objects/",$key)){
+ $s_action = "copy_multiple";
+ }elseif(preg_match("/^multiple_cut_objects/",$key)){
+ $s_action = "cut_multiple";
}
}
if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
$s_entry = preg_replace("/_.$/","",$s_entry);
+ /********************
+ 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);
+ }
+
+
/*****************
Create a new Macro
*****************/
}
+ 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->macros[$s_entry]['dn'];
+ $this->CopyPasteHandler->add_to_queue($dn,$s_action,"macrotabs","MACROTABS","gofonmacro");
+ }
+
+ /* 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->macros[$id]['dn'];
+
+ if($s_action == "copy_multiple"){
+ $this->CopyPasteHandler->add_to_queue($dn,"copy","macrotabs","MACROTABS","gofonmacro");
+ }
+ if($s_action == "cut_multiple"){
+ $this->CopyPasteHandler->add_to_queue($dn,"cut","macrotabs","MACROTABS","gofonmacro");
+ }
+ }
+ }
+
+ /* 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->DivListMacro->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("");
+ }
+
+
+
/* Return departments, that will be included within snapshot detection */
function get_used_snapshot_bases()
{
diff --git a/plugins/gofon/macro/class_gofonMacroParameters.inc b/plugins/gofon/macro/class_gofonMacroParameters.inc
index b1ca0a8afe3dab8dad79b05a168777a58ec03629..2960bbeb87c12b54174833e0afa8b6d96bbf835a 100755 (executable)
show_ldap_error($ldap->get_error(), sprintf(_("Removing of goFonMacro/generic account with dn '%s' failed."),$this->dn));
}
+ function PrepareForCopyPaste($source)
+ {
+ plugin::PrepareForCopyPaste($source);
+
+ $source_o = new macroParameter($this->config,$source['dn']);
+ $this->goFonMacroParameter = $source_o-> goFonMacroParameter;
+ }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
diff --git a/plugins/gofon/macro/paste_generic.tpl b/plugins/gofon/macro/paste_generic.tpl
--- /dev/null
@@ -0,0 +1,9 @@
+<table summary="">
+ <tr>
+ <td>
+ <LABEL for="cn">{t}Macro name{/t}</LABEL>{$must}</td>
+ <td>
+ <input name="cn" id="id" size=13 maxlength=13 value="{$cn}" title="{t}Macro name{/t}">
+ </td>
+ </tr>
+</table>