Code

Added ppd for printer dialog, schema parser is still missing
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 31 Aug 2005 10:14:05 +0000 (10:14 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 31 Aug 2005 10:14:05 +0000 (10:14 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1269 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_printGeneric.inc
plugins/admin/systems/printer.tpl

index 18a8e1b9b3be50fc64b132bf422b44a1dac1201c..61a0e71e3c1b17fdaeeced50bccd68cbb8b2a300 100644 (file)
@@ -26,7 +26,7 @@ class printgeneric extends plugin
   var $UserMember       ="";
   var $UserMembers      =array();
   var $UserMemberKeys   =array();
-
+  
   var $AdminMember      ="";
   var $AdminMembers     =array();
   var $AdminMemberKeys  =array();
@@ -37,7 +37,7 @@ class printgeneric extends plugin
   var $dialog           =NULL;
 
   /* attribute list for save action */
-  var $attributes     = array("cn", "description", "l", "labeledURI", "gotoPrinterPPD","macAddress", "ipHostNumber");
+  var $attributes     = array("cn", "description", "l", "labeledURI", "macAddress", "ipHostNumber","gotoPrinterPPD");
   var $objectclasses  = array("top", "gotoPrinter");
 
   function printgeneric ($config, $dn= NULL)
@@ -124,6 +124,7 @@ class printgeneric extends plugin
 
   function execute()
   {
+
     $smarty= get_smarty();
     $display="";
     /* Template management.
@@ -198,11 +199,34 @@ class printgeneric extends plugin
       $this->dialog = new selectUserToPrinterDialog($this->config, get_userinfo(),"AddAdminGroup");
     }
 
+    if(isset($_POST['EditDriver'])){
+      $this->dialog = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD);
+    }
+
     if(isset($_POST['PrinterCancel'])){
       unset($this->dialog);
       $this->dialog= NULL;
     }
 
+    if(isset($_POST['SavePPD'])){
+      if(count($this->dialog->check())){
+        foreach($this->dialog->check() as $msg){
+          print_red($msg);
+        }
+      }else{
+        $this->gotoPrinterPPD = array();
+        $this->gotoPrinterPPD = $this->dialog->save();
+        unset($this->dialog);
+        $this->dialog=NULL;
+      }
+
+    }
+    
+    if(isset($_POST['ClosePPD'])){
+      unset($this->dialog);
+      $this->dialog=NULL;
+    }
+
     if((isset($_POST['DelUser']))&&(isset($_POST['UserMember']))){
       if(isset($this->member['AddUser'][$_POST['UserMember']])){
         unset($this->member['AddUser'][$_POST['UserMember']]);
@@ -259,7 +283,15 @@ class printgeneric extends plugin
 
     /* Don't show Asterisk for non-required attribute ipHostNumber and macAddress */
     $smarty->assign("staticAddress", "");
-    $smarty->assign("driverInfo", "Not implemented yet");
+
+
+    require_once ("class_ppdManager.inc");
+    $ppdManager= new ppdManager('/var/spool/ppd/');
+    if(!empty($this->gotoPrinterPPD)){
+      $smarty->assign("driverInfo", $ppdManager->loadDescription($this->gotoPrinterPPD));
+    }else{
+      $smarty->assign("driverInfo", _("Undefined"));
+    }
 
     $list=$this->generateList();
     $userlist   = array_merge($list['AddUser'],$list['AddGroup']);
index 6893d3c776a5326db597eb2911068fe0bec41240..c04020c5f086d3652f00160f403a096e5cc545d4 100644 (file)
@@ -3,6 +3,7 @@
        <tr>
                <td style="vertical-align:top; width:50%;">
 {if $is_terminal ne 'true'}
+                       <h2>{t}General{/t}</h2>
                        <table summary="">
                         <tr>
                          <td><LABEL for="cn" >{t}Printer name{/t}</LABEL>{$must}</td>
@@ -37,6 +38,7 @@
        <tr>
                <td colspan="2">
 {/if}
+                       <h2>{t}Details{/t}</h2>
                        <table summary="">
                                <tr>
                                        <td><LABEL for="l">{t}Location{/t}</LABEL></td>
                                        <td><LABEL for="labeledURI">{t}Printer URL{/t}</LABEL></td>
                                        <td><input id="labeledURI" name="labeledURI" size=25 maxlength=80 value="{$labeledURI}"></td>
                                </tr>
+                       </table>
+                       <table summary="">
                                <tr>    
-                                       <td>{t}Driver{/t}:<br>{$driverInfo}<input type="submit" name="EditDriver" value="{t}Edit{/t}"></td>
-                                       
+                                       <td>
+                                               <br>
+                                               {t}PPD{/t} : {$driverInfo}<br><input type="submit" name="EditDriver" value="{t}Edit{/t}">
+                                       </td>
                                </tr>
                        </table>
   </td>
@@ -57,7 +63,7 @@
 
 <p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
 
-{t}Permissions{/t}
+<h2>{t}Permissions{/t}</h2>
 <table summary="" width="100%">
        <tr>
                <td>
@@ -66,7 +72,7 @@
                                <tr>
                                        <td>
                                                {t}Following objects are assigned as user.{/t}<br>
-                                               <select size="1" name="UserMember" title="{t}Users{/t}" style="width:350px;height:200px;" size=10 multiple>
+                                               <select size="1" name="UserMember" title="{t}Users{/t}" style="width:350px;height:120px;"  multiple>
                                                {html_options options=$UserMembers values=$UserMemberKeys}
                                                </select><br>
                                                        <input type="submit" value="Add user"  name="AddUser">
@@ -83,7 +89,7 @@
                                <tr>
                                        <td>
                                                {t}Following objects are assigned as admin.{/t}<br>
-                                               <select size="1" name="AdminMember" title="{t}Admins{/t}" style="width:350px;height:200px;" size=10 multiple>
+                                               <select size="1" name="AdminMember" title="{t}Admins{/t}" style="width:350px;height:120px;"  multiple>
                                                {html_options options=$AdminMembers values=$AdminMemberKeys}
                                                </select><br>
                                                        <input type="submit" value="Add admin user"  name="AddAdminUser">