Code

Environment multipe edit.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 14 Dec 2007 09:11:32 +0000 (09:11 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 14 Dec 2007 09:11:32 +0000 (09:11 +0000)
-Added LogonScripts

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

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

index 25de2cb6d07c2c8f585989c147c199e71c12db16..dc410f4bff0c48d6e4f52a6a46fe6a74ba24acf0 100644 (file)
@@ -568,6 +568,10 @@ class environment extends plugin
           unset($this->dialog);
           $this->dialog=FALSE;
           $this->is_dialog=false;
+
+          if($this->multiple_support_active){
+            $tmp['UsedByAllUsers'] = TRUE;
+          }
           $this->gotoLogonScripts[$tmp['LogonName']]=$tmp; 
         }
       }
@@ -611,10 +615,15 @@ class environment extends plugin
     }
 
     /* Append List to smarty*/
-    $ls = $this->printOutLogonScripts();
-    $smarty->assign("gotoLogonScripts",  $ls);
-    $smarty->assign("gotoLogonScriptKeys",array_flip($ls));
-    $smarty->assign("gotoLogonScriptKeysCnt",count($ls));
+    if($this->multiple_support_active){
+      $smarty->assign("gotoLogonScripts",  $this->gotoLogonScripts);
+      $smarty->assign("gotoLogonScriptKeysCnt",count($this->gotoLogonScripts));
+    }else{
+      $ls = $this->printOutLogonScripts();
+      $smarty->assign("gotoLogonScripts",  $ls);
+      $smarty->assign("gotoLogonScriptKeys",array_flip($ls));
+      $smarty->assign("gotoLogonScriptKeysCnt",count($ls));
+    }
 
     /* In this section server shares will be defined 
      * A user can select one of the given shares and a mount point
@@ -1426,15 +1435,68 @@ class environment extends plugin
         $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
       }
     }
+
+
+    /* prepare LogonScripts */
+    if((isset($this->multi_attrs_all['gotoLogonScript']))&&(is_array($this->multi_attrs_all['gotoLogonScript']))){
+      unset($this->multi_attrs_all['gotoLogonScript']['count']);
+      foreach($this->multi_attrs_all['gotoLogonScript'] as $device){
+        $tmp = $tmp2 = array();
+        $tmp = split("\|",$device);
+        $tmp2['LogonName']        = $tmp[0];
+        $tmp2['LogonPriority']    = $tmp[2];
+        if(preg_match("/O/i",$tmp[1])){
+          $tmp2['LogonOverload'] = "O";
+        }else{
+          $tmp2['LogonOverload'] = "";
+        }
+        if(preg_match("/L/i",$tmp[1])){
+          $tmp2['LogonLast'] = "L";
+        }else{
+          $tmp2['LogonLast'] = "";
+        }
+        $tmp2['LogonData']        = base64_decode($tmp[3]);
+        $tmp2['LogonDescription'] = $tmp[4];
+        $tmp2['UsedByAllUsers'] = FALSE;
+        $this->gotoLogonScripts[$tmp[0]]=$tmp2;
+      }
+    }
+
+    /* prepare LogonScripts */
+    if((isset($this->multi_attrs['gotoLogonScript']))&&(is_array($this->multi_attrs['gotoLogonScript']))){
+      unset($this->multi_attrs['gotoLogonScript']['count']);
+      foreach($this->multi_attrs['gotoLogonScript'] as $device){
+        $tmp = $tmp2 = array();
+        $tmp = split("\|",$device);
+        $tmp2['LogonName']        = $tmp[0];
+        $tmp2['LogonPriority']    = $tmp[2];
+        if(preg_match("/O/i",$tmp[1])){
+          $tmp2['LogonOverload'] = "O";
+        }else{
+          $tmp2['LogonOverload'] = "";
+        }
+        if(preg_match("/L/i",$tmp[1])){
+          $tmp2['LogonLast'] = "L";
+        }else{
+          $tmp2['LogonLast'] = "";
+        }
+        $tmp2['LogonData']        = base64_decode($tmp[3]);
+        $tmp2['LogonDescription'] = $tmp[4];
+        $tmp2['UsedByAllUsers'] = TRUE;
+        $this->gotoLogonScripts[$tmp[0]]=$tmp2;
+      }
+    }
   }
 
 
   function set_multi_edit_values($attrs)
   {
     $shares = $this->gotoShares;
+    $scripts= $this->gotoLogonScripts;
     plugin::set_multi_edit_values($attrs);
 
     $this->gotoShares = $shares;
+    $this->gotoLogonScripts = $scripts;
     foreach($attrs['gotoShares'] as $name => $share){
       if($share['UsedByAllUsers'] == TRUE){
         $this->gotoShares[$name] = $share;
@@ -1445,6 +1507,16 @@ class environment extends plugin
         unset($this->gotoShares[$name]);
       }
     }
+    foreach($attrs['gotoLogonScripts'] as $name => $share){
+      if($share['UsedByAllUsers'] == TRUE){
+        $this->gotoLogonScripts[$name] = $share;
+      }
+    }
+    foreach($this->gotoLogonScripts as $name => $share){
+      if(!isset($attrs['gotoLogonScripts'][$name])){
+        unset($this->gotoLogonScripts[$name]);
+      }
+    }
   }
 
 
@@ -1453,6 +1525,7 @@ class environment extends plugin
   {
     $ret = plugin::get_multi_edit_values();
     $ret['gotoShares'] = $this->gotoShares;
+    $ret['gotoLogonScripts'] = $this->gotoLogonScripts;
     return($ret);
   }
 
index ba6c35623c42e15c68c0a74b3db49cd397f468fd..3fdbead4b6653d49667bd39d18aec1efeb0d6af5 100644 (file)
      <td>
 {render acl=$gotoLogonScriptACL}
       <select style="width:100%;" name="gotoLogonScript" multiple size=5 id="gotoLogonScript">
-       {html_options values=$gotoLogonScriptKeys output=$gotoLogonScripts }
-       <option disabled>&nbsp;</option>
+
+               {if $multiple_support}
+                       {foreach from=$gotoLogonScripts item=item key=key}
+                               {if $item.UsedByAllUsers}
+                               <option value="{$key}">{$item.LogonPriority}&nbsp;{$item.LogonName}&nbsp;[{$item.LogonDescription}]</option>
+                               {else}
+                               <option style='color: #888888; background: #DDDDDD;background-color: #DDDDDD;' value="{$key}">{$item.LogonPriority}&nbsp;{$item.LogonName}&nbsp;[{$item.LogonDescription}]</option>
+                               {/if}
+                       {/foreach}
+               {else}
+          {html_options values=$gotoLogonScriptKeys output=$gotoLogonScripts }
+              <option disabled>&nbsp;</option>
+               {/if}
       </select>
 {/render}