Code

Updated gotoLpdEnable
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 13 Oct 2008 12:39:58 +0000 (12:39 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 13 Oct 2008 12:39:58 +0000 (12:39 +0000)
-It is now part of the systems service dialog.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12673 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/class_gotoLpdEnabled.inc
gosa-plugins/goto/admin/systems/goto/class_terminalService.inc
gosa-plugins/goto/admin/systems/goto/gotoLpdEnable.tpl
gosa-plugins/goto/admin/systems/goto/terminalService.tpl

index 62c18810659359defe319b1e02541c5e1c1ba80a..0437ed9a0d747390c1a8fea1832cf4d90a764887 100644 (file)
@@ -119,38 +119,6 @@ class gotoLpdEnable extends plugin
        {
     $display = "";
 
-    /* Handle account add/remove 
-     */
-    if(isset($_POST['modify_state'])){
-      $this->is_account = !$this->is_account;
-
-      /* Reset account or create a new one
-       */
-      if(!$this->is_account){
-        $this->data = array();
-      }else{
-      
-        /* Initialize plugin with default entries
-         */
-        $entry = $this->default_entry;
-        $entry['i_Port'] = $entry['i_Port'] + count($this->data);
-        $entry['s_Device'] = $entry['s_Device'].count($this->data);
-        $this->data = array(0 => $entry);
-        $this->DevID = 0; 
-        foreach($this->attributes as $attr){
-          $this->$attr = $this->data[$this->DevID][$attr];
-        }
-      }
-    }
-
-    /* Add toggle plugin buttons on top of the generated page
-     */
-    if($this->is_account){
-        $display .= $this->show_disable_header(msgPool::removeFeaturesButton(_("Printer")),"",FALSE);
-    }else{
-        $display .= $this->show_enable_header(msgPool::addFeaturesButton(_("Printer")),"",FALSE);
-    }
-
     /* Set smarty variables 
      */
                $smarty = get_smarty();
@@ -198,10 +166,19 @@ class gotoLpdEnable extends plugin
   */
   public function save_object()
   {
-    if(!$this->is_account || !isset($_POST['gotoLpdEnable_entry_posted'])){
+
+    if(!isset($_POST['gotoLpdEnable_entry_posted'])){
       return;
     }
 
+    /* Handle account add/remove 
+     */
+    if(isset($_POST['gotoLpdEnable_enabled'])){
+      $this->is_account = TRUE;
+    }else{
+      $this->is_account = FALSE;
+    }
+
     /* Check if we have to propose device settings 
         (current device info is empty and the printer type has changed)
      */
index d987e441f2af948bb6ee531f082559d8f81e0dbc..75c8abc1240025d5fb7881c15c3a0deda893d97c 100644 (file)
@@ -90,6 +90,7 @@ class termservice extends plugin
         $this->gotoLpdEnable[] = $this->attrs['gotoLpdEnable'][$i];
       }
     }
+    $this->gotoLpdEnable_dialog = new gotoLpdEnable($this->config,$this->gotoLpdEnable,$this); 
 
     /* Get list of available xdrivers */
     $this->XDrivers = $this->getListOfXDrivers();
@@ -314,41 +315,9 @@ class termservice extends plugin
       return ($display);
     }
 
-
-    /**********
-      gotoLpdEnable
-     **********/
-    if(isset($_POST['gotoLpdEnable_Close'])){
-      $this->dialog = NULL;
-    }
-
-    if(isset($_POST['gotoLpdEnable_Ok'])){
-      $this->dialog->save_object();
-      $msgs = $this->dialog->check();
-      if(count($msgs)) {
-        msg_dialog::displayChecks($msgs);
-      }else{
-        $this->gotoLpdEnable = $this->dialog->save();
-        $this->dialog = NULL;
-      }
-    }
-
-    if(isset($_POST['gotoLpdEnable_Edit'])){
-      $this->dialog = new gotoLpdEnable($this->config,$this->gotoLpdEnable,$this);
-    }
-
-    if($this->dialog instanceof plugin){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-
-    /**********
-      Ende: gotoLpdEnable
-     **********/
-
-
     /* Show main page */
     $smarty= get_smarty();
+    $smarty->assign("gotoLpdEnable_dialog", $this->gotoLpdEnable_dialog->execute());
 
     /* Assign acls */
     $tmp= $this->plInfo();
@@ -485,6 +454,13 @@ class termservice extends plugin
   {
     plugin::save_object();
 
+    $this->gotoLpdEnable_dialog->save_object();
+    if($this->gotoLpdEnable_dialog->is_account){
+      $this->gotoLpdEnable = $this->gotoLpdEnable_dialog->save();
+    }else{
+      $this->gotoLpdEnable = array();
+    }
+
     /* Save checkbox state */
     if (isset ($_POST['gotoXMethod'])){
       foreach (array("gotoScannerEnable") as $val){
index 561826ba3882d1cd748dcc3d1831e56f8a3b18f1..18e025d34e22f1d67f80749f6aefd9394933ae15 100644 (file)
@@ -1,5 +1,20 @@
 {if !$is_account}
 
+<table style='width:100%;'>
+       <tr>
+               <td style='width:55%;'>
+                       <table>
+                               <tr>
+                                       <td colspan="2">
+                                               <input class="center" type='checkbox' onChange="document.mainform.submit();" 
+                                                       {if $is_account} checked {/if}
+                                                       name='gotoLpdEnable_enabled'>&nbsp;{t}Enable printer settings{/t}</td>
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
 {else}
 <table style='width:100%;'>
        <tr>
                                        </td>
                                </tr>
 -->
+                               <tr>
+                                       <td colspan="2">
+                                               <input class="center" type='checkbox' onChange="document.mainform.submit();" 
+                                                       {if $is_account} checked {/if}
+                                                       name='gotoLpdEnable_enabled'>&nbsp;{t}Enable printer settings{/t}</td>
+                                       </TD>
+                               </tr>
                                <tr>
                                        <td>{t}Type{/t}</td>
                                        <td>    
                </td>
        </tr>
 </table>
-<input type='hidden' name="gotoLpdEnable_entry_posted" value="1">
-<p class='seperator'>
-</p>
 {/if}
-<div style='width:100%; text-align: right; padding:5px;'>
-       <input type='submit' name='gotoLpdEnable_Ok' value='{msgPool type=okButton}'>&nbsp;
-       <input type='submit' name='gotoLpdEnable_Close' value='{msgPool type=cancelButton}'>
-</div>
+<input type='hidden' name="gotoLpdEnable_entry_posted" value="1">
index a268d8ba5491ea59d8fa9ea00a9f996a2aadb519..60f54bf57b4a168b84bfc511f21d5e59a58a68a7 100644 (file)
   </td>
        <td>
    <h2><img class="center" alt="" src="plugins/systems/images/select_printer.png"> {t}Printer{/t}</h2>
-
-{render acl=$gotoLpdEnableACL}
-       <input type='submit' name='gotoLpdEnable_Edit' value='{msgPool type=editButton}'>
-{/render}
+       {$gotoLpdEnable_dialog}
        </td>
  </tr>
 </table>