Code

Removed usePrototype flag, its activated always now.
[gosa.git] / gosa-plugins / goto / admin / applications / class_applicationManagement.inc
index aec27779e8660a9311ee619697e4b3c640170e5f..e1bafafa080de3cb5b29fb43aa922e0a7a635e23 100644 (file)
@@ -23,7 +23,7 @@
 class applicationManagement extends management
 {
   var $plHeadline     = "Applications";
-  var $plDescription  = "Application management";
+  var $plDescription  = "Define and parametrize desktop applications for using them in desktop profiles";
   var $plIcon  = "plugins/goto/images/application.png";
 
   var $app_release = ""; // The currently selected release while in release management mode!
@@ -86,6 +86,61 @@ class applicationManagement extends management
   }
 
 
+  /*! \brief   Someone wants to remove some object(s)
+   *            ask for a confirmation now.
+   */
+  function removeEntryRequested($action="",$target=array(),$all=array(), 
+      $altTabClass ="", $altTabType = "",             $altAclCategory="")
+  {
+    // Close dialogs and remove locks for currently handled dns
+    $this->cancelEdit();
+
+    // Do not allow to remove objects with state freeezed
+    $errors = $disallowed = array();
+    $headpage = $this->getHeadpage();
+    foreach($target as $dn){
+
+      $obj = $headpage->getEntry($dn);
+      $acl  = $this->ui->get_permissions($obj['dn'],"application/application");
+      if(!preg_match("/d/",$acl)){
+        $disallowed[] = $obj['dn'];
+      }elseif(isset($obj['FAIstate']) && preg_match('/freeze/i', $obj['FAIstate'][0])){
+        $errors[] = $obj['dn'];
+      }else{
+        $this->dns[] = $obj['dn'];
+      }
+    }
+    if(count($errors)){
+      msg_dialog::display(_("Branch locked"),
+          sprintf(_("The following entries are locked, you can't remove them %s."),
+            msgPool::buildList($errors)),INFO_DIALOG);
+    }
+    if(count($disallowed)){
+      msg_dialog::display(_("Permission error"), msgPool::permDelete($disallowed), ERROR_DIALOG);
+    }
+    return(management::removeEntryRequested($action, $this->dns));
+  }
+
+
+  /*! \brief  This method opens an existing object or a list of existing objects to be edited.
+   *
+   *
+   *  @param  String  'action'  The name of the action which was the used as trigger.
+   *  @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 editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
+  {
+    management::editEntry($action,$target,$all,$altTabClass,$altTabType,$altAclCategory);
+    if($this->tabObject){
+      if(isset($this->tabObject->by_object['application']->attrs['FAIstate'][0])){
+        $state = $this->tabObject->by_object['application']->attrs['FAIstate'][0];
+        $this->tabObject->setReadOnly(preg_match("/freeze/i", $state));
+      }
+    }
+  }
+
+
   /*! \brief   Overridden render method of class mangement.
    *            this allows us to add a release selection box.
    */
@@ -95,35 +150,20 @@ class applicationManagement extends management
     $filter = $this->getFilter();
     $headpage = $this->getHeadpage();
 
-    $this->releaseSelector->update();
-    $this->app_release = $this->releaseSelector->getBase();
+    // Display release selector
+    if($this->IsReleaseManagementActivated()){
+      $this->releaseSelector->update();
+      $this->app_release = $this->releaseSelector->getBase();
+      $headpage->setBase($this->app_release);
+      $smarty->assign("RELEASE", $this->releaseSelector->render());
+    }
 
-    $headpage->setBase($this->app_release);
     $headpage->update();
-    $smarty->assign("RELEASE", $this->releaseSelector->render());
     $display = $headpage->render();
     return($this->getHeader().$display);
   }
 
 
-  function getReleaseList($base = "", $prefix ="")
-  {
-    $list = array();
-    if(empty($base)){
-      $base = get_ou('applicationRDN').$this->config->current['BASE'];
-      $list[$base] = "/";
-    }
-
-    $ldap = $this->config->get_ldap_link();
-    $ldap->ls("(objectClass=FAIbranch)",$base,array("ou","FAIstate"));
-    while($release = $ldap->fetch()){
-      $list[$release['dn']] = $prefix.$release['ou'][0];
-      $list = array_merge($list,$this->getReleaseList($release['dn'],$prefix."  "));
-    }
-    return($list);
-  }
-  
-
   function IsReleaseManagementActivated()
   {
     /* Check if we should enable the release selection */