From: hickert Date: Wed, 8 Oct 2008 12:32:29 +0000 (+0000) Subject: Added gotoLpd to terminals X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2ea3967e60a34327e6ec0e1ed9bcdc936c099f9d;p=gosa.git Added gotoLpd to terminals git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12629 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 8303b1d4a..8c8152522 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_gotoLpdEnabled.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_gotoLpdEnabled.inc @@ -21,7 +21,6 @@ class gotoLpdEnable extends plugin /* Option predefinition */ private $a_Types = array(); - private $a_Boolean = array(); private $a_FlowControls = array(); // private $a_Parities = array(); // private $a_Speeds = array(); // @@ -31,22 +30,26 @@ class gotoLpdEnable extends plugin public $attributes = array("s_Type","s_Device","i_Port","s_Options","s_WriteOnly", "s_Speed","s_FlowControl","s_Parity","i_Bit"); + /*! \brief Create gotoLpdEnable dialog, allows to edit printer settings. + @param Object $config The GOsa configuration object. + @param Array $data The values for attribute 'gotoLpdEnable' + e.g. array("USB:/dev/usb/lp0:9100:9600:S:E:0:Y:options", + "USB:/dev/usb/lp1:9101:9600:S:E:5:Y:", ...) + @param Object $parent A reference to the parent plugin-object. + @return Object gotoLpdEnable (plugin) + */ public function __construct($config,$data,&$parent) { plugin::plugin($config,NULL); $this->parent = $parent; $this->DevID = 0; - /**** - Predefine values - ****/ + /* Predefine selectable values + */ $this->a_Types = array( "USB" => _("USB"), "Parallel" => _("Parallel port"), "Serial" => _("Serial")); - $this->a_Boolean = array( - "Y" => _("Yes"), - "N" => _("No")); $this->a_FlowControl = array( "S" => _("Software"), "H" => _("Hardware")); @@ -81,8 +84,10 @@ class gotoLpdEnable extends plugin if(count($data) == 0){ $this->is_account = FALSE; }else{ - $this->is_account = TRUE; foreach($data as $dat){ + + if(substr_count($dat,":") < 8) continue; + list($s_Type,$s_Device,$i_Port,$s_Speed,$s_FlowControl,$s_Parity,$i_Bit,$s_WriteOnly,$s_Options) = split("\:",$dat); $entry = array(); foreach($this->attributes as $attr){ @@ -91,15 +96,26 @@ class gotoLpdEnable extends plugin $this->data[] = $entry; } + if(count($this->data)){ /* Set first entry values */ foreach($this->attributes as $attr){ $this->$attr = $this->data[$this->DevID][$attr]; } + $this->is_account = TRUE; + } } $this->initially_was_account = $this->is_account; } + + /*! \brief Create HTML output of this plugin. + Depending on the current plugin status, there is a + 'create' and a 'remove'account button displayed on top + followed by the gotoLpdEnable options. + @param . + @return String HTML content + */ public function execute() { $display = ""; @@ -128,7 +144,7 @@ class gotoLpdEnable extends plugin foreach($this->attributes as $attr){ $smarty->assign($attr,$this->$attr); } - foreach(array("DevID","a_Types","a_Boolean","a_FlowControl","a_Parities","a_Speeds","a_Bits") as $attr){ + foreach(array("DevID","a_Types","a_FlowControl","a_Parities","a_Speeds","a_Bits") as $attr){ $smarty->assign($attr,$this->$attr); } ksort($this->data); @@ -141,6 +157,11 @@ class gotoLpdEnable extends plugin } + /*! \brief Checks the given informations and returns an array + with the error messages or an empty array if everything went fine. + @param . + @return Array of Strings Error messages. + */ public function check() { $messages = plugin::check(); @@ -159,6 +180,10 @@ class gotoLpdEnable extends plugin } + /*! \brief Save all ui inputs. + @param . + @return . + */ public function save_object() { if(!$this->is_account) return; @@ -214,6 +239,12 @@ class gotoLpdEnable extends plugin } } + + /*! \brief Creates an array containing all gotoLpdEnabled values, + see constructor for more details. + @param . + @return Array of gotoLpdEnabled Strings. + */ public function save() { $ret = array(); @@ -229,16 +260,30 @@ class gotoLpdEnable extends plugin } - /* Allow every action, check are made in class service not here. - */ + /*! \brief . + @param . + @return . + */ public function acl_is_writeable($attr,$skip_write = FALSE) { return(TRUE); } + + + /*! \brief . + @param . + @return . + */ public function acl_is_removeable($skip_write = FALSE) { return(TRUE); } + + + /*! \brief . + @param . + @return . + */ public function acl_is_createable($skip_write = FALSE) { return(TRUE); diff --git a/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc b/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc index 2a580e10f..d987e441f 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc @@ -3,7 +3,6 @@ class termservice extends plugin { /* Generic terminal attributes */ - var $gotoLpdEnable= FALSE; var $gotoXMonitor= ""; var $gotoXMethod= "default"; var $gotoXdmcpServer= ""; @@ -24,6 +23,8 @@ class termservice extends plugin var $gotoScannerBackend= ""; var $goFonHardware= "automatic"; + var $gotoLpdEnable = array(); + var $AutoSync = false; var $view_logged = FALSE; @@ -48,7 +49,7 @@ class termservice extends plugin /* attribute list for save action */ var $attributes= array("gotoLpdEnable", "gotoXMonitor", "gotoXMethod", "gotoXdmcpServer", "gotoXDriver", "gotoXResolution", "gotoXColordepth", - "gotoXHsync", "gotoXVsync", "gotoLpdEnable", "gotoLpdServer", + "gotoXHsync", "gotoXVsync", "gotoLpdServer", "gotoScannerEnable", "gotoScannerModel", "gotoScannerClients", "gotoScannerBackend", "gotoXKbModel", "gotoXKbLayout", "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport", "goFonHardware"); @@ -81,6 +82,15 @@ class termservice extends plugin $this->is_ogroup_member = TRUE; } + /* Load gotoLpdEnable + */ + $this->gotoLpdEnable = array(); + if(isset($this->attrs['gotoLpdEnable']['count'])){ + for($i = 0 ; $i < $this->attrs['gotoLpdEnable']['count']; $i ++){ + $this->gotoLpdEnable[] = $this->attrs['gotoLpdEnable'][$i]; + } + } + /* Get list of available xdrivers */ $this->XDrivers = $this->getListOfXDrivers(); @@ -215,10 +225,6 @@ class termservice extends plugin } } - /* Convert gotoLpdEnable - */ - $this->gotoLpdEnable= preg_match("/yes/i",$this->gotoLpdEnable); - /* Load hardware list */ $ldap= $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); @@ -308,6 +314,39 @@ 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(); @@ -392,7 +431,7 @@ class termservice extends plugin $smarty->assign("staticAddress", ""); /* Checkboxes */ - foreach(array("gotoLpdEnable", "gotoScannerEnable") as $val){ + foreach(array("gotoScannerEnable") as $val){ if ($this->$val == TRUE) { $smarty->assign("$val", "checked"); } else { @@ -448,7 +487,7 @@ class termservice extends plugin /* Save checkbox state */ if (isset ($_POST['gotoXMethod'])){ - foreach (array("gotoLpdEnable", "gotoScannerEnable") as $val){ + foreach (array("gotoScannerEnable") as $val){ if($this->acl_is_writeable($val)){ if (!isset ($_POST["$val"])){ @@ -533,9 +572,6 @@ class termservice extends plugin /* Save to LDAP */ function save() { - /* Convert to string */ - $this->gotoLpdEnable= $this->gotoLpdEnable?"Yes":"No"; - /* remove objectclass GOhard if this is an ogroup tab */ if(isset($this->parent->by_object['ogroup'])){ $this->objectclasses = array(); @@ -671,6 +707,7 @@ class termservice extends plugin "plCategory" => array("terminal"), "plProvidedAcls"=> array( + "gotoXMonitor" => _("Monitor"), "gotoXMethod" => _("Method"), "gotoXdmcpServer" => _("Remote desktop"), @@ -680,7 +717,6 @@ class termservice extends plugin "gotoXHsync" => _("HSync"), "gotoXVsync" => _("VSync"), "AutoSync" => _("Auto-Sync"), - "gotoLpdEnable" => _("Printer service enabled"), "gotoLpdServer" => _("Spool server"), "gotoScannerEnable" => _("Scanner enabled"), "gotoXKbModel" => _("Keyboard model"), @@ -688,6 +724,7 @@ class termservice extends plugin "gotoXKbVariant" => _("Keyboard variant"), "gotoXMouseType" => _("Mouse type"), "gotoXMouseport" => _("Mouse port"), + "gotoLpdEnable" => _("Printer enabled"), "goFonHardware" => _("Telephone hardware")) )); } diff --git a/gosa-plugins/goto/admin/systems/goto/terminalService.tpl b/gosa-plugins/goto/admin/systems/goto/terminalService.tpl index 0d5d1b527..a268d8ba5 100644 --- a/gosa-plugins/goto/admin/systems/goto/terminalService.tpl +++ b/gosa-plugins/goto/admin/systems/goto/terminalService.tpl @@ -222,15 +222,28 @@ - - + + + +

+ +

+

+

{t}Scan device{/t}

{render acl=$gotoScannerEnableACL} {/render} {t}Provide scan services{/t} +
+

{t}Printer{/t}

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