From: hickert Date: Mon, 13 Oct 2008 12:39:58 +0000 (+0000) Subject: Updated gotoLpdEnable X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=59233f94f39227b522c0b05cf86344971bd06aa9;p=gosa.git Updated gotoLpdEnable -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 --- diff --git a/gosa-plugins/goto/admin/systems/goto/class_gotoLpdEnabled.inc b/gosa-plugins/goto/admin/systems/goto/class_gotoLpdEnabled.inc index 62c188106..0437ed9a0 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_gotoLpdEnabled.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_gotoLpdEnabled.inc @@ -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) */ diff --git a/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc b/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc index d987e441f..75c8abc12 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc @@ -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){ diff --git a/gosa-plugins/goto/admin/systems/goto/gotoLpdEnable.tpl b/gosa-plugins/goto/admin/systems/goto/gotoLpdEnable.tpl index 561826ba3..18e025d34 100644 --- a/gosa-plugins/goto/admin/systems/goto/gotoLpdEnable.tpl +++ b/gosa-plugins/goto/admin/systems/goto/gotoLpdEnable.tpl @@ -1,5 +1,20 @@ {if !$is_account} + + + + +
+ + + + + +
+  {t}Enable printer settings{/t}
+
{else} @@ -23,6 +38,13 @@ --> + + + +
+  {t}Enable printer settings{/t}
{t}Type{/t} @@ -97,11 +119,5 @@
- -

-

{/if} -
-   - -
+ diff --git a/gosa-plugins/goto/admin/systems/goto/terminalService.tpl b/gosa-plugins/goto/admin/systems/goto/terminalService.tpl index a268d8ba5..60f54bf57 100644 --- a/gosa-plugins/goto/admin/systems/goto/terminalService.tpl +++ b/gosa-plugins/goto/admin/systems/goto/terminalService.tpl @@ -239,10 +239,7 @@

{t}Printer{/t}

- -{render acl=$gotoLpdEnableACL} - -{/render} + {$gotoLpdEnable_dialog}