Code

split - second flush
[gosa.git] / gosa-plugins / goto / personal / environment / class_environment.inc
index 511565d75902b63b938af076ef5ba1aca0d92b87..b72ced3ce70b2584673ccef8f447eb45cba48c2d 100644 (file)
@@ -2,6 +2,8 @@
 
 class environment extends plugin
 {
+  var $plIcon = "plugins/goto/images/plugin.png";
+
   /* attribute list for save action */
   var $ignore_account       = FALSE;
   var $plHeadline           = "Environment";
@@ -13,7 +15,7 @@ class environment extends plugin
 
   var $is_group             = false;
   var $view_logged = FALSE;
-  
+
   /* Attribute definition
    */
 
@@ -145,7 +147,7 @@ class environment extends plugin
       unset($this->attrs['gotoLogonScript']['count']);
       foreach($this->attrs['gotoLogonScript'] as $device){
         $tmp = $tmp2 = array();
-        $tmp = split("\|",$device);
+        $tmp = explode("|",$device);
         $tmp2['LogonName']        = $tmp[0]; 
         $tmp2['LogonPriority']    = $tmp[2]; 
         if(preg_match("/O/i",$tmp[1])){
@@ -169,7 +171,7 @@ class environment extends plugin
       unset($this->attrs['gotoShare']['count']);
       foreach($this->attrs['gotoShare'] as $share){
         $tmp = $tmp2 = array();
-        $tmp = split("\|",$share);
+        $tmp = explode("|",$share);
         $tmp2['server']      =$tmp[0];
         $tmp2['name']        =$tmp[1];
 
@@ -215,12 +217,12 @@ class environment extends plugin
                                     "1280x768"  =>  "1280x768",
                                     "1280x1024" =>  "1280x1024");
 
-    if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
-      $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
+    if($this->config->get_cfg_value("resolutions") != ""){
+      $file = $this->config->get_cfg_value("resolutions");
 
       if(is_readable($file)){
         $str = file_get_contents($file);
-        $lines = split("\n",$str);
+        $lines = preg_split("/\n/",$str);
         foreach($lines as $line){
           $line = trim($line);
           if(!empty($line)){
@@ -739,7 +741,7 @@ class environment extends plugin
 
 
     $tmp = array();
-    if($this->acl_is_readable("gotoShares")){
+    if($this->acl_is_readable("gotoShare")){
       $tmp = $this->printOutAssignedShares();
     }
 
@@ -773,7 +775,8 @@ class environment extends plugin
 
         /* Create pwd reset images */
         if($this->gotoShares[$key]['PwdHash'] != ""){
-          $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
+          $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 
+            'src='plugins/goto/images/list_reset_password.png' alt='"._("Reset password hash")."' 
             title='"._("Reset password hash")."'>";
         }
         $field1 = array("string" => "<font style=\"color:#C0C0C0\">".$value."</font>" , "attach" => "style='".$color."'");
@@ -782,7 +785,8 @@ class environment extends plugin
 
         /* Create pwd reset img && delete image */
         if($this->gotoShares[$key]['PwdHash'] != ""){
-          $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
+          $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 
+            'src='plugins/goto/images/list_reset_password.png' alt='"._("Reset password hash")."' 
             title='"._("Reset password hash")."'>";
           $img.= "&nbsp;";
         }
@@ -992,7 +996,6 @@ class environment extends plugin
     }
 
     $smarty->assign("gotoPrinter",$this->printOutPrinterDevices());
-    $smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices()));
 
     /* General behavior */
     if(is_object($this->dialog)){
@@ -1237,7 +1240,7 @@ class environment extends plugin
     /* Prepare HotPlug devices */
     $this->attrs['gotoHotplugDeviceDN'] = array();
     foreach($this->gotoHotplugDevices as $name => $device){
-      $this->attrs['gotoHotplugDeviceDN'][]= $device['dn'];
+      $this->attrs['gotoHotplugDeviceDN'][]= LDAP::fix($device['dn']);
     }
 
     /* Prepare LogonScripts */
@@ -1353,22 +1356,20 @@ class environment extends plugin
   function printOutPrinterDevices()
   {
     $a_return = array();
-    
-    if($this->acl_is_readable("gotoPrinter")){
 
-      if(is_array($this->gotoPrinter)){
-        foreach($this->gotoPrinter as $printer){
-          if($printer['mode'] == "admin"){
-            $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Administrator");
-          }else{
-            $a_return[$printer['cn'][0]]= $printer['cn'][0]; 
-          }
-          if ($printer['cn'][0] == $this->gosaDefaultPrinter){
-            $a_return[$printer['cn'][0]].=" - "._("Default printer");
-          }
+    if(is_array($this->gotoPrinter)){
+      foreach($this->gotoPrinter as $printer){
+        if($printer['mode'] == 'admin'){
+          $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Administrator");
+        }else{
+          $a_return[$printer['cn'][0]]= $printer['cn'][0]; 
+        }
+        if ($printer['cn'][0] == $this->gosaDefaultPrinter){
+          $a_return[$printer['cn'][0]].=" - "._("Default printer");
         }
       }
     }
+               asort($a_return);
     return($a_return);
   }
 
@@ -1427,7 +1428,7 @@ class environment extends plugin
       unset($this->multi_attrs_all['gotoShare']['count']);
       foreach($this->multi_attrs_all['gotoShare'] as $share){
         $tmp = $tmp2 = array();
-        $tmp = split("\|",$share);
+        $tmp = explode("|",$share);
         $tmp2['server']      =$tmp[0];
         $tmp2['name']        =$tmp[1];
 
@@ -1458,7 +1459,7 @@ class environment extends plugin
       unset($this->multi_attrs['gotoShare']['count']);
       foreach($this->multi_attrs['gotoShare'] as $share){
         $tmp = $tmp2 = array();
-        $tmp = split("\|",$share);
+        $tmp = explode("|",$share);
         $tmp2['server']      =$tmp[0];
         $tmp2['name']        =$tmp[1];
 
@@ -1490,7 +1491,7 @@ class environment extends plugin
       unset($this->multi_attrs_all['gotoLogonScript']['count']);
       foreach($this->multi_attrs_all['gotoLogonScript'] as $device){
         $tmp = $tmp2 = array();
-        $tmp = split("\|",$device);
+        $tmp = explode("|",$device);
         $tmp2['LogonName']        = $tmp[0];
         $tmp2['LogonPriority']    = $tmp[2];
         if(preg_match("/O/i",$tmp[1])){
@@ -1515,7 +1516,7 @@ class environment extends plugin
       unset($this->multi_attrs['gotoLogonScript']['count']);
       foreach($this->multi_attrs['gotoLogonScript'] as $device){
         $tmp = $tmp2 = array();
-        $tmp = split("\|",$device);
+        $tmp = explode("|",$device);
         $tmp2['LogonName']        = $tmp[0];
         $tmp2['LogonPriority']    = $tmp[2];
         if(preg_match("/O/i",$tmp[1])){
@@ -1775,19 +1776,15 @@ class environment extends plugin
 
           "plProvidedAcls"  => array(
 
-            "gotoProfileFlagL"    => _("Resolution changeable during session") ,
-            "gotoProfileFlagC"    => _("Cache profile localy") ,
-
-            "gotoProfileQuota"    => _("Profile quota") ,
             "gotoProfileServer"   => _("Profile server") ,
-
-            "gotoXResolution"     => _("Resolution") ,
-            "gotoKioskProfile"    => _("Kiosk profile") ,
-
-            "gosaDefaultPrinter"  => _("Default printer") ,
-            "gotoLogonScript"     => _("Logon script") ,
+            "gotoProfileQuota"    => _("Profile quota") ,
+            "gotoProfileFlagC"    => _("Cache profile localy") ,
+            "gotoShare"           => _("Shares"),
             "gotoHotplugDevice"   => _("Hotplug devices"),
-            "gotoShare"           => _("Shares"))
+            "gotoKioskProfile"    => _("Kiosk profile") ,
+            "gotoProfileFlagL"    => _("Resolution changeable during session") ,
+            "gotoXResolution"     => _("Resolution") ,
+            "gotoLogonScript"     => _("Logon script"))
             ));
   }
 }