Code

Fixed problem in deletion/pw reset
[gosa.git] / plugins / personal / environment / class_environment.inc
index 25291da7abd30973d034e926159afafa9620c601..4132771b48a963cde6528fd5e8cafa49b5df3eaf 100644 (file)
@@ -561,6 +561,7 @@ class environment extends plugin
         $once = false;  
         $key  = preg_replace("/^gotoShareDel_/","",$name);
         $key  = preg_replace("/_+[xy]$/","",$key);
+        $key  = preg_replace("/_/", ".", $key);
         if(isset($this->gotoShares[$key])) {
           unset($this->gotoShares[$key]);
         }
@@ -569,6 +570,7 @@ class environment extends plugin
         $once = false;
         $key  = preg_replace("/^gotoShareResetPwd_/","",$name);
         $key  = preg_replace("/_+[xy]$/","",$key);
+        $key  = preg_replace("/_/", ".", $key);
         $this->gotoShares[$key]['PwdHash'] = "";
       }
     }
@@ -578,15 +580,34 @@ class environment extends plugin
     $tmp = $this->printOutAssignedShares();
     
     foreach($tmp as $key => $value){
+      $img = "";
+   
+      /* Check if entry starts with an ! */
+      if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
+
+        /* If we are currently editing groups environment, skip those ! entries */ 
+        if($this->is_group) continue;
     
-      $img = "<input type='image' name='gotoShareResetPwd_".$key." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
-                title='"._("Reset password hash")."'>";
-      $img.= "&nbsp;";
-      $img.= "<input type='image' name='gotoShareDel_".$key." 'src='images/edittrash.png' alt='"._("Delete")."' 
-                title='"._("Delete share entry")."'>";
-
-      $field1 = array("string" => $value);
-      $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
+        /* Create pwd reset images */
+        if($this->gotoShares[$key]['PwdHash'] != ""){
+          $img.= "<input type='image' name='gotoShareResetPwd_".$key." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
+            title='"._("Reset password hash")."'>";
+        }
+        $field1 = array("string" => "<font style=\"color:#C0C0C0\">".$value."</font>" );
+        $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
+      }else{
+
+        /* Create pwd reset img && delete image */
+        if($this->gotoShares[$key]['PwdHash'] != ""){
+          $img.= "<input type='image' name='gotoShareResetPwd_".$key." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
+            title='"._("Reset password hash")."'>";
+          $img.= "&nbsp;";
+        }
+        $img.= "<input type='image' name='gotoShareDel_".$key." 'src='images/edittrash.png' alt='"._("Delete")."' 
+          title='"._("Delete share entry")."'>";
+        $field1 = array("string" => $value);
+        $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
+      }
       $divlistShares->AddEntry(array($field1,$field2));
     }
     $smarty->assign("divlistShares",$divlistShares->DrawList());
@@ -1127,7 +1148,9 @@ $ldap->modify ($attrs);
     $a_return = array();
     if(is_array($this->gotoShares)){
       foreach($this->gotoShares as $share){
-        if (!preg_match('/^!/', $share['server'])){
+        if(preg_match("/^!/",$share['server'])){
+          $a_return[$share['name']."|".$share['server']]= preg_replace("/^!/","",$share['server'])."://".$share['name']." - "._("group share"); 
+        }else{
           $a_return[$share['name']."|".$share['server']]= $share['server']."://".$share['name']." on ".$share['mountPoint']." as ".$share['Username'];
         }
       }