Code

Added divlist for shares.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 1 Jun 2006 07:18:18 +0000 (07:18 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 1 Jun 2006 07:18:18 +0000 (07:18 +0000)
Added pwd hash reset button.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3596 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/environment/class_environment.inc
plugins/personal/environment/environment.tpl

index c68b5af1c5261e4b6877c3a63de44b47f36c5d4b..25291da7abd30973d034e926159afafa9620c601 100644 (file)
@@ -151,9 +151,9 @@ class environment extends plugin
         $tmp2['name']        =$tmp[1];
         $tmp2['mountPoint']  =$tmp[2];
         if(isset($tmp[3])){
-          $tmp2['OtherStuff']  =$tmp[3];
+          $tmp2['PwdHash']  =$tmp[3];
         }else{
-          $tmp2['OtherStuff']  ="";
+          $tmp2['PwdHash']  ="";
         }
         if(isset($tmp[4])){
           $tmp2['Username']  =$tmp[4];
@@ -547,7 +547,7 @@ class environment extends plugin
         /* Preparing the new assignment */ 
         $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
         $this->gotoShares[$a_share['name']."|".$a_share['server']]['Username']=$s_user;
-        $this->gotoShares[$a_share['name']."|".$a_share['server']]['OtherStuff']="";
+        $this->gotoShares[$a_share['name']."|".$a_share['server']]['PwdHash']="";
         $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
       }
     }  
@@ -555,12 +555,41 @@ class environment extends plugin
     /* if the Post  gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
      * If there is no defined share selected, we will abort the deletion without any message 
      */
-    if((isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare']))){
-      unset($this->gotoShares[$_POST['gotoShare']]);
+    $once = true;
+    foreach($_POST as $name => $value){
+      if((preg_match("/^gotoShareDel_/",$name)) && ($once)){
+        $once = false;  
+        $key  = preg_replace("/^gotoShareDel_/","",$name);
+        $key  = preg_replace("/_+[xy]$/","",$key);
+        if(isset($this->gotoShares[$key])) {
+          unset($this->gotoShares[$key]);
+        }
+      }
+      if((preg_match("/^gotoShareResetPwd_/",$name)) && ($once)){
+        $once = false;
+        $key  = preg_replace("/^gotoShareResetPwd_/","",$name);
+        $key  = preg_replace("/_+[xy]$/","",$key);
+        $this->gotoShares[$key]['PwdHash'] = "";
+      }
     }
 
-    $smarty->assign("gotoShares",$this->printOutAssignedShares());
-    $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
+    $divlistShares = new divSelectBox("gotoShares");
+    $divlistShares->SetHeight(100);
+    $tmp = $this->printOutAssignedShares();
+    
+    foreach($tmp as $key => $value){
+    
+      $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());
 
     /* Hotplug devices will be handled here 
      * There are 3 possible methods for this feature
@@ -1040,7 +1069,7 @@ $ldap->modify ($attrs);
     /* Prepare Shares */
     $this->attrs['gotoShare']=array();
     foreach($this->gotoShares as $name => $share){
-      $this->attrs['gotoShare'][] =$share['server']."|".$share['name']."|".$share['mountPoint']."|".$share['OtherStuff']."|".$share['Username'];
+      $this->attrs['gotoShare'][] =$share['server']."|".$share['name']."|".$share['mountPoint']."|".$share['PwdHash']."|".$share['Username'];
     }
 
 
index 5daf8ef2d5aa62c67847c9edabe6e0e2d3c9bf96..df2df9ba516e9f2bc463d93c1e2eb7a79c0dc888 100644 (file)
        <table summary="" style="width:100%">
                <tr>
                        <td>
-                       <select style="width:100%;" name="gotoShare" multiple size=5 {$gotoShareACL} id="gotoShare">
-       {html_options values=$gotoShareKeys output=$gotoShares}
-       <option disabled>&nbsp;</option>
-                               </select>
-                               <br>
-                       <select name="gotoShareSelection" {$gotoShareACL}>
-       {html_options values=$gotoShareSelectionKeys output=$gotoShareSelections}
-       <option disabled>&nbsp;</option>
+                               {$divlistShares}
+                               <input type="text" size=15 {$gotoShareACL} name="ShareUser" value="%u" title="{t}User used to connect to the share{/t}">@
+                               <select name="gotoShareSelection" {$gotoShareACL} title="{t}Select a share{/t}">
+                                       {html_options values=$gotoShareSelectionKeys output=$gotoShareSelections}
+                                       <option disabled>&nbsp;</option>
                                </select>
-                               <input type="text" size=15 {$gotoShareACL} name="gotoShareMountPoint" value="%H/Netzlaufwerke/%L/%S">
-                               <input type="text" size=15 {$gotoShareACL} name="ShareUser" value="%u">
+                               :
+                               <input type="text" size=15 {$gotoShareACL} name="gotoShareMountPoint" value="%H/Netzlaufwerke/%L/%S"
+                  title="{t}Mount path{/t}">
                                <input type="submit" {$gotoShareACL} name="gotoShareAdd" value="{t}Add{/t}"> 
-                               <input type="submit" {$gotoShareACL} name="gotoShareDel" value="{t}Remove{/t}"> 
+       <!--                    <input type="submit" {$gotoShareACL} name="gotoShareDel" value="{t}Remove{/t}"> -->
                        </td>
                </tr>
        </table>