Code

Re-Added default printer functionality
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 23 May 2006 08:33:13 +0000 (08:33 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 23 May 2006 08:33:13 +0000 (08:33 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3503 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index a9630783a4eacac167508d57fbed04bb61fd2e44..860726ad2dc086b476cf338550f11c18ec7226cf 100644 (file)
@@ -40,6 +40,7 @@ class environment extends plugin
   /* Printer */
   var $gotoPrinter        = array();// All available Printer, with their configurations
   var $gotoPrinterSel     = "";     //  The selected Printer
+  var $gosaDefaultPrinter = "";     // Default printer
 
   /* Share */
   var $gotoShares         = array();// Current Share Options
@@ -65,7 +66,7 @@ class environment extends plugin
   var $attributes         = array("uid","gotoProfileServer","gotoProfileFlags",
                                     "gotoXResolution","gotoProfileQuota",
                                     "gotoLogonScripts","gotoLogonScript",
-                                    "gotoPrinter",
+                                    "gotoPrinter", "gosaDefaultPrinter",
                                     "gotoShares","gotoShare",
                                     "gotoKioskProfile","gotoKioskProfiles",
                                     "gotoHotplugDevice");
@@ -684,6 +685,14 @@ class environment extends plugin
       }
     }
 
+    if((isset($_POST['gotoPrinterDefault']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
+      if ($this->gosaDefaultPrinter == $_POST['gotoPrinterSel'][0]){
+        $this->gosaDefaultPrinter= "";
+      } else {
+        $this->gosaDefaultPrinter= $_POST['gotoPrinterSel'][0];
+      }
+    }
+
     $smarty->assign("gotoPrinter",$this->printOutPrinterDevices());
     $smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices()));
  
@@ -752,8 +761,6 @@ class environment extends plugin
     /* Get all Posted vars 
      * Setup checkboxes 
      */
-   
-    
  
     if(isset($_POST['iamposted'])){
       if(isset($_POST['useProfile'])){
@@ -772,6 +779,7 @@ class environment extends plugin
         $this->gotoProfileFlag_L = false;
       }
 
+      $tmp= $this->gosaDefaultPrinter;
       plugin::save_object();
       foreach($this->attributes as $s_attr){
         if(in_array($s_attr,array("gotoShares","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
@@ -781,6 +789,7 @@ class environment extends plugin
           $this->$s_attr = false;
         }
       }
+      $this->gosaDefaultPrinter= $tmp;
     }
   }
 
@@ -1113,10 +1122,13 @@ function printOutHotPlugDevices()
     if(is_array($this->gotoPrinter)){
       foreach($this->gotoPrinter as $printer){
         if($printer['mode'] == "admin"){
-          $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("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");
+        }
       }
     }
     return($a_return);
index 4877177b6ef549d5889a1c0a96b470b24ee8ab8a..1af617c146cbb89bec722dbaddf2517884eb2b04 100644 (file)
                <br>
                <input type="submit" {$gotoPrinterACL} name="gotoPrinterAdd"     value="{t}Add{/t}">
                <input type="submit" {$gotoPrinterACL} name="gotoPrinterDel"     value="{t}Delete{/t}">
-               <input type="submit" {$gotoPrinterACL} name="gotoPrinterEdit"    value="{t}Admin Toggle{/t}">
+               <input type="submit" {$gotoPrinterACL} name="gotoPrinterEdit"    value="{t}Toggle admin{/t}">
+               <input type="submit" {$gotoPrinterACL} name="gotoPrinterDefault"    value="{t}Toggle default{/t}">
            </td>
        </tr>
     </table>