Code

Made headpage and filter private
[gosa.git] / gosa-core / include / class_management.inc
index dd70b733254ab02430c4acfeae24fd8d221d4673..4439b559abb49c2a550fcce68b4cefe0c6ca699a 100644 (file)
@@ -70,8 +70,8 @@ class management
   protected $snapHandler = null;
 
   // The listing handlers
-  protected $headpage = null;
-  protected $filter = null;
+  private $headpage = null;
+  private $filter = null;
 
   // A list of configured actions/events
   protected $actions = array();
@@ -96,6 +96,7 @@ class management
     $this->registerAction("apply",  "applyChanges");
     $this->registerAction("save",   "saveChanges");
     $this->registerAction("cancel", "cancelEdit");
+    $this->registerAction("cancelDelete", "cancelEdit");
     $this->registerAction("remove", "removeEntryRequested");
     $this->registerAction("removeConfirmed", "removeEntryConfirmed");
 
@@ -165,13 +166,27 @@ class management
       }
       $this->snapHandler->setSnapshotBases($bases);
     }
-
+    
+    // Display list
+    return($this->renderList());
+  }
+  
+  function renderList()
+  {
     $this->headpage->update();
     $display = $this->headpage->render();
     return($this->getHeader().$display);
   }
 
+  function getHeadpage()
+  {
+    return($this->headpage);
+  }
 
+  function getFilter()
+  {
+    return($this->filter);
+  }
 
   /*! \brief  Generates the plugin header which is displayed whenever a tab object is 
    *           opened.
@@ -202,7 +217,7 @@ class management
     // Check if there is a dialog opened - We don't need any buttons in this case. 
     if($this->tabObject->by_object[$this->tabObject->current]){
       $current = $this->tabObject->by_object[$this->tabObject->current];  
-      if(is_object($current->dialog)){
+      if(isset($current->dialog) && (is_object($current->dialog) || $current->dialog)){
         return("");
       }
     }
@@ -311,6 +326,7 @@ class management
         $this->tabObject= new $tabClass($this->config,$this->config->data['TABS'][$tabType], $this->dn, $aclCategory);
         $this->tabObject->set_acl_base($this->dn);
         $this->tabObject->delete ();
+        $this->tabObject->parent = &$this;
 
         // Remove the lock for the current object.
         del_lock($this->dn);        
@@ -331,11 +347,16 @@ class management
    */
   function detectPostActions()
   {
+    if(!is_object($this->headpage)){
+      trigger_error("No valid headpage given....!");
+      return(array());
+    }
     $action= $this->headpage->getAction();
     if(isset($_POST['edit_apply']))  $action['action'] = "apply";    
     if(isset($_POST['edit_finish'])) $action['action'] = "save";    
     if(isset($_POST['edit_cancel'])) $action['action'] = "cancel";    
     if(isset($_POST['delete_confirmed'])) $action['action'] = "removeConfirmed";   
+    if(isset($_POST['delete_cancel'])) $action['action'] = "cancelDelete";   
 
     // Detect Snapshot actions
     if(isset($_POST['CreateSnapshot'])) $action['action'] = "saveSnapshot";   
@@ -381,6 +402,7 @@ class management
       if(!empty($entry) && $this->ui->allow_snapshot_create($entry,$this->aclCategory)){
         $this->dialogObject = new SnapShotDialog($this->config,$entry,$this);
         $this->dialogObject->aclCategories = array($this->aclCategory);
+        $this->dialogObject->parent = &$this;
 
       }else{
         msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to create a snapshot for %s."),$entry),
@@ -397,7 +419,7 @@ class management
    *  @param  Array   'target'  A list of object dns, which should be affected by this method.
    *  @param  Array   'all'     A combination of both 'action' and 'target'.
    */
-  function saveSnapsho($action="",$target=array(),$all=array())
+  function saveSnapshot($action="",$target=array(),$all=array())
   {
     $this->dialogObject->save_object();
     $msgs = $this->dialogObject->check();
@@ -461,6 +483,7 @@ class management
         $this->dialogObject->set_snapshot_bases($bases);
         $this->dialogObject->display_all_removed_objects = true;
         $this->dialogObject->display_restore_dialog = true;
+        $this->dialogObject->parent = &$this;
       }else{
         msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to restore a snapshot for %s."),$entry),
             ERROR_DIALOG);
@@ -474,6 +497,7 @@ class management
         $this->dialogObject = new SnapShotDialog($this->config,$entry,$this);
         $this->dialogObject->set_snapshot_bases($bases);
         $this->dialogObject->display_restore_dialog = true;
+        $this->dialogObject->parent = &$this;
       }else{
         msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to restore a snapshot for %s."),$entry),
             ERROR_DIALOG);
@@ -530,6 +554,7 @@ class management
     }else{
       $this->tabObject= new $tabClass($this->config,$this->config->data['TABS'][$tabType], $this->dn, $aclCategory);
       $this->tabObject->set_acl_base($this->headpage->getBase());
+      $this->tabObject->parent = &$this;
       @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dn,"Create new entry initiated!");
     }
   }
@@ -593,6 +618,7 @@ class management
         $this->tabObject= new $tab($this->config,$this->config->data['TABS'][$tabType], $this->dn,$aclCategory);
         @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dn,"Edit entry initiated!");
         $this->tabObject->set_acl_base($this->dn);
+        $this->tabObject->parent = &$this;
       }
     }else{