Code

Some changes
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 30 Aug 2005 12:13:58 +0000 (12:13 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 30 Aug 2005 12:13:58 +0000 (12:13 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1264 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 3394cc566927478f8cb511d7f67e99b3be0423f5..a9a2bdbebc6735f9e49cd822e6e77d9317608f32 100644 (file)
@@ -32,7 +32,10 @@ class printgeneric extends plugin
   var $AdminMemberKeys  =array();
 
   var $member           =array();
+  
+  var $strings          = "";
 
+  var $type             = "";
   var $dialog           =NULL;
 
   /* attribute list for save action */
@@ -54,27 +57,23 @@ class printgeneric extends plugin
     }
 
 
+    /* In case of gotoWorkstation this tab is calles from workstation plugin
+     */
     if((in_array("gotoWorkstation",$this->attrs['objectClass']))){
       $this->is_terminal = "true";   
       $this->dn   = preg_replace("/ou=workstation/","ou=printer",$this->dn);
-
-      // Reload plugin with new dn... (ou=printers instead of ou=terminals)
-      plugin::plugin ($this->config, $this->dn);
-      $ldap->cat($this->dn);
-      if(count($ldap->fetch())>0){
-        $this->orig_dn= $this->dn;
-        $this->is_account=true;
-        $this->initially_was_account = true;
-      }else{
-        $this->orig_dn = "new";
-        $this->is_account=false;
-        $this->initially_was_account = false;
-      }
+      $this->type = "station";
     }elseif((in_array("gotoTerminal",$this->attrs['objectClass']))){
+      $this->type = "terminal";
       $this->is_terminal = "true";
       $this->dn   = preg_replace("/ou=terminal/","ou=printer",$this->dn);
+    }else{
+      /* Save dn for later references */
+      $this->orig_dn= $this->dn;
+    }
 
-      // Reload plugin with new dn... (ou=printers instead of ou=terminals) 
+    if($this->is_terminal){
+      // Reload plugin with new dn... (ou=printers instead of ou=terminals)
       plugin::plugin ($this->config, $this->dn);
       $ldap->cat($this->dn);
       if(count($ldap->fetch())>0){
@@ -86,43 +85,43 @@ class printgeneric extends plugin
         $this->is_account=false;
         $this->initially_was_account = false;
       }
-
-    }else{
-
-      /* Save dn for later references */
-      $this->orig_dn= $this->dn;
     }
-    
+
+   
+    /* Prepare different member types 
+     */ 
     foreach(array("AddUser"       =>"gotoUserPrinter",
                   "AddGroup"      =>"gotoGroupPrinter",
                   "AddAdminUser"  =>"gotoUserAdminPrinter",
                   "AddAdminGroup" =>"gotoGroupAdminPrinter") as $type => $attr){
 
+      /* $this->members contains all members */
       $this->member[$type]=array();
+
       unset($this->attrs[$attr]['count']);
-      if(isset($this->attrs[$attr]))
-      foreach($this->attrs[$attr] as $mem){
-        if(preg_match("/Group/",$type)){
-          $ldap->search("(&(objectClass=posixGroup)(cn=".$mem."))",array("cn","description"));
-          $entry = $ldap->fetch();
-          if(isset($entry['description'])){
-            $this->member[$type][$entry['cn'][0]]=$entry;
-          }
-        }else{
-          $ldap->search("(&(objectClass=person)(objectClass=inetOrgPerson)(uid=".$mem."))",array("cn","uid"));
-          $entry = $ldap->fetch();
-          if(isset($entry['uid'])){
-            $this->member[$type][$entry['uid'][0]]=$entry;
+
+      if(isset($this->attrs[$attr])){
+        foreach($this->attrs[$attr] as $mem){
+          if(preg_match("/Group/",$type)){
+            $ldap->search("(&(objectClass=posixGroup)(cn=".$mem."))",array("cn","description"));
+            $entry = $ldap->fetch();
+            if(isset($entry['description'])){
+              $this->member[$type][$entry['cn'][0]]=$entry;
+            }
+          }else{
+            $ldap->search("(&(objectClass=person)(objectClass=inetOrgPerson)(uid=".$mem."))",array("cn","uid"));
+            $entry = $ldap->fetch();
+            if(isset($entry['uid'])){
+              $this->member[$type][$entry['uid'][0]]=$entry;
+            }
           }
         }
       }
     }
-    
   }
 
   function execute()
   {
-    print_a($this);
     $smarty= get_smarty();
     $display="";
     /* Template management.
@@ -147,11 +146,21 @@ class printgeneric extends plugin
 
     if($this->is_terminal){
       if ($this->is_account){
-        $display= $this->show_header(_("Remove environment extension"),
-            _("This server has environment extension enabled. You can disable it by clicking below."));
+        if($this->type=="station"){
+          $display= $this->show_header(_("Remove printer extension"),
+              _("This workstation has printer extension enabled. You can disable it by clicking below."));
+        }else{
+          $display= $this->show_header(_("Remove printer extension"),
+              _("This terminal has printer extension enabled. You can disable it by clicking below."));
+        }
       }else{
-        $display= $this->show_header(_("Add environment extension"),
-            _("This server has environment extension disabled. You can enable it by clicking below."));
+        if($this->type=="station"){
+          $display= $this->show_header(_("Add printer extension"),
+              _("This workstation has printer extension disabled. You can enable it by clicking below."));
+        }else{
+          $display= $this->show_header(_("Add printer extension"),
+              _("This terminal has printer extension disabled. You can enable it by clicking below."));
+        }  
         return ($display);
       }
     }
index 1f2dc3222c3533b16940cad60580d35181a0d88c..1e5a50afe007cac7016fe1728a24f73d5f85c7e8 100644 (file)
@@ -1,4 +1,4 @@
-<h2><img alt="" src="images/house.png" align="middle">&nbsp;{t}Select printer entry{/t}</h2>
+<h2><img alt="" src="images/house.png" align="middle">&nbsp;{t}Select entry{/t}</h2>
 
     <input type="hidden" name="dialogissubmitted" value="1">
 
@@ -7,12 +7,12 @@
             <td width="50%">
                                <div class="contentboxh" style="height:20px;">
                                <p class="contentboxh" style="font-size:12px">
-                                       <b><LABEL for="gotoPrinter">{t}Select printer to add{/t}</LABEL></b>
+                                       <b><LABEL for="gotoPrinter">{t}Select user/group to add{/t}</LABEL></b>
                                </p>
                                </div>
                                <div class="contentboxb">
                                <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                               <select style="width:550px;" size=20 name="gotoPrinter[]" id="gotoPrinter" multiple>
+                               <select style="width:500px;" size=20 name="gotoPrinter[]" id="gotoPrinter" multiple>
                                {html_options values=$gotoPrinterKeys output=$gotoPrinters}
                                <option disabled>&nbsp;</option>
                                         </select><br>
@@ -25,8 +25,8 @@
                                </div>
                                <div class="contentboxb">
                                        <p class="contentboxb">
-                                       {t}This menu allows you to create, edit and delete selected printers
-                                                       Having a great number of printers, you may want to use the range selectors on top of the printers list.{/t}
+                                       {t}This menu allows you to select one or multiple users or groups to add them to the printer
+                                                       Having a great number of users, you may want to use the range selectors on top of this list.{/t}
                                </p>
                                </div>
                                <br>
@@ -38,7 +38,7 @@
                                <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
                                        <tr>
                                                <td width="50%">
-                                                       <img alt="" src="{$tree_image}" align=middle>&nbsp;{t}Display printers of department{/t}
+                                                       <img alt="" src="{$tree_image}" align=middle>&nbsp;{t}Display members of department{/t}
                                                </td>
                                                <td>
                                                        <select name="depselectPrinter" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
                                        <table summary="" width="100%" style="border-top:1px solid #B0B0B0;">
                                                        <tr>
                                                                <td>
-                                                                       <LABEL for='filter'><img alt="Search" src="{$search_image}" align="middle" title="{t}Display printers matching{/t}">
+                                                                       <LABEL for='filter'><img alt="Search" src="{$search_image}" align="middle" title="{t}Display members matching{/t}">
                                                                        </LABEL>
                                                                </td>
                                                        <td width="99%">
                                                                        <input id='filter' style='width:99%' type='text' name='regexPrinter' maxlength='20' value='{$regexPrinter}' 
-                                                                                       title='{t}Regular expression for matching printer names{/t}' onChange="mainform.submit()">
+                                                                                       title='{t}Regular expression for matching member names{/t}' onChange="mainform.submit()">
                                                                </td>
                                                        </tr>
                                                </table>
@@ -71,7 +71,7 @@
     </table>
 
     <p align="right">
-    <input type="submit" name="PrinterSave"     value="{t}Use{/t}">
+    <input type="submit" name="PrinterSave"     value="{t}Add{/t}">
     <input type="submit" name="PrinterCancel"   value="{t}Cancel{/t}">
     </p>