diff --git a/plugins/gofax/blocklists/class_blocklistManagement.inc b/plugins/gofax/blocklists/class_blocklistManagement.inc
index af37e1b76d6918281137dc33e3f9743f2b941f56..0e470ae16803bf77d1c82054e0d2d96e8f12ba21 100644 (file)
/* Get global filter config */
if (!is_global("blockfilter")){
$ui= get_userinfo();
- $base= get_base_from_people($ui->dn);
+ $this->base= get_base_from_people($ui->dn);
$blockfilter= array("sendlists" => "checked",
"receivelists" => "checked",
"entry" => "*",
- "depselect" => $base,
+ "depselect" => $this->base,
"regex" => "*");
register_global("blockfilter", $blockfilter);
}else{
$blockfilter = $_SESSION["blockfilter"];
$this->base = $blockfilter['depselect'];
}
+
$ui= get_userinfo();
$acl= get_permissions ($ui->dn, $ui->subtreeACL);
$this->acl= get_module_permission($acl, "blocklists", $ui->dn);
$this->reload();
}
+ /* Cancel dialog */
+ if (isset($_POST['edit_cancel']) || isset($_POST['delete_blocklist_cancel']) ||
+ isset($_POST['delete_blocklist_confirm']) || isset($_POST['delete_lock'])){
+
+ del_lock ($this->dn);
+ $this->clear_fields();
+ unset($_SESSION['objectinfo']);
+ }
+
/* Test Posts */
foreach($_POST as $key => $val){
// Post for delete
}
/* Edit selected blocklist? */
- if ($s_action=="edit"){
+ if (($s_action=="edit") && (empty($this->dn))){
$this->clear_fields();
$this->dn=$this->blocklists[$s_entry]['dn'];
- plugin::plugin ($this->config, $this->dn);
+ if (($user= get_lock($this->dn)) != ""){
+ $_SESSION['dn']= $this->dn;
+ //$this->dn ="";
+ return(gen_locked_message($user, $this->dn));
+ } else {
+# Lock this dn for editing
+ add_lock ($this->dn, $this->ui->dn);
- /* Load missing lists */
- if (isset($this->attrs["goFaxSBlocklist"])){
- for ($i= 0; $i<$this->attrs["goFaxSBlocklist"]["count"]; $i++){
- $this->goFaxBlocklist[]= $this->attrs["goFaxSBlocklist"][$i];
- }
- $this->type= 0;
- } elseif (isset($this->attrs["goFaxRBlocklist"])){
- for ($i= 0; $i<$this->attrs["goFaxRBlocklist"]["count"]; $i++){
- $this->goFaxBlocklist[]= $this->attrs["goFaxRBlocklist"][$i];
+ plugin::plugin ($this->config, $this->dn);
+
+ /* Load missing lists */
+ if (in_array("goFaxSBlock",$this->attrs['objectClass'])){
+ if(isset($this->attrs["goFaxSBlocklist"])){
+ for ($i= 0; $i<$this->attrs["goFaxSBlocklist"]["count"]; $i++){
+ $this->goFaxBlocklist[]= $this->attrs["goFaxSBlocklist"][$i];
+ }
+ }
+ $this->type= 0;
+ } elseif (in_array("goFaxRBlock",$this->attrs['objectClass'])){
+ if(isset($this->attrs["goFaxRBlocklist"])){
+ for ($i= 0; $i<$this->attrs["goFaxRBlocklist"]["count"]; $i++){
+ $this->goFaxBlocklist[]= $this->attrs["goFaxRBlocklist"][$i];
+ }
+ }
+ $this->type= 1;
}
- $this->type= 1;
+ $_SESSION['objectinfo']= trim($this->dn);
}
- $_SESSION['objectinfo']= trim($this->dn);
}
/* Delete blocklist requested */
}
}
- /* Cancel dialog */
- if (isset($_POST['edit_cancel']) || isset($_POST['delete_blocklist_cancel']) ||
- isset($_POST['delete_blocklist_confirm']) || isset($_POST['delete_lock'])){
-
- del_lock ($this->dn);
- $this->clear_fields();
- unset($_SESSION['objectinfo']);
- }
/* Handle interactions: add */
if (isset($_POST['add_number']) && $_POST['number'] != ""){
}
/* What about finish? */
- if (isset($_POST['edit_finish'])){
+ if ((isset($_POST['edit_finish'])) && (!empty($this->dn))){
$message= $this->check();
+ $this->remove_lock();
/* No errors, save object */
if (count ($message) == 0){
if ($this->dn == "new"){
$this->dn= "cn=$this->cn,ou=gofax,ou=systems,".$this->base;
}
-
+
$this->save ();
gosa_log ("Blocklist object'".$this->dn."' has been saved");
$this->dn= "";
/* NEW LIST MANAGMENT */
$listhead = "<div style='background:#F0F0F9;padding:5px;'>".
- " <input class='center' type='image' align='middle' src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
" <input class='center' type='image' src='images/list_root.png' align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ".
+ " <input class='center' type='image' align='middle' src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
" <input class='center' type='image' align='middle' src='images/list_home.png' title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
+ " <input class='center' type='image' src='images/list_reload.png' align='middle' title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'> ".
" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
" <input class='center' type='image' align='middle' src='images/list_new_blocklist.png' title='"._("Create new blocklist")."' alt='"._("New Blocklist")."' name='user_new'> ".
- " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> "._("Current base")." <select name='depselect' onChange='mainform.submit()'>$options</select>".
+ " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> "._("Base")." <select name='depselect' onChange='mainform.submit()' class='center'>$options</select>".
" <input class='center' type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ".
"</div>";
/* Fill templating stuff */
$smarty->assign("bases", $this->config->idepartments);
- $smarty->assign("base_select", $_SESSION['blockfilter']['depselect']);//$this->base);
+ $smarty->assign("base_select", $this->base);
$smarty->assign("types", array(0 => _("send"), 1 => _("receive")));
if ($this->dn == "new" || preg_match ("/,ou=incoming,/", $this->dn)){
$smarty->assign("selectmode", "");
$this->dn= "";
$this->description= "";
$this->cn= "";
- $this->base= "";
+ $this->base= $_SESSION['blockfilter']['depselect'];
$this->goFaxBlocklist= array();
}
* We also need to search for the departments
* So we are able to navigate like in konquerer
*/
- $base2 = preg_replace("/ou=people,/i","",$base);
+ $peopleBase = get_people_ou();
+ if(empty($peopleBase)){
+ $base2 = $base;
+ }else{
+ $base2 = preg_replace("/".$peopleBase.",/i","",$base);
+ }
+
$res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
TRUE, $base2, array("ou", "description"), TRUE);
{
plugin::save_object();
+ if(isset($_POST['base'])){
+ $this->base = $_POST['base'];
+ }
+
foreach($this->attributes as $attr){
if(isset($_POST[$attr])){
$this->$attr = $_POST[$attr];
if ($this->dn == 'new'){
$ldap= $this->config->get_ldap_link();
$ldap->cd ("ou=gofax,ou=systems,".$this->config->current["BASE"]);
- $ldap->search ("(&(|(objectClass=goFaxSBlock)(objectClass=goFaxRBlock))".
- "(cn=".$this->cn."))", array("cn"));
+ $ldap->search ("(&(|(objectClass=goFaxSBlock)(objectClass=goFaxRBlock))(cn=".$this->cn."))", array("cn"));
if ($ldap->count() != 0){
$message[]= _("Specified name is already used.");
}
function save()
{
plugin::save();
+
/* Type selection */
if ($this->type == 0){
/* Write back to ldap */
$ldap= $this->config->get_ldap_link();
- $ldap->cd($ldap->getParentDir($this->dn));
- $ldap->search("cn=$this->cn");
+ $ldap->cd($this->base);
+ $ldap->search("cn=$this->cn",array("cn"));
+ $ldap->cat($this->dn);
$a= $ldap->fetch();
+
if (count($a)){
if (!isset($this->attrs["$type"."list"])){
$this->attrs["$type"."list"]= array();
}
$ldap->cd($this->dn);
+ $this->cleanup();
$ldap->modify($this->attrs);
$this->handle_post_events("modify");
} else {