X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Fgoto%2Fadmin%2Fapplications%2Fclass_applicationManagement.inc;h=7024e7991199da05e2c41791cfbdcc465f2e8075;hb=aa786551ba1615ecfba75ca25d1c28e68e5bc3a1;hp=71b9a49a6ad3174d7709c7b96b28c76842085ba1;hpb=296b97f03e4f6b903b1ecf57451101a3926bd1fc;p=gosa.git diff --git a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc b/gosa-plugins/goto/admin/applications/class_applicationManagement.inc index 71b9a49a6..7024e7991 100644 --- a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc +++ b/gosa-plugins/goto/admin/applications/class_applicationManagement.inc @@ -36,6 +36,8 @@ class applicationManagement extends plugin var $app_base =""; var $app_release =""; + var $dns = array(); + function IsReleaseManagementActivated() { /* Check if we should enable the release selection */ @@ -86,8 +88,6 @@ class applicationManagement extends plugin $this->app_base = $app_filter['app_base']; $this->app_release = $app_filter['app_release']; } - $this->app_base = "ou=apps,ou=Direktorium,o=Landeshauptstadt München,c=de"; - $this->app_release= $this->app_base; } @@ -129,7 +129,7 @@ class applicationManagement extends plugin /* These vars will be stored if you try to open a locked app, to be able to perform your last requests after showing a warning message */ - session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^appl_edit_/","/^appl_del_/","/^item_selected/","/^remove_multiple_applications/")); + session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^appl_edit_/","/^appl_del_/","/^item_selected/","/^remove_multiple_applications/","/^menu_action/")); $smarty = get_smarty(); // Smarty instance $s_action = ""; // Contains the action to proceed @@ -230,8 +230,7 @@ class applicationManagement extends plugin /* Cancel dialogs */ if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){ - del_lock ($this->apptabs->dn); - unset ($this->apptabs); + $this->remove_lock(); $this->apptabs= NULL; session::un_set('objectinfo'); } @@ -261,11 +260,16 @@ class applicationManagement extends plugin /* Application has been saved successfully, remove lock from LDAP. */ if ($this->dn != "new"){ - del_lock ($this->dn); + $this->remove_lock(); } - unset ($this->apptabs); $this->apptabs= NULL; session::un_set('objectinfo'); + }else{ + + /* Reinitialize tab */ + if($this->apptabs instanceof tabs){ + $this->apptabs->re_init(); + } } } else { /* Ok. There seem to be errors regarding to the tab data, @@ -312,16 +316,15 @@ class applicationManagement extends plugin $ids = $this->list_get_selected_items(); if(count($ids)){ - + $this->dns = array(); foreach($ids as $id){ - $dn = $this->applications[$id]['dn']; - $this->dns[$id] = $dn; + $this->dns[$id] = $this->applications[$id]['dn']; } if ($user= get_multiple_locks($this->dns)){ return(gen_locked_message($user,$this->dns)); } - $dns_names[] = array(); + $dns_names = array(); foreach($this->dns as $dn){ add_lock ($dn, $this->ui->dn); $dns_names[] =@LDAP::fix($dn); @@ -363,10 +366,11 @@ class applicationManagement extends plugin msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG); new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion."); } - /* Remove lock file after successfull deletion */ - del_lock ($dn); - unset($this->dns[$key]); } + + /* Remove lock file after successfull deletion */ + $this->remove_lock(); + $this->dns = array(); } @@ -376,10 +380,10 @@ class applicationManagement extends plugin /* Remove lock */ if(isset($_POST['delete_multiple_application_cancel'])){ - foreach($this->dns as $key => $dn){ - del_lock ($dn); - unset($this->dns[$key]); - } + + /* Remove lock file after successfull deletion */ + $this->remove_lock(); + $this->dns = array(); } /**************** @@ -450,7 +454,7 @@ class applicationManagement extends plugin } /* Remove lock file after successfull deletion */ - del_lock ($this->dn); + $this->remove_lock(); } @@ -460,7 +464,7 @@ class applicationManagement extends plugin /* Delete application canceled? */ if (isset($_POST['delete_cancel'])){ - del_lock ($this->dn); + $this->remove_lock(); session::un_set('objectinfo'); } @@ -534,15 +538,19 @@ class applicationManagement extends plugin if(!$this->IsReleaseManagementActivated()){ $use_base = $this->app_base; + if($SubSearch){ + $use_base = preg_replace("/^".normalizePreg(get_ou("applicationou"))."/","",$use_base); + } }else{ $use_base = $this->app_release; + $SubSearch= FALSE; } - - if($SubSearch){ - $Flags |= GL_SUBSEARCH; + + if($SubSearch){ + $res= get_sub_list($Filter, "application",get_ou("applicationou"), $use_base, array("cn","description","dn","objectClass"), $Flags); + }else{ + $res= get_list($Filter, "application",$use_base, array("cn","description","dn","objectClass"), $Flags); } - - $res= get_list($Filter, "application", $use_base, array("cn","description","dn","objectClass"), $Flags); $tmp2 = array(); foreach ($res as $val){ $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val; @@ -612,7 +620,7 @@ class applicationManagement extends plugin /* Get dialog */ $this->CopyPasteHandler->SetVar("base",$this->app_base); - $this->CopyPasteHandler->SetVar("parent",&$this); + $this->CopyPasteHandler->SetVar("parent",$this); $data = $this->CopyPasteHandler->execute(); /* Return dialog data */ @@ -649,13 +657,21 @@ class applicationManagement extends plugin $this->postcreate(); } + function remove_lock() { if (isset($this->apptabs->dn)){ del_lock ($this->apptabs->dn); } + if(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){ + del_lock($this->dn); + } + if(isset($this->dns) && is_array($this->dns) && count($this->dns)){ + del_lock($this->dns); + } } + function save_object() { $this->DivListApplication->save_object(); @@ -669,8 +685,14 @@ class applicationManagement extends plugin if(isset($releases[$sel_rel])){ $this->app_release = $releases[$sel_rel]; } + $app_filter = session::get("app_filter"); + $app_filter['app_release'] = $this->app_release; + session::set("app_filter",$app_filter); }elseif(!$this->IsReleaseManagementActivated()){ $this->app_base = get_ou("applicationou").$this->DivListApplication->selectedBase; + $app_filter = session::get("app_filter"); + $app_filter['app_base'] = $this->app_base; + session::set("app_filter",$app_filter); } }