summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9a83314)
raw | patch | inline | side by side (parent: 9a83314)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 27 Nov 2007 14:24:46 +0000 (14:24 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 27 Nov 2007 14:24:46 +0000 (14:24 +0000) |
We are now able to assign acls and to take snapshots.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7913 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7913 594d385d-05f5-0310-b6e9-bd551577e9d8
index 438c7fcb6c1cf9015c7639ac6a45b04719a5c8d9..acff81c88347ee0852e96e3a76884219f57e2bfc 100644 (file)
"blocklist" => "plugins/gofax/blocklists/class_blocklistManagement.inc",
"divListBlocklist" => "plugins/gofax/blocklists/class_divListBlocklists.inc",
"blocklistGeneric" => "plugins/gofax/blocklists/class_blocklistGeneric.inc",
+ "faxblocktabs" => "plugins/gofax/blocklists/tabs_blocklist.inc",
"gofaxAccount" => "plugins/gofax/faxaccount/class_gofaxAccount.inc",
"faxreport" => "plugins/gofax/faxreports/class_faxreport.inc",
"addressbook" => "plugins/addons/addressbook/class_addressbook.inc",
diff --git a/plugins/gofax/blocklists/class_blocklistGeneric.inc b/plugins/gofax/blocklists/class_blocklistGeneric.inc
index 352fa7df1d85dc0b3c666f59f8a92b3de1350b8d..4504dfb278d7dbeb7cc29d7b73a518b6070405d1 100644 (file)
var $readonly = FALSE;
var $view_logged = FALSE;
var $attributes = array("cn","description");
-
- var $orig_dn;
+ var $ignore_account = TRUE;
+
function __construct($config,$dn = "new")
{
plugin::plugin($config,$dn);
/* Set default list type */
$this->type = BLOCK_LIST_SEND;
- $this->orig_dn = $this->dn;
/* Load defined numbers */
if($dn != "new"){
$this->attrs[$type]= $this->goFaxBlocklist;
}
- /* Create base */
- $this->dn = "cn=".$this->cn.",ou=gofax,ou=systems,".$this->base;
-
- /* Move object in necessary */
- if($this->orig_dn != "new" && $this->dn != $this->orig_dn){
- $this->move($this->orig_dn,$this->dn);
- }
-
/* Write back to ldap */
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->base);
diff --git a/plugins/gofax/blocklists/class_blocklistManagement.inc b/plugins/gofax/blocklists/class_blocklistManagement.inc
index 4985e0fc9d19b52d7606fefcda5aec0106eceaf3..16fa5e08f9591173c8d0602125e893ff4998762e 100644 (file)
var $DivListBlocklist = NULL;
var $CopyPasteHandler = NULL;
+ var $start_pasting_copied_objects = FALSE;
+
function blocklist (&$config, $ui)
{
$this->config = &$config;
$this->base = $_SESSION['CurrentMainBase'];
$this->DivListBlocklist = new divListBlocklist($this->config,$this);
+
+ /* Initialize copy&paste queue */
+ if ($this->config->boolValueIsTrue("main", "enableCopyPaste")){
+ $this->CopyPasteHandler= new CopyPasteHandler($this->config);
+ }
}
$s_action="new";
}elseif(preg_match("/^remove_multiple_blocklists/",$key)){
$s_action="del_multiple";
+ }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);
}
- }
+ }
if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
$s_action ="edit";
$s_entry = $_GET['id'];
$s_entry = preg_replace("/_.$/","",$s_entry);
-
-
-
-
/* handle C&P from layers menu */
-# if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-# $s_action = "copy_multiple";
-# }
-# if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-# $s_action = "cut_multiple";
-# }
-# if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-# $s_action = "editPaste";
-# }
+ if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+ $s_action = "copy_multiple";
+ }
+ if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+ $s_action = "cut_multiple";
+ }
+ if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+ $s_action = "editPaste";
+ }
/* Create options */
}
+ /***************
+ Handle copy & paste
+ ***************/
+
+ $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+ if($ret){
+ return($ret);
+ }
+
+
/***************
Cancel some dialogs
***************/
if (count ($message) == 0){
$this->dialog->save ();
-
+
if (!isset($_POST['edit_apply'])){
del_lock ($this->dn);
$this->dn= "";
show_errors ($message);
}
}
-
-
+
+
/***************
Create a new blocklist (dialog)
***************/
/* Create new blocklist? */
if ($s_action=="new"){
$this->dn= "new";
- $this->dialog = new blocklistGeneric($this->config,$this->dn);
+ $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
$this->dialog->set_acl_base($this->base);
}
add_lock ($this->dn, $this->ui->dn);
}
$_SESSION['objectinfo']= trim($this->dn);
- $this->dialog = new blocklistGeneric($this->config,$this->dn);
+ $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
$this->dialog->set_acl_base($this->dn);
}
Display dialog
***************/
- if(is_object($this->dialog) && ($this->dialog instanceof blocklistGeneric)){
+ if(is_object($this->dialog) && ($this->dialog instanceof faxblocktabs)){
$this->dialog->save_object();
return($this->dialog->execute());
}
/* Remove user by user and check acls before removeing them */
foreach($this->dns as $key => $dn){
- $acl = $this->ui->get_permissions($dn, "blocklist/blocklist");
- if (preg_match('/d/', $acl)){
+ if (preg_match("/d/",$this->ui->get_permissions($this->dn,"gofaxlist/blocklistGeneric"))){
$this->dn = $dn;
- $this->dialog = new blocklistGeneric($this->config,$this->dn);
- $this->dialog->remove_from_parent();
+ $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
+ $this->dialog->delete();
$this->dialog = NULL;
} else {
print_red (sprintf(_("You are not allowed to delete the blocklist '%s'!"),$dn));
/* Finally delete blocklist */
if (isset($_POST['delete_blocklist_confirm'])){
- if ($this->acl_is_removeable()){
- $this->dialog = new blocklistGeneric($this->config,$this->dn);
- $this->dialog->remove_from_parent();
+ if (preg_match("/d/",$this->ui->get_permissions($this->dn,"gofaxlist/blocklistGeneric"))){
+ $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
+ $this->dialog->delete();
$this->dialog = NULL;
+ del_lock ($this->dn);
} else {
print_red (_("You have no permission to remove this blocklist."));
}
$filter2= "(&(objectClass=goFaxRBlock)(|(cn=".$Regex.")(goFaxRBlocklist=".$Regex.")))";
$res2= get_list($filter2, "gofaxlist", $base,array("*"), $Flags);
}
-
+
$this->blocklists = array_merge($res,$res2);
/* appen && sort */
{
$this->DivListBlocklist->save_object();
}
+
+
+
+
+
+ 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->blocklists[$s_entry]['dn'];
+ $this->CopyPasteHandler->add_to_queue($dn,$s_action,"blocklistGeneric","","users");
+ }
+
+ /* 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->blocklists[$id]['dn'];
+
+ if($s_action == "copy_multiple"){
+ $this->CopyPasteHandler->add_to_queue($dn,"copy","usertabs","USERTABS","users");
+ }
+ if($s_action == "cut_multiple"){
+ $this->CopyPasteHandler->add_to_queue($dn,"cut","usertabs","USERTABS","users");
+ }
+ }
+ }
+
+ /* 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->DivListUsers->selectedBase);
+
+ /* Get dialog */
+ $data = $this->CopyPasteHandler->execute();
+
+ /* Set CPPasswordChange to s_entry which indicates that this entry requires a new password. */
+ if(isset($_POST['passwordTodo']) && ($_POST['passwordTodo'] == "new")){
+ $s_entry = $this->CopyPasteHandler->last_entry();
+ $this->reload();
+ foreach($this->blocklists as $key => $entry){
+ if($entry['dn'] == $s_entry){
+ $this->CPPasswordChange = $key;
+ }
+ }
+ }
+
+ /* Return dialog data */
+ if(!empty($data) && $this->CPPasswordChange == ""){
+ return($data);
+ }
+ }
+
+ /* Automatically disable status for pasting */
+ if(!$this->CopyPasteHandler->entries_queued()){
+ $this->start_pasting_copied_objects = FALSE;
+ }
+ return("");
+ }
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
diff --git a/plugins/gofax/blocklists/class_divListBlocklists.inc b/plugins/gofax/blocklists/class_divListBlocklists.inc
index f3812ff68730085072141f387629a1bb2ffa5cd9..8b8a505a650a03510581009465d3c2d35146903a 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;
}
$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;
}
if(preg_match("/w/",$acl) && preg_match("/c/",$acl)){
$action.= $this->GetSnapShotActions($val['dn']);
}
-
+
+ /* Add copy & cut icons */
+ if(preg_match("/(c.*w|w.*c)/",$acl) && $this->parent->CopyPasteHandler){
+ $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")."'> ";
+ }
+
+
/* Delete entry ; requires remove access */
if(preg_match("/d/",$acl)){
$action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='goFaxBlocklist_del_%KEY%' title='"._("Delete user")."'>";
/* Cutted objects should be displayed in light grey */
if(isset($this->parent->CopyPasteHandler->queue) && is_array($this->parent->CopyPasteHandler->queue)){
foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
- if($queue_data['dn'] == $acl_entry['dn']) {
+ if($queue_data['dn'] == $val['dn']) {
$display = "<font color='#999999'>".$display."</font>";
break;
}
index c42cc55e3d0eb0170b0caaacb9e99d419e4e7fc3..71c0b81a36e0942401a2c00f8b6af48cda1526b4 100644 (file)
if ($remove_lock){
if(isset($_SESSION['blocklist'])){
$blocklist= $_SESSION['blocklist'];
- $blocklist->remove_lock();
del_lock ($ui->dn);
sess_del ('blocklist');
}
diff --git a/plugins/gofax/blocklists/tabs_blocklist.inc b/plugins/gofax/blocklists/tabs_blocklist.inc
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+class faxblocktabs extends tabs
+{
+ function faxblocktabs($config, $data, $dn)
+ {
+ tabs::tabs($config, $data, $dn, 'gofaxlist');
+
+ /* Add references/acls/snapshots */
+ $this->addSpecialTabs();
+ }
+
+ function save($ignore_account= FALSE)
+ {
+ $baseobject= $this->by_object['blocklistGeneric'];
+
+ /* Check for new 'dn', in order to propagate the 'dn' to all plugins */
+ $new_dn= "cn=".$baseobject->cn.",ou=gofax,ou=systems,".$baseobject->base;
+
+ /* Move group? */
+ if ($this->dn != $new_dn){
+
+ /* Write entry on new 'dn' */
+ if ($this->dn != "new"){
+ $baseobject->move($this->dn, $new_dn);
+ $this->by_object['blocklistGeneric']= $baseobject;
+ }
+
+ /* Happen to use the new one */
+ $this->dn= $new_dn;
+ }
+
+ tabs::save();
+ }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>