Code

Ensure that the currenlty selected profile server stays selected after saving, even...
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 1 Jul 2008 12:43:38 +0000 (12:43 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 1 Jul 2008 12:43:38 +0000 (12:43 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11496 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/personal/environment/class_environment.inc
gosa-plugins/goto/personal/environment/environment.tpl

index f3a1d06eaa3855b8e40133fd0b00638bceba3a4e..21ecc93f1c30e79d147cb8f5ffebc383bf37ab4a 100644 (file)
@@ -236,7 +236,27 @@ class environment extends plugin
     $this->gotoProfileServers= $config->getShareServerList() ;
     $this->gotoShareSelections= $config->getShareList(true);
     $this->gotoAvailableShares= $config->getShareList(false);  
+  
+    /* Ensure that a currently selected server will stay selected, even if the list of profile servers
+        is empty due to insufficient permissions.
+     */
+    if(count($this->gotoProfileServers) && !empty($this->gotoProfileServer)){
+
+      /* The currently selected profile server is outdated/no longer available */
+      if(!isset($this->gotoProfileServers[$this->gotoProfileServer])){
 
+      }else{
+        $c = $this->gotoProfileServers[$this->gotoProfileServer];
+        if(!preg_match("/r/",$c['ACL'])){
+
+          /* We are not allowed to read to currently selected server.
+             But to ensure that the selection will be kept after saving the account, we 
+              override the current ACL tag.
+           */          
+          $this->gotoProfileServers[$this->gotoProfileServer]['ACL'] .= "r";
+        }
+      }
+    }
     $this->update_kiosk_profiles();
   }
 
@@ -322,7 +342,10 @@ class environment extends plugin
 
     /* Check profile server */
     if($this->acl_is_writeable("gotoProfileServer",$WriteOnly)){
+
       if(!empty($this->gotoProfileServer) && !isset($this->gotoProfileServers[$this->gotoProfileServer])){
+
+
         if(count($this->gotoProfileServers)){
 
           /* Get First Profile */
@@ -535,7 +558,6 @@ class environment extends plugin
     if(!is_array($this->gotoProfileServers)){
       $this->gotoProfileServers =array();
     }
-    $smarty->assign("gotoProfileServerKeys",array_flip($this->gotoProfileServers));
 
     /* Handle kiosk profiles*/
     $smarty->assign("kiosk_servers" , $this->gotoKioskProfiles['SERVERS']);
index afb1f64dcaf29fb803630b113796923d3330fd32..d1ed3aa35ae96c024c057c760ef9da1b16354aaf 100644 (file)
        <br>
        {render acl=$gotoProfileServerACL checkbox=$multiple_support checked=$use_gotoProfileServer}
                {t}Profil path{/t}
-               <select id="gotoProfileServer" name="gotoProfileServer">
-                       {html_options values=$gotoProfileServerKeys output=$gotoProfileServers selected=$gotoProfileServer}
-               </select>
+         <select id="gotoProfileServer" name="gotoProfileServer">
+                       {foreach from=$gotoProfileServers key=key item=item}
+                               <option {if $gotoProfileServer == $key} selected {/if}value='{$key}'>{$item.DISPLAY}</option>
+                       {/foreach}
+          <option disabled>&nbsp;</option>
+         </select>
        {/render}
        <br>
        {render acl=$gotoProfileQuotaACL checkbox=$multiple_support checked=$use_gotoProfileQuota}
 
 {if $gotoProfileServerWriteable}
          <select id="gotoProfileServer" name="gotoProfileServer">
-          {html_options values=$gotoProfileServerKeys output=$gotoProfileServers selected=$gotoProfileServer}
+                       {foreach from=$gotoProfileServers key=key item=item}
+                               <option {if $gotoProfileServer == $key} selected {/if}value='{$key}'>{$item.DISPLAY}</option>
+                       {/foreach}
           <option disabled>&nbsp;</option>
          </select>
 {else}
-         <select id="gotoProfileServer" name="gotoProfileServer">
-          {html_options values=$gotoProfileServer output=$gotoProfileServer selected=$gotoProfileServer}
-          <option disabled>&nbsp;</option>
+         <select id="dummy_pS" name="dummy_pS" disabled >
+          <option >{$gotoProfileServer}</option> 
          </select>
 {/if}
 {/render}