Code

Updated printer settings when editing multiple entries
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 14 Dec 2007 10:58:46 +0000 (10:58 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 14 Dec 2007 10:58:46 +0000 (10:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8128 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 54c7c0283cdcc70556531148561bfec1574caedc..1e4934514efe0e0eab4f873009d99853b355d2bc 100644 (file)
@@ -82,6 +82,8 @@ class environment extends plugin
 
   var $multiple_support =TRUE;
 
+  var $use_gotoPrinter;
+
   function environment (&$config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
@@ -882,7 +884,9 @@ class environment extends plugin
               $type = "AddGroup";
             }
           }else{
-            if(isset($this->NewDeletedPrinters[$pname])){
+            if($this->multiple_support_active){
+              $type = "AddUser";
+            }elseif(isset($this->NewDeletedPrinters[$pname])){
               $type = "AddUser";
             }elseif($printerObj->by_object['printgeneric']->AddMember("AddUser",$this->dn)){
               $type = "AddUser";
@@ -974,6 +978,16 @@ class environment extends plugin
       return($disp);
     }
 
+    /* Assign used attributes for multiple edit */
+    foreach(array("gotoPrinter") as $box){
+      $ubox ="use_".$box;
+      if(in_array($box,$this->multi_boxes)){
+        $smarty->assign($ubox,TRUE);
+      }else{
+        $smarty->assign($ubox,FALSE);
+      }
+    }
+
     /* Als smarty vars are set. Get smarty template and generate output */
     $smarty->assign("multiple_support",$this->multiple_support_active);
     $display.= $smarty->fetch(get_template_path('environment.tpl', TRUE,dirname(__FILE__)));
@@ -1611,10 +1625,30 @@ class environment extends plugin
     $ret['gotoShares'] = $this->gotoShares;
     $ret['gotoLogonScripts'] = $this->gotoLogonScripts;
     $ret['gotoHotplugDevices'] = $this->gotoHotplugDevices;
+  
+    if(in_array("gotoPrinter",$this->multi_boxes)){
+      $ret['gotoPrinter'] = $this->gotoPrinter;
+      $ret['gotoPrinterSel'] = $this->gotoPrinterSel;
+      $ret['gosaDefaultPrinter'] = $this->gosaDefaultPrinter;
+  
+      /* Force printer reset */
+      $ret['add_del_printer_member_was_called'] = TRUE;
+    }
+   
     return($ret);
   }
 
 
+  function multiple_save_object()
+  {
+    if(isset($_POST['environment_multiple_posted'])){
+      plugin::multiple_save_object();
+      if(isset($_POST['use_gotoPrinter'])){
+        $this->multi_boxes[] = "gotoPrinter";
+      }
+    }
+  }
+
   /* Return plugin informations for acl handling 
 #FIXME these ACLs should work for groups too */ 
   static function plInfo()
index cbc6bc20977912913820376aafe354e9eeb04d1f..fa387379e3f1d4842144b83344de4e372edbf98c 100644 (file)
                {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>
+                               <option value="{$key}">{$item.LogonPriority}&nbsp;{$item.LogonName}&nbsp;[{$item.LogonDescription}] ({t}Used by all users{/t})</option>
                                {else}
-                               <option style='color: #888888; background: #DDDDDD;background-color: #DDDDDD;' value="{$key}">{$item.LogonPriority}&nbsp;{$item.LogonName}&nbsp;[{$item.LogonDescription}]</option>
+                               <option style='color: #888888; background: #DDDDDD;background-color: #DDDDDD;' value="{$key}">{$item.LogonPriority}&nbsp;{$item.LogonName}&nbsp;[{$item.LogonDescription}] ({t}Used by some users{/t})</option>
                                {/if}
                        {/foreach}
                {else}
                {if $multiple_support}
                        {foreach from=$gotoHotplugDevices item=item key=key}
                                {if $item.UsedByAllUsers}
-                               <option value="{$key}">{$item.name}&nbsp;[{$item.description}]</option>
+                               <option value="{$key}">{$item.name}&nbsp;[{$item.description}] ({t}Used by all users{/t})</option>
                                {else}
-                               <option style='color: #888888; background: #DDDDDD;background-color: #DDDDDD;' value="{$key}">{$item.name}&nbsp;[{$item.description}]</option>
+                               <option style='color: #888888; background: #DDDDDD;background-color: #DDDDDD;' value="{$key}">{$item.name}&nbsp;[{$item.description}] ({t}Used by some users{/t})</option>
                                {/if}
                        {/foreach}
                {else}
    </table>
   </td>
   <td>
+
+
+{if $multiple_support}
+
+   <h2>
+       <input type="checkbox" name="use_gotoPrinter" value="1" {if $use_gotoPrinter} checked {/if}
+               class="center" onClick="toggle('div_gotoPrinter');">
+    <img alt="" src="images/select_printer.png" align="middle" class="center" />&nbsp;
+    <label for="gotoPrinter">{t}Printer{/t}</label>
+   </h2>
+
+   <div id="div_gotoPrinter" {if !$use_gotoPrinter} style="visibility:hidden;" {/if}>
+       <b>{t}Using this option will overwrite the complete printer settings for all currently edited objects!{/t}</b>
+   <table style="width:100%" summary="{t}Printer settings{/t}">
+    <tr>
+     <td>
+{render acl=$gotoPrinterACL}
+      <select style="width:100%;" name="gotoPrinterSel[]" multiple size=5 id="gotoPrinter">
+       {html_options values=$gotoPrinterKeys output=$gotoPrinter}
+       <option disabled>&nbsp;</option>
+      </select>
+{/render}
+      <br>
+{render acl=$gotoPrinterACL}
+      <input type="submit"  name="gotoPrinterAdd"     value="{t}Add{/t}">
+{/render}
+{render acl=$gotoPrinterACL}
+      <input type="submit" name="gotoPrinterDel"     value="{t}Delete{/t}" {if !$gotoPrinter } disabled {/if}>
+{/render}
+{render acl=$gotoPrinterACL}
+      <input type="submit" name="gotoPrinterEdit"    value="{t}Toggle admin{/t}" {if !$gotoPrinter } disabled {/if}>
+{/render}
+{render acl=$gosaDefaultPrinterACL}
+      <input type="submit" name="gotoPrinterDefault"    value="{t}Toggle default{/t}" {if !$gotoPrinter | $is_group} disabled {/if}>
+{/render}
+     </td>
+    </tr>
+   </table>
+       </div>
+
+{else}
+
    <h2>
     <img alt="" src="images/select_printer.png" align="middle" class="center" />&nbsp;
     <label for="gotoPrinter">{t}Printer{/t}</label>
      </td>
     </tr>
    </table>
+
+{/if}
+
   </td>
  </tr>
 </table>
+{if $multiple_support}
+       <input type="hidden" name="environment_multiple_posted" value="1">
+{/if}
 <script language="JavaScript" type="text/javascript">
 <!-- // First input field on page
 focus_field('useProfile');