Code

Fixed self edit mode
[gosa.git] / plugins / personal / environment / main.inc
index 91883ab78c87743d22741d2ef36392524e95fa8e..4c04e5a0e8ee1476b70b3e62a259474d5d1e30bc 100644 (file)
@@ -30,6 +30,7 @@ if (!$remove_lock){
   /* Create mail object on demand */
   if (!isset($_SESSION['environment']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
     $_SESSION['environment']= new environment ($config, $ui->dn);
+    $_SESSION['environment']->set_acl_category('users');
   }
   $environment= $_SESSION['environment'];
 
@@ -54,16 +55,6 @@ if (!$remove_lock){
     $_SESSION['edit']= TRUE;
   }
 
-  /* Adjust acl's to mode */
-  if (isset($_SESSION['edit'])){
-    $acl= get_permissions ($ui->dn, $ui->subtreeACL);
-    $environment->acl= get_module_permission($acl, "environment", $ui->dn);
-  } else {
-    $acl= get_permissions ($ui->dn, $ui->subtreeACL);
-    $editacl= get_module_permission($acl, "environment",$ui->dn);
-    $environment->acl= "#none#";
-  }
-
   /* save changes to LDAP and disable edit mode */
   if (isset($_POST['edit_finish'])){
 
@@ -100,8 +91,8 @@ if (!$remove_lock){
     $display.= "<p class=\"plugbottom\">";
 
     /* Are we in edit mode? */
-    if (isset($_SESSION['edit'])){
-      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+    if ((isset($_SESSION['edit']))&&($environment->dialog==NULL)){
+      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
       $display.= "&nbsp;";
       $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
       $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
@@ -109,11 +100,12 @@ if (!$remove_lock){
     } else {
       $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
              "\"> ".$ui->dn."&nbsp;";
-      if (isset($editacl) && $editacl != "#none#"){
+  #      if (isset($editacl) && $editacl != "#none#"){
+      echo "FIxme, only display edit button if there is at least one attribute writeable";
         $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
             "\"> "._("Click the 'Edit' button below to change informations in this dialog");
         $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
-      }
+   #   }
 
       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
     }