From: cajus Date: Thu, 17 Jan 2008 12:57:31 +0000 (+0000) Subject: Moved goto to subdirectory X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2d0c65fcdb389c0cd8986ed750d3bd9d2c626406;p=gosa.git Moved goto to subdirectory git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8442 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/admin/systems/ArpNewDevice.tpl b/gosa-core/plugins/admin/systems/ArpNewDevice.tpl deleted file mode 100644 index 8e4bf44ac..000000000 --- a/gosa-core/plugins/admin/systems/ArpNewDevice.tpl +++ /dev/null @@ -1,31 +0,0 @@ -

{t}Integrating unknown devices{/t}

-

- {t}The current device has been detected by the ARP monitor used by GOsa. You can integrate this device into your running DHCP/DNS infrastructure by submitting this form. The device entry will disapear from the list of the systems and move to the DNS/DHCP configuration.{/t} -

- - - - - - - -
- - - - - - - -
-
-

-{$netconfig} - - - -

diff --git a/gosa-core/plugins/admin/systems/SelectDeviceType.tpl b/gosa-core/plugins/admin/systems/SelectDeviceType.tpl deleted file mode 100644 index d25acbf49..000000000 --- a/gosa-core/plugins/admin/systems/SelectDeviceType.tpl +++ /dev/null @@ -1,46 +0,0 @@ -
-

-{t}This is a new system which currently has no system type defined. Please choose a system type for this entry and press the 'continue' button. If this system should be added to a group of system settings, specify the preferred object group below.{/t} -
-
-

-

-
-{t}Please select a system type and an optional bundle of predefined settings to be inherited.{/t} -
-
-

-
- - - - - -
- - - - -
- {t}System type{/t}  - -
-
- - - - -
- {t}Choose an object group as template{/t}  - -
-
-

 

-

- - -

diff --git a/gosa-core/plugins/admin/systems/chooser.tpl b/gosa-core/plugins/admin/systems/chooser.tpl deleted file mode 100644 index 3e8bf95f9..000000000 --- a/gosa-core/plugins/admin/systems/chooser.tpl +++ /dev/null @@ -1,21 +0,0 @@ -

{t}Choose the kind of system component you want to create{/t}

- -

- {t}Linux terminals and workstations are autocreated on bootup. For this reason you're only be able to create templates for a specific tree. Servers are normally automatically added too, but in some special cases you may need to create a faked server entry to provide GOsa with some informations. Other network components may be used for Nagios setups to create component dependencies.{/t} -

- -{t}Linux thin client template{/t}
-{t}Linux workstation template{/t}
-{t}Linux Server{/t}
- -{t}Network printer{/t}
-{t}Phone{/t}
-{t}Other network component{/t}
- -

- -   - -

- - diff --git a/gosa-core/plugins/admin/systems/class_ArpNewDevice.inc b/gosa-core/plugins/admin/systems/class_ArpNewDevice.inc deleted file mode 100644 index 79009908e..000000000 --- a/gosa-core/plugins/admin/systems/class_ArpNewDevice.inc +++ /dev/null @@ -1,74 +0,0 @@ -cn =""; - $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses); - $this->acl = "#all#"; - $this->netConfigDNS->acl = $this->acl; - $this->netConfigDNS->force_dns(); - } - - function execute() - { - $smarty = get_smarty(); - foreach($this->attributes as $attr){ - $smarty->assign($attr,$this->$attr); - } - $this->netConfigDNS->cn= $this->cn; - $smarty->assign("netconfig", $this->netConfigDNS->execute()); - - /* Display sub dialog from network settings */ - $this->netConfigDNS->acl = $this->acl; - if($this->netConfigDNS->dialog){ - $this->dialog = TRUE; - return($this->netConfigDNS->execute()); - }else{ - $this->dialog = FALSE; - } - - return($smarty->fetch (get_template_path('ArpNewDevice.tpl', TRUE))); - } - - function check() - { - $message= plugin::check(); - $message= array_merge($message, $this->netConfigDNS->check()); - if(empty($this->cn)){ - $message[] = _("Please specify a valid dns name."); - } - return($message); - } - - function save_object() - { - if(isset($_POST['ArpNewDevice_posted'])){ - plugin::save_object(); - $this->netConfigDNS->save_object(); - } - } - - function save() - { - $this->netConfigDNS->acl = $this->acl; - plugin::save(); - $this->netConfigDNS->cn = $this->cn; - $this->netConfigDNS->save($this->dn); - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->rmdir_recursive($this->dn); - show_ldap_error($ldap->get_error(),_("Could not remove arp-alert device after writing dns and dhcp configuration.")); - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/class_SelectDeviceType.inc b/gosa-core/plugins/admin/systems/class_SelectDeviceType.inc deleted file mode 100644 index c17b8ef5f..000000000 --- a/gosa-core/plugins/admin/systems/class_SelectDeviceType.inc +++ /dev/null @@ -1,85 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* attribute list for save action */ - var $ignore_account= TRUE; - var $attributes= array("ObjectGroup","SystemType"); - var $objectclasses= array("whatever"); - - var $ObjectGroups = array(); - var $SystemTypes = array(); - - var $ObjectGroup = ""; - var $SystemType = ""; - - function SelectDeviceType (&$config, $dn= NULL) - { - plugin::plugin ($config, $dn); - - /* Get object groups */ - $ldap = $this->config->get_ldap_link(); - $ldap->cd ($this->config->current['BASE']); - $ldap->search("(&(objectClass=gosaGroupOfNames)(cn=*))",array("cn")); - $this->ObjectGroups['none']=_("none"); - while($attrs = $ldap->fetch()){ - $this->ObjectGroups[$attrs['dn']]= $attrs['cn'][0]; - } - - $this->SystemTypes =array("workstation"=>_("Workstation"), "terminal"=>_("Terminal"), "server"=>_("Server")); - } - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - /* Fill templating stuff */ - $smarty= get_smarty(); - $display= ""; - - $smarty->assign("ObjectGroups" ,$this->ObjectGroups); - $smarty->assign("ObjectGroupKeys" ,array_flip($this->ObjectGroups)); - $smarty->assign("SystemTypes" ,$this->SystemTypes); - $smarty->assign("SystemTypeKeys" ,array_flip($this->SystemTypes)); - - $smarty->assign("ObjectGroup",$this->ObjectGroup); - $smarty->assign("SystemType",$this->SystemType); - - $display.= $smarty->fetch(get_template_path('SelectDeviceType.tpl', TRUE)); - return($display); - } - - /* Save data to object */ - function save_object() - { - plugin::save_object(); - foreach($this->attributes as $attr){ - if(isset($_POST[$attr])){ - $this->$attr = $_POST[$attr]; - } - } - } - - /* Check supplied data */ - function check() - { - /* Call common method to give check the hook */ - $message= plugin::check(); - - return ($message); - } - - /* Save to LDAP */ - function save() - { - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/class_printGeneric.inc b/gosa-core/plugins/admin/systems/class_printGeneric.inc deleted file mode 100644 index 9eec1acaf..000000000 --- a/gosa-core/plugins/admin/systems/class_printGeneric.inc +++ /dev/null @@ -1,1046 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* Generic terminal attributes */ - var $interfaces = array(); - var $ignore_account = FALSE; - - /* Needed values and lists */ - var $base = ""; - var $cn = ""; - var $l = ""; - var $description = ""; - var $labeledURI = ""; - var $gotoPrinterPPD = ""; - var $initial_PPD = ""; - var $orig_dn = ""; - - var $UserMember =""; - var $UserMembers =array(); - var $UserMemberKeys =array(); - - var $AdminMember =""; - var $AdminMembers =array(); - var $AdminMemberKeys =array(); - - var $PPDdialogToSave = NULL; - var $BelongsTo = "unknown"; // Specifies if this is a standalone printer, or belongs to a terminal / WS - - var $member =array(); - var $strings = ""; - var $netConfigDNS; - var $baseSelection = false; - var $macAddress = ""; - - var $gotoUserAdminPrinter; - var $gotoGroupAdminPrinter ; - var $gotoGroupPrinter; - var $gotoUserPrinter ; - - /* attribute list for save action */ - var $attributes = array("cn", "description", "l", "labeledURI", "gotoPrinterPPD","gotoUserPrinter", "macAddress", - "gotoUserAdminPrinter","gotoGroupAdminPrinter","gotoUserPrinter","gotoGroupPrinter"); - var $objectclasses = array("top", "gotoPrinter"); - var $view_logged = FALSE; - var $parent; - - function printgeneric (&$config, $dn,$parent_init,$parent) - { - $this->config = &$config; - $this->dn = $dn; - - /* If parent was posted(the tabs object) we can detect the printer type. */ - if($parent){ - $this->parent = $parent; - $this->getTypeOfPrinter(); - }else{ - $this->BelongsTo = "unknown"; - return; - } - - /* Update dn, to ensure storing as printer instead of WS / terminal */ - if(preg_match("/Terminal/i",$this->BelongsTo) || preg_match("/TerminalTemplate/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".normalizePreg(get_ou('terminalou'))."/",get_ou('printerou'),$this->dn); - } - - if(preg_match("/Workstation/i",$this->BelongsTo) || preg_match("/WorkstationTemplate/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".normalizePreg(get_ou('workstationou'))."/",get_ou('printerou'),$this->dn); - } - - $this->orig_dn = $this->dn; - - /* Get printer settings, possibly dn has changed */ - plugin::plugin ($config, $this->dn); - - /* Get is_account initially_was_account status */ - $this->getTypeOfPrinter(true); - - /* set orig dn to new if object is new */ - $ldap= $this->config->get_ldap_link(); - $ldap->cat($this->dn, array('dn')); - if(!$ldap->count()){ - $this->orig_dn = "new"; - } - - /* create dns object */ - $this->netConfigDNS = new termDNS($this->config, $this,$this->objectclasses); - - /* Set base */ - if ($this->dn == "new"){ - $ui= get_userinfo(); - $this->base= dn2base($ui->dn); - $this->cn= ""; - } else { - - /* Set base and check if the extracted base exists */ - if(preg_match("/".normalizePreg(get_ou('incomingou'))."/",$this->dn)){ - $this->base= preg_replace("/".normalizePreg(get_ou('incomingou'))."/","",dn2base($this->dn)); - }else{ - $this->base= preg_replace("/".normalizePreg(get_ou('printerou'))."/","",dn2base($this->dn)); - } - - if(!isset($this->config->idepartments[$this->base])){ - print_red(_("Can't extract a valid base out of object dn, setting base to '%s'."),session::get('CurrentMainBase')); - $this->base = session::get('CurrentMainBase'); - } - } - - /* Extract selected ppd */ - if(isset($this->gotoPrinterPPD)){ - $this->gotoPrinterPPD = preg_replace("/^http.*ppd\//i","",$this->gotoPrinterPPD); - } - - $this->initial_PPD = $this->gotoPrinterPPD; - - /* 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(); - - if (isset($this->attrs[$attr]['count'])) { - 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")); - if($ldap->count()){ - $entry = $ldap->fetch(); - $this->member[$type][$entry['cn'][0]]=$entry; - } - }else{ - $ldap->search("(&(objectClass=person)(objectClass=inetOrgPerson)(uid=".$mem."))",array("cn","uid")); - if($ldap->count()){ - $entry = $ldap->fetch(); - $this->member[$type][$entry['uid'][0]]=$entry; - } - } - } - } - } - } - - function set_acl_base($base) - { - plugin::set_acl_base($base); - if(is_object($this->netConfigDNS)){ - $this->netConfigDNS->set_acl_base($base); - } - } - - function set_acl_category($cat) - { - plugin::set_acl_category($cat); - if(is_object($this->netConfigDNS)){ - $this->netConfigDNS->set_acl_category($cat); - } - } - - /* Detect type of printer. - * Printer can be stand alone, belong to a workstation or belong to a terminal. - * We can detect the type printer type when comparing the tabs objects - */ - function getTypeOfPrinter($UpdateAccountStatus = false) - { - /* Disable account as default - */ - $this->is_account = $this->initially_was_account = false; - - /* Detect type of printer via parent tabs. - */ - - $class = get_class($this->parent); - if(isset($this->parent->by_object['workgeneric'])){ - - /* Exclude templates - */ - $this->cn = $this->parent->by_object['workgeneric']->cn; - if($this->parent->by_object['workgeneric']->cn == "wdefault"){ - $this->BelongsTo = "WorkstationTemplate"; - }else{ - $this->BelongsTo = "Workstation"; - } - }elseif(isset($this->parent->by_object['termgeneric'])){ - - /* Exclude templates - */ - $this->cn = $this->parent->by_object['termgeneric']->cn; - if($this->parent->by_object['termgeneric']->cn == "default"){ - $this->BelongsTo = "TerminalTemplate"; - }else{ - $this->BelongsTo = "Terminal"; - } - }elseif(isset($this->parent->by_name['printgeneric'])){ - $this->BelongsTo = "Printer"; - } - - if($UpdateAccountStatus){ - - /* Set is_account / was account - */ - if($this->dn == "new"){ - $this->initially_was_account = false; - } - - /* If is printer it must be a true account. - */ - if(preg_match("/printer/i",$this->BelongsTo)){ - $this->is_account = true; - } - - /* Update dn, to ensure storing as printer instead of WS / terminal - */ - if(preg_match("/terminal/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".normalizePreg(get_ou('terminalou'))."/",get_ou('printerou'),$this->dn); - } - - if(preg_match("/workstation/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".normalizePreg(get_ou('workstationou'))."/",get_ou('printerou'),$this->dn); - } - - /* Detect if this is a valid printer account; - */ - $ldap = $this->config->get_ldap_link(); - $ldap->cat($this->dn, array('objectClass')); - - if($ldap->count()){ - $attrs = $ldap->fetch(); - if(in_array("gotoPrinter",$attrs['objectClass'])){ - $this->initially_was_account = true; - $this->is_account = true; - }else{ - $this->is_account = false; - } - } - } - } - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","printer/".get_class($this),$this->dn); - } - - - /* If type of printer couldn't be detected (because of missing parent object in construction) - * hide this tab. - */ - if(preg_match("/unknown/i",$this->BelongsTo)){ - $display= $this->show_enable_header(_("Add printer extension"), - _("Could not initialize printer tab, parameter parent was missing while construction."),TRUE,TRUE); - return($display); - } - - /* Templates can't have printer extensions - */ - if(preg_match("/WorkstationTemplate/i",$this->BelongsTo)){ - $display= $this->show_enable_header(_("Add printer extension"), - _("This is a workstation template, printer tab is disabled."),TRUE,TRUE); - return($display); - } - if(preg_match("/TerminalTemplate/i",$this->BelongsTo)){ - $display= $this->show_enable_header(_("Add printer extension"), - _("This is a terminal template, printer tab is disabled."),TRUE,TRUE); - return($display); - } - - /* Get cn from base object */ - if(preg_match("/^Workstation$/i",$this->BelongsTo)){ - $this->cn = $this->parent->by_object['workgeneric']->cn; - } - if(preg_match("/^Terminal$/i",$this->BelongsTo)){ - $this->cn = $this->parent->by_object['termgeneric']->cn; - } - - $smarty= get_smarty(); - - /* Assign acls */ - $tmp = $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $name => $translation){ - $smarty->assign($name."ACL", $this->getacl($name)); - } - - $display=""; - - /* Tell smarty if this is a standalone object or a terminal / WS depending printer */ - if(preg_match("/^Printer$/i",$this->BelongsTo)){ - $smarty->assign("StandAlone",true); - }else{ - $smarty->assign("StandAlone",false); - } - - /* Do we need to flip is_account state? */ - if(isset($_POST['modify_state'])){ - if($this->is_account && $this->acl_is_removeable()){ - $this->is_account= FALSE; - }elseif(!$this->is_account && $this->acl_is_createable()){ - $this->is_account= TRUE; - } - } - - /* Do we represent a valid printer? */ - if (!$this->is_account && $this->parent === NULL){ - $display= "\"\" ". - _("This 'dn' has no printer features.").""; - return($display); - } - - /* If this is a WS / Terminal depending printer, display account state button */ - if(!preg_match("/^Printer$/i",$this->BelongsTo)){ - if((empty($this->cn)) && ($this->dn != "new")){ - $display= $this->show_enable_header(_("Add printer extension"), - _("This object has printer extension disabled. You can't enable it while 'cn' is not present in entry. Possibly you are currently creating a new terminal template"),TRUE,TRUE); - $this->is_account= false; - return $display; - } - - if (($this->is_account)){ - if(preg_match("/^Workstation$/i",$this->BelongsTo)){ - $display= $this->show_disable_header(_("Remove printer extension"), - _("This workstation has printer extension enabled.You can disable it by clicking below.")); - }elseif(preg_match("/^Terminal$/i",$this->BelongsTo)){ - $display= $this->show_disable_header(_("Remove printer extension"), - _("This terminal has printer extension enabled. You can disable it by clicking below.")); - } - }else{ - if(preg_match("/^Workstation$/i",$this->BelongsTo)){ - $display= $this->show_disable_header(_("Add printer extension"), - _("This workstation has printer extension disabled. You can enable it by clicking below.")); - }elseif(preg_match("/^Terminal$/i",$this->BelongsTo)){ - $display= $this->show_enable_header(_("Add printer extension"), - _("This terminal has printer extension disabled. You can enable it by clicking below.")); - } - return ($display); - } - } - - /* Base select dialog */ - $once = true; - foreach($_POST as $name => $value){ - if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){ - $once = false; - $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases()); - $this->dialog->setCurrentBase($this->base); - $this->baseSelection = true; - } - } - - /* Dialog handling for base select dialog - * Check if base was selected, dialog aborted etc */ - if(is_object($this->dialog)){ - - $this->dialog->save_object(); - if($this->baseSelection){ - if($this->dialog->isClosed()){ - $this->dialog = false; - $this->baseSelection = false; - }elseif($this->dialog->isSelected()){ - - /* A new base was selected, check if it is a valid one */ - $tmp = $this->get_allowed_bases(); - if(isset($tmp[$this->dialog->isSelected()])){ - $this->base = $this->dialog->isSelected(); - } - - $this->dialog= false; - $this->baseSelection = false; - }else{ - return($this->dialog->execute()); - } - } - } - - /* Fill templating stuff */ - $smarty->assign("bases", $this->get_allowed_bases()); - $smarty->assign("base_select", $this->base); - - /* Assign attributes */ - foreach ($this->attributes as $attr){ - $smarty->assign("$attr", $this->$attr); - } - - if(isset($_POST['AddUser'])){ - $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddUser"); - } - if(isset($_POST['AddGroup'])){ - $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddGroup"); - } - if(isset($_POST['AddAdminUser'])){ - $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddAdminUser"); - } - if(isset($_POST['AddAdminGroup'])){ - $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddAdminGroup"); - } - - /* Display ppd configure/select dialog */ - if(isset($_POST['EditDriver'])){ - if($this->PPDdialogToSave && is_object($this->PPDdialogToSave)){ - $this->dialog = $this->PPDdialogToSave; - }else{ - $this->dialog = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD); - $this->dialog->cn= $this->cn; - } - } - - /* remove ppd */ - if(isset($_POST['RemoveDriver'])){ - $this->gotoPrinterPPD = array(); - $this->PPDdialogToSave = NULL; - } - - /* Close ppd dialog */ - if(isset($_POST['ClosePPD'])){ - unset($this->dialog); - $this->dialog=FALSE; - } - - /* Save selected ppd */ - if(isset($_POST['SavePPD'])){ - $this->dialog->save_object(); - if(count($this->dialog->check())){ - foreach($this->dialog->check() as $msg){ - print_red($msg); - } - }else{ - $this->gotoPrinterPPD = array(); - $this->gotoPrinterPPD = $this->dialog->save(); - $this->PPDdialogToSave = $this->dialog; - unset($this->dialog); - $this->dialog=FALSE; - } - } - - /* Member management, delete user / group / admin ..*/ - if((isset($_POST['DelUser']))&&(isset($_POST['UserMember']))){ - foreach($_POST['UserMember'] as $mem){ - $this->DelMember('AddUser',$mem); - } - } - - if((isset($_POST['DelUser']))&&(isset($_POST['UserMember']))){ - foreach($_POST['UserMember'] as $mem){ - $this->DelMember('AddGroup',$mem); - } - } - - if((isset($_POST['DelAdmin']))&&(isset($_POST['AdminMember']))){ - foreach($_POST['AdminMember'] as $mem){ - $this->DelMember('AddAdminUser',$mem); - } - } - - if((isset($_POST['DelAdmin']))&&(isset($_POST['AdminMember']))){ - foreach($_POST['AdminMember'] as $mem){ - $this->DelMember('AddAdminGroup',$mem); - } - } - - /* Abort user / group adding dialog */ - if(isset($_POST['PrinterCancel'])){ - unset($this->dialog); - $this->dialog= FALSE; - } - - /* Save selected users / groups */ - if(isset($_POST['PrinterSave'])){ - $this->dialog->save_object(); - if(count($this->dialog->check())){ - foreach($this->dialog->check() as $msg){ - print_red($msg); - } - }else{ - $data= $new = $this->dialog->save(); - unset($data['type']); - foreach($data as $mem){ - $this->AddMember($new['type'], $mem['dn']); - } - unset($this->dialog); - $this->dialog=FALSE; - } - } - - /* Display dialog, if there is currently one open*/ - if(is_object($this->dialog)){ - $this->dialog->save_object(); - $display = $this->dialog->execute(); - return $display; - } - - /* Parse selected ppd file */ - $config = session::get('config'); - if((isset($config->data['MAIN']['PPD_PATH']))&&(is_dir($config->data['MAIN']['PPD_PATH']))){ - - $path = $config->data['MAIN']['PPD_PATH']; - if(!preg_match("/\/$/",$path)){ - $path = $path."/"; - } - - $ppdManager= new ppdManager($path); - if(!empty($this->gotoPrinterPPD)){ - if((!file_exists($path.$this->gotoPrinterPPD))){ - $smarty->assign("driverInfo", "".sprintf(_("Your currently selected PPD file '%s' doesn't exist."),$path.$this->gotoPrinterPPD).""); - }else{ - $smarty->assign("driverInfo", $ppdManager->loadDescription($path.$this->gotoPrinterPPD)); - } - }else{ - $smarty->assign("driverInfo", _("Not defined")); - } - }else{ - $smarty->assign("driverInfo",_("Can't get ppd informations.")); - } - - /* Create user & admin user list */ - $list=$this->generateList(); - $userlist = array_merge($list['AddUser'],$list['AddGroup']); - $adminlist = array_merge($list['AddAdminUser'],$list['AddAdminGroup']); - - asort($userlist); - asort($adminlist); - - if(!preg_match("/Printer/i",$this->BelongsTo)){ - if(preg_match("/Terminal/i",$this->BelongsTo)){ - $smarty->assign("desc" ,sprintf(_("This printer belongs to terminal %s. You can't rename this printer."),"".$this->cn."")); - }else{ - $smarty->assign("desc" ,sprintf(_("This printer belongs to workstation %s. You can't rename this printer."),"".$this->cn."")); - } - $smarty->assign("cnACL" , $this->getacl("cn",true)); - }else{ - $smarty->assign("desc" ,""); - } - $smarty->assign("UserMember" ,$this->UserMember); - $smarty->assign("UserMembers" ,$userlist); - $smarty->assign("UserMemberKeys",array_flip($userlist)); - - $smarty->assign("AdminMember" ,$this->AdminMember); - $smarty->assign("AdminMembers" ,$adminlist); - $smarty->assign("AdminMemberKeys",array_flip($adminlist)); - if(preg_match("/Printer/i",$this->BelongsTo)){ - - /* Show main page */ - $str = $this->netConfigDNS->execute(); - if(is_object($this->netConfigDNS->dialog)){ - return($str); - } - $smarty->assign("netconfig", $str); - } else { - $smarty->assign("netconfig", ""); - } - - return($display.$smarty->fetch (get_template_path('printer.tpl', TRUE))); - } - - function remove_from_parent() - { - /* Only remove if there was initially an account */ - if($this->initially_was_account){ - - /* Update dn, to ensure storing as printer instead of WS / terminal - */ - if(preg_match("/terminal/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".normalizePreg(get_ou('terminalou')).",/",get_ou('printerou'),$this->dn); - } - - if(preg_match("/workstation/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".normalizePreg(get_ou('workstationou'))."/",get_ou('printerou'),$this->dn); - } - - /* Check if this dn points to a printer, to avoid deleting something else */ - $ldap= $this->config->get_ldap_link(); - $ldap->cat($this->dn, array('dn',"objectClass")); - if(!$ldap->count()){ - print_red("Trying to remove printer object which isn't a printer. Aborted to avoid data loss."); - return; - } - - /* Check if obejct is a printer */ - $CheckPrinter = $ldap->fetch(); - if(!in_array("gotoPrinter",$CheckPrinter['objectClass'])){ - print_red("Trying to remove printer object which isn't a printer. Aborted to avoid data loss."); - return; - } - - /* Remove account & dns extension */ - $this->netConfigDNS->remove_from_parent(); - $ldap->rmdir($this->dn); - - new log("remove","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - - show_ldap_error($ldap->get_error(), sprintf(_("Removing of system print/generic with dn '%s' failed."),$this->dn)); - $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); - - /* Delete references to object groups */ - $ldap->cd ($this->config->current['BASE']); - $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn")); - while ($ldap->fetch()){ - $og= new ogroup($this->config, $ldap->getDN()); - unset($og->member[$this->dn]); - $og->save (); - } - - /* Remove previously selected ppd file.*/ - if(!empty($this->initial_PPD)){ - $tmp = new printerPPDDialog($this->config, $this->dn,$this->initial_PPD); - $tmp->removeModifiedPPD(); - } - } - } - - - /* Save data to object */ - function save_object() - { - /* Create a base backup and reset the - base directly after calling plugin::save_object(); - Base will be set seperatly a few lines below */ - $base_tmp = $this->base; - plugin::save_object(); - $this->base = $base_tmp; - - if(is_object($this->netConfigDNS)){ - $this->netConfigDNS->save_object(); - } - - /* Set new base if allowed */ - $tmp = $this->get_allowed_bases(); - if(isset($_POST['base'])){ - if(isset($tmp[$_POST['base']])){ - $this->base= $_POST['base']; - } - } - } - - /* Check supplied data */ - function check() - { - /* Call common method to give check the hook */ - $message= plugin::check(); - if (preg_match("/printer/i",$this->BelongsTo)){ - $message= array_merge($message, $this->netConfigDNS->check()); - } - - /* Don't display check messages if this is a template object */ - if(isset($this->parent->by_object['workgeneric'])){ - if($this->parent->by_object['workgeneric']->cn == "wdefault"){ - return $message; - } - }elseif(isset($this->parent->by_object['termgeneric'])){ - if($this->parent->by_object['termgeneric']->cn == "default"){ - return $message; - } - } - - $dn= "cn=".$this->cn.get_ou('printerou').",".$this->base; - - /* must: cn */ - if(($this->BelongsTo == "Printer") && (empty($this->cn))){ - $message[]= _("The required field 'Printer name' is not set."); - } - - /* must: cn */ - if(($this->BelongsTo == "Printer") && !tests::is_dns_name($this->cn)){ - $message[]= _("Invalid character in printer name."); - } - - /* must: labeledURI */ - if(empty($this->labeledURI)){ - $message[]= "The required field 'Printer URL' is not set."; - } - - /* Check if there is already an entry with this cn*/ - if (($this->orig_dn != $dn)&&( preg_match("/printer/i",$this->BelongsTo))){ - $ldap= $this->config->get_ldap_link(); - $ldap->cd ($this->base); - $ldap->ls("(cn=".$this->cn.")",get_ou('printerou').$this->base, array("cn")); - if ($ldap->count() != 0){ - while ($attrs= $ldap->fetch()){ - if(preg_match("/cn=dhcp,/",$attrs['dn'])){ - continue; - } - if ($attrs['dn'] != $this->orig_dn){ - $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); - break; - } - } - } - } - - return ($message); - } - - - /* Save to LDAP */ - function save() - { - /* Update dn, to ensure storing as printer instead of WS / terminal - */ - if(preg_match("/terminal/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".normalizePreg(get_ou('terminalou')).",/",get_ou('printerou'),$this->dn); - } - - if(preg_match("/workstation/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".normalizePreg(get_ou('workstationou'))."/",get_ou('printerou'),$this->dn); - } - - if(!$this->is_account) return; - if(isset($this->parent->by_object['workgeneric'])){ - if($this->parent->by_object['workgeneric']->cn == "wdefault"){ - return; - } - }elseif(isset($this->parent->by_object['termgeneric'])){ - if($this->parent->by_object['termgeneric']->cn == "default"){ - return; - } - } - - /* If type is still unknown, the initialisation of this printer failed, abort. */ - if(preg_match("/unknown/i",$this->BelongsTo)){ - return; - } - - /* save ppd configuration */ - if($this->PPDdialogToSave && is_object($this->PPDdialogToSave)){ - $this->PPDdialogToSave->save_ppd(); - } - if($this->orig_dn != $this->dn){ - if(!empty($this->gotoPrinterPPD)) { - $this->PPDdialogToSave = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD); - $this->PPDdialogToSave->cn = $this->cn; - $this->PPDdialogToSave->generateProperties(); - $this->PPDdialogToSave->update_ppd_url(); - } - } - - /* Remove previously selected ppd file.*/ - if($this->initial_PPD != $this->gotoPrinterPPD){ - if(!empty($this->initial_PPD)){ - $tmp = new printerPPDDialog($this->config, $this->dn,$this->initial_PPD); - $tmp->removeModifiedPPD(); - } - } - - if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){ - $method="https://"; - }else{ - $method="http://"; - } - - /* If no ppd is selected, remove this attribute */ - if(!empty($this->gotoPrinterPPD)) { - $this->gotoPrinterPPD = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/ppd/".$this->gotoPrinterPPD); - }else{ - $this->gotoPrinterPPD = array(); - } - - $dn= $this->dn; - plugin::save(); - $ldap= $this->config->get_ldap_link(); - - /* reduce objectClasses to minimun */ - $this->attrs['objectClass']= $this->objectclasses; - - /* Remove all empty values */ - if ($this->orig_dn == 'new'){ - $attrs= array(); - foreach ($this->attrs as $key => $val){ - if (is_array($val) && count($val) == 0){ - continue; - } - $attrs[$key]= $val; - } - $this->attrs= $attrs; - } - - /* Append printer user - */ - $this->attrs['gotoUserPrinter']=array(); - foreach($this->member['AddUser'] as $mem){ - $this->attrs['gotoUserPrinter'][]=$mem['uid'][0]; - } - - /* Append printer group - */ - $this->attrs['gotoGroupPrinter'] = array(); - foreach($this->member['AddGroup'] as $mem){ - $this->attrs['gotoGroupPrinter'][]=$mem['cn'][0]; - } - - /* Append printer admin user - */ - $this->attrs['gotoUserAdminPrinter'] = array(); - foreach($this->member['AddAdminUser'] as $mem){ - $this->attrs['gotoUserAdminPrinter'][]=$mem['uid'][0]; - } - - /* Append printer admin group - */ - $this->attrs['gotoGroupAdminPrinter']= array(); - foreach($this->member['AddAdminGroup'] as $mem){ - $this->attrs['gotoGroupAdminPrinter'][]=$mem['cn'][0]; - } - - if($this->orig_dn == 'new'){ - foreach(array("gotoGroupPrinter","gotoUserAdminPrinter","gotoGroupAdminPrinter","gotoUserPrinter") as $checkVar){ - if(count($this->attrs[$checkVar]) == 0 || empty($this->attrs[$checkVar])){ - unset($this->attrs[$checkVar]); - } - } - }else{ - if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){ - $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag"; - } - } - - /* Ensure to create a new object */ - if(preg_match("/".normalizePreg(get_ou('incomingou'))."/",$this->orig_dn)){ - $this->orig_dn = "new"; - } - - /* Move object in necessary*/ - if (($this->orig_dn != $this->dn) && ($this->orig_dn != 'new')){ - $this->move($this->orig_dn, $this->dn); - } - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cat($this->dn); - if(!$ldap->count()){ - $ldap->cd($this->config->current['BASE']); - $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); - $ldap->cd($this->dn); - - /* Remove empty values */ - foreach($this->attrs as $name => $value){ - if(empty($value)){ - unset($this->attrs[$name]); - } - } - - $ldap->add($this->attrs); - $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); - new log("create","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } else { - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); - new log("modify","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } - show_ldap_error($ldap->get_error(), sprintf(_("Saving of system print/generic with dn '%s' failed."),$this->dn)); - - if(preg_match("/printer/i",$this->BelongsTo)){ - $this->netConfigDNS->cn = $this->cn; - $this->netConfigDNS->dn = $this->dn; - $this->netConfigDNS->save(); - } - } - - function generateList(){ - $a_return=array(); - - foreach($this->member as $type => $values){ - $a_return[$type]=array(); - foreach($values as $value){ - if((preg_match("/Group/i",$type))){ - if(!isset($value['description'])){ - $a_return[$type][$value['cn'][0]]= _("Group")." : ".$value['cn'][0]; - }else{ - $a_return[$type][$value['cn'][0]]= _("Group")." : ".$value['cn'][0]." [".$value['description'][0]."]"; - } - }else{ - $a_return[$type][$value['uid'][0]]=_("User")." : ".$value['cn'][0]; - } - } - } - return($a_return); - } - - /* Return plugin informations for acl handling - #FIXME FAIscript seams to ununsed within this class... */ - static function plInfo() - { - return (array( - "plShortName" => _("Generic"), - "plDescription" => _("Print generic"), - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 4, - "plSection" => array("administration"), - "plCategory" => array("printer" => array("description" => _("Printer"), - "objectClass" => "gotoPrinter"),"workstation","terminal"), - "plProvidedAcls"=> array( - "cn" => _("Name"), - "base" => _("Base") , - "description" => _("Description"), - "l" => _("Location"), - "labeledURI" => _("LabeledURL"), - "gotoPrinterPPD" => _("Printer PPD"), - "gotoUserPrinter" => _("Permissions")) - )); - } - - - /* Delete member */ - function DelMember($type,$id) - { - /* Check if there was a printer "dn" given, or the "cn" */ - foreach($this->member[$type] as $key => $printer){ - if($printer['dn'] == $id) { - $id = $key; - } - } - - if(!$this->acl_is_writeable("gotoUserPrinter")){ - print_red(sprintf(_("You are not allowed to remove the given object '%s' from the list of members of printer '%s'."),$id,$this->dn)); - return(FALSE); - } - - if(isset($this->member[$type][$id])){ - unset($this->member[$type][$id]); - return(TRUE); - } - return(FALSE); - } - - - /* Add given obejct to members */ - function AddMember($type,$dn) - { - $types = array("AddUser","AddGroup","AddAdminUser","AddAdminGroup"); - if(!in_array_ics($type, $types)){ - print_red(sprintf(_("Illegal printer type while adding '%s' to the list of '%s' printers,"),$dn,$type)); - return(FALSE); - } - - if(!$this->acl_is_writeable("gotoUserPrinter")){ - print_red(sprintf(_("You are not allowed to add the given object '%s' to the list of members of '%s'."),$dn,$this->dn)); - return(FALSE); - } - - /* Get name of index attributes */ - if(preg_match("/user/i",$type)){ - $var = "uid"; - }else{ - $var = "cn"; - } - - $ldap = $this->config->get_ldap_link(); - $ldap->cd($dn); - $ldap->cat($dn,array($var,"cn")); - if($ldap->count()){ - - $attrs = $ldap->fetch(); - - if(isset($attrs[$var][0])){ - $name = $attrs[$var][0]; - - /* Check if this uid/cn is already assigned to any permission */ - foreach($types as $ctype){ - - /* If we want to add a user, only check user/userAdmin members */ - if((preg_match("/user/i",$type)) && (!preg_match("/user/i",$ctype))){ - continue; - } - - /* If we want to add a group, only check groups/adminGroups .. */ - if((preg_match("/group/i",$type)) && (!preg_match("/group/i",$ctype))){ - continue; - } - - if(isset( $this->member[$ctype][$name])){ - print_red(sprintf(_("Can't add '%s' to the list of members, it is already used."),$attrs[$var][0])); - return(FALSE); - } - } - - /* Everything is fine. So add the given object to members */ - $this->member[$type][$attrs[$var][0]] = $attrs ; - }else{ - print_a($attrs); - } - }else{ - print_red(sprintf(_("Can't add '%s' to list of members, it is not reachable."),$dn)); - return(FALSE); - } - return(TRUE); - } - - - /* Display generic part for server copy & paste */ - function getCopyDialog() - { - $vars = array("cn"); - $smarty = get_smarty(); - $smarty->assign("cn" ,$this->cn); - $smarty->assign("object","printer"); - $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); - $ret = array(); - $ret['string'] = $str; - $ret['status'] = ""; - return($ret); - } - - - function saveCopyDialog() - { - if(isset($_POST['cn'])){ - $this->cn = $_POST['cn']; - } - } - - function PrepareForCopyPaste($source) - { - plugin::PrepareForCopyPaste($source); - if(isset($source['macAddress'][0])){ - $this->netConfigDNS->macAddress = $source['macAddress'][0]; - } - if(isset($source['ipHostNumber'][0])){ - $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0]; - } - - $source_o = new printgeneric($this->config,$source['dn'],NULL,$this->parent); - foreach($this->attributes as $attr){ - $this->$attr = $source_o->$attr; - } - $this->member = $source_o -> member; - - $this->gotoPrinterPPD = ""; - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/class_selectUserToPrinterDialog.inc b/gosa-core/plugins/admin/systems/class_selectUserToPrinterDialog.inc deleted file mode 100644 index 1f110e355..000000000 --- a/gosa-core/plugins/admin/systems/class_selectUserToPrinterDialog.inc +++ /dev/null @@ -1,198 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* attribute list for save action */ - var $ignore_account = TRUE; - var $attributes = array(); - var $objectclasses = array("whatever"); - var $regex = "*"; - var $subtree = FALSE; - var $depselect = "/"; - var $deplist = "/"; - - var $searchObjects = ""; - var $searchAttrs = ""; - var $searchAppend = ""; - var $baseAddition = ""; - var $type = ""; - var $search_cat = ""; - - function selectUserToPrinterDialog (&$config, $dn= NULL,$type=false ) - { - plugin::plugin ($config, $dn); - $this->depselect = $this->config->current['BASE']; - - switch($type){ - case "AddUser" : - $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))"; - $this->searchAttrs = array("cn","uid"); - $this->searchAppend = "uid"; - $this->baseAddition = get_people_ou(); - $this->search_cat = "users"; - ;break; - case "AddGroup" : - $this->searchObjects = "(objectClass=posixGroup)"; - $this->searchAttrs = array("cn","description"); - $this->searchAppend = "cn"; - $this->baseAddition = get_groups_ou(); - $this->search_cat = "groups"; - ;break; - case "AddAdminUser" : - $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))"; - $this->searchAttrs = array("cn","uid"); - $this->searchAppend = "uid"; - $this->baseAddition = get_people_ou(); - $this->search_cat = "users"; - ;break; - case "AddAdminGroup" : - $this->searchObjects = "(objectClass=posixGroup)"; - $this->searchAttrs = array("cn","description"); - $this->searchAppend = "cn"; - $this->baseAddition = get_groups_ou(); - $this->search_cat = "groups"; - ;break; - } - $this->type = $type; - - } - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - /* Fill templating stuff */ - $smarty= get_smarty(); - $display= ""; - - if(isset($_POST['dialogissubmitted'])){ - $this->regex=$_POST['regexPrinter']; - $this->depselect = $_POST['depselectPrinter']; - } - $this->subtree= isset($_POST['SubSearch']); - - if((isset($_GET['search']))&&(!empty($_GET['search']))){ - $this->regex=$_GET['search']."*"; - $this->regex=preg_replace("/\*\*/","*",$this->regex); - } - - - /* Get all departments within this subtree */ - $base = $this->config->current['BASE']; - $deps_res[] = array("dn"=>$this->config->current['BASE']); - $deps_res= array_merge($deps_res,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", array("users","groups"), $this->config->current['BASE'], - array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH)); - - /* Load possible departments */ - $ui = get_userinfo(); - - /* Allowed user departments */ - $udeps = $ui->get_module_departments("users"); - - /* Allowed groups department */ - $gdeps = $ui->get_module_departments("groups"); - - /* Combine both arrays */ - $tdeps = array_unique(array_merge($udeps,$gdeps)); - - /* Create usable departments array */ - $ids = $this->config->idepartments; - $deps = array(); - foreach($deps_res as $dep){ - if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){ - $value = $ids[$dep['dn']]; - $deps[$dep['dn']] = $value; - } - } - if(!isset($deps[$this->depselect])){ - $this->depselect = key($deps); - } - - - - $tmp_printers= $this->getPrinter(); - natcasesort($tmp_printers); - $smarty->assign("regexPrinter" , $this->regex); - $smarty->assign("deplistPrinter" , $deps);;//deplist); - $smarty->assign("depselectPrinter" , $this->depselect); - $smarty->assign("gotoPrinters" , $tmp_printers); - $smarty->assign("gotoPrinterKeys" , array_flip($tmp_printers)); - $smarty->assign("apply" , apply_filter()); - $smarty->assign("alphabet" , generate_alphabet()); - $smarty->assign("search_image" , get_template_path('images/search.png')); - $smarty->assign("tree_image" , get_template_path('images/tree.png')); - $smarty->assign("infoimage" , get_template_path('images/info.png')); - $smarty->assign("launchimage" , get_template_path('images/small_filter.png')); - $smarty->assign("deplist" , $deps); - $smarty->assign("subtree", $this->subtree?"checked":""); - - $display.= $smarty->fetch(get_template_path('selectUserToPrinterDialog.tpl', TRUE,dirname(__FILE__))); - return($display); - } - - function check(){ - /* Call common method to give check the hook */ - $message= plugin::check(); - - if(empty($_POST['gotoPrinter'])){ - $message[] = _("Please select a printer or press cancel."); - } - return $message; - } - - /* Save to LDAP */ - function save() - { - $a_return['type']=$this->type; - - foreach($_POST['gotoPrinter'] as $name){ - $data = $this->getPrinter(true); - $a_return[$name]= $data[$name]; - } - return($a_return); - } - - /* This function generates the Printerlist - * All printers are returned that match regex and and depselect - */ - function getPrinter($detailed = false) - { - $a_return=array(); - - $filter = "(&".$this->searchObjects."(cn=".$this->regex."))"; - $base = $this->baseAddition.$this->depselect; - $attrs = $this->searchAttrs; - $cat = $this->search_cat; - - if ($this->subtree){ - $res= get_list($filter,$cat,$this->depselect,$attrs, GL_SUBSEARCH); - } else { - $res= get_list($filter,$cat,$base,$attrs); - } - foreach($res as $printer){ - if(($detailed ==true)){ - if(isset($printer[$this->searchAppend])){ - $a_return[$printer[$this->searchAppend][0]] = $printer; - } - }else{ - if(isset($printer[$this->searchAppend])){ - if(isset($printer['description'][0])){ - $a_return[$printer[$this->searchAppend][0]] = $printer['cn'][0]." - ".$printer['description'][0]; - }else{ - $a_return[$printer[$this->searchAppend][0]] = $printer['cn'][0]; - } - } - } - } - return($a_return); - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/class_terminalGeneric.inc b/gosa-core/plugins/admin/systems/class_terminalGeneric.inc deleted file mode 100644 index cdd9b8d68..000000000 --- a/gosa-core/plugins/admin/systems/class_terminalGeneric.inc +++ /dev/null @@ -1,682 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* Generic terminal attributes */ - var $gotoMode= "disabled"; - var $gotoTerminalPath= ""; - var $gotoSwapServer= ""; - var $gotoSyslogServer= ""; - var $gotoSyslogServers = array(); - var $gotoNtpServer= array(); - var $gotoNtpServers= array(); - var $gotoSndModule= ""; - var $gotoFloppyEnable= ""; - var $gotoCdromEnable= ""; - var $ghCpuType= "-"; - var $ghMemSize= "-"; - var $ghUsbSupport= "-"; - var $ghNetNic= array(); - var $ghIdeDev= array(); - var $ghScsiDev= array(); - var $ghGfxAdapter= "-"; - var $ghSoundAdapter= "-"; - var $gotoLastUser= "-"; - var $netConfigDNS; - /* Needed values and lists */ - var $base= ""; - var $cn= ""; - var $orig_dn= ""; - - var $inheritTimeServer = true; - - /* Plugin side filled */ - var $modes= array(); - - /* attribute list for save action */ - var $ignore_account= TRUE; - var $attributes= array("gotoMode", "gotoTerminalPath", - "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer", - "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule", - "ghCpuType", "ghMemSize","ghUsbSupport", - "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser"); - var $objectclasses= array("top", "gotoTerminal", "GOhard"); - - var $mapActions = array("reboot" => "", - "instant_update" => "softupdate", - "update" => "sceduledupdate", - "reinstall" => "install", - "rescan" => "", - "memcheck" => "memcheck", - "sysinfo" => "sysinfo"); - - var $fai_activated = FALSE; - var $view_logged = FALSE; - - var $member_of_ogroup = FALSE; - - function termgeneric (&$config, $dn= NULL, $parent= NULL) - { - /* Check if FAI is activated */ - $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs')); - if(!empty($tmp)){ - $this->fai_activated = TRUE; - } - - plugin::plugin ($config, $dn, $parent); - - if(!isset($this->parent->by_object['ogroup'])){ - $ldap = $this->config->get_ldap_link(); - $ldap->cd ($this->config->current['BASE']); - $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))",array("cn")); - $this->member_of_ogroup = $ldap->count() >= 1; - } - - $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses); - /* Read arrays */ - foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){ - if (!isset($this->attrs[$val])){ - continue; - } - for ($i= 0; $i<$this->attrs[$val]['count']; $i++){ - array_push($this->$val, $this->attrs[$val][$i]); - } - } - - /* Create used ntp server array */ - $this->gotoNtpServer= array(); - if(isset($this->attrs['gotoNtpServer'])){ - $this->inheritTimeServer = false; - unset($this->attrs['gotoNtpServer']['count']); - foreach($this->attrs['gotoNtpServer'] as $server){ - $this->gotoNtpServer[$server] = $server; - } - } - - /* Set inherit checkbox state */ - if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){ - $this->inheritTimeServer = true; - $this->gotoNtpServer=array(); - } - - /* You can't inherit the NTP service, if we are not member in an object group */ - if(!$this->member_of_ogroup){ - $this->inheritTimeServer = FALSE; - } - - /* Create available ntp options */ - $this->gotoNtpServers = $this->config->data['SERVERS']['NTP']; - foreach($this->gotoNtpServers as $key => $server){ - if($server == "default"){ - unset($this->gotoNtpServers[$key]); - } - } - - $this->modes["disabled"]= _("disabled"); - $this->modes["text"]= _("text"); - $this->modes["graphic"]= _("graphic"); - - /* Set base */ - if ($this->dn == "new"){ - $ui= get_userinfo(); - $this->base= dn2base($ui->dn); - } else { - $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn); - } - - /* Create an array of all Syslog servers */ - $tmp = $this->config->data['SERVERS']['SYSLOG']; - foreach($tmp as $server){ - $visible = $server; - if($server == "default" && $this->member_of_ogroup) { - $visible = "["._("inherited")."]"; - } - $this->gotoSyslogServers[$server] = $visible; - } - - $this->orig_dn= $this->dn; - } - - function set_acl_base($base) - { - plugin::set_acl_base($base); - $this->netConfigDNS->set_acl_base($base); - } - - function set_acl_category($cat) - { - plugin::set_acl_category($cat); - $this->netConfigDNS->set_acl_category($cat); - } - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","terminal/".get_class($this),$this->dn); - } - - /* Do we need to flip is_account state? */ - if (isset($_POST['modify_state'])){ - $this->is_account= !$this->is_account; - } - - if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate")){ - - /* Set FAIstate */ - if($this->fai_activated && $this->dn != "new"){ - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->cat($this->dn,array("objectClass")); - $res = $ldap->fetch(); - - $attrs = array(); - $attrs['FAIstate'] = ""; - if(isset($this->mapActions[$_POST['saction']])){ - $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']]; - } - - for($i = 0; $i < $res['objectClass']['count'] ; $i ++){ - $attrs['objectClass'][] = $res['objectClass'][$i]; - } - - if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){ - $attrs['objectClass'][] = "FAIobject"; - } - - if($attrs['FAIstate'] == ""){ -#FIXME we should check if FAIobject is used anymore - $attrs['FAIstate'] = array(); - } - - $ldap->cd($this->dn); - $ldap->modify($attrs); - show_ldap_error($ldap->get_error(), sprintf(_("Saving of system terminal/generic (FAIstate) with dn '%s' failed."),$this->dn)); - } - - switch($_POST['saction']){ - case 'wake': - $cmd= $this->config->search("termgeneric", "WAKECMD",array('tabs')); - - if ($cmd == ""){ - print_red(_("No WAKECMD definition found in your gosa.conf")); - } else { - exec ($cmd." ".$this->netConfigDNS->macAddress, $dummy, $retval); - if ($retval != 0){ - print_red(sprintf(_("Execution of '%s' failed!"), $cmd)); - } - } - break; - - case 'reboot': - $cmd= $this->config->search("termgeneric", "REBOOTCMD",array('tabs')); - if ($cmd == ""){ - print_red(_("No REBOOTCMD definition found in your gosa.conf")); - } else { - exec ($cmd." ".$this->cn, $dummy, $retval); - if ($retval != 0){ - print_red(sprintf(_("Execution of '%s' failed!"), $cmd)); - } - } - break; - - case 'halt': - $cmd= $this->config->search("termgeneric", "HALTCMD",array('tabs')); - if ($cmd == ""){ - print_red(_("No HALTCMD definition found in your gosa.conf")); - } else { - exec ($cmd." ".$this->cn, $dummy, $retval); - if ($retval != 0){ - print_red(sprintf(_("Execution of '%s' failed!"), $cmd)); - } - } - break; - } - } - - /* Base select dialog */ - $once = true; - foreach($_POST as $name => $value){ - if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){ - $once = false; - $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases()); - $this->dialog->setCurrentBase($this->base); - } - } - - /* Dialog handling */ - if(is_object($this->dialog)){ - /* Must be called before save_object */ - $this->dialog->save_object(); - - if($this->dialog->isClosed()){ - $this->dialog = false; - }elseif($this->dialog->isSelected()){ - - /* A new base was selected, check if it is a valid one */ - $tmp = $this->get_allowed_bases(); - if(isset($tmp[$this->dialog->isSelected()])){ - $this->base = $this->dialog->isSelected(); - } - $this->dialog= false; - }else{ - return($this->dialog->execute()); - } - } - - /* Do we represent a valid terminal? */ - if (!$this->is_account && $this->parent === NULL){ - $display= "\"\" ". - _("This 'dn' has no terminal features.").""; - return($display); - } - - /* Add new ntp Server to our list */ - if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){ - $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers']; - } - - /* Delete selected NtpServer for list of used servers */ - if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){ - foreach($_POST['gotoNtpServerSelected'] as $name){ - unset($this->gotoNtpServer[$name]); - } - } - - /* Fill templating stuff */ - $smarty= get_smarty(); - - $tmp = $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $name => $translation){ - $smarty->assign($name."ACL",$this->getacl($name)); - } - - $smarty->assign("cn", $this->cn); - $smarty->assign("staticAddress", ""); - - $smarty->assign("bases", $this->get_allowed_bases()); - - /* tell smarty the inherit checkbox state */ - $smarty->assign("inheritTimeServer",$this->inheritTimeServer); - - /* Check if terminal is online */ - $query= "fping -q -r 1 -t 500 ".$this->cn; - exec ($query, $dummy, $retval); - - /* Offline */ - if ($retval == 0){ - $smarty->assign("actions", array( "halt" => _("Switch off"), - "reboot" => _("Reboot"), - "memcheck" => _("Memory test"), - "sysinfo" => _("System analysis"))); - } else { - $smarty->assign("actions", array("wake" => _("Wake up"), - "memcheck" => _("Memory test"), - "sysinfo" => _("System analysis"))); - } - - /* Arrays */ - $smarty->assign("modes", $this->modes); - - $tmp2 = array(); - foreach($this->config->data['SERVERS']['NFS'] as $server){ - if($server != "default"){ - $tmp2[$server]= $server; - }else{ - if($this->member_of_ogroup){ - $tmp2[$server]="["._("inherited")."]"; - } - } - } - - $smarty->assign("nfsservers", $tmp2); - $smarty->assign("syslogservers", $this->gotoSyslogServers); - - $tmp = array(); - foreach($this->gotoNtpServers as $server){ - if(!in_array($server,$this->gotoNtpServer)){ - $tmp[$server] = $server; - } - } - - $smarty->assign("ntpservers", $tmp); - $smarty->assign("fai_activated",$this->fai_activated); - - /* Variables */ - foreach(array("base", "gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){ - $smarty->assign($val."_select", $this->$val); - } - - $smarty->assign("member_of_ogroup",$this->member_of_ogroup); - - /* Show main page */ - $str = $this->netConfigDNS->execute(); - if(is_object($this->netConfigDNS->dialog)){ - return($str); - } - $smarty->assign("netconfig", $str); - return($smarty->fetch (get_template_path('terminal.tpl', TRUE))); - } - - function remove_from_parent() - { - if($this->acl_is_removeable()){ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $ldap->cat($this->dn, array('dn')); - if($ldap->count()){ - $this->netConfigDNS->remove_from_parent(); - $ldap->rmDir($this->dn); - - new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - - show_ldap_error($ldap->get_error(), sprintf(_("Removing of object system terminal/generic with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); - - /* Delete references to object groups */ - $ldap->cd ($this->config->current['BASE']); - $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn")); - while ($ldap->fetch()){ - $og= new ogroup($this->config, $ldap->getDN()); - unset($og->member[$this->dn]); - $og->save (); - } - } - } - } - - - /* Save data to object */ - function save_object() - { - /* Create a base backup and reset the - base directly after calling plugin::save_object(); - Base will be set seperatly a few lines below */ - $base_tmp = $this->base; - plugin::save_object(); - $this->base = $base_tmp; - - /* Set new base if allowed */ - $tmp = $this->get_allowed_bases(); - if(isset($_POST['base'])){ - if(isset($tmp[$_POST['base']])){ - $this->base= $_POST['base']; - } - } - - $this->netConfigDNS->save_object(); - - /* Save terminal path to parent since it is used by termstartup, too */ - if(isset($this->parent->by_object['termstartup'])){ - $this->parent->by_object['termstartup']->gotoTerminalPath= $this->gotoTerminalPath; - } - - if(isset($_POST['termgeneric_posted'])){ - if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){ - $this->inheritTimeServer = true; - }else{ - $this->inheritTimeServer = false; - } - } - - if(isset($_POST["inheritAll"])){ - $this->set_everything_to_inherited(); - } - - } - - - /* Check supplied data */ - function check() - { - /* Call common method to give check the hook */ - $message= plugin::check(); - - /* Skip IP & Mac checks if this is a template */ - if($this->cn != "default"){ - $message= array_merge($message, $this->netConfigDNS->check()); - } - - /* Permissions for that base? */ - $this->dn= "cn=".$this->cn.",".get_ou('terminalou').$this->base; - - if ($this->cn == ""){ - $message[]= _("The required field 'Terminal name' is not set."); - } - - /* Check if given name is a valid host/dns name */ - if(!tests::is_dns_name($this->cn) ){ - $message[] = _("Please specify a valid name for this object."); - } - - if ($this->orig_dn == 'new'){ - $ldap= $this->config->get_ldap_link(); - $ldap->cd ($this->base); - - /* It is possible to have a 'default' terminal on every base */ - if($this->cn == "default"){ - $ldap->cat($this->dn); - }else{ - $ldap->search ("(&(objectClass=gotoTerminal)(cn=".$this->cn."))", array("cn")); - } - if ($ldap->count() != 0){ - while ($attrs= $ldap->fetch()){ - if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".normalizePreg(get_ou('incomingou'))."/", $ldap->getDN())){ - continue; - } else { - if ($attrs['dn'] != $this->orig_dn){ - $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); - break; - } - } - } - } - } - - /* Check for valid ntpServer selection */ - if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){ - $message[]= _("There must be at least one NTP server selected, or the inherit mode activated."); - } - - return ($message); - } - - - /* Save to LDAP */ - function save() - { - - /* Move object if requested */ - if( $this->orig_dn != 'new' && $this->dn != $this->orig_dn){ - $this->move($this->orig_dn, $this->dn); - } - - plugin::save(); - - /* Strip out 'default' values */ - foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){ - if(isset($this->attrs[$val])){ - if ($this->attrs[$val] == "default"){ - $this->attrs[$val]= array(); - } - } - } - - /* Add missing arrays */ - foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){ - if (isset ($this->$val) && count ($this->$val) != 0){ - $this->attrs["$val"]= $this->$val; - } - } - - /* Remove all empty values */ - if ($this->orig_dn == 'new'){ - $attrs= array(); - foreach ($this->attrs as $key => $val){ - if (is_array($val) && count($val) == 0){ - continue; - } - $attrs[$key]= $val; - } - $this->attrs= $attrs; - } - - /* Set ntpServers */ - $this->attrs['gotoNtpServer'] = array(); - if(!$this->inheritTimeServer){ - foreach($this->gotoNtpServer as $server){ - $this->attrs['gotoNtpServer'][] = $server; - } - } - - /* Append gosaAdministrativeUnitTag to objectClass if gosaUnitTag isset */ - if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){ - $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag"; - } - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - if ($this->orig_dn == 'new'){ - $ldap->cd($this->config->current['BASE']); - $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); - $ldap->cd($this->dn); - if (!count($this->attrs['gotoNtpServer'])){ - unset($this->attrs['gotoNtpServer']); - } - $ldap->add($this->attrs); - new log("create","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); - } else { - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); - } - - /* cn=default and macAddress=- indicates that this is a template */ - if($this->cn == "default"){ - $this->netConfigDNS->macAddress = "-"; - } - - $this->netConfigDNS->cn = $this->cn; - $this->netConfigDNS->save(); - show_ldap_error($ldap->get_error(), sprintf(_("Saving of object system terminal/generic with dn '%s' failed."),$this->dn)); - } - - - - - - /* Display generic part for server copy & paste */ - function getCopyDialog() - { - $vars = array("cn"); - $smarty = get_smarty(); - $smarty->assign("cn" ,$this->cn); - $smarty->assign("object","terminal"); - $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); - $ret = array(); - $ret['string'] = $str; - $ret['status'] = ""; - return($ret); - } - - - function saveCopyDialog() - { - if(isset($_POST['cn'])){ - $this->cn = $_POST['cn']; - } - } - - - function PrepareForCopyPaste($source) - { - plugin::PrepareForCopyPaste($source); - if(isset($source['macAddress'][0])){ - $this->netConfigDNS->macAddress = $source['macAddress'][0]; - } - if(isset($source['ipHostNumber'][0])){ - $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0]; - } - - /* Create used ntp server array */ - $this->gotoNtpServer= array(); - if(isset($source['gotoNtpServer'])){ - $this->inheritTimeServer = false; - unset($source['gotoNtpServer']['count']); - foreach($source['gotoNtpServer'] as $server){ - $this->gotoNtpServer[$server] = $server; - } - } - - /* Set inherit checkbox state */ - if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){ - $this->inheritTimeServer = true; - $this->gotoNtpServer=array(); - } - } - - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Terminal"), - "plDescription" => _("Terminal generic"), - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 1, - "plSection" => array("administration"), - "plCategory" => array("terminal" => array( "description" => _("Terminal"), - "objectClass" => "gotoTerminal")), - "plProvidedAcls"=> array( - "gotoMode" => _("Mode"), - "gotoTerminalPath" => _("Root server"), - "gotoSwapServer" => _("Swap server"), - "gotoSyslogServer" => _("Syslog server enabled"), - "gotoNtpServer" => _("Ntp server settings"), - "base" => _("Base"), - "cn" => _("Name"), - "gotoRootPasswd" => _("Root password"), - "FAIstate" => _("Action flag")) - )); - } - - - function set_everything_to_inherited() - { - $this->gotoTerminalPath = "default"; - $this->gotoSwapServer = "default" ; - $this->gotoSyslogServer = "default"; - $this->inheritTimeServer = TRUE; - - /* Set workstation service attributes to inherited */ - if($this->member_of_ogroup && isset($this->parent->by_object['termservice'])){ - foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant", - "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){ - $this->parent->by_object['termservice']->$name = "default"; - } - } - - /* Set workstation startup attributes to inherited */ - if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){ - $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited"; - $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited"; - } - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/class_terminalInfo.inc b/gosa-core/plugins/admin/systems/class_terminalInfo.inc deleted file mode 100644 index 0a21884d2..000000000 --- a/gosa-core/plugins/admin/systems/class_terminalInfo.inc +++ /dev/null @@ -1,255 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* Generic terminal attributes */ - var $ghCpuType= "-"; - var $ghMemSize= "-"; - var $macAddress= "-"; - var $ghUsbSupport= "-"; - var $ghNetNic= array(); - var $ghIdeDev= array(); - var $ghScsiDev= array(); - var $ghGfxAdapter= "-"; - var $ghSoundAdapter= "-"; - var $ghInventoryNumber= "-"; - var $gotoLastUser= "-"; - var $gotoFloppyEnable= ""; - var $gotoCdromEnable= ""; - - /* Needed values and lists */ - var $base= ""; - var $cn= ""; - var $view_logged = FALSE; - - /* attribute list for save action */ - var $ignore_account= TRUE; - var $attributes= array("cn", "gotoMode", "gotoTerminalPath", "gotoFloppyEnable", - "gotoCdromEnable", "ghInventoryNumber", - "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer", - "ghCpuType", "ghMemSize", "macAddress", "ghUsbSupport", - "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser"); - var $objectclasses= array("GOhard"); - - function terminfo (&$config, $dn= NULL, $parent= NULL) - { - plugin::plugin ($config,$dn); - - /* Read arrays */ - foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){ - if (!isset($this->attrs[$val])){ - continue; - } - for ($i= 0; $i<$this->attrs[$val]['count']; $i++){ - array_push($this->$val, $this->attrs[$val][$i]); - } - } - - /* Fix USB entry */ - if ($this->ghUsbSupport == "true"){ - $this->ghUsbSupport= _("present"); - } - } - - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","terminal/".get_class($this),$this->dn); - } - - /* Do we represent a valid terminal? */ - if (!$this->is_account && $this->parent === NULL){ - echo "\"\" ". - _("This 'dn' has no terminal features.").""; - return; - } - - $smarty= get_smarty(); - $display= ""; - if(!is_callable("snmpget")){ - print_red(_("There is no php snmp module installed, can't gather any informations.")); - - $smarty->assign("load", progressbar(0,100,15,true)); - $smarty->assign("mem", progressbar(0,100,15,true)); - $smarty->assign("swap", progressbar(0,100,15,true)); - foreach(array("uptime", "sshd", "X", "saned", "artsd", "cupsd","status","ghNetNic", "ghIdeDev", "ghScsiDev","FloppyDevice", "CdromDevice","active") as $val){ - $smarty->assign("$val", ""._("unknown status").""); - } - - - $display =""; - }else - /* Default entry? */ - if ($this->cn == "default"){ - $display= "

"; - $display.= _("This is a virtual terminal which has no properties to show here."); - $display.= "
"; - } else { - - /* Get template object */ - $smarty->assign("staticAddress", ""); - - /* Prevent undefined variable .... */ - $smarty->assign("load", progressbar(0,100,15,true)); - $smarty->assign("mem", progressbar(0,100,15,true)); - $smarty->assign("swap", progressbar(0,100,15,true)); - - /* Check if terminal is online */ - $query= "fping -q -r 1 -t 500 ".$this->cn; - exec ($query, $dummy, $retval); - - if ($retval == 0){ - $smarty->assign("status", _("online")); - $smarty->assign("active", "true"); - - /* Fill data if we have snmp */ - $host= $this->cn; - - /* Use 'goto' as snmp community or the configured value from the config */ - $community= 'goto'; - $str = search_config($this->config->data['TABS'],"terminfo","SNMPCOMMUNITY"); - if(!empty($str)){ - $community = $str; - } - - /* Get memory informations */ - if(!is_callable("snmpget")){ - $MemFree = false; - }else{ - $MemFree= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memAvailReal.0"); - } - if ($MemFree != FALSE){ - $MemFree= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $MemFree); - $MemTotal= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memTotalReal.0"); - $MemTotal= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $MemTotal); - if ($MemTotal != 0){ - $smarty->assign("mem",progressbar( (int)(($MemTotal - $MemFree)*100/$MemTotal),100,15,true)); - ; - } - $SwapFree= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memAvailSwap.0"); - $SwapFree= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $SwapFree); - $SwapTotal= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memTotalSwap.0"); - $SwapTotal= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $SwapTotal); - if ($SwapTotal != 0){ -#$smarty->assign("swap", (int)(($SwapTotal - $SwapFree)*100/$SwapTotal)); - $smarty->assign("swap", progressbar(0,100,15,true)); - } - - /* Get system uptime */ - $sysup= @snmpget($host, $community, "SNMPv2-MIB::sysUpTime.0"); - $smarty->assign("uptime", preg_replace('/^.* ([0-9:]+)\..*$/', '\\1', $sysup)); - - /* Get system load */ - $sysload= @snmpget($host, $community, "UCD-SNMP-MIB::laLoad.2"); - $sysload= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $sysload); - - $smarty->assign("load", progressbar($sysload*100,100,15,true)); - - /* Get status for key processes */ - $processes= @snmpwalk($host, $community, "UCD-SNMP-MIB::prNames"); - $check4= array("sshd", "cupsd", "artsd", "X", "saned"); - foreach ($check4 as $pname){ - $eflag= -1; - foreach ($processes as $key => $val){ - $process= preg_replace('/^.*[:=] (.*)$/', '\\1', $val); - if ($process == $pname){ - $index= preg_replace('/^.*\.([0-9]+) [:=] .*$/', '\\1', $val); - $res= @snmpget($host, $community, "UCD-SNMP-MIB::prErrorFlag.$index"); - $eflag= preg_replace('/^.*[:=] /', '', $res); - break; - } - } - switch ($eflag){ - case 0: - $smarty->assign("$pname", "\""._("running")."\""); - break; - case 1: - $smarty->assign("$pname", "\""._("not"); - break; - default: - $smarty->assign("$pname", _("not defined")); - } - } - } else { - foreach(array("uptime", "sshd", "X", "saned", "artsd", "cupsd") as $val){ - $smarty->assign("$val", ""._("unknown status").""); - } - } - /* Check for mounted partitions (show max 8 partitions) */ - $partitions= ""; - for ($n= 1; $n<9; $n++){ - $device= @snmpget($host, $community, "UCD-SNMP-MIB::dskDevice.$n"); - if ($device == ""){ - break; - } - $device= preg_replace('/^STRING: */', '', $device); - $usage= @snmpget($host, $community, "UCD-SNMP-MIB::dskPercent.$n"); - $usage= preg_replace('/^INTEGER: */', '', $usage); - $partitions.= "$device".progressbar($usage,100,16,true)."\n"; - } - $smarty->assign("partitions", $partitions); - } else { - $smarty->assign("status", _("offline")); - $smarty->assign("active", "false"); - } - - /* Set floppy and cdrom status */ - foreach(array("Floppy", "Cdrom") as $val){ - $name= "goto".$val."Enable"; - if ($this->$name == "YES"){ - $status= _("present"); - } else { - $status= "-"; - } - $smarty->assign($val."Device", $status); - } - - /* Show main page */ - foreach(array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){ - if (!count($this->$val)){ - $this->$val= "-"; - } - $smarty->assign($val, $this->$val); - } - } - foreach(array("ghCpuType", "ghMemSize", "macAddress", "ghUsbSupport", - "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "ghInventoryNumber") as $val){ - - $smarty->assign($val, $this->$val); - } - $display= $smarty->fetch (get_template_path('info.tpl', TRUE)); - - return ($display); - } - - function remove_from_parent() - { - } - - - /* Save data to object */ - function save_object() - { - plugin::save_object(); - } - - - /* Save to LDAP */ - function save() - { - } - -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/class_terminalService.inc b/gosa-core/plugins/admin/systems/class_terminalService.inc deleted file mode 100644 index 54e1d865d..000000000 --- a/gosa-core/plugins/admin/systems/class_terminalService.inc +++ /dev/null @@ -1,527 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* Generic terminal attributes */ - var $gotoLpdEnable= FALSE; - var $gotoXMonitor= ""; - var $gotoXMethod= ""; - var $gotoXdmcpServer= ""; - var $gotoFontPath= ""; - var $gotoXDriver= ""; - var $gotoXResolution= ""; - var $gotoXColordepth= ""; - var $gotoXHsync= ""; - var $gotoXVsync= ""; - var $gotoXKbModel= ""; - var $gotoXKbLayout= ""; - var $gotoXKbVariant= ""; - var $gotoXMouseType= ""; - var $gotoXMouseport= ""; - var $gotoLpdServer= ""; - var $gotoScannerEnable= ""; - var $gotoScannerModel= ""; - var $gotoScannerClients= ""; - var $gotoScannerBackend= ""; - var $goFonHardware= "automatic"; - - var $AutoSync = false; - var $view_logged = FALSE; - - /* Needed values and lists */ - var $ignore_account= TRUE; - var $base= ""; - var $cn= ""; - var $orig_dn= ""; - var $XMethods= array(); - var $XDrivers= array(); - var $XResolutions= array(); - var $XColordepths= array(); - var $XKbModels= array (); - var $XKbLayouts= array (); - var $XKbVariants= array (); - var $MouseTypes= array(); - var $MousePorts= array(); - var $gotoScannerModels= array(); - var $hardware_list= array(); - var $used_hardware= array(); - - - /* attribute list for save action */ - var $attributes= array("cn", "gotoLpdEnable", "gotoXMonitor", "gotoXMethod", "gotoXdmcpServer", - "gotoFontPath", "gotoXDriver", "gotoXResolution", "gotoXColordepth", - "gotoXHsync", "gotoXVsync", "gotoLpdEnable", "gotoLpdServer", - "gotoScannerEnable", "gotoScannerModel", "gotoScannerClients", - "gotoScannerBackend", "gotoXKbModel", "gotoXKbLayout", "gotoXKbVariant", - "gotoXMouseType", "gotoXMouseport", "goFonHardware"); - var $objectclasses= array("GOhard"); - - - function termservice (&$config, $dn= NULL, $parent= NULL) - { - plugin::plugin ($config, $dn, $parent); - - /* Get list of available xdrivers */ - $this->XDrivers = $this->getListOfXDrivers(); - array_unshift($this->XDrivers, "["._("unknown")."]"); - - $this->XResolutions= array( - "default" => "["._("inherited")."]" , - "640x480" => "640x480", - "800x600" => "800x600", - "1024x768" => "1024x768", - "1152x864" => "1152x864", - "1280x1024" => "1280x1024", - "1400x1050" => "1400x1050", - "1600x1200" => "1600x1200"); - - if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){ - $file = $this->config->data['MAIN']['RESOLUTION_HOOK']; - - if(is_readable($file)){ - $str = file_get_contents($file); - $lines = split("\n",$str); - foreach($lines as $line){ - $line = trim($line); - if(!empty($line)){ - $this->XResolutions[$line]=$line; - } - } - //natcasesort($this->gotoXResolutions); - }else{ - print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file)); - } - } - - $this->XColordepths= array( - "default" => "["._("inherited")."]", - "8" => "8 " ._("bit"), - "15" => "15 "._("bit"), - "16" => "16 "._("bit"), - "24" => "24 "._("bit")); - - $this->XKbModels['default']= "["._("inherited")."]"; - foreach(array ("btc9000", "chicony", "compaq", "dell", "dell101", "everex", - "flexpro", "geniuscomfy", "hp", "itouch", "jp106", "logicordless", - "logiinetnav", "logiinternet", "macintosh", "microsoft", - "microsoftpro", "omnikey101", "pc101", "pc102", "pc104", - "pc105", "rapidaccess", "rapidaccess2", "winbook") as $type){ - $this->XKbModels[$type] = $type; - } - - /* Additional values will be extracted from CONFIG_DIR.keyboardLayouts */ - $this->XKbLayouts= array ("default"=>"["._("inherited")."]","de"=> "de","intl" =>"intl","us" =>"us"); - $this->XKbVariants= array ("default"=>"["._("inherited")."]", "nodeadkeys"=>"nodeadkeys", "basic"=>"basic"); - - $this->MouseTypes= array( "AUTO" => "["._("inherited")."]" , "ImPS/2" => "ImPS/2", - "PS/2" => "PS/2" , "Microsoft" => "Microsoft", - "Logitech" => "Logitech"); - - $this->MousePorts= array("AUTO" =>"["._("inherited")."]" , "/dev/ttyS0" => "/dev/ttyS0", - "/dev/ttyS1" => "/dev/ttyS1" , "/dev/psaux" => "/dev/psaux", - "/dev/input/mice" =>"/dev/input/mice"); - - - /* try to read additional keyboard layouts - */ - if(file_exists(CONFIG_DIR."/keyboardLayouts")){ - if(is_readable(CONFIG_DIR."/keyboardLayouts")){ - $str = file_get_contents(CONFIG_DIR."/keyboardLayouts"); - $tmp = split("\n",$str); - foreach($tmp as $entry){ - if((!empty($entry)) && (!preg_match("/^#/",$entry))){ - $entry = trim($entry); - $tmp2 = split ("\:",$entry); - $la = trim($tmp2[0]); // What would be saved to ldap - $da = trim($tmp2[1]); // This wis displayed in the listbox - $this->XKbLayouts [ $la] = $da; - } - } - } - } - - /* Load scanner models */ - $fcontents = file (CONFIG_DIR."/scanner-list"); - while (list ($line_num, $line) = each ($fcontents)) { - preg_match('/^(\w+) "([^"]+)" "([^"]+)" "([^"]+)"/', "$line", $matches); - $this->gotoScannerModels[$matches[2]." - ".$matches[3]]= $matches[1]."|".$matches[4]; - } - ksort ($this->gotoScannerModels); - - /* Initialize methods */ - $this->XMethods["default"]= _("default"); - $this->XMethods["indirect"]= _("show chooser"); - $this->XMethods["query"]= _("direct"); -#$this->XMethods["squery"]= _("direct via ssh"); -#$this->XMethods["nquery"]= _("direct via nx"); - $this->XMethods["load"]= _("load balanced"); -#$this->XMethods["sload"]= _("load balanced via ssh"); -#$this->XMethods["nload"]= _("load balanced via nx"); - $this->XMethods["rdp"]= _("Windows RDP"); - $this->XMethods["citrix"]= _("ICA client"); - - $this->orig_dn= $this->dn; - - /* Load hardware list */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(objectClass=goFonHardware)", array('cn', 'description')); - while ($attrs= $ldap->fetch()){ - $cn= $attrs['cn'][0]; - if (isset($attrs['description'])){ - $description= " - ".$attrs['description'][0]; - } else { - $description= ""; - } - $this->hardware_list[$cn]= "$cn$description"; - } - - /* Eventually colorize phones */ - $ldap->cd($this->config->current['BASE']); - $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware')); - while($attrs = $ldap->fetch()){ - $cn = $attrs['goFonHardware'][0]; - if(isset($this->hardware_list[$cn])){ - $this->used_hardware[$cn]= $cn; - } - } - - $this->hardware_list["automatic"]= _("automatic"); - ksort($this->hardware_list); - - /* 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']); - $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))"); - if ($ldap->count() == 1){ - $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout", - "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport"); - $attrs= $ldap->fetch(); - - foreach ($map as $name){ - if (!isset($attrs[$name][0])){ - continue; - } - - switch ($name){ - case 'gotoXResolution': - $this->XResolutions['default'] = _("inherited").' ['.$attrs[$name][0].']' ; - break; - case 'gotoXColordepth': - $this->XColordepths['default'] = _("inherited").' ['.$attrs[$name][0].' '._('Bit').']'; - break; - case 'gotoXKbModel': - $this->XKbModels['default'] = _("inherited").' ['.$attrs[$name][0].']'; - break; - case 'gotoXKbLayout': - $this->XKbLayouts['default'] = _("inherited").' ['.$attrs[$name][0].']'; - break; - case 'gotoXKbVariant': - $this->XKbVariants['default'] = _("inherited").' ['.$attrs[$name][0].']' ; - break; - case 'gotoXMouseType': - $this->MouseTypes['AUTO'] = _("inherited").' ['.$attrs[$name][0].']' ; - break; - case 'gotoXMouseport': - $this->MousePorts['AUTO'] = _("inherited").' ['.$attrs[$name][0].']' ; - break; - } - } - } - if(preg_match("/\+/",$this->gotoXHsync)){ - $this->AutoSync = true; - $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync); - $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync); - } - } - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","terminal/".get_class($this),$this->dn); - } - - /* Do we need to flip is_account state? */ - if (isset($_POST['modify_state'])){ - $this->is_account= !$this->is_account; - } - - /* Do we represent a valid terminal? */ - if (!$this->is_account && $this->parent === NULL){ - $display= "\"\" ". - _("This 'dn' has no terminal features.").""; - return ($display); - } - - /* Show main page */ - $smarty= get_smarty(); - - /* Assign acls */ - $tmp= $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $name => $translation){ - $smarty->assign($name."ACL",$this->getacl($name)); - } - - - /* Arrays */ - foreach(array("XMethods", "XDrivers", "XResolutions", "XColordepths", - "gotoScannerModels", "XKbModels","XKbVariants", - "MouseTypes", "MousePorts") as $val){ - $smarty->assign("$val", $this->$val); - } - $smarty->assign("XKbLayouts", $this->XKbLayouts); - $smarty->assign("XKbLayoutKeys",array_flip($this->XKbLayouts)); - - $smarty->assign("xdmcpservers", $this->config->data['SERVERS']['TERMINAL']); - $smarty->assign("fontservers", $this->config->data['SERVERS']['FONT']); - $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']); - $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']); - - /* Variables - select */ - foreach(array("gotoXMethod", "gotoXdmcpServer", "gotoFontPath", - "gotoXDriver", "gotoXResolution", "gotoXColordepth", - "gotoLpdServer", "gotoScannerModel", "gotoXKbModel", "gotoXKbLayout", - "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){ - - $smarty->assign($val."_select", $this->$val); - } - - /* Variables */ - foreach(array("gotoXHsync", "gotoXVsync") as $val){ - $smarty->assign($val, $this->$val); - } - $smarty->assign("staticAddress", ""); - - /* Checkboxes */ - foreach(array("gotoLpdEnable", "gotoScannerEnable") as $val){ - if ($this->$val == TRUE) { - $smarty->assign("$val", "checked"); - } else { - $smarty->assign("$val", ""); - } - } - - /* Phone stuff */ - $smarty->assign ("goFonHardware", $this->goFonHardware); - $hl= "\n"; - $smarty->assign ("hardware_list", $hl); - $smarty->assign ("gotoXMonitor", $this->gotoXMonitor); - - $smarty->assign("AutoSyncACL",$this->getacl("AutoSync")); - - $smarty->assign("AutoSyncCHK"," "); - if($this->AutoSync){ - $smarty->assign("AutoSyncCHK"," checked "); - $smarty->assign("gotoXVsyncACL", preg_replace("/w/","",$this->getacl("gotoXVsync"))); - $smarty->assign("gotoXHsyncACL", preg_replace("/w/","",$this->getacl("gotoXHsync"))); - } - - /* Show main page */ - return($smarty->fetch (get_template_path('terminalService.tpl', TRUE))); - } - - function remove_from_parent() - { - new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs)); - $this->handle_post_events("remove"); - } - - - /* Save data to object */ - function save_object() - { - plugin::save_object(); - - /* Save checkbox state */ - if (isset ($_POST['gotoXMethod'])){ - foreach (array("gotoLpdEnable", "gotoScannerEnable") as $val){ - - if($this->acl_is_writeable($val)){ - if (!isset ($_POST["$val"])){ - $this->$val= FALSE; - } else { - $this->$val= TRUE; - } - } - } - } - - if(isset($_POST['gotoXDriver'])){ - if(isset($_POST['AutoSync'])){ - $this->AutoSync = true; - }else{ - $this->AutoSync = false; - } - } - - /* Default entries can use blank hsync/vsync entries */ - if ($this->dn != "" && $this->cn != "default" && $this->cn != "default"){ - - /* But only if no auto sync is enabled... */ - if (!$this->AutoSync){ - - /* Check vsync for correct usage */ - $val= preg_replace ("/\s/", "", $this->gotoXVsync); - if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXVsync")){ - - $message[]= _("Please specify a valid VSync range."); - } elseif ($this->acl_is_writeable("gotoXVsync")){ - list($v1,$v2)= preg_split ("/[-+]/", $val); - if ($v2 != ""){ - if ($v1 > $v2){ - $message[]= _("Please specify a valid VSync range."); - } - } - } - - /* Check hsync for correct usage */ - $val= preg_replace ("/\s/", "", $this->gotoXHsync); - if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXHsync")){ - - $message[]= _("Please specify a valid HSync range."); - } elseif ($this->acl_is_writeable("gotoXHsync")){ - list($v1,$v2)= preg_split ("/[-+]/", $val); - if ($v2 != ""){ - if ($v1 > $v2){ - $message[]= _("Please specify a valid HSync range."); - } - } - } - } - } - } - - - /* Check supplied data */ - function check() - { - /* Call common method to give check the hook */ - $message= plugin::check(); - return ($message); - } - - - /* Save to LDAP */ - function save() - { - /* Convert to string */ - $this->gotoLpdEnable= $this->gotoLpdEnable?"Yes":"No"; - - plugin::save(); - - /* Strip out 'default' values */ - foreach(array("gotoXMethod", "gotoXdmcpServer", "gotoFontPath", - "gotoXDriver", "gotoXResolution", "gotoXColordepth", - "gotoLpdServer", "gotoScannerModel", "gotoXKbModel", "gotoXKbLayout", - "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){ - - if ($this->attrs[$val] == "default"){ - $this->attrs[$val]= array(); - } - } - - if($this->AutoSync){ - $this->attrs['gotoXHsync'] = "30+55"; - $this->attrs['gotoXVsync'] = "50+70"; - } - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - - show_ldap_error($ldap->get_error(), sprintf(_("Saving of object system terminal/service with dn '%s' failed."),$this->dn)); - $this->handle_post_events("modify"); - } - - - function getListOfXDrivers() - { - $drivers = array(); - - /* Generate a list of xdrivers from CONFIG_DIR/xdrivers */ - if (file_exists(CONFIG_DIR.'/xdrivers')){ - $xdrivers = file (CONFIG_DIR.'/xdrivers'); - foreach ($xdrivers as $line){ - if (!preg_match ("/^#/", $line)){ - $drivers[]= trim($line); - } - } - } else { - $drivers = array("ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx", - "i128", "i740", "i810", "imstt", "mga", "neomagic", "newport", "nsc", "nv", "nvidia", - "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion", - "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware"); - } - return($drivers); - } - - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Service"), - "plDescription" => _("Terminal service"), - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 3, - "plSection" => array("administration"), - "plCategory" => array("terminal"), - - "plProvidedAcls"=> array( - "gotoXMonitor" => _("Monitor"), - "gotoXMethod" => _("Method"), - "gotoXdmcpServer" => _("Remote desktop"), - "gotoFontPath" => _("Font path"), - "gotoXDriver" => _("Gfx driver"), - "gotoXResolution" => _("Gfx resolution"), - "gotoXColordepth" => _("Gfx color depth"), - "gotoXHsync" => _("Hsync"), - "gotoXVsync" => _("Vsync"), - "AutoSync" => _("Auto-Sync"), - "gotoLpdEnable" => _("Printer service enabled"), - "gotoLpdServer" => _("Spool server"), - "gotoScannerEnable" => _("Scanner enabled"), - "gotoScannerModel" => _("Scanner model"), - "gotoXKbModel" => _("Keyboard model"), - "gotoXKbLayout" => _("Keyboard layout"), - "gotoXKbVariant" => _("Keyboard variant"), - "gotoXMouseType" => _("Mouse type"), - "gotoXMouseport" => _("Mouse port"), - "goFonHardware" => _("Telephone hardware")) - )); - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/class_terminalStartup.inc b/gosa-core/plugins/admin/systems/class_terminalStartup.inc deleted file mode 100644 index 362bc7d8c..000000000 --- a/gosa-core/plugins/admin/systems/class_terminalStartup.inc +++ /dev/null @@ -1,582 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* Generic terminal attributes */ - var $bootmode= "G"; - var $goLdapServerList= array(); - var $gotoBootKernel= "default-inherit"; - var $gotoKernelParameters= ""; - var $gotoLdapServer= ""; - var $gotoModules= array(); - var $gotoTerminalPath= ""; - var $gotoBootKernels= array(); - - /* Ldap server list */ - var $gotoLdapServers = array(); - var $gotoLdapServerList = array(); - var $gotoLdap_inherit = FALSE; - - /* Share */ - var $gotoShares = array();// Currently Share Option - var $gotoShare = ""; // currently selected Share Option - var $gotoShareSelections= array();// Available Shares for this account in Listbox format - var $gotoAvailableShares= array();// Available Shares for this account - - - /* attribute list for save action */ - var $attributes= array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters","gotoModules"); - var $objectclasses= array("GOhard"); - var $view_logged = FALSE; - - /* Helper */ - var $customParameters= ""; - var $orig_dn= ""; - var $ignore_account= TRUE; - - function termstartup (&$config, $dn= NULL, $parent= NULL) - { - plugin::plugin ($config, $dn, $parent); - - $this->gotoBootKernels = array("default-inherit"=>"["._("inherited")."]"); - - /* Get arrays */ - foreach (array("gotoModules") as $val){ - $this->$val = array(); - if (isset($this->attrs["$val"]["count"])){ - for ($i= 0; $i<$this->attrs["count"]; $i++){ - if (isset($this->attrs["$val"][$i])){ - array_push($this->$val, $this->attrs["$val"][$i]); - } - } - } - sort ($this->$val); - $this->$val= array_unique($this->$val); - } - - /* Parse Kernel Parameters to decide what boot mode is enabled */ - if (preg_match("/ splash=silent/", $this->gotoKernelParameters)){ - $this->bootmode= "G"; - } elseif (preg_match("/ debug/", $this->gotoKernelParameters)){ - $this->bootmode= "D"; - } elseif ($this->gotoKernelParameters == "") { - $this->bootmode= "G"; - } else { - $this->bootmode= "T"; - } - if (preg_match("/ o /", $this->gotoKernelParameters)){ - $this->customParameters= preg_replace ("/^.* o /", "", $this->gotoKernelParameters); - } else { - $this->customParameters= ""; - } - - /* Prepare Shares */ - if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){ - unset($this->attrs['gotoShare']['count']); - foreach($this->attrs['gotoShare'] as $share){ - $tmp = $tmp2 = array(); - $tmp = split("\|",$share); - $tmp2['server'] =$tmp[0]; - $tmp2['name'] =$tmp[1]; - $tmp2['mountPoint'] =$tmp[2]; - $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2; - } - } - - $this->gotoShareSelections= $config->getShareList(true); - $this->gotoAvailableShares= $config->getShareList(false); - - $this->orig_dn= $this->dn; - - /* Get list of boot kernels */ - if (isset($this->config->data['TABS'])){ - $command= $this->config->search(get_class($this), "KERNELS",array('tabs')); - - if (!check_command($command)){ - $message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command, - get_class($this)); - } else { - $fh= popen($command, "r"); - while (!feof($fh)) { - $buffer= trim(fgets($fh, 256)); - - if(!empty($buffer)){ - - $name=$value = $buffer; - - if(preg_match("/:/",$buffer)){ - $name = preg_replace("/:.*$/","",$buffer); - $value= preg_replace("/^.*:/","",$buffer); - $this->gotoBootKernels[$name]= $name.":".$value; - }else{ - $this->gotoBootKernels[$name]= $value; - } - } - } - pclose($fh); - } - - } - - foreach($this->config->data['SERVERS']['LDAP'] as $server) { - $this->gotoLdapServerList[]= $server; - } - if(isset($this->attrs['gotoLdapServer'])){ - unset($this->attrs['gotoLdapServer']['count']); - sort($this->attrs['gotoLdapServer']); - foreach($this->attrs['gotoLdapServer'] as $value){ - $this->gotoLdapServers[] = preg_replace("/^[0-9]*:/","",$value); - } - } - if(!count($this->gotoLdapServers)){ - $this->gotoLdap_inherit = TRUE; - } - - /* Load hardware list */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))"); - if ($ldap->count() == 1){ - $map= array("gotoLdapServer"); - $attrs= $ldap->fetch(); - - foreach ($map as $name){ - if (!isset($attrs[$name][0])){ - continue; - } - - switch ($name){ - case 'gotoLdapServer': - $this->goLdapServerList= array_merge(array('default-inherit' => _("inherited").' ['.$attrs[$name][0].']' ), $this->goLdapServerList); - break; - } - } - } - } - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","terminal/".get_class($this),$this->dn); - } - - /* Do we need to flip is_account state? */ - if (isset($_POST['modify_state'])){ - $this->is_account= !$this->is_account; - } - - /* Do we represent a valid terminal? */ - if (!$this->is_account && $this->parent === NULL){ - $display= "\"\" ". - _("This 'dn' has no terminal features.").""; - return ($display); - } - - /* Add module */ - if (isset ($_POST['add_module'])){ - if ($_POST['module'] != "" && $this->acl_is_writeable("gotoMode")){ - $this->add_list ($this->gotoModules, $_POST['module']); - } - } - - /* Delete module */ - if (isset ($_POST['delete_module'])){ - if (count($_POST['modules_list']) && $this->acl_is_writeable("gotoMode")){ - $this->del_list ($this->gotoModules, $_POST['modules_list']); - } - } - - /* Show main page */ - $smarty= get_smarty(); - - /* Assign acls */ - $tmp = $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $name => $translation){ - $smarty->assign($name."ACL",$this->getacl($name)); - } - - - /* In this section server shares will be defined - * A user can select one of the given shares and a mount point - * and attach this combination to his setup. - */ - $smarty->assign("gotoShareSelections", $this->gotoShareSelections); - $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections)); - $smarty->assign("gotoBootKernels",$this->gotoBootKernels); - - /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry - * This entry will be, a combination of mountPoint and sharedefinitions - */ - if(isset($_POST['gotoShareAdd']) && $this->acl_is_writeable("gotoShare")){ - /* We assign a share to this user, if we don't know where to mount the share */ - if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){ - print_red(_("You must specify a valid mount point.")); - }else{ - $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']]; - $s_mount = $_POST['gotoShareMountPoint']; - /* Preparing the new assignment */ - $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share; - $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount; - } - } - - /* if the Post gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected) - * If there is no defined share selected, we will abort the deletion without any message - */ - if((isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare'])) && $this->acl_is_writeable("gotoShare")){ - unset($this->gotoShares[$_POST['gotoShare']]); - } - - $smarty->assign("gotoShares",$this->printOutAssignedShares()); - $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares())); - - /* Create divSelectBox for ldap server selection - */ - $SelectBoxLdapServer = new divSelectBox("LdapServer"); - $SelectBoxLdapServer->SetHeight(80); - - /* Add new ldap server to the list */ - if(!$this->gotoLdap_inherit && isset($_POST['add_ldap_server']) && isset($_POST['ldap_server_to_add'])){ - if(isset($this->gotoLdapServerList[$_POST['ldap_server_to_add']])){ - $to_add = $this->gotoLdapServerList[$_POST['ldap_server_to_add']]; - if(!in_array($to_add,$this->gotoLdapServers)){ - $this->gotoLdapServers[] = $to_add; - } - } - } - - /* Move ldap servers up and down */ - if(!$this->gotoLdap_inherit){ - foreach($_POST as $name => $value){ - if(preg_match("/sort_ldap_up_/",$name)){ - $id = preg_replace("/^sort_ldap_up_([0-9]*)_(x|y)$/","\\1",$name); - $from = $id; - $to = $id -1; - $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to); - if($tmp){ - $this->gotoLdapServers = $tmp; - } - break; - } - if(preg_match("/sort_ldap_down_/",$name)){ - $id = preg_replace("/^sort_ldap_down_([0-9]*)_(x|y)$/","\\1",$name); - $from = $id; - $to = $id +1; - $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to); - if($tmp){ - $this->gotoLdapServers = $tmp; - } - break; - } - if(preg_match("/gotoLdapRemove_/",$name)){ - $id = preg_replace("/^gotoLdapRemove_([0-9]*)_(x|y)$/","\\1",$name); - $value = $this->gotoLdapServers[$id]; - $this->gotoLdapServers = array_remove_entries(array($value),$this->gotoLdapServers); - break; - } - } - } - /* Add Entries - */ - foreach($this->gotoLdapServers as $key => $server){ - if(!in_array($server,$this->gotoLdapServerList)){ - $server = $server." (missing)"; - } - - $SelectBoxLdapServer->AddEntry( - array(array("string" => $server), - array("string" => - " ". - " ". - "", - "attach" => "style='text-align:right;width:40px;border-right:0px;'"))); - } - - if($this->gotoLdap_inherit){ - $smarty->assign("gotoLdapServerACL_inherit", preg_replace("/w/","",$this->getacl("gotoLdapServer")));; - }else{ - $smarty->assign("gotoLdapServerACL_inherit", $this->getacl("gotoLdapServer")); - } - - $list = array(); - foreach($this->gotoLdapServerList as $key => $entry){ - if(!in_array($entry,$this->gotoLdapServers)){ - $list[$key] = $entry; - } - } - $smarty->assign("gotoLdapServers", $SelectBoxLdapServer->DrawList()); - $smarty->assign("gotoLdapServerList", $list); - $smarty->assign("gotoLdap_inherit", $this->gotoLdap_inherit); - $smarty->assign("JS", session::get('js')); - - foreach (array("gotoModules" ) as $val){ - $smarty->assign("$val", $this->$val); - } - - /* Values */ - foreach(array("gotoBootKernel", "customParameters") as $val){ - $smarty->assign($val, $this->$val); - } - - /* Radio button group */ - if (preg_match("/G/", $this->bootmode)) { - $smarty->assign("graphicalbootup", "checked"); - } else { - $smarty->assign("graphicalbootup", ""); - } - if (preg_match("/T/", $this->bootmode)) { - $smarty->assign("textbootup", "checked"); - } else { - $smarty->assign("textbootup", ""); - } - if (preg_match("/D/", $this->bootmode)) { - $smarty->assign("debugbootup", "checked"); - } else { - $smarty->assign("debugbootup", ""); - } - - /* Show main page */ - return($smarty->fetch (get_template_path('terminalStartup.tpl', TRUE))); - } - - function remove_from_parent() - { - if($this->acl_is_removeable()){ - $this->handle_post_events("remove"); - new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs)); - } - } - - - /* Save data to object */ - function save_object() - { - plugin::save_object(); - - if(isset($_POST['TerminalStarttabPosted'])){ - if(isset($_POST['gotoLdap_inherit'])){ - $this->gotoLdap_inherit = TRUE; - }else{ - $this->gotoLdap_inherit = FALSE; - } - - /* Save group radio buttons */ - if ($this->acl_is_writeable("bootmode") && isset($_POST["bootmode"])){ - $this->bootmode= $_POST["bootmode"]; - } - - /* Save kernel parameters */ - if ($this->acl_is_writeable("gotoKernelParameters") && isset($_POST["customParameters"])){ - $this->customParameters= $_POST["customParameters"]; - } - } - } - - - /* Save to LDAP */ - function save() - { - /* Find proper terminal path for tftp configuration - FIXME: This is suboptimal when the default has changed to - another location! */ - if ($this->gotoTerminalPath == "default-inherit"){ - $ldap= $this->config->get_ldap_link(); - - /* Strip relevant part from dn, keep trailing ',' */ - $tmp= preg_replace("/^cn=[^,]+,".get_ou('terminalou')."/i", "", $this->dn); - $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp); - - /* Walk from top to base and try to load default values for - 'gotoTerminalPath'. Abort when an entry is found. */ - while (TRUE){ - $tmp= preg_replace ("/^[^,]+,/", "", $tmp); - - $ldap->cat("cn=default,".get_ou('terminalou').$tmp. - $this->config->current['BASE'], array('gotoTerminalPath')); - $attrs= $ldap->fetch(); - if (isset($attrs['gotoTerminalPath'])){ - $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0]; - break; - } - - /* Nothing left? */ - if ($tmp == ""){ - break; - } - } - } - - /* Add semi automatic values */ - // FIXME: LDAP Server may not be set here... - $this->gotoKernelParameters= "root=/dev/nfs nfsroot=". - $this->gotoTerminalPath. - ",ro,hard,nolock,fg,rsize=8192 ". - "ip=::::::dhcp ldap=".base64_encode($this->gotoLdapServer); - - switch ($this->bootmode){ - case "D": - $this->gotoKernelParameters.= " debug"; - break; - case "G": - $this->gotoKernelParameters.= " splash=silent"; - break; - } - if ($this->customParameters != ""){ - $this->gotoKernelParameters.= " o ".$this->customParameters; - } - - plugin::save(); - - /* Add missing arrays */ - foreach (array("gotoModules") as $val){ - if (isset ($this->$val) && count ($this->$val) != 0){ - - $this->attrs["$val"]= array_unique($this->$val); - } - if(!isset($this->attrs["$val"])){ - $this->attrs["$val"]=array(); - } - } - - /* Prepare list of ldap servers */ - $this->attrs['gotoLdapServer'] = array(); - if(!$this->gotoLdap_inherit){ - $i = 0; - foreach($this->gotoLdapServers as $server){ - $i ++; - $this->attrs['gotoLdapServer'][] = $i.":".$server; - } - } - - /* Strip out 'default' values */ - foreach(array("gotoBootKernel") as $value){ - if (!isset($this->attrs[$value]) || $this->attrs[$value] == "default-inherit"){ - $this->attrs[$value] = array(); - } - } - - /* prepare share settings */ - $tmp = array(); - foreach($this->gotoShares as $name => $settings){ - $tmp2 = split("\|",$name); - $name = $tmp2[0]; - $tmp[] = $settings['server']."|".$name."|".$settings['mountPoint']; - } - $this->attrs['gotoShare']=$tmp; - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - - $this->cleanup(); - $ldap->modify ($this->attrs); - - new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - - show_ldap_error($ldap->get_error(), sprintf(_("Saving of system terminal/startup with dn '%s' failed."),$this->dn)); - $this->handle_post_events("modify"); - } - - /* Add value to array, check if unique */ - function add_list (&$array, $value) - { - if ($value != ""){ - $array[]= $value; - sort($array); - array_unique ($array); - } - } - - - /* Delete value to array, check if unique */ - function del_list (&$array, $list) - { - $tmp= array(); - foreach ($array as $mod){ - if (!in_array($mod, $list)){ - $tmp[]= $mod; - } - } - $array= $tmp; - } - - /* Generate ListBox frindly output for the defined shares - * Possibly Add or remove an attribute here, - */ - function printOutAssignedShares() - { - $a_return = array(); - if(is_array($this->gotoShares)){ - foreach($this->gotoShares as $share){ - $a_return[$share['name']."|".$share['server']]= $share['name']." [".$share['server']."]"; - } - } - return($a_return); - } - - - function PrepareForCopyPaste($source) - { - plugin::PrepareForCopyPaste($source); - - $source_o = new termstartup ($this->config, $source['dn']); - - foreach(array("gotoModules", "gotoKernelParameters","gotoShares","customParameters","bootmode","gotoTerminalPath","gotoShares","goLdapServerList","gotoBootKernel","gotoLdapServer","gotoBootKernels") as $attr){ - $this->$attr = $source_o->$attr; - } - } - - - function array_switch_item($ar,$from,$to) - { - if(!is_array($ar)){ - return(false); - } - if(!isset($ar[$from])){ - return(false); - } - if(!isset($ar[$to])){ - return(false); - } - - $tmp = $ar[$from]; - $ar[$from] = $ar[$to]; - $ar[$to] = $tmp; - return($ar); - } - - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Startup"), - "plDescription" => _("Terminal startup"), - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 5, - "plSection" => array("administration"), - "plCategory" => array("terminal"), - - "plProvidedAcls"=> array( - "gotoLdapServer" => _("Ldap server"), - "gotoShare" => _("Shares"), - "gotoModules" => _("Kernel modules"), - "gotoBootKernel" => _("Boot kernel"), - "gotoKernelParameters"=> _("Kernel parameter")) - )); - } - - -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/class_workstationGeneric.inc b/gosa-core/plugins/admin/systems/class_workstationGeneric.inc deleted file mode 100644 index 0f0f97a98..000000000 --- a/gosa-core/plugins/admin/systems/class_workstationGeneric.inc +++ /dev/null @@ -1,663 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* Generic terminal attributes */ - var $gotoMode= "locked"; - var $gotoSyslogServer= ""; - var $gotoSyslogServers= array(); - var $gotoNtpServer= array(); - var $gotoNtpServers= array(); - var $gotoSndModule= ""; - var $gotoFloppyEnable= ""; - var $gotoCdromEnable= ""; - var $ghCpuType= "-"; - var $ghMemSize= "-"; - var $ghUsbSupport= "-"; - var $ghNetNic= array(); - var $ghIdeDev= array(); - var $ghScsiDev= array(); - var $ghGfxAdapter= "-"; - var $ghSoundAdapter= "-"; - var $gotoLastUser= "-"; - var $FAIscript= ""; - var $didAction= FALSE; - var $FAIstate= ""; - var $view_logged = FALSE; - - /* Needed values and lists */ - var $base= ""; - var $cn= ""; - var $l= ""; - var $orig_dn= ""; - - /* Plugin side filled */ - var $modes= array(); - - var $netConfigDNS; - - var $inheritTimeServer = true; - - /* attribute list for save action */ - var $ignore_account= TRUE; - var $attributes= array("gotoMode", "gotoSyslogServer", "gotoNtpServer", - "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule", - "ghCpuType", "ghMemSize", "ghUsbSupport", - "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l","FAIscript"); - var $objectclasses= array("top", "gotoWorkstation", "GOhard"); - - var $mapActions = array("reboot" => "", - "localboot" => "localboot", - "halt" => "", - "instant_update" => "softupdate", - "update" => "scheduledupdate", - "reinstall" => "install", - "rescan" => "", - "memcheck" => "memcheck", - "sysinfo" => "sysinfo"); - - - var $fai_activated = FALSE; - - var $member_of_ogroup = FALSE; - - function workgeneric (&$config, $dn= NULL, $parent= NULL) - { - $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs')); - if(!empty($tmp)){ - $this->fai_activated = TRUE; - } - - plugin::plugin ($config, $dn, $parent); - - if(!isset($this->parent->by_object['ogroup'])){ - $ldap = $this->config->get_ldap_link(); - $ldap->cd ($this->config->current['BASE']); - $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))",array("cn")); - $this->member_of_ogroup = $ldap->count() >= 1; - } - - $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses); - - /* Read arrays */ - foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){ - if (!isset($this->attrs[$val])){ - continue; - } - for ($i= 0; $i<$this->attrs[$val]['count']; $i++){ - array_push($this->$val, $this->attrs[$val][$i]); - } - } - - /* Create used ntp server array */ - $this->gotoNtpServer= array(); - if(isset($this->attrs['gotoNtpServer'])){ - $this->inheritTimeServer = false; - unset($this->attrs['gotoNtpServer']['count']); - foreach($this->attrs['gotoNtpServer'] as $server){ - $this->gotoNtpServer[$server] = $server; - } - } - - /* Set inherit checkbox state */ - if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer) == 0)){ - $this->inheritTimeServer = true; - $this->gotoNtpServer=array(); - } - - /* You can't inherit the NTP service, if we are not member in an object group */ - if(!$this->member_of_ogroup){ - $this->inheritTimeServer = FALSE; - } - - /* Create available ntp options */ - $tmp = $this->config->data['SERVERS']['NTP']; - $this->gotoNtpServers = array(); - foreach($tmp as $key => $server){ - if($server == "default") continue; - $this->gotoNtpServers[$server] = $server; - } - - $this->modes["active"]= _("Activated"); - $this->modes["locked"]= _("Locked"); - - /* Set base */ - if ($this->dn == "new"){ - $ui= get_userinfo(); - $this->base= dn2base($ui->dn); - } else { - $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn); - } - - /* Create an array of all Syslog servers */ - $tmp = $this->config->data['SERVERS']['SYSLOG']; - foreach($tmp as $server){ - $visible = $server; - if($server == "default" && $this->member_of_ogroup) { - $visible = "["._("inherited")."]"; - } - $this->gotoSyslogServers[$server] = $visible; - } - - /* Save 'dn' for later referal */ - $this->orig_dn= $this->dn; - } - - - function set_acl_base($base) - { - plugin::set_acl_base($base); - $this->netConfigDNS->set_acl_base($base); - } - - function set_acl_category($cat) - { - plugin::set_acl_category($cat); - $this->netConfigDNS->set_acl_category($cat); - } - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","workstation/".get_class($this),$this->dn); - } - - /* Do we need to flip is_account state? */ - if(isset($_POST['modify_state'])){ - if($this->is_account && $this->acl_is_removeable()){ - $this->is_account= FALSE; - }elseif(!$this->is_account && $this->acl_is_createable()){ - $this->is_account= TRUE; - } - } - - if ((isset($_POST['action'])) && ($this->acl_is_writeable("FAIstate"))){ - $cmd= $this->config->search("workgeneric", "ACTIONCMD",array('tabs')); - if ($cmd == ""){ - print_red(_("No ACTIONCMD definition found in your gosa.conf")); - } else { - exec ($cmd." ".$this->netConfigDNS->macAddress." ".escapeshellarg($_POST['saction']), $dummy, $retval); - if ($retval != 0){ - print_red(sprintf(_("Execution of '%s' failed!"), $cmd)); - } elseif ($_POST['saction'] != "wake") { - - /* Set FAIstate */ - if($this->fai_activated && $this->dn != "new"){ - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->cat($this->dn,array("objectClass")); - $res = $ldap->fetch(); - - $attrs = array(); - $attrs['FAIstate'] = $this->FAIstate; - if(isset($this->mapActions[$_POST['saction']]) && $this->mapActions[$_POST['saction']] != ""){ - $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']]; - } - - for($i = 0; $i < $res['objectClass']['count'] ; $i ++){ - $attrs['objectClass'][] = $res['objectClass'][$i]; - } - - if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){ - $attrs['objectClass'][] = "FAIobject"; - } - - if($attrs['FAIstate'] == ""){ -#FIXME we should check if FAIobject is not used anymore - $attrs['FAIstate'] = array(); - } - - $ldap->cd($this->dn); - $ldap->modify($attrs); - show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic (FAIstate) with dn '%s' failed."),$this->dn)); - - } - $this->didAction= TRUE; - } - } - } - - /* Do we represent a valid terminal? */ - if (!$this->is_account && $this->parent === NULL){ - $display= "\"\" ". - _("This 'dn' has no workstation features.").""; - return($display); - } - - /* Base select dialog */ - $once = true; - foreach($_POST as $name => $value){ - if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_writeable("base")){ - $once = false; - $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases()); - $this->dialog->setCurrentBase($this->base); - } - } - - /* Dialog handling */ - if(is_object($this->dialog)){ - /* Must be called before save_object */ - $this->dialog->save_object(); - - if($this->dialog->isClosed()){ - $this->dialog = false; - }elseif($this->dialog->isSelected()){ - - /* A new base was selected, check if it is a valid one */ - $tmp = $this->get_allowed_bases(); - if(isset($tmp[$this->dialog->isSelected()])){ - $this->base = $this->dialog->isSelected(); - } - - $this->dialog= false; - }else{ - return($this->dialog->execute()); - } - } - - /* Add new ntp Server to our list */ - if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){ - $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers']; - } - - /* Delete selected NtpServer for list of used servers */ - if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){ - foreach($_POST['gotoNtpServerSelected'] as $name){ - unset($this->gotoNtpServer[$name]); - } - } - - /* Fill templating stuff */ - $smarty= get_smarty(); - - /* Set acls */ - $tmp = $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $name => $translation){ - $smarty->assign($name."ACL",$this->getacl($name)); - } - - $smarty->assign("cn", $this->cn); - $smarty->assign("l", $this->l); - $smarty->assign("bases", $this->get_allowed_bases()); - $smarty->assign("staticAddress", ""); - - $tmp = array(); - foreach($this->gotoNtpServers as $server){ - if(!in_array($server,$this->gotoNtpServer)){ - $tmp[$server] = $server; - } - } - $smarty->assign("gotoNtpServers",$tmp); - - /* Check if workstation is online */ - $query= "fping -q -r 1 -t 500 ".$this->cn; - exec ($query, $dummy, $retval); - - /* Offline */ - if ($retval == 0){ - $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"), - "instant_update" => _("Instant update"), - "update" => _("Scheduled update"), - "reinstall" => _("Reinstall"), - "rescan" => _("Rescan hardware"), - "memcheck" => _("Memory test"), - "localboot" => _("Force localboot"), - "sysinfo" => _("System analysis"))); - } else { - $smarty->assign("actions", array("wake" => _("Wake up"), - "reinstall" => _("Reinstall"), - "update" => _("Scheduled update"), - "memcheck" => _("Memory test"), - "localboot" => _("Force localboot"), - "sysinfo" => _("System analysis"))); - } - /* Arrays */ - $smarty->assign("modes", $this->modes); - $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']); - $smarty->assign("syslogservers", $this->gotoSyslogServers); - $smarty->assign("fai_activated",$this->fai_activated); - - $ntpser = array(); - foreach($this->gotoNtpServers as $server){ - if(!in_array($server,$this->gotoNtpServer)){ - $ntpser[$server] = $server; - } - } - $smarty->assign("gotoNtpServers", $ntpser); - - /* Variables */ - foreach(array("base", "gotoMode", "gotoSyslogServer", "gotoNtpServer") as $val){ - $smarty->assign($val."_select", $this->$val); - } - - /* tell smarty the inherit checkbox state */ - $smarty->assign("inheritTimeServer",$this->inheritTimeServer); - $smarty->assign("member_of_ogroup",$this->member_of_ogroup); - - $str = $this->netConfigDNS->execute(); - if(is_object($this->netConfigDNS->dialog)){ - return($str); - } - $smarty->assign("netconfig", $str); - - /* Show main page */ - return($smarty->fetch (get_template_path('workstation.tpl', TRUE))); - } - - function remove_from_parent() - { - if($this->acl_is_removeable()){ - - $this->netConfigDNS->remove_from_parent(); - $ldap= $this->config->get_ldap_link(); - $ldap->rmdir($this->dn); - new log("remove","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of system workstation/generic with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); - - /* Delete references to object groups */ - $ldap->cd ($this->config->current['BASE']); - $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn")); - while ($ldap->fetch()){ - $og= new ogroup($this->config, $ldap->getDN()); - unset($og->member[$this->dn]); - $og->save (); - } - } - - if(isset($_POST["inheritAll"])){ - $this->set_everything_to_inherited(); - } - } - - - /* Save data to object */ - function save_object() - { - - /* Create a base backup and reset the - base directly after calling plugin::save_object(); - Base will be set seperatly a few lines below */ - $base_tmp = $this->base; - plugin::save_object(); - $this->base = $base_tmp; - - /* Save base, since this is no LDAP attribute */ - $tmp = $this->get_allowed_bases(); - if(isset($_POST['base'])){ - if(isset($tmp[$_POST['base']])){ - $this->base= $_POST['base']; - } - } - - $this->netConfigDNS->save_object(); - - /* Set inherit mode */ - if((isset($_POST['workgeneric_posted'])) && ($this->acl_is_writeable("gotoNtpServer"))){ - if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){ - $this->inheritTimeServer = true; - }else{ - $this->inheritTimeServer = false; - } - } - - if(isset($_POST["inheritAll"])){ - $this->set_everything_to_inherited(); - } - } - - - /* Check supplied data */ - function check() - { - /* Call common method to give check the hook */ - $message= plugin::check(); - - /* Skip IP & Mac checks if this is a template */ - if($this->cn != "wdefault"){ - $message= array_merge($message, $this->netConfigDNS->check()); - } - - $this->dn= "cn=".$this->cn.",".get_ou('workstationou').$this->base; - - if ($this->cn == ""){ - $message[]= _("The required field 'Workstation name' is not set."); - } - - /* Check if given name is a valid host/dns name */ - if(!tests::is_dns_name($this->cn)){ - $message[] = _("Please specify a valid name for this object."); - } - - if ($this->orig_dn != $this->dn){ - $ldap= $this->config->get_ldap_link(); - $ldap->cd ($this->base); - - if($this->cn == "wdefault"){ - $ldap->cat($this->dn); - }else{ - $ldap->search ("(&(cn=".$this->cn.")(objectClass=gotoWorkstation))", array("cn")); - } - if ($ldap->count() != 0){ - while ($attrs= $ldap->fetch()){ - if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".get_ou('incomingou')."/", $ldap->getDN())){ - continue; - } else { - if ($attrs['dn'] != $this->orig_dn){ - $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); - break; - } - } - } - } - } - - /* Check for valid ntpServer selection */ - if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){ - $message[]= _("There must be at least one NTP server selected, or the inherit mode activated."); - } - - return ($message); - } - - - /* Save to LDAP */ - function save() - { - plugin::save(); - - /* Strip out 'default' values */ - foreach (array("gotoSyslogServer") as $val){ - - if (isset($this->attrs[$val]) && $this->attrs[$val] == "default"){ - $this->attrs[$val]= array(); - } - } - - /* Add missing arrays */ - foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){ - if (isset ($this->$val) && count ($this->$val) != 0){ - $this->attrs["$val"]= $this->$val; - } - } - - /* Remove all empty values */ - if ($this->orig_dn == 'new'){ - $attrs= array(); - foreach ($this->attrs as $key => $val){ - if (is_array($val) && count($val) == 0){ - continue; - } - $attrs[$key]= $val; - } - $this->attrs= $attrs; - } - - /* Update ntp server settings */ - if($this->inheritTimeServer){ - if($this->is_new){ - if(isset($this->attrs['gotoNtpServer'])){ - unset($this->attrs['gotoNtpServer']); - } - }else{ - $this->attrs['gotoNtpServer'] = array(); - } - }else{ - /* Set ntpServers */ - $this->attrs['gotoNtpServer'] = array(); - foreach($this->gotoNtpServer as $server){ - $this->attrs['gotoNtpServer'][] = $server; - } - } - - if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){ - $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag"; - } - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - if ($this->orig_dn == 'new'){ - $ldap->cd($this->config->current['BASE']); - $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); - $ldap->cd($this->dn); - $ldap->add($this->attrs); - new log("create","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn)); - if(!$this->didAction){ - $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); - } - } else { - if ($this->orig_dn != $this->dn){ - $this->move($this->orig_dn, $this->dn); - } - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - - if(!$this->didAction){ - $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); - } - } - - /* cn=default and macAddress=- indicates that this is a template */ - if($this->cn == "wdefault"){ - $this->netConfigDNS->macAddress = "-"; - } - - $this->netConfigDNS->cn = $this->cn; - $this->netConfigDNS->save(); - show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn)); - } - - - /* Display generic part for server copy & paste */ - function getCopyDialog() - { - $vars = array("cn"); - $smarty = get_smarty(); - $smarty->assign("cn" ,$this->cn); - $smarty->assign("object","workstation"); - $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); - $ret = array(); - $ret['string'] = $str; - $ret['status'] = ""; - return($ret); - } - - - function saveCopyDialog() - { - if(isset($_POST['cn'])){ - $this->cn = $_POST['cn']; - } - } - - - function PrepareForCopyPaste($source) - { - plugin::PrepareForCopyPaste($source); - if(isset($source['macAddress'][0])){ - $this->netConfigDNS->macAddress = $source['macAddress'][0]; - } - if(isset($source['ipHostNumber'][0])){ - $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0]; - } - - /* Create used ntp server array */ - $this->gotoNtpServer= array(); - if(isset($source['gotoNtpServer'])){ - $this->inheritTimeServer = false; - unset($source['gotoNtpServer']['count']); - foreach($source['gotoNtpServer'] as $server){ - $this->gotoNtpServer[$server] = $server; - } - } - - /* Set inherit checkbox state */ - if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){ - $this->inheritTimeServer = true; - $this->gotoNtpServer=array(); - } - } - - - /* Return plugin informations for acl handling - #FIXME FAIscript seams to ununsed within this class... */ - static function plInfo() - { - return (array( - "plShortName" => _("Generic"), - "plDescription" => _("Workstation generic"), - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 0, - "plSection" => array("administration"), - "plCategory" => array("workstation" => array("description" => _("Workstation"), - "objectClass" => "gotoWorkstation")), - "plProvidedAcls"=> array( - "cn" => _("Workstation name"), - "l" => _("Location") , - "base" => _("Base") , - "gotoMode" => _("Goto mode"), - "gotoSyslogServer" => _("Syslog server"), - "gotoNtpServer" => _("Ntp server"), - "gotoRootPasswd" => _("Root password"), - "FAIstate" => _("Action flag")) - )); - } - - function set_everything_to_inherited() - { - $this->gotoSyslogServer = "default"; - $this->inheritTimeServer = TRUE; - - /* Set workstation service attributes to inherited */ - if($this->member_of_ogroup && isset($this->parent->by_object['workservice'])){ - foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant", - "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){ - $this->parent->by_object['workservice']->$name = "default"; - } - } - - /* Set workstation startup attributes to inherited */ - if($this->member_of_ogroup && isset($this->parent->by_object['workstartup'])){ - $this->parent->by_object['workstartup']->gotoBootKernel = "default-inherited"; - $this->parent->by_object['workstartup']->gotoLdapServer = "default-inherited"; - $this->parent->by_object['workstartup']->FAIdebianMirror= "inherited"; - } - } -} - // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/class_workstationService.inc b/gosa-core/plugins/admin/systems/class_workstationService.inc deleted file mode 100644 index 815b52c0c..000000000 --- a/gosa-core/plugins/admin/systems/class_workstationService.inc +++ /dev/null @@ -1,506 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - var $gotoScannerEnable; - /* Generic terminal attributes */ - var $gotoXMonitor= ""; - var $gotoXDriver= ""; - var $gotoXResolution= ""; - var $gotoXColordepth= ""; - var $gotoXHsync= ""; - var $gotoXVsync= ""; - var $AutoSync = false; - var $gotoXKbModel= ""; - var $gotoXKbLayout= ""; - var $gotoXKbVariant= ""; - var $gotoXMouseType= ""; - var $gotoXMouseport= ""; - var $gotoScannerClients= ""; - var $gotoScannerBackend= ""; - var $goFonHardware= "automatic"; - var $view_logged = FALSE; - - /* Needed values and lists */ - var $ignore_account= TRUE; - var $base= ""; - var $cn= ""; - var $orig_dn= ""; - var $XMethods= array(); - var $XDrivers= array(); - var $XResolutions = array(); - var $MouseTypes= array(); - var $MousePorts= array(); - var $hardware_list= array(); - var $used_hardware= array(); - - - /* attribute list for save action */ - var $attributes= array("gotoXMonitor", - "gotoXDriver", "gotoXResolution", "gotoXColordepth", - "gotoXHsync", "gotoXVsync", - "gotoScannerEnable", "gotoScannerClients", - "gotoScannerBackend", "gotoXKbModel", "gotoXKbLayout", "gotoXKbVariant", - "gotoXMouseType", "gotoXMouseport", "goFonHardware"); - var $objectclasses= array("GOhard"); - - var $XColordepths =array(); - var $XKbModels =array(); - var $XKbLayouts =array(); - var $XKbVariants =array(); - - function workservice (&$config, $dn= NULL, $parent= NULL) - { - plugin::plugin ($config, $dn, $parent); - - $this->XResolutions= array( - "640x480" => "640x480", - "800x600" => "800x600", - "1024x768" => "1024x768", - "1152x864" => "1152x864", - "1280x1024" => "1280x1024", - "1400x1050" => "1400x1050", - "1600x1200" => "1600x1200"); - - if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){ - $file = $this->config->data['MAIN']['RESOLUTION_HOOK']; - - if(is_readable($file)){ - $str = file_get_contents($file); - $lines = split("\n",$str); - foreach($lines as $line){ - $line = trim($line); - if(!empty($line)){ - $this->XResolutions[$line]=$line; - } - } - //natcasesort($this->gotoXResolutions); - }else{ - print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file)); - } - } - - /* Get list of available xdrivers */ - $this->XDrivers = $this->getListOfXDrivers(); - - array_unshift($this->XDrivers, "["._("unknown")."]"); - - $this->XColordepths= array( - "8" => "8 " ._("bit"), - "15" => "15 "._("bit"), - "16" => "16 "._("bit"), - "24" => "24 "._("bit")); - - foreach(array ("btc9000", "chicony", "compaq", "dell", "dell101", "everex", - "flexpro", "geniuscomfy", "hp", "itouch", "jp106", "logicordless", - "logiinetnav", "logiinternet", "macintosh", "microsoft", - "microsoftpro", "omnikey101", "pc101", "pc102", "pc104", - "pc105", "rapidaccess", "rapidaccess2", "winbook") as $type){ - $this->XKbModels[$type] = $type; - } - - $this->MouseTypes= array("ImPS/2" => "ImPS/2", "PS/2" => "PS/2", "Microsoft" => "Microsoft", - "Logitech" => "Logitech"); - - $this->MousePorts= array("/dev/ttyS0" =>"/dev/ttyS0", - "/dev/ttyS1" => "/dev/ttyS1", "/dev/psaux" =>"/dev/psaux", - "/dev/input/mice" => "/dev/input/mice"); - - /* Additional values will be extracted from CONFIG_DIR./keyboardLayouts */ - $this->XKbLayouts= array ("de"=> "de","intl" =>"intl","us" =>"us"); - $this->XKbVariants= array ("nodeadkeys"=>"nodeadkeys", "basic"=>"basic"); - - /* try to read additional keyboard layouts - */ - if(file_exists(CONFIG_DIR."/keyboardLayouts")){ - if(is_readable(CONFIG_DIR."/keyboardLayouts")){ - $str = file_get_contents(CONFIG_DIR."/keyboardLayouts"); - $tmp = split("\n",$str); - foreach($tmp as $entry){ - if((!empty($entry)) && (!preg_match("/^#/",$entry))){ - $entry = trim($entry); - $tmp2 = split ("\:",$entry); - $la = trim($tmp2[0]); // What would be saved to ldap - $da = trim($tmp2[1]); // This wis displayed in the listbox - $this->XKbLayouts [ $la] = $da; - } - } - } - } - - /* Initialize methods */ - $this->XMethods["indirect"]= _("show chooser"); - $this->XMethods["query"]= _("direct"); - #$this->XMethods["squery"]= _("direct via ssh"); - #$this->XMethods["nquery"]= _("direct via nx"); - $this->XMethods["load"]= _("load balanced"); - #$this->XMethods["sload"]= _("load balanced via ssh"); - #$this->XMethods["nload"]= _("load balanced via nx"); - $this->XMethods["rdp"]= _("Windows RDP"); - $this->XMethods["citrix"]= _("ICA client"); - - $this->orig_dn= $this->dn; - - /* Load hardware list */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(objectClass=goFonHardware)", array('cn', 'description')); - while ($attrs= $ldap->fetch()){ - $cn= $attrs['cn'][0]; - if (isset($attrs['description'])){ - $description= " - ".$attrs['description'][0]; - } else { - $description= ""; - } - $this->hardware_list[$cn]= "$cn$description"; - } - - /* Eventually colorize phones */ - $ldap->cd($this->config->current['BASE']); - $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware')); - while($attrs = $ldap->fetch()){ - $cn = $attrs['goFonHardware'][0]; - if(isset($this->hardware_list[$cn])){ - $this->used_hardware[$cn]= $cn; - } - } - - if(preg_match("/\+/",$this->gotoXHsync)){ - $this->AutoSync = true; - $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync); - $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync); - } - - $this->hardware_list["automatic"]= _("automatic"); - ksort($this->hardware_list); - - /* Load hardware list */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))"); - if ($ldap->count() == 1){ - $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout", - "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport"); - $attrs= $ldap->fetch(); - - foreach ($map as $name){ - if (!isset($attrs[$name][0])){ - continue; - } - - switch ($name){ - case 'gotoXResolution': - $this->XResolutions= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XResolutions; - break; - case 'gotoXColordepth': - $this->XColordepths= array('default' => _("inherited").' ['.$attrs[$name][0].' '._('Bit').']') + $this->XColordepths; - break; - case 'gotoXKbModel': - $this->XKbModels= array('default' => _("inherited").' ['.$attrs[$name][0].']') + $this->XKbModels; - break; - case 'gotoXKbLayout': - $this->XKbLayouts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbLayouts; - break; - case 'gotoXKbVariant': - $this->XKbVariants= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbVariants; - break; - case 'gotoXMouseType': - $this->MouseTypes= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes; - break; - case 'gotoXMouseport': - $this->MousePorts= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts; - break; - } - - } - - } - - /* Workaround to fill in inherited values if we've specified an objectclass */ - $SelectedSystemType = session::get("SelectedSystemType"); - if (isset($SelectedSystemType['ogroup']) && $SelectedSystemType['ogroup'] != 'none'){ - $this->XResolutions= array('default' => _("inherited")); - $this->XColordepths= array('default' => _("inherited")); - $this->XKbModels= array('default' => _("inherited")); - $this->XKbLayouts= array('default' => _("inherited")); - $this->XKbVariants= array('default' => _("inherited")); - $this->MouseTypes= array('AUTO' => _("inherited")); - $this->MousePorts= array('AUTO' => _("inherited")); - } - } - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","workstation/".get_class($this),$this->dn); - } - - /* Do we need to flip is_account state? */ - if (isset($_POST['modify_state'])){ - $this->is_account= !$this->is_account; - } - - /* Do we need to flip is_account state? */ - if(isset($_POST['modify_state'])){ - if($this->is_account && $this->acl_is_removeable()){ - $this->is_account= FALSE; - }elseif(!$this->is_account && $this->acl_is_createable()){ - $this->is_account= TRUE; - } - } - - /* Show main page */ - $smarty= get_smarty(); - - /* Assign ACLs */ - $tmp = $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $name => $translated){ - $smarty->assign($name."ACL",$this->getacl($name)); - } - - /* Arrays */ - foreach(array("XMethods", "XDrivers", "XResolutions", "XColordepths", - "XKbModels", "XKbVariants", - "MouseTypes", "MousePorts") as $val){ - $smarty->assign("$val", $this->$val); - } - $smarty->assign("XKbLayouts" ,$this->XKbLayouts); - $smarty->assign("XKbLayoutKeys" ,array_flip($this->XKbLayouts)); - - $smarty->assign("xdmcpservers", $this->config->data['SERVERS']['TERMINAL']); - $smarty->assign("fontservers", $this->config->data['SERVERS']['FONT']); - $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']); - $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']); - - /* Variables - select */ - foreach(array( - "gotoXDriver", "gotoXResolution", "gotoXColordepth", - "gotoXKbModel", "gotoXKbLayout","gotoScannerEnable", - "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){ - - $smarty->assign($val."_select", $this->$val); - } - - /* Variables */ - foreach(array("gotoXHsync", "gotoXVsync") as $val){ - $smarty->assign($val, $this->$val); - } - $smarty->assign("staticAddress", ""); - - /* Checkboxes */ - foreach(array("gotoScannerEnable") as $val){ - if ($this->$val == TRUE) { - $smarty->assign("$val", "checked"); - } else { - $smarty->assign("$val", ""); - } - } - - /* Phone stuff */ - $smarty->assign ("goFonHardware", $this->goFonHardware); - - $perms = ""; - if($this->acl_is_writeable("goFonHardware")){ - $perms = " disabled "; - } - - $hl= "\n"; - $smarty->assign ("hardware_list", $hl); - $smarty->assign ("gotoXMonitor", $this->gotoXMonitor); - - if($this->AutoSync){ - $smarty->assign("AutoSyncCHK"," checked "); - $smarty->assign("hiddenState"," disabled "); - }else{ - $smarty->assign("AutoSyncCHK"," "); - $smarty->assign("hiddenState",""); - } - - /* Show main page */ - return($smarty->fetch (get_template_path('workstationService.tpl',TRUE,dirname(__FILE__)))); - } - - function remove_from_parent() - { - $this->handle_post_events("remove"); - new log("remove","workstation/".get_class($this),$this->dn); - } - - /* Save data to object */ - function save_object() - { - plugin::save_object(); - - if((isset($_POST['gotoXDriver'])) && $this->acl_is_writeable("AutoSync")) { - if(isset($_POST['AutoSync'])){ - $this->AutoSync = true; - }else{ - $this->AutoSync = false; - } - } - } - - /* Check supplied data */ - function check() - { - /* Call common method to give check the hook */ - $message= plugin::check(); - - /* Default entries can use blank hsync/vsync entries */ - if ($this->dn != "" && $this->cn != "default" && $this->cn != "wdefault"){ - - /* But only if no auto sync is enabled... */ - if (!$this->AutoSync){ - - /* Check vsync for correct usage */ - $val= preg_replace ("/\s/", "", $this->gotoXVsync); - - if($this->acl_is_writeable("gotoXVsync")){ - if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){ - $message[]= _("Please specify a valid VSync range."); - } else{ - list($v1,$v2)= preg_split ("/[-+]/", $val); - if ($v2 != ""){ - if ($v1 > $v2){ - $message[]= _("Please specify a valid VSync range."); - } - } - } - } - - /* Check hsync for correct usage */ - $val= preg_replace ("/\s/", "", $this->gotoXHsync); - if($this->acl_is_writeable("gotoXHsync")){ - if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){ - $message[]= _("Please specify a valid HSync range."); - } else{ - list($v1,$v2)= preg_split ("/[-+]/", $val); - if ($v2 != ""){ - if ($v1 > $v2){ - $message[]= _("Please specify a valid HSync range."); - } - } - } - } - } - } - - return ($message); - } - - - /* Save to LDAP */ - function save() - { - /* remove objectclass GOhard if this is an ogroup tab */ - if(isset($this->parent->by_object['ogroup'])){ - $this->objectclasses = array(); - } - - plugin::save(); - - /* Strip out 'default' values */ - foreach(array( - "gotoXDriver", "gotoXResolution", "gotoXColordepth", - "gotoXKbModel", "gotoXKbLayout", - "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){ - - if ($this->attrs[$val] == "default"){ - $this->attrs[$val]= array(); - } - } - - if($this->AutoSync){ - $this->attrs['gotoXHsync'] = "30+55"; - $this->attrs['gotoXVsync'] = "50+70"; - } - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/service with dn '%s' failed."),$this->dn)); - $this->handle_post_events("modify"); - } - - - function getListOfXDrivers() - { - /* Generate a list of xdrivers from CONFIG_DIR./xdrivers */ - $drivers = array(); - if (file_exists(CONFIG_DIR.'/xdrivers')){ - $xdrivers = file (CONFIG_DIR.'/xdrivers'); - foreach ($xdrivers as $line){ - if (!preg_match ("/^#/", $line)){ - $drivers[]= trim($line); - } - } - } else { - $drivers = array("ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx", - "i128", "i740", "i810", "imstt", "mga", "neomagic", "newport", "nsc", "nv", "nvidia", - "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion", - "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware"); - } - return($drivers); - } - - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Service"), - "plDescription" => _("Workstation service"), - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 10, - "plSection" => array("administration"), - "plCategory" => array("workstation","ogroups"), - - "plProvidedAcls"=> array( - "gotoXMonitor" => _("Monitor"), - "gotoXDriver" => _("Gfx driver"), - "gotoXResolution" => _("Gfx resolution"), - "gotoXColordepth" => _("Gfx color depth"), - "gotoXHsync" => _("Hsync"), - "gotoXVsync" => _("Vsync"), - "AutoSync" => _("Use DDC"), - "gotoScannerEnable" => _("Scanner enabled"), - "gotoXKbModel" => _("Keyboard model"), - "gotoXKbLayout" => _("Keyboard layout"), - "gotoXKbVariant" => _("Keyboard variant"), - "gotoXMouseType" => _("Mouse type"), - "gotoXMouseport" => _("Mouse port"), - "goFonHardware" => _("Telephone hardware")) - )); - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/class_workstationStartup.inc b/gosa-core/plugins/admin/systems/class_workstationStartup.inc deleted file mode 100644 index c74b37617..000000000 --- a/gosa-core/plugins/admin/systems/class_workstationStartup.inc +++ /dev/null @@ -1,1293 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* Ldap server list */ - var $gotoLdapServers = array(); - var $gotoLdapServerList = array(); - var $gotoLdap_inherit = FALSE; - - /* Generic terminal attributes */ - var $bootmode = "G"; - var $gotoBootKernel = "default-inherited"; - var $gotoKernelParameters = ""; - var $gotoLdapServer = "default-inherited"; - var $gotoModules = array(); - var $gotoAutoFs = array(); - var $gotoFilesystem = array(); - var $gotoTerminalPath = ""; - var $gotoBootKernels = array(); - - /* attribute list for save action */ - var $attributes = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", - "FAIclass", "FAIstatus", "gotoShare","FAIdebianMirror", "FAIrelease"); - var $objectclasses = array("GOhard", "FAIobject"); - - /* Share */ - var $gotoShares = array();// Currently Share Option - var $gotoShare = ""; // currently selected Share Option - var $gotoShareSelections= array();// Available Shares for this account in Listbox format - var $gotoAvailableShares= array();// Available Shares for this account - - /* Helper */ - var $customParameters = ""; - var $orig_dn = ""; - var $ignore_account = TRUE; - - /* FAI class selection */ - var $FAIclass = array(); // The currently selected classes - var $FAIrelease = ""; - var $FAIdebianMirror = "auto"; - - var $cache = array(); // Used as cache in fai mehtods - - var $FAIstatus = ""; - var $FAIclasses = array(); - - var $view_logged = FALSE; - - /* FAI class selection */ - var $InheritedFAIclass = array(); - var $InheritedFAIrelease = ""; - var $InheritedFAIdebianMirror= "auto"; - - var $CopyPasteVars = array("gotoModules","gotoShares"); - var $fai_activated = FALSE; - var $o_group_dn = ""; - var $member_of_ogroup = FALSE; - - function workstartup (&$config, $dn= NULL, $parent= NULL) - { - /* Check if FAI is active */ - $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs')); - if(!empty($tmp)){ - $this->fai_activated = TRUE; - }else{ - $this->attributes = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "gotoShare"); - $this->objectclasses = array("GOhard"); - } - - plugin::plugin ($config, $dn, $parent); - - /* Check object group membership */ - if(!isset($this->parent->by_object['ogroup'])){ - $ldap = $this->config->get_ldap_link(); - $ldap->cd ($this->config->current['BASE']); - $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))",array("cn","dn")); - if($ldap->count()){ - $this->member_of_ogroup = TRUE; - $attrs = $ldap->fetch(); - $this->o_group_dn = $attrs['dn']; - } - } - - /* Creating a list of valid Mirrors - * none will not be saved to ldap. - */ - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - foreach($this->config->data['SERVERS']['LDAP'] as $server) { - $this->gotoLdapServerList[]= $server; - } - - /* Get list of assigned ldap servers - */ - if(isset($this->attrs['gotoLdapServer'])){ - unset($this->attrs['gotoLdapServer']['count']); - sort($this->attrs['gotoLdapServer']); - foreach($this->attrs['gotoLdapServer'] as $value){ - $this->gotoLdapServers[] = preg_replace("/^[0-9]*:/","",$value); - } - } - if(!count($this->gotoLdapServers) && $this->member_of_ogroup){ - $this->gotoLdap_inherit = TRUE; - } - - /* FAI Initialization - Skip this if FAI is not activated - */ - if($this->fai_activated) { - - $this->update_fai_cache(TRUE); - - /* Parse used FAIclasses (stored as string). - * The single classes are seperated by ' '. - * There is also the release type given, after first - * occurrence of ':'. - */ - $this->FAIclass =array(); - if(isset($this->attrs['FAIclass'][0])){ - $tmp = split(" ",$this->attrs['FAIclass'][0]); - $tmp2 =array(); - - foreach($tmp as $class){ - if( ":" == $class[0] ) { - $this->FAIrelease = trim(substr($class, 1)); - }else{ - $tmp2[$class] = $class; - } - } - $this->FAIclass = $tmp2; - } - } - - /* Get arrays */ - foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){ - if (isset($this->attrs["$val"]["count"])){ - for ($i= 0; $i<$this->attrs["count"]; $i++){ - if (isset($this->attrs["$val"][$i])){ - array_push($this->$val, $this->attrs["$val"][$i]); - } - } - } - sort ($this->$val); - $this->$val= array_unique($this->$val); - } - - /* Parse Kernel Parameters to decide what boot mode is enabled */ - if (preg_match("/ splash=silent/", $this->gotoKernelParameters)){ - $this->bootmode= "G"; - } elseif (preg_match("/ debug/", $this->gotoKernelParameters)){ - $this->bootmode= "D"; - } elseif ($this->gotoKernelParameters == "") { - $this->bootmode= "G"; - } else { - $this->bootmode= "T"; - } - if (preg_match("/ o /", $this->gotoKernelParameters)){ - $this->customParameters= preg_replace ("/^.* o /", "", $this->gotoKernelParameters); - } else { - $this->customParameters= ""; - } - - /* Prepare Shares */ - if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){ - unset($this->attrs['gotoShare']['count']); - foreach($this->attrs['gotoShare'] as $share){ - $tmp = $tmp2 = array(); - $tmp = split("\|",$share); - $tmp2['server'] =$tmp[0]; - $tmp2['name'] =$tmp[1]; - $tmp2['mountPoint'] =$tmp[2]; - $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2; - } - } - - $this->gotoShareSelections= $config->getShareList(true); - $this->gotoAvailableShares= $config->getShareList(false); - $tmp2 = array(); - - - $this->orig_dn= $this->dn; - - /* Handle inheritance value "default" */ - if ($this->member_of_ogroup){ - $this->gotoBootKernels= array("default-inherited" => '['._("inherited").']'); - } - - /* If we are member in an object group, - * we have to handle inherited values. - * So you can see what is inherited. - */ - if ($this->member_of_ogroup){ - - if(count($this->FAIclass)==0 && $this->FAIrelease == ""){ - $this->FAIdebianMirror = "inherited"; - } - - if($this->fai_activated){ - $map= array("gotoBootKernel","FAIclass","FAIdebianMirror"); - }else{ - $map= array("gotoBootKernel"); - } - - $ldap = $this->config->get_ldap_link(); - $ldap->cat($this->o_group_dn); - $attrs= $ldap->fetch(); - - foreach ($map as $name){ - if (!isset($attrs[$name][0])){ - continue; - } - - switch ($name){ - case 'gotoBootKernel': - $this->gotoBootKernels['default-inherited']= _("inherited").' ['.$attrs[$name][0].']' ; - break; - - case 'FAIclass': - $str = split(":",$attrs[$name][0]); - $this->InheritedFAIclass = split("\ ",trim($str[0])); - $this->InheritedFAIrelease = trim($str[1]); - break; - - case 'FAIdebianMirror': - $this->InheritedFAIdebianMirror = $attrs[$name][0]; - break; - } - } - } - - - if($this->fai_activated){ - - /* Check if the current mirror is available - */ - if(!isset($this->cache['SERVERS'][$this->FAIdebianMirror])){ - if(count($this->FAIclass)){ - print_red(sprintf(_("The selected FAI mirror '%s' is no longer available, the mirror was set to 'auto'."), - $this->FAIdebianMirror)); - } - $this->FAIdebianMirror = "auto"; - $this->FAIrelease = key($this->cache['SERVERS'][$this->FAIdebianMirror]); - $this->cache =array(); - $this->update_fai_cache(); - - } - - /* Check if the current mirror is available - */ - if(!isset($this->cache['SERVERS'][$this->FAIdebianMirror][$this->FAIrelease])){ - $new_release = key($this->cache['SERVERS'][$this->FAIdebianMirror]); - if(count($this->FAIclass)){ - print_red(sprintf(_("The selected FAI release '%s' is not available for mirror '%s', the release was set to '%s'."), - $this->FAIrelease,$this->FAIdebianMirror,$new_release)); - } - $this->FAIrelease = $new_release; - $this->cache =array(); - $this->update_fai_cache(); - } - } - - /* Get list of boot kernels */ - if (isset($this->config->data['TABS'])){ - $command= $this->config->search(get_class($this), "KERNELS",array('tabs')); - if (!check_command($command)){ - $message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command, - get_class($this)); - } else { - $fh= popen($command, "r"); - while (!feof($fh)) { - $buffer= trim(fgets($fh, 256)); - if(!empty($buffer)){ - $name=$value = $buffer; - if(preg_match("/:/",$buffer)){ - $name = preg_replace("/:.*$/","",$buffer); - $value= preg_replace("/^.*:/","",$buffer); - $this->gotoBootKernels[$name]= $name.":".$value; - }else{ - $this->gotoBootKernels[$name]= $value; - } - } - } - pclose($fh); - } - } - - /* Turn to default, if we've nothing to inherit */ - if (!isset($this->gotoBootKernels['default-inherited']) && $this->gotoBootKernel == "default-inherited"){ - $this->gotoBootKernel= "default"; - } - } - - - function check() - { - $messages = array(); - - /* Call common method to give check the hook */ - $messages= plugin::check(); - - /* If there are packages selected, but no mirror show error */ - if(($this->FAIdebianMirror == "none")&&(count($this->FAIclass)>0)){ - $messages[]=_("Please select a 'FAI server' or remove the 'FAI classes'."); - } - - return($messages); - } - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","workstation/".get_class($this),$this->dn); - } - - /* Do we need to flip is_account state? */ - if(isset($_POST['modify_state'])){ - if($this->is_account && $this->acl_is_removeable()){ - $this->is_account= FALSE; - }elseif(!$this->is_account && $this->acl_is_createable()){ - $this->is_account= TRUE; - } - } - - /* Do we represent a valid terminal? */ - if (!$this->is_account && $this->parent === NULL){ - $display= "\"\" ". - _("This 'dn' has no terminal features.").""; - return ($display); - } - - /* Add module */ - if (isset ($_POST['add_module'])){ - if ($_POST['module'] != "" && $this->acl_is_writeable("gotoModule")){ - $this->add_list ($this->gotoModules, $_POST['module']); - } - } - - /* Delete module */ - if (isset ($_POST['delete_module'])){ - if (count($_POST['modules_list']) && $this->acl_is_writeable("gotoModule")){ - $this->del_list ($this->gotoModules, $_POST['modules_list']); - } - } - - /* FAI class management */ - if($this->fai_activated){ - if(((isset($_POST['AddClass']))&&(isset($_POST['FAIclassesSel']))) && ($this->acl_is_writeable("FAIclass"))){ - $found = 0 ; - - /* If this new class/profile will attach a second partition table - * to our list of classes, abort and show a message. - */ - foreach($this->FAIclass as $name){ - if(isset($this->FAIclassInfo[$name])){ - foreach($this->FAIclassInfo[$name] as $atr){ - if(isset($atr['obj'])){ - if($atr['obj'] == "FAIpartitionTable"){ - $found ++ ; - } - } - } - } - } - - if((isset($this->FAIclassInfo[$_POST['FAIclassesSel']]['FAIpartitionTable']))&&($found>0)){ - print_red(_("There is already a profile in your selection that contain partition table configurations.")); - }else{ - $this->FAIclass[$_POST['FAIclassesSel']]=$_POST['FAIclassesSel']; - } - } - - $sort = false; - - /* Move one used class class one position up or down */ - if($this->acl_is_writeable("FAIclass")){ - foreach($_POST as $name => $val){ - - $sort_type = false; - if((preg_match("/sort_up/",$name))&&(!$sort)){ - $sort_type = "sort_up_"; - } - if((preg_match("/sort_down/",$name))&&(!$sort)){ - $sort_type = "sort_down_"; - } - - if(($sort_type)&&(!$sort)){ - $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/".$sort_type."/i","",$name))); - $sort = true; - - $last = -1; - $change_down = -1; - - /* Create array with numeric index */ - $tmp = array(); - foreach($this->FAIclass as $class){ - $tmp [] = $class; - } - - /* Walk trough array */ - foreach($tmp as $key => $faiName){ - if($faiName == $value){ - if($sort_type == "sort_up_"){ - if($last != -1){ - $change_down= $last; - } - }else{ - if(isset($tmp[$key+1])){ - $change_down = $key; - } - } - } - $last = $key; - } - - $tmp2 = array(); - $skip = false; - - foreach($tmp as $ky => $vl){ - - if($ky == $change_down){ - $skip = $vl; - }else{ - $tmp2[$vl] = $vl; - } - if(($skip != false)&&($ky != $change_down)){ - $tmp2[$skip] = $skip; - $skip =false; - } - } - $this->FAIclass = $tmp2; - } - - if(preg_match("/fai_remove/i",$name)){ - $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/fai_remove_/i","",$name))); - unset($this->FAIclass[$value]); - } - } - } - - /* Delete selected class from our list */ - if($this->acl_is_writeable("FAIclass")){ - if((isset($_POST['DelClass']))&&(isset($_POST['FAIclassSel']))){ - if(isset($this->FAIclass[$_POST['FAIclassSel']])){ - unset($this->FAIclass[$_POST['FAIclassSel']]); - } - } - } - }// END fai handling - - /* Show main page */ - $smarty= get_smarty(); - - /* Assign ACLs to smarty */ - $tmp = $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $name => $translation){ - $smarty->assign($name."ACL",$this->getacl($name)); - } - - $smarty->assign("member_of_ogroup",$this->member_of_ogroup); - - /* In this section server shares will be defined - * A user can select one of the given shares and a mount point - * and attach this combination to his setup. - */ - $smarty->assign("gotoShareSelections", $this->gotoShareSelections); - $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections)); - - /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry - * This entry will be, a combination of mountPoint and sharedefinitions - */ - if((isset($_POST['gotoShareAdd'])) && ($this->acl_is_writeable("gotoShare"))) { - /* We assign a share to this user, if we don't know where to mount the share */ - if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){ - print_red(_("You must specify a valid mount point.")); - }else{ - if(count($this->gotoAvailableShares)){ - $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']]; - $s_mount = $_POST['gotoShareMountPoint']; - /* Preparing the new assignment */ - $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share; - $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount; - } - } - } - - /* if the Post gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected) - * If there is no defined share selected, we will abort the deletion without any message - */ - if(($this->acl_is_writeable("gotoShare"))&& (isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare']))){ - unset($this->gotoShares[$_POST['gotoShare']]); - } - - $smarty->assign("gotoShares",$this->printOutAssignedShares()); - $smarty->assign("gotoSharesCount",count($this->printOutAssignedShares())); - $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares())); - $smarty->assign("gotoBootKernels",$this->gotoBootKernels); - - /* Create divSelectBox for ldap server selection - */ - $SelectBoxLdapServer = new divSelectBox("LdapServer"); - $SelectBoxLdapServer->SetHeight(130); - - /* Add new ldap server to the list */ - if(!$this->gotoLdap_inherit && isset($_POST['add_ldap_server']) && isset($_POST['ldap_server_to_add'])){ - if(isset($this->gotoLdapServerList[$_POST['ldap_server_to_add']])){ - $to_add = $this->gotoLdapServerList[$_POST['ldap_server_to_add']]; - if(!in_array($to_add,$this->gotoLdapServers)){ - $this->gotoLdapServers[] = $to_add; - } - } - } - - /* Move ldap servers up and down */ - if(!$this->gotoLdap_inherit){ - foreach($_POST as $name => $value){ - if(preg_match("/sort_ldap_up_/",$name)){ - $id = preg_replace("/^sort_ldap_up_([0-9]*)_(x|y)$/","\\1",$name); - $from = $id; - $to = $id -1; - $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to); - if($tmp){ - $this->gotoLdapServers = $tmp; - } - break; - } - if(preg_match("/sort_ldap_down_/",$name)){ - $id = preg_replace("/^sort_ldap_down_([0-9]*)_(x|y)$/","\\1",$name); - $from = $id; - $to = $id +1; - $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to); - if($tmp){ - $this->gotoLdapServers = $tmp; - } - break; - } - if(preg_match("/gotoLdapRemove_/",$name)){ - $id = preg_replace("/^gotoLdapRemove_([0-9]*)_(x|y)$/","\\1",$name); - $value = $this->gotoLdapServers[$id]; - $this->gotoLdapServers = array_remove_entries(array($value),$this->gotoLdapServers); - break; - } - } - } - - /* Add Entries - */ - foreach($this->gotoLdapServers as $key => $server){ - if(!in_array($server,$this->gotoLdapServerList)){ - $server = $server." (missing)"; - } - - $SelectBoxLdapServer->AddEntry( - array(array("string" => $server), - array("string" => - " ". - " ". - "", - "attach" => "style='text-align:right;width:40px;border-right:0px;'"))); - } - - if($this->gotoLdap_inherit){ - $smarty->assign("gotoLdapServerACL_inherit", preg_replace("/w/","",$this->getacl("gotoLdapServer")));; - }else{ - $smarty->assign("gotoLdapServerACL_inherit", $this->getacl("gotoLdapServer")); - } - - $list = array(); - foreach($this->gotoLdapServerList as $key => $entry){ - if(!in_array($entry,$this->gotoLdapServers)){ - $list[$key] = $entry; - } - } - $smarty->assign("gotoLdapServers", $SelectBoxLdapServer->DrawList()); - $smarty->assign("gotoLdapServerList", $list); - $smarty->assign("gotoLdap_inherit", $this->gotoLdap_inherit); - $smarty->assign("JS", session::get('js')); - - foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){ - $smarty->assign("$val", $this->$val); - } - - /* Values */ - foreach(array("gotoBootKernel", "customParameters", "gotoShare","FAIclasses","FAIclass","FAIdebianMirror","FAIrelease") as $val){ - $smarty->assign($val, $this->$val); - } - - $smarty->assign("fai_activated",$this->fai_activated); - - /* Create FAI output */ - if($this->fai_activated){ - - $this->update_fai_cache(); - - $smarty->assign("FAIservers" , $this->cache['SERVERS']); - $smarty->assign("FAIdebianMirror",$this->FAIdebianMirror); - $smarty->assign("FAIrelease" , $this->FAIrelease); - $smarty->assign("FAIclasses" , $this->selectable_classes()); - - $smarty->assign("InheritedFAIrelease",$this->InheritedFAIrelease); - - $div = new divSelectBox("WSFAIscriptClasses"); - $div -> SetHeight("110"); - $str_up = "  "; - $str_down = "  "; - $str_remove = "  "; - $str_empty = "  \"\""; - - /* Get classes */ - if($this->FAIdebianMirror == "inherited"){ - $tmp = $this->InheritedFAIclass; - }else{ - $tmp = $this->FAIclass; - } - - /* Get invalid classes */ - $invalid = $this->get_invalid_classes($tmp); - - /* Draw every single entry */ - $i = 1; - foreach($tmp as $class){ - - /* Mark invalid classes. (Not in selected release) - */ - $marker = ""; - if(in_array_ics($class,$invalid)){ - $marker = " ("._("Not available in current setup").")"; - } - - /* Create up/down priority icons - * Skip this, if we have inherited the FAI classes. - */ - if($this->FAIdebianMirror == "inherited"){ - $str = ""; - }else{ - if($i==1){ - $str = $str_empty.$str_down.$str_remove; - }elseif($i == count($this->FAIclass)){ - $str = $str_up.$str_empty.$str_remove; - }else{ - $str = $str_up.$str_down.$str_remove; - } - } - $i ++ ; - - /* Get Description tag - * There may be several FAI objects with the same class name, - * use the description from FAIprofile, if possible. - */ - $desc = ""; - if(isset($this->cache['CLASSES'][$this->FAIrelease][$class])){ - foreach($this->cache['CLASSES'][$this->FAIrelease][$class] as $types ){ - if(isset($types['Desc'])){ - $desc= $types['Desc']; - if($types['Type'] == "FAIprofile"){ - break; - } - } - } - } - if(!empty($desc)){ - $desc = " [".trim($desc)."]"; - } - - $div->AddEntry(array( - array("string"=>$class.$desc.$marker), - array("string"=>preg_replace("/\%s/",base64_encode($class),$str),"attach"=>"style='width:50px;border-right:none;'") - )); - } - $smarty->assign("FAIScriptlist",$div->DrawList()); - }// END FAI output generation - - /* Radio button group */ - if (preg_match("/G/", $this->bootmode)) { - $smarty->assign("graphicalbootup", "checked"); - } else { - $smarty->assign("graphicalbootup", ""); - } - if (preg_match("/T/", $this->bootmode)) { - $smarty->assign("textbootup", "checked"); - } else { - $smarty->assign("textbootup", ""); - } - if (preg_match("/D/", $this->bootmode)) { - $smarty->assign("debugbootup", "checked"); - } else { - $smarty->assign("debugbootup", ""); - } - - /* Show main page */ - return($smarty->fetch (get_template_path('workstationStartup.tpl', TRUE,dirname(__FILE__)))); - } - - - function remove_from_parent() - { - $this->handle_post_events("remove"); - new log("remove","workstation/".get_class($this),$this->dn); - } - - - /* Save data to object */ - function save_object() - { - $old_mirror = $this->FAIdebianMirror; - plugin::save_object(); - - /* Update release */ - if($old_mirror != $this->FAIdebianMirror){ - if(!isset($this->cache['SERVERS'][$this->FAIdebianMirror][$this->FAIrelease])){ - $this->FAIrelease = key($this->cache['SERVERS'][$this->FAIdebianMirror]); - } - } - - if(isset($_POST['WorkstationStarttabPosted'])){ - if(isset($_POST['gotoLdap_inherit'])){ - $this->gotoLdap_inherit = TRUE; - }else{ - $this->gotoLdap_inherit = FALSE; - } - - /* Save group radio buttons */ - if ($this->acl_is_writeable("bootmode") && isset($_POST["bootmode"])){ - $this->bootmode= $_POST["bootmode"]; - } - - /* Save kernel parameters */ - if ($this->acl_is_writeable("gotoKernelParameters") && isset($_POST["customParameters"])){ - $this->customParameters= $_POST["customParameters"]; - } - } - } - - - /* Save to LDAP */ - function save() - { - - /* Depending on the baseobject (Ogroup / WS) we - * use another set of objectClasses - * In case of WS itself, we use "array("GOhard", "FAIobject");" - * if we are currently editing from ogroup menu we use (array("gotWorkstationTemplate","GOhard", "FAIobject")) - */ - if(isset($this->parent->by_object['ogroup'])){ - $this->objectclasses = array("gotoWorkstationTemplate"); - }elseif(isset($this->parent->by_object['workgeneric'])){ - $this->objectclasses = array("GOhard"); - }elseif(isset($this->parent->by_object['servgeneric'])){ - $this->objectclasses = array("GOhard","gotoWorkstationTemplate"); - }else{ - print "Object Type Configuration : unknown"; - exit(); - } - - /* Append FAI class */ - if($this->fai_activated){ - $this->objectclasses[] = "FAIobject"; - } - - /* Find proper terminal path for tftp configuration - FIXME: This is suboptimal when the default has changed to - another location! */ - if (($this->gotoTerminalPath == "default")){ - $ldap= $this->config->get_ldap_link(); - - /* Strip relevant part from dn, keep trailing ',' */ - $tmp= preg_replace("/^cn=[^,]+,".get_ou('terminalou')."/i", "", $this->dn); - $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp); - - /* Walk from top to base and try to load default values for - 'gotoTerminalPath'. Abort when an entry is found. */ - while (TRUE){ - $tmp= preg_replace ("/^[^,]+,/", "", $tmp); - - $ldap->cat("cn=default,".get_ou('terminalou').$tmp. - $this->config->current['BASE'], array('gotoTerminalPath')); - $attrs= $ldap->fetch(); - if (isset($attrs['gotoTerminalPath'])){ - $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0]; - break; - } - - /* Nothing left? */ - if ($tmp == ""){ - break; - } - } - } - - /* Add semi automatic values */ - // FIXME: LDAP Server may not be set here... - $this->gotoKernelParameters= "ldap=".base64_encode($this->gotoLdapServer); - - switch ($this->bootmode){ - case "D": - $this->gotoKernelParameters.= " debug"; - break; - case "G": - $this->gotoKernelParameters.= " splash=silent"; - break; - } - if ($this->customParameters != ""){ - $this->gotoKernelParameters.= " o ".$this->customParameters; - } - - plugin::save(); - - unset( $this->attrs['FAIrelease'] ); - - $str = ""; - - /* Skip FAI attribute handling if not necessary */ - if($this->fai_activated){ - if($this->FAIdebianMirror == "inherited"){ - $this->attrs['FAIclass'] = $this->attrs['FAIrelease'] = $this->attrs['FAIdebianMirror'] = array(); - }else{ - foreach($this->FAIclass as $class){ - $str .= $class." "; - } - $str .= ":" . $this->FAIrelease; - $this->attrs['FAIclass']= ""; - $this->attrs['FAIclass']= trim($str); - - if(empty($this->attrs['FAIclass'])){ - $this->attrs['FAIclass'] = array(); - } - } - } - - /* Add missing arrays */ - foreach (array("gotoFilesystem", "gotoAutoFs", "gotoModules") as $val){ - if (isset ($this->$val) && count ($this->$val) != 0){ - - $this->attrs["$val"]= array_unique($this->$val); - } - if(!isset($this->attrs["$val"])) $this->attrs["$val"]=array(); - } - - /* Prepare list of ldap servers */ - $this->attrs['gotoLdapServer'] = array(); - if(!$this->gotoLdap_inherit){ - $i = 0; - foreach($this->gotoLdapServers as $server){ - $i ++; - $this->attrs['gotoLdapServer'][] = $i.":".$server; - } - } - - if (($this->attrs['gotoBootKernel'] == "default-inherited") || ($this->attrs['gotoBootKernel'] == "%default%")){ - $this->attrs['gotoBootKernel']= array(); - } - - /* if mirror == none stop saving this attribute */ - if($this->FAIdebianMirror == "none"){ - $this->FAIdebianMirror = ""; - } - - /* Get FAIstate from object, the generic tab could have changed it during execute */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - - - /* Skip FAI attribute handling if not necessary */ - if($this->fai_activated){ - $ldap->cat($this->dn,array("FAIstate")); - $checkFAIstate = $ldap->fetch(); - - /* Remove FAI objects if no FAI class is selected */ - if((count($this->FAIclass)==0) && (!isset($checkFAIstate['FAIstate']))){ - $this->attrs['FAIclass'] = array(); - $this->attrs['FAIdebianMirror'] = array(); - } - } - - - /* prepare share settings */ - $tmp = array(); - foreach($this->gotoShares as $name => $settings){ - $tmp2= split("\|",$name); - $name = $tmp2[0]; - $tmp[] = $settings['server']."|".$name."|".$settings['mountPoint']; - } - $this->attrs['gotoShare']=$tmp; - - $this->cleanup(); - $ldap->modify ($this->attrs); - new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - - show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/startup with dn '%s' failed."),$this->dn)); - $this->handle_post_events("modify"); - } - - - /* Add value to array, check if unique */ - function add_list (&$array, $value) - { - if ($value != ""){ - $array[]= $value; - sort($array); - array_unique ($array); - } - } - - - /* Delete value to array, check if unique */ - function del_list (&$array, $list) - { - $tmp= array(); - foreach ($array as $mod){ - if (!in_array($mod, $list)){ - $tmp[]= $mod; - } - } - $array= $tmp; - } - - /* Generate ListBox frindly output for the defined shares - * Possibly Add or remove an attribute here, - */ - function printOutAssignedShares() - { - $a_return = array(); - if(is_array($this->gotoShares)){ - foreach($this->gotoShares as $share){ - $a_return[$share['name']."|".$share['server']]= $share['name']." [".$share['server']."]"; - } - } - return($a_return); - } - - - - function PrepareForCopyPaste($source) - { - plugin::PrepareForCopyPaste($source); - $source_o = new workstartup ($this->config, $source['dn']); - foreach(array("FAIclass","gotoModules", "gotoAutoFs", "gotoFilesystem", - "gotoKernelParameters","gotoShares","customParameters") as $attr){ - $this->$attr = $source_o->$attr; - } - } - - - function array_switch_item($ar,$from,$to) - { - if(!is_array($ar)){ - return(false); - } - if(!isset($ar[$from])){ - return(false); - } - if(!isset($ar[$to])){ - return(false); - } - - $tmp = $ar[$from]; - $ar[$from] = $ar[$to]; - $ar[$to] = $tmp; - return($ar); - } - - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Startup"), - "plDescription" => _("System startup"), - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 9, - "plSection" => array("administration"), - "plCategory" => array("workstation","server","ogroups"), - - "plProvidedAcls"=> array( - "gotoLdapServer" => _("Ldap server"), - "gotoBootKernel" => _("Boot kernel"), - "gotoKernelParameters" => _("Kernel parameter"), - - "gotoModules" => _("Kernel modules"), - "gotoShare" => _("Shares"), - - "FAIclass" => _("FAI classes"), - "FAIdebianMirror" => _("Debian mirror"), - "FAIrelease" => _("Debian release"), - - "FAIstatus" => _("FAI status flag")) // #FIXME is this acl realy necessary ? - )); - } - - - /* Updates release dns - * and reads all classes for the current release, - * if not already done ($this->cache). - */ - function update_fai_cache($first_call = FALSE) - { - $force = FALSE; - - /* Get the list of available servers and their releases. - */ - if($force || !isset($this->cache['SERVERS'])){ - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(&(FAIrepository=*)(objectClass=FAIrepositoryServer))",array("FAIrepository")); - $this->cache['SERVERS'] = array(); - - /* Only add inherit option, if we are part in an object group - */ - if($this->member_of_ogroup){ - $this->cache['SERVERS']['inherited']=array(); - } - - /* Add auto value - */ - $this->cache['SERVERS']['auto'] = array(); - $sort_by = array("auto"); - $server_tmp = array("auto"=>array()); - while($attr = $ldap->fetch()){ - if(isset($attr['FAIrepository'])){ - for($i = 0 ; $i < $attr['FAIrepository']['count'] ; $i ++ ){ - $rep = $attr['FAIrepository'][$i]; - $tmp = split("\|",$rep); - if(count($tmp)==4){ - $sections = split(",",$tmp[3]); - $release = $tmp[2]; - $server = $tmp[1]; - $url = $tmp[0]; - $server_tmp[$url][$release]=$release; - $server_tmp['auto'][$release]=$release; - $sort_by[$url] = $url; - } - } - } - } - natcasesort($sort_by); - foreach($sort_by as $name){ - $releases = $server_tmp[$name]; - natcasesort($releases); - $this->cache['SERVERS'][$name] = $releases; - } - } - - /* Build up arrays, without checks */ - if(!$first_call){ - - /* Check if the selected mirror is available */ - if(!isset($this->cache['SERVERS'][$this->FAIdebianMirror])){ - $this->FAIdebianMirror = "auto"; - $this->FAIrelease = key($this->cache['SERVERS'][$this->FAIdebianMirror]); - trigger_error("There was a problem with the selected FAIdebianMirror. This mirror ('".$this->FAIdebianMirror."') is not available"); - } - - /* Check if the selected release is available */ - if($this->FAIdebianMirror != "inherited" && !isset($this->cache['SERVERS'][$this->FAIdebianMirror][$this->FAIrelease])){ - trigger_error("There was a problem with the selected FAIrelease. This release ('".$this->FAIrelease."') is not available"); - $this->FAIrelease = key($this->cache['SERVERS'][$this->FAIdebianMirror]); - } - } - - /* Get classes for release from cache. - * Or build cache - */ - if($this->FAIdebianMirror == "inherited"){ - $release = $this->InheritedFAIrelease; - }else{ - $release = $this->FAIrelease; - } - if($force || !isset($this->cache['CLASSES'][$release])){ - - /* Create a list of available releases. - * $this->cache['RELEASE_DNS'][ou=siga...,c=de] = "siga"; - * $this->cache['RELEASE_DNS'][ou=siga,ou=rc1,...,c=de] = "siga/rc1"; - */ - if($force || !isset($this->cache['RELEASE_DNS'])){ - $this->cache['RELEASE_DNS'] = array(); - $fai_ou_parts = preg_replace("/\/.*$/","",$this->FAIrelease); - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(objectClass=FAIbranch)",array("ou")); - while($attrs = $ldap->fetch()){ - if(preg_match("/".normalizePreg(get_ou("faiou"))."/",$attrs['dn'])){ - $this->cache['RELEASE_DNS'][$attrs['dn']] = $this->dn_to_release_name($attrs['dn']); - } - } - } - - /* Create list of available classes for the currenlty selected release. - */ - $base = array_search($release,$this->cache['RELEASE_DNS']); - $this->cache['CLASSES'][$release] = array(); - - if(class_exists("FAI")){ - if(!empty($base)){ - $filter = "(|(objectClass=FAIpackageList)(objectClass=FAItemplate)(objectClass=FAIvariable)". - "(objectClass=FAIscript)(objectClass=FAIhook)(objectClass=FAIprofile)". - "(objectClass=FAIpartitionTable))"; - $list = FAI::get_all_objects_for_given_base($base,$filter,TRUE); - foreach($list as $attrs){ - $info = $this->analyse_fai_object($attrs); - if(count($info)){ - $this->cache['CLASSES'][$release][$attrs['cn'][0]][] = $info; - } - } - } - }else{ - print_red(_("Could not load available classes, the fai extension plugin seems not to be installed.")); - } - - /* Add object caught from external hook - */ - $lines= $this->GetHookElements(); - foreach ($lines as $hline){ - $entries= split(";", $hline); - $server = $entries['0']; - $url = $entries['1']; - if (!empty($url)){ - - /* Split releases */ - if (isset($entries[2])){ - $releases= split(",", $entries[2]); - - foreach ($releases as $release_data){ - $release= preg_replace('/:.*$/', '', $release_data); - $sections = split(':', preg_replace('/^[^:]+:([^|]+)|.*$/', '\1', $release_data)); - $classes = split('\|', preg_replace('/^[^|]+\|(.*)$/', '\1', $release_data)); - $this->cache['SERVERS'][$url][$release]=$release; - $this->cache['SERVERS']['auto'][$release]=$release; - foreach ($classes as $class){ - if ($class != ""){ - $this->cache['CLASSES'][$release][$class]= array(); - } - } - } - } - } - } - } - } - - - /* This function return an array containing all - * invalid classes for the selected server/release - */ - function get_invalid_classes($classes) - { - $this->update_fai_cache(); - if($this->FAIdebianMirror == "inherited"){ - $release_classes = $this->cache['CLASSES'][$this->InheritedFAIrelease]; - }else{ - $release_classes = $this->cache['CLASSES'][$this->FAIrelease]; - } - - - /* Detect all classes that are not valid - * for the selected release - */ - $NA = array(); - foreach($classes as $class){ - if(!isset($release_classes[$class])){ - $NA[] = $class; - } - } - return($NA); - } - - - /* Get all selectable classes for the ui select box - */ - function selectable_classes() - { - $this->update_fai_cache(); - - if($this->FAIdebianMirror == "inherited"){ - $classes = $this->cache['CLASSES'][$this->InheritedFAIrelease]; - }else{ - $classes = $this->cache['CLASSES'][$this->FAIrelease]; - } - - $Abbr =""; - $ret= array(); - foreach($classes as $class_name => $class_types){ - if(!in_array($class_name,$this->FAIclass)){ - foreach($class_types as $type){ - if(!preg_match("/".$type['Abbr']."/",$Abbr)){ - $Abbr .= $type['Abbr']." "; - } - } - $ret[$class_name] = trim($Abbr); - } - } - uksort($ret, 'strnatcasecmp'); - return($ret); - } - - - /* Analyse FAI object and return an array with usefull informations like - * FAIobject type. - */ - function analyse_fai_object($attr) - { - $tmp2 = array(); - if(!isset($attr['description'])){ - $attr['description'][0] =""; - } - if(in_array('FAIpackageList',$attr['objectClass'])){ - $tmp2["Type"] = 'FAIpackageList'; - $tmp2["Abbr"] = 'Pl'; - $tmp2["Desc"] = $attr['description'][0]; - } - if(in_array('FAItemplate',$attr['objectClass'])){ - $tmp2["Type"] = 'FAItemplate'; - $tmp2["Abbr"] = 'T'; - $tmp2["Desc"] = $attr['description'][0]; - } - if(in_array('FAIvariable',$attr['objectClass'])){ - $tmp2["Type"] = 'FAIvariable'; - $tmp2["Abbr"] = 'V'; - $tmp2["Desc"] = $attr['description'][0]; - } - if(in_array('FAIscript',$attr['objectClass'])){ - $tmp2["Type"] = 'FAIscript'; - $tmp2["Abbr"] = 'S'; - $tmp2["Desc"] = $attr['description'][0]; - } - if(in_array('FAIhook',$attr['objectClass'])){ - $tmp2["Type"] = 'FAIhook'; - $tmp2["Abbr"] = 'H'; - $tmp2["Desc"] = $attr['description'][0]; - } - if(in_array('FAIpartitionTable',$attr['objectClass'])){ - $tmp2["Type"]= 'FAIpartitionTable'; - $tmp2["Abbr"]= 'Pt'; - $tmp2["Desc"] = $attr['description'][0]; - } - if(in_array('FAIprofile',$attr['objectClass'])){ - $tmp2["Type"]= 'FAIprofile'; - $tmp2["Abbr"]= 'P'; - $tmp2["Desc"] = $attr['description'][0]; - } - return($tmp2); - } - - - /* Return repository hook output, if possible. - */ - function GetHookElements() - { - $ret = array(); - $cmd= $this->config->search("servrepository", "REPOSITORY_HOOK",array('tabs')); - if(!empty($cmd)){ - $res = shell_exec($cmd); - $res2 = trim($res); - if((!$res)){ - print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s' please check your gosa.conf."),$cmd)); - }elseif(empty($res2)){ - print_red(sprintf(_("The specified REPOSITORY_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd)); - }else{ - $tmp = split("\n",$res); - foreach($tmp as $line){ - if(empty($line)) continue; - $ret[]= $line; - } - } - } - return($ret); - } - - - /* This function creates the release name out of a dn - * e.g. "ou=1.0rc2,ou=siga,ou=fai,..." => "siga/1.0rc2" - */ - function dn_to_release_name($dn) - { - $relevant = preg_replace("/,".normalizePreg(get_ou("faiou")).".*$/","",$dn); - $parts = array_reverse(split("\,",$relevant)); - $str =""; - foreach($parts as $part){ - $str .= preg_replace("/^ou=/","",$part)."/"; - } - return(preg_replace("/\/$/","",$str)); - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/gencd.tpl b/gosa-core/plugins/admin/systems/gencd.tpl deleted file mode 100644 index f0c449677..000000000 --- a/gosa-core/plugins/admin/systems/gencd.tpl +++ /dev/null @@ -1,20 +0,0 @@ -

- {t}CD-Install-Image generation{/t} -

-

- {t}This option enables you to generate FAI install CD images for the selected workstation. The procedure may take about 10 minutes to complete, so please be patient after pressing the 'Create ISO-Image' button.{/t} -

- -

- -   - -

- - - diff --git a/gosa-core/plugins/admin/systems/gencd_frame.tpl b/gosa-core/plugins/admin/systems/gencd_frame.tpl deleted file mode 100644 index 4c53bdab5..000000000 --- a/gosa-core/plugins/admin/systems/gencd_frame.tpl +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/gosa-core/plugins/admin/systems/goto/ArpNewDevice.tpl b/gosa-core/plugins/admin/systems/goto/ArpNewDevice.tpl new file mode 100644 index 000000000..8e4bf44ac --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/ArpNewDevice.tpl @@ -0,0 +1,31 @@ +

{t}Integrating unknown devices{/t}

+

+ {t}The current device has been detected by the ARP monitor used by GOsa. You can integrate this device into your running DHCP/DNS infrastructure by submitting this form. The device entry will disapear from the list of the systems and move to the DNS/DHCP configuration.{/t} +

+ + + + + + + +
+ + + + + + + +
+
+

+{$netconfig} + + + +

diff --git a/gosa-core/plugins/admin/systems/goto/SelectDeviceType.tpl b/gosa-core/plugins/admin/systems/goto/SelectDeviceType.tpl new file mode 100644 index 000000000..d25acbf49 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/SelectDeviceType.tpl @@ -0,0 +1,46 @@ +
+

+{t}This is a new system which currently has no system type defined. Please choose a system type for this entry and press the 'continue' button. If this system should be added to a group of system settings, specify the preferred object group below.{/t} +
+
+

+

+
+{t}Please select a system type and an optional bundle of predefined settings to be inherited.{/t} +
+
+

+
+ + + + + +
+ + + + +
+ {t}System type{/t}  + +
+
+ + + + +
+ {t}Choose an object group as template{/t}  + +
+
+

 

+

+ + +

diff --git a/gosa-core/plugins/admin/systems/goto/chooser.tpl b/gosa-core/plugins/admin/systems/goto/chooser.tpl new file mode 100644 index 000000000..3e8bf95f9 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/chooser.tpl @@ -0,0 +1,21 @@ +

{t}Choose the kind of system component you want to create{/t}

+ +

+ {t}Linux terminals and workstations are autocreated on bootup. For this reason you're only be able to create templates for a specific tree. Servers are normally automatically added too, but in some special cases you may need to create a faked server entry to provide GOsa with some informations. Other network components may be used for Nagios setups to create component dependencies.{/t} +

+ +{t}Linux thin client template{/t}
+{t}Linux workstation template{/t}
+{t}Linux Server{/t}
+ +{t}Network printer{/t}
+{t}Phone{/t}
+{t}Other network component{/t}
+ +

+ +   + +

+ + diff --git a/gosa-core/plugins/admin/systems/goto/class_ArpNewDevice.inc b/gosa-core/plugins/admin/systems/goto/class_ArpNewDevice.inc new file mode 100644 index 000000000..79009908e --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/class_ArpNewDevice.inc @@ -0,0 +1,74 @@ +cn =""; + $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses); + $this->acl = "#all#"; + $this->netConfigDNS->acl = $this->acl; + $this->netConfigDNS->force_dns(); + } + + function execute() + { + $smarty = get_smarty(); + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->$attr); + } + $this->netConfigDNS->cn= $this->cn; + $smarty->assign("netconfig", $this->netConfigDNS->execute()); + + /* Display sub dialog from network settings */ + $this->netConfigDNS->acl = $this->acl; + if($this->netConfigDNS->dialog){ + $this->dialog = TRUE; + return($this->netConfigDNS->execute()); + }else{ + $this->dialog = FALSE; + } + + return($smarty->fetch (get_template_path('ArpNewDevice.tpl', TRUE))); + } + + function check() + { + $message= plugin::check(); + $message= array_merge($message, $this->netConfigDNS->check()); + if(empty($this->cn)){ + $message[] = _("Please specify a valid dns name."); + } + return($message); + } + + function save_object() + { + if(isset($_POST['ArpNewDevice_posted'])){ + plugin::save_object(); + $this->netConfigDNS->save_object(); + } + } + + function save() + { + $this->netConfigDNS->acl = $this->acl; + plugin::save(); + $this->netConfigDNS->cn = $this->cn; + $this->netConfigDNS->save($this->dn); + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->rmdir_recursive($this->dn); + show_ldap_error($ldap->get_error(),_("Could not remove arp-alert device after writing dns and dhcp configuration.")); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/admin/systems/goto/class_SelectDeviceType.inc b/gosa-core/plugins/admin/systems/goto/class_SelectDeviceType.inc new file mode 100644 index 000000000..c17b8ef5f --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/class_SelectDeviceType.inc @@ -0,0 +1,85 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* attribute list for save action */ + var $ignore_account= TRUE; + var $attributes= array("ObjectGroup","SystemType"); + var $objectclasses= array("whatever"); + + var $ObjectGroups = array(); + var $SystemTypes = array(); + + var $ObjectGroup = ""; + var $SystemType = ""; + + function SelectDeviceType (&$config, $dn= NULL) + { + plugin::plugin ($config, $dn); + + /* Get object groups */ + $ldap = $this->config->get_ldap_link(); + $ldap->cd ($this->config->current['BASE']); + $ldap->search("(&(objectClass=gosaGroupOfNames)(cn=*))",array("cn")); + $this->ObjectGroups['none']=_("none"); + while($attrs = $ldap->fetch()){ + $this->ObjectGroups[$attrs['dn']]= $attrs['cn'][0]; + } + + $this->SystemTypes =array("workstation"=>_("Workstation"), "terminal"=>_("Terminal"), "server"=>_("Server")); + } + + function execute() + { + /* Call parent execute */ + plugin::execute(); + + /* Fill templating stuff */ + $smarty= get_smarty(); + $display= ""; + + $smarty->assign("ObjectGroups" ,$this->ObjectGroups); + $smarty->assign("ObjectGroupKeys" ,array_flip($this->ObjectGroups)); + $smarty->assign("SystemTypes" ,$this->SystemTypes); + $smarty->assign("SystemTypeKeys" ,array_flip($this->SystemTypes)); + + $smarty->assign("ObjectGroup",$this->ObjectGroup); + $smarty->assign("SystemType",$this->SystemType); + + $display.= $smarty->fetch(get_template_path('SelectDeviceType.tpl', TRUE)); + return($display); + } + + /* Save data to object */ + function save_object() + { + plugin::save_object(); + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = $_POST[$attr]; + } + } + } + + /* Check supplied data */ + function check() + { + /* Call common method to give check the hook */ + $message= plugin::check(); + + return ($message); + } + + /* Save to LDAP */ + function save() + { + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/admin/systems/goto/class_printGeneric.inc b/gosa-core/plugins/admin/systems/goto/class_printGeneric.inc new file mode 100644 index 000000000..9eec1acaf --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/class_printGeneric.inc @@ -0,0 +1,1046 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* Generic terminal attributes */ + var $interfaces = array(); + var $ignore_account = FALSE; + + /* Needed values and lists */ + var $base = ""; + var $cn = ""; + var $l = ""; + var $description = ""; + var $labeledURI = ""; + var $gotoPrinterPPD = ""; + var $initial_PPD = ""; + var $orig_dn = ""; + + var $UserMember =""; + var $UserMembers =array(); + var $UserMemberKeys =array(); + + var $AdminMember =""; + var $AdminMembers =array(); + var $AdminMemberKeys =array(); + + var $PPDdialogToSave = NULL; + var $BelongsTo = "unknown"; // Specifies if this is a standalone printer, or belongs to a terminal / WS + + var $member =array(); + var $strings = ""; + var $netConfigDNS; + var $baseSelection = false; + var $macAddress = ""; + + var $gotoUserAdminPrinter; + var $gotoGroupAdminPrinter ; + var $gotoGroupPrinter; + var $gotoUserPrinter ; + + /* attribute list for save action */ + var $attributes = array("cn", "description", "l", "labeledURI", "gotoPrinterPPD","gotoUserPrinter", "macAddress", + "gotoUserAdminPrinter","gotoGroupAdminPrinter","gotoUserPrinter","gotoGroupPrinter"); + var $objectclasses = array("top", "gotoPrinter"); + var $view_logged = FALSE; + var $parent; + + function printgeneric (&$config, $dn,$parent_init,$parent) + { + $this->config = &$config; + $this->dn = $dn; + + /* If parent was posted(the tabs object) we can detect the printer type. */ + if($parent){ + $this->parent = $parent; + $this->getTypeOfPrinter(); + }else{ + $this->BelongsTo = "unknown"; + return; + } + + /* Update dn, to ensure storing as printer instead of WS / terminal */ + if(preg_match("/Terminal/i",$this->BelongsTo) || preg_match("/TerminalTemplate/i",$this->BelongsTo)){ + $this->dn= preg_replace("/".normalizePreg(get_ou('terminalou'))."/",get_ou('printerou'),$this->dn); + } + + if(preg_match("/Workstation/i",$this->BelongsTo) || preg_match("/WorkstationTemplate/i",$this->BelongsTo)){ + $this->dn= preg_replace("/".normalizePreg(get_ou('workstationou'))."/",get_ou('printerou'),$this->dn); + } + + $this->orig_dn = $this->dn; + + /* Get printer settings, possibly dn has changed */ + plugin::plugin ($config, $this->dn); + + /* Get is_account initially_was_account status */ + $this->getTypeOfPrinter(true); + + /* set orig dn to new if object is new */ + $ldap= $this->config->get_ldap_link(); + $ldap->cat($this->dn, array('dn')); + if(!$ldap->count()){ + $this->orig_dn = "new"; + } + + /* create dns object */ + $this->netConfigDNS = new termDNS($this->config, $this,$this->objectclasses); + + /* Set base */ + if ($this->dn == "new"){ + $ui= get_userinfo(); + $this->base= dn2base($ui->dn); + $this->cn= ""; + } else { + + /* Set base and check if the extracted base exists */ + if(preg_match("/".normalizePreg(get_ou('incomingou'))."/",$this->dn)){ + $this->base= preg_replace("/".normalizePreg(get_ou('incomingou'))."/","",dn2base($this->dn)); + }else{ + $this->base= preg_replace("/".normalizePreg(get_ou('printerou'))."/","",dn2base($this->dn)); + } + + if(!isset($this->config->idepartments[$this->base])){ + print_red(_("Can't extract a valid base out of object dn, setting base to '%s'."),session::get('CurrentMainBase')); + $this->base = session::get('CurrentMainBase'); + } + } + + /* Extract selected ppd */ + if(isset($this->gotoPrinterPPD)){ + $this->gotoPrinterPPD = preg_replace("/^http.*ppd\//i","",$this->gotoPrinterPPD); + } + + $this->initial_PPD = $this->gotoPrinterPPD; + + /* 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(); + + if (isset($this->attrs[$attr]['count'])) { + 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")); + if($ldap->count()){ + $entry = $ldap->fetch(); + $this->member[$type][$entry['cn'][0]]=$entry; + } + }else{ + $ldap->search("(&(objectClass=person)(objectClass=inetOrgPerson)(uid=".$mem."))",array("cn","uid")); + if($ldap->count()){ + $entry = $ldap->fetch(); + $this->member[$type][$entry['uid'][0]]=$entry; + } + } + } + } + } + } + + function set_acl_base($base) + { + plugin::set_acl_base($base); + if(is_object($this->netConfigDNS)){ + $this->netConfigDNS->set_acl_base($base); + } + } + + function set_acl_category($cat) + { + plugin::set_acl_category($cat); + if(is_object($this->netConfigDNS)){ + $this->netConfigDNS->set_acl_category($cat); + } + } + + /* Detect type of printer. + * Printer can be stand alone, belong to a workstation or belong to a terminal. + * We can detect the type printer type when comparing the tabs objects + */ + function getTypeOfPrinter($UpdateAccountStatus = false) + { + /* Disable account as default + */ + $this->is_account = $this->initially_was_account = false; + + /* Detect type of printer via parent tabs. + */ + + $class = get_class($this->parent); + if(isset($this->parent->by_object['workgeneric'])){ + + /* Exclude templates + */ + $this->cn = $this->parent->by_object['workgeneric']->cn; + if($this->parent->by_object['workgeneric']->cn == "wdefault"){ + $this->BelongsTo = "WorkstationTemplate"; + }else{ + $this->BelongsTo = "Workstation"; + } + }elseif(isset($this->parent->by_object['termgeneric'])){ + + /* Exclude templates + */ + $this->cn = $this->parent->by_object['termgeneric']->cn; + if($this->parent->by_object['termgeneric']->cn == "default"){ + $this->BelongsTo = "TerminalTemplate"; + }else{ + $this->BelongsTo = "Terminal"; + } + }elseif(isset($this->parent->by_name['printgeneric'])){ + $this->BelongsTo = "Printer"; + } + + if($UpdateAccountStatus){ + + /* Set is_account / was account + */ + if($this->dn == "new"){ + $this->initially_was_account = false; + } + + /* If is printer it must be a true account. + */ + if(preg_match("/printer/i",$this->BelongsTo)){ + $this->is_account = true; + } + + /* Update dn, to ensure storing as printer instead of WS / terminal + */ + if(preg_match("/terminal/i",$this->BelongsTo)){ + $this->dn= preg_replace("/".normalizePreg(get_ou('terminalou'))."/",get_ou('printerou'),$this->dn); + } + + if(preg_match("/workstation/i",$this->BelongsTo)){ + $this->dn= preg_replace("/".normalizePreg(get_ou('workstationou'))."/",get_ou('printerou'),$this->dn); + } + + /* Detect if this is a valid printer account; + */ + $ldap = $this->config->get_ldap_link(); + $ldap->cat($this->dn, array('objectClass')); + + if($ldap->count()){ + $attrs = $ldap->fetch(); + if(in_array("gotoPrinter",$attrs['objectClass'])){ + $this->initially_was_account = true; + $this->is_account = true; + }else{ + $this->is_account = false; + } + } + } + } + + function execute() + { + /* Call parent execute */ + plugin::execute(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","printer/".get_class($this),$this->dn); + } + + + /* If type of printer couldn't be detected (because of missing parent object in construction) + * hide this tab. + */ + if(preg_match("/unknown/i",$this->BelongsTo)){ + $display= $this->show_enable_header(_("Add printer extension"), + _("Could not initialize printer tab, parameter parent was missing while construction."),TRUE,TRUE); + return($display); + } + + /* Templates can't have printer extensions + */ + if(preg_match("/WorkstationTemplate/i",$this->BelongsTo)){ + $display= $this->show_enable_header(_("Add printer extension"), + _("This is a workstation template, printer tab is disabled."),TRUE,TRUE); + return($display); + } + if(preg_match("/TerminalTemplate/i",$this->BelongsTo)){ + $display= $this->show_enable_header(_("Add printer extension"), + _("This is a terminal template, printer tab is disabled."),TRUE,TRUE); + return($display); + } + + /* Get cn from base object */ + if(preg_match("/^Workstation$/i",$this->BelongsTo)){ + $this->cn = $this->parent->by_object['workgeneric']->cn; + } + if(preg_match("/^Terminal$/i",$this->BelongsTo)){ + $this->cn = $this->parent->by_object['termgeneric']->cn; + } + + $smarty= get_smarty(); + + /* Assign acls */ + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL", $this->getacl($name)); + } + + $display=""; + + /* Tell smarty if this is a standalone object or a terminal / WS depending printer */ + if(preg_match("/^Printer$/i",$this->BelongsTo)){ + $smarty->assign("StandAlone",true); + }else{ + $smarty->assign("StandAlone",false); + } + + /* Do we need to flip is_account state? */ + if(isset($_POST['modify_state'])){ + if($this->is_account && $this->acl_is_removeable()){ + $this->is_account= FALSE; + }elseif(!$this->is_account && $this->acl_is_createable()){ + $this->is_account= TRUE; + } + } + + /* Do we represent a valid printer? */ + if (!$this->is_account && $this->parent === NULL){ + $display= "\"\" ". + _("This 'dn' has no printer features.").""; + return($display); + } + + /* If this is a WS / Terminal depending printer, display account state button */ + if(!preg_match("/^Printer$/i",$this->BelongsTo)){ + if((empty($this->cn)) && ($this->dn != "new")){ + $display= $this->show_enable_header(_("Add printer extension"), + _("This object has printer extension disabled. You can't enable it while 'cn' is not present in entry. Possibly you are currently creating a new terminal template"),TRUE,TRUE); + $this->is_account= false; + return $display; + } + + if (($this->is_account)){ + if(preg_match("/^Workstation$/i",$this->BelongsTo)){ + $display= $this->show_disable_header(_("Remove printer extension"), + _("This workstation has printer extension enabled.You can disable it by clicking below.")); + }elseif(preg_match("/^Terminal$/i",$this->BelongsTo)){ + $display= $this->show_disable_header(_("Remove printer extension"), + _("This terminal has printer extension enabled. You can disable it by clicking below.")); + } + }else{ + if(preg_match("/^Workstation$/i",$this->BelongsTo)){ + $display= $this->show_disable_header(_("Add printer extension"), + _("This workstation has printer extension disabled. You can enable it by clicking below.")); + }elseif(preg_match("/^Terminal$/i",$this->BelongsTo)){ + $display= $this->show_enable_header(_("Add printer extension"), + _("This terminal has printer extension disabled. You can enable it by clicking below.")); + } + return ($display); + } + } + + /* Base select dialog */ + $once = true; + foreach($_POST as $name => $value){ + if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){ + $once = false; + $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases()); + $this->dialog->setCurrentBase($this->base); + $this->baseSelection = true; + } + } + + /* Dialog handling for base select dialog + * Check if base was selected, dialog aborted etc */ + if(is_object($this->dialog)){ + + $this->dialog->save_object(); + if($this->baseSelection){ + if($this->dialog->isClosed()){ + $this->dialog = false; + $this->baseSelection = false; + }elseif($this->dialog->isSelected()){ + + /* A new base was selected, check if it is a valid one */ + $tmp = $this->get_allowed_bases(); + if(isset($tmp[$this->dialog->isSelected()])){ + $this->base = $this->dialog->isSelected(); + } + + $this->dialog= false; + $this->baseSelection = false; + }else{ + return($this->dialog->execute()); + } + } + } + + /* Fill templating stuff */ + $smarty->assign("bases", $this->get_allowed_bases()); + $smarty->assign("base_select", $this->base); + + /* Assign attributes */ + foreach ($this->attributes as $attr){ + $smarty->assign("$attr", $this->$attr); + } + + if(isset($_POST['AddUser'])){ + $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddUser"); + } + if(isset($_POST['AddGroup'])){ + $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddGroup"); + } + if(isset($_POST['AddAdminUser'])){ + $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddAdminUser"); + } + if(isset($_POST['AddAdminGroup'])){ + $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddAdminGroup"); + } + + /* Display ppd configure/select dialog */ + if(isset($_POST['EditDriver'])){ + if($this->PPDdialogToSave && is_object($this->PPDdialogToSave)){ + $this->dialog = $this->PPDdialogToSave; + }else{ + $this->dialog = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD); + $this->dialog->cn= $this->cn; + } + } + + /* remove ppd */ + if(isset($_POST['RemoveDriver'])){ + $this->gotoPrinterPPD = array(); + $this->PPDdialogToSave = NULL; + } + + /* Close ppd dialog */ + if(isset($_POST['ClosePPD'])){ + unset($this->dialog); + $this->dialog=FALSE; + } + + /* Save selected ppd */ + if(isset($_POST['SavePPD'])){ + $this->dialog->save_object(); + if(count($this->dialog->check())){ + foreach($this->dialog->check() as $msg){ + print_red($msg); + } + }else{ + $this->gotoPrinterPPD = array(); + $this->gotoPrinterPPD = $this->dialog->save(); + $this->PPDdialogToSave = $this->dialog; + unset($this->dialog); + $this->dialog=FALSE; + } + } + + /* Member management, delete user / group / admin ..*/ + if((isset($_POST['DelUser']))&&(isset($_POST['UserMember']))){ + foreach($_POST['UserMember'] as $mem){ + $this->DelMember('AddUser',$mem); + } + } + + if((isset($_POST['DelUser']))&&(isset($_POST['UserMember']))){ + foreach($_POST['UserMember'] as $mem){ + $this->DelMember('AddGroup',$mem); + } + } + + if((isset($_POST['DelAdmin']))&&(isset($_POST['AdminMember']))){ + foreach($_POST['AdminMember'] as $mem){ + $this->DelMember('AddAdminUser',$mem); + } + } + + if((isset($_POST['DelAdmin']))&&(isset($_POST['AdminMember']))){ + foreach($_POST['AdminMember'] as $mem){ + $this->DelMember('AddAdminGroup',$mem); + } + } + + /* Abort user / group adding dialog */ + if(isset($_POST['PrinterCancel'])){ + unset($this->dialog); + $this->dialog= FALSE; + } + + /* Save selected users / groups */ + if(isset($_POST['PrinterSave'])){ + $this->dialog->save_object(); + if(count($this->dialog->check())){ + foreach($this->dialog->check() as $msg){ + print_red($msg); + } + }else{ + $data= $new = $this->dialog->save(); + unset($data['type']); + foreach($data as $mem){ + $this->AddMember($new['type'], $mem['dn']); + } + unset($this->dialog); + $this->dialog=FALSE; + } + } + + /* Display dialog, if there is currently one open*/ + if(is_object($this->dialog)){ + $this->dialog->save_object(); + $display = $this->dialog->execute(); + return $display; + } + + /* Parse selected ppd file */ + $config = session::get('config'); + if((isset($config->data['MAIN']['PPD_PATH']))&&(is_dir($config->data['MAIN']['PPD_PATH']))){ + + $path = $config->data['MAIN']['PPD_PATH']; + if(!preg_match("/\/$/",$path)){ + $path = $path."/"; + } + + $ppdManager= new ppdManager($path); + if(!empty($this->gotoPrinterPPD)){ + if((!file_exists($path.$this->gotoPrinterPPD))){ + $smarty->assign("driverInfo", "".sprintf(_("Your currently selected PPD file '%s' doesn't exist."),$path.$this->gotoPrinterPPD).""); + }else{ + $smarty->assign("driverInfo", $ppdManager->loadDescription($path.$this->gotoPrinterPPD)); + } + }else{ + $smarty->assign("driverInfo", _("Not defined")); + } + }else{ + $smarty->assign("driverInfo",_("Can't get ppd informations.")); + } + + /* Create user & admin user list */ + $list=$this->generateList(); + $userlist = array_merge($list['AddUser'],$list['AddGroup']); + $adminlist = array_merge($list['AddAdminUser'],$list['AddAdminGroup']); + + asort($userlist); + asort($adminlist); + + if(!preg_match("/Printer/i",$this->BelongsTo)){ + if(preg_match("/Terminal/i",$this->BelongsTo)){ + $smarty->assign("desc" ,sprintf(_("This printer belongs to terminal %s. You can't rename this printer."),"".$this->cn."")); + }else{ + $smarty->assign("desc" ,sprintf(_("This printer belongs to workstation %s. You can't rename this printer."),"".$this->cn."")); + } + $smarty->assign("cnACL" , $this->getacl("cn",true)); + }else{ + $smarty->assign("desc" ,""); + } + $smarty->assign("UserMember" ,$this->UserMember); + $smarty->assign("UserMembers" ,$userlist); + $smarty->assign("UserMemberKeys",array_flip($userlist)); + + $smarty->assign("AdminMember" ,$this->AdminMember); + $smarty->assign("AdminMembers" ,$adminlist); + $smarty->assign("AdminMemberKeys",array_flip($adminlist)); + if(preg_match("/Printer/i",$this->BelongsTo)){ + + /* Show main page */ + $str = $this->netConfigDNS->execute(); + if(is_object($this->netConfigDNS->dialog)){ + return($str); + } + $smarty->assign("netconfig", $str); + } else { + $smarty->assign("netconfig", ""); + } + + return($display.$smarty->fetch (get_template_path('printer.tpl', TRUE))); + } + + function remove_from_parent() + { + /* Only remove if there was initially an account */ + if($this->initially_was_account){ + + /* Update dn, to ensure storing as printer instead of WS / terminal + */ + if(preg_match("/terminal/i",$this->BelongsTo)){ + $this->dn= preg_replace("/".normalizePreg(get_ou('terminalou')).",/",get_ou('printerou'),$this->dn); + } + + if(preg_match("/workstation/i",$this->BelongsTo)){ + $this->dn= preg_replace("/".normalizePreg(get_ou('workstationou'))."/",get_ou('printerou'),$this->dn); + } + + /* Check if this dn points to a printer, to avoid deleting something else */ + $ldap= $this->config->get_ldap_link(); + $ldap->cat($this->dn, array('dn',"objectClass")); + if(!$ldap->count()){ + print_red("Trying to remove printer object which isn't a printer. Aborted to avoid data loss."); + return; + } + + /* Check if obejct is a printer */ + $CheckPrinter = $ldap->fetch(); + if(!in_array("gotoPrinter",$CheckPrinter['objectClass'])){ + print_red("Trying to remove printer object which isn't a printer. Aborted to avoid data loss."); + return; + } + + /* Remove account & dns extension */ + $this->netConfigDNS->remove_from_parent(); + $ldap->rmdir($this->dn); + + new log("remove","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + + show_ldap_error($ldap->get_error(), sprintf(_("Removing of system print/generic with dn '%s' failed."),$this->dn)); + $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); + + /* Delete references to object groups */ + $ldap->cd ($this->config->current['BASE']); + $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn")); + while ($ldap->fetch()){ + $og= new ogroup($this->config, $ldap->getDN()); + unset($og->member[$this->dn]); + $og->save (); + } + + /* Remove previously selected ppd file.*/ + if(!empty($this->initial_PPD)){ + $tmp = new printerPPDDialog($this->config, $this->dn,$this->initial_PPD); + $tmp->removeModifiedPPD(); + } + } + } + + + /* Save data to object */ + function save_object() + { + /* Create a base backup and reset the + base directly after calling plugin::save_object(); + Base will be set seperatly a few lines below */ + $base_tmp = $this->base; + plugin::save_object(); + $this->base = $base_tmp; + + if(is_object($this->netConfigDNS)){ + $this->netConfigDNS->save_object(); + } + + /* Set new base if allowed */ + $tmp = $this->get_allowed_bases(); + if(isset($_POST['base'])){ + if(isset($tmp[$_POST['base']])){ + $this->base= $_POST['base']; + } + } + } + + /* Check supplied data */ + function check() + { + /* Call common method to give check the hook */ + $message= plugin::check(); + if (preg_match("/printer/i",$this->BelongsTo)){ + $message= array_merge($message, $this->netConfigDNS->check()); + } + + /* Don't display check messages if this is a template object */ + if(isset($this->parent->by_object['workgeneric'])){ + if($this->parent->by_object['workgeneric']->cn == "wdefault"){ + return $message; + } + }elseif(isset($this->parent->by_object['termgeneric'])){ + if($this->parent->by_object['termgeneric']->cn == "default"){ + return $message; + } + } + + $dn= "cn=".$this->cn.get_ou('printerou').",".$this->base; + + /* must: cn */ + if(($this->BelongsTo == "Printer") && (empty($this->cn))){ + $message[]= _("The required field 'Printer name' is not set."); + } + + /* must: cn */ + if(($this->BelongsTo == "Printer") && !tests::is_dns_name($this->cn)){ + $message[]= _("Invalid character in printer name."); + } + + /* must: labeledURI */ + if(empty($this->labeledURI)){ + $message[]= "The required field 'Printer URL' is not set."; + } + + /* Check if there is already an entry with this cn*/ + if (($this->orig_dn != $dn)&&( preg_match("/printer/i",$this->BelongsTo))){ + $ldap= $this->config->get_ldap_link(); + $ldap->cd ($this->base); + $ldap->ls("(cn=".$this->cn.")",get_ou('printerou').$this->base, array("cn")); + if ($ldap->count() != 0){ + while ($attrs= $ldap->fetch()){ + if(preg_match("/cn=dhcp,/",$attrs['dn'])){ + continue; + } + if ($attrs['dn'] != $this->orig_dn){ + $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); + break; + } + } + } + } + + return ($message); + } + + + /* Save to LDAP */ + function save() + { + /* Update dn, to ensure storing as printer instead of WS / terminal + */ + if(preg_match("/terminal/i",$this->BelongsTo)){ + $this->dn= preg_replace("/".normalizePreg(get_ou('terminalou')).",/",get_ou('printerou'),$this->dn); + } + + if(preg_match("/workstation/i",$this->BelongsTo)){ + $this->dn= preg_replace("/".normalizePreg(get_ou('workstationou'))."/",get_ou('printerou'),$this->dn); + } + + if(!$this->is_account) return; + if(isset($this->parent->by_object['workgeneric'])){ + if($this->parent->by_object['workgeneric']->cn == "wdefault"){ + return; + } + }elseif(isset($this->parent->by_object['termgeneric'])){ + if($this->parent->by_object['termgeneric']->cn == "default"){ + return; + } + } + + /* If type is still unknown, the initialisation of this printer failed, abort. */ + if(preg_match("/unknown/i",$this->BelongsTo)){ + return; + } + + /* save ppd configuration */ + if($this->PPDdialogToSave && is_object($this->PPDdialogToSave)){ + $this->PPDdialogToSave->save_ppd(); + } + if($this->orig_dn != $this->dn){ + if(!empty($this->gotoPrinterPPD)) { + $this->PPDdialogToSave = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD); + $this->PPDdialogToSave->cn = $this->cn; + $this->PPDdialogToSave->generateProperties(); + $this->PPDdialogToSave->update_ppd_url(); + } + } + + /* Remove previously selected ppd file.*/ + if($this->initial_PPD != $this->gotoPrinterPPD){ + if(!empty($this->initial_PPD)){ + $tmp = new printerPPDDialog($this->config, $this->dn,$this->initial_PPD); + $tmp->removeModifiedPPD(); + } + } + + if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){ + $method="https://"; + }else{ + $method="http://"; + } + + /* If no ppd is selected, remove this attribute */ + if(!empty($this->gotoPrinterPPD)) { + $this->gotoPrinterPPD = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/ppd/".$this->gotoPrinterPPD); + }else{ + $this->gotoPrinterPPD = array(); + } + + $dn= $this->dn; + plugin::save(); + $ldap= $this->config->get_ldap_link(); + + /* reduce objectClasses to minimun */ + $this->attrs['objectClass']= $this->objectclasses; + + /* Remove all empty values */ + if ($this->orig_dn == 'new'){ + $attrs= array(); + foreach ($this->attrs as $key => $val){ + if (is_array($val) && count($val) == 0){ + continue; + } + $attrs[$key]= $val; + } + $this->attrs= $attrs; + } + + /* Append printer user + */ + $this->attrs['gotoUserPrinter']=array(); + foreach($this->member['AddUser'] as $mem){ + $this->attrs['gotoUserPrinter'][]=$mem['uid'][0]; + } + + /* Append printer group + */ + $this->attrs['gotoGroupPrinter'] = array(); + foreach($this->member['AddGroup'] as $mem){ + $this->attrs['gotoGroupPrinter'][]=$mem['cn'][0]; + } + + /* Append printer admin user + */ + $this->attrs['gotoUserAdminPrinter'] = array(); + foreach($this->member['AddAdminUser'] as $mem){ + $this->attrs['gotoUserAdminPrinter'][]=$mem['uid'][0]; + } + + /* Append printer admin group + */ + $this->attrs['gotoGroupAdminPrinter']= array(); + foreach($this->member['AddAdminGroup'] as $mem){ + $this->attrs['gotoGroupAdminPrinter'][]=$mem['cn'][0]; + } + + if($this->orig_dn == 'new'){ + foreach(array("gotoGroupPrinter","gotoUserAdminPrinter","gotoGroupAdminPrinter","gotoUserPrinter") as $checkVar){ + if(count($this->attrs[$checkVar]) == 0 || empty($this->attrs[$checkVar])){ + unset($this->attrs[$checkVar]); + } + } + }else{ + if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){ + $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag"; + } + } + + /* Ensure to create a new object */ + if(preg_match("/".normalizePreg(get_ou('incomingou'))."/",$this->orig_dn)){ + $this->orig_dn = "new"; + } + + /* Move object in necessary*/ + if (($this->orig_dn != $this->dn) && ($this->orig_dn != 'new')){ + $this->move($this->orig_dn, $this->dn); + } + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cat($this->dn); + if(!$ldap->count()){ + $ldap->cd($this->config->current['BASE']); + $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); + $ldap->cd($this->dn); + + /* Remove empty values */ + foreach($this->attrs as $name => $value){ + if(empty($value)){ + unset($this->attrs[$name]); + } + } + + $ldap->add($this->attrs); + $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); + new log("create","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } else { + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); + new log("modify","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of system print/generic with dn '%s' failed."),$this->dn)); + + if(preg_match("/printer/i",$this->BelongsTo)){ + $this->netConfigDNS->cn = $this->cn; + $this->netConfigDNS->dn = $this->dn; + $this->netConfigDNS->save(); + } + } + + function generateList(){ + $a_return=array(); + + foreach($this->member as $type => $values){ + $a_return[$type]=array(); + foreach($values as $value){ + if((preg_match("/Group/i",$type))){ + if(!isset($value['description'])){ + $a_return[$type][$value['cn'][0]]= _("Group")." : ".$value['cn'][0]; + }else{ + $a_return[$type][$value['cn'][0]]= _("Group")." : ".$value['cn'][0]." [".$value['description'][0]."]"; + } + }else{ + $a_return[$type][$value['uid'][0]]=_("User")." : ".$value['cn'][0]; + } + } + } + return($a_return); + } + + /* Return plugin informations for acl handling + #FIXME FAIscript seams to ununsed within this class... */ + static function plInfo() + { + return (array( + "plShortName" => _("Generic"), + "plDescription" => _("Print generic"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 4, + "plSection" => array("administration"), + "plCategory" => array("printer" => array("description" => _("Printer"), + "objectClass" => "gotoPrinter"),"workstation","terminal"), + "plProvidedAcls"=> array( + "cn" => _("Name"), + "base" => _("Base") , + "description" => _("Description"), + "l" => _("Location"), + "labeledURI" => _("LabeledURL"), + "gotoPrinterPPD" => _("Printer PPD"), + "gotoUserPrinter" => _("Permissions")) + )); + } + + + /* Delete member */ + function DelMember($type,$id) + { + /* Check if there was a printer "dn" given, or the "cn" */ + foreach($this->member[$type] as $key => $printer){ + if($printer['dn'] == $id) { + $id = $key; + } + } + + if(!$this->acl_is_writeable("gotoUserPrinter")){ + print_red(sprintf(_("You are not allowed to remove the given object '%s' from the list of members of printer '%s'."),$id,$this->dn)); + return(FALSE); + } + + if(isset($this->member[$type][$id])){ + unset($this->member[$type][$id]); + return(TRUE); + } + return(FALSE); + } + + + /* Add given obejct to members */ + function AddMember($type,$dn) + { + $types = array("AddUser","AddGroup","AddAdminUser","AddAdminGroup"); + if(!in_array_ics($type, $types)){ + print_red(sprintf(_("Illegal printer type while adding '%s' to the list of '%s' printers,"),$dn,$type)); + return(FALSE); + } + + if(!$this->acl_is_writeable("gotoUserPrinter")){ + print_red(sprintf(_("You are not allowed to add the given object '%s' to the list of members of '%s'."),$dn,$this->dn)); + return(FALSE); + } + + /* Get name of index attributes */ + if(preg_match("/user/i",$type)){ + $var = "uid"; + }else{ + $var = "cn"; + } + + $ldap = $this->config->get_ldap_link(); + $ldap->cd($dn); + $ldap->cat($dn,array($var,"cn")); + if($ldap->count()){ + + $attrs = $ldap->fetch(); + + if(isset($attrs[$var][0])){ + $name = $attrs[$var][0]; + + /* Check if this uid/cn is already assigned to any permission */ + foreach($types as $ctype){ + + /* If we want to add a user, only check user/userAdmin members */ + if((preg_match("/user/i",$type)) && (!preg_match("/user/i",$ctype))){ + continue; + } + + /* If we want to add a group, only check groups/adminGroups .. */ + if((preg_match("/group/i",$type)) && (!preg_match("/group/i",$ctype))){ + continue; + } + + if(isset( $this->member[$ctype][$name])){ + print_red(sprintf(_("Can't add '%s' to the list of members, it is already used."),$attrs[$var][0])); + return(FALSE); + } + } + + /* Everything is fine. So add the given object to members */ + $this->member[$type][$attrs[$var][0]] = $attrs ; + }else{ + print_a($attrs); + } + }else{ + print_red(sprintf(_("Can't add '%s' to list of members, it is not reachable."),$dn)); + return(FALSE); + } + return(TRUE); + } + + + /* Display generic part for server copy & paste */ + function getCopyDialog() + { + $vars = array("cn"); + $smarty = get_smarty(); + $smarty->assign("cn" ,$this->cn); + $smarty->assign("object","printer"); + $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); + } + + + function saveCopyDialog() + { + if(isset($_POST['cn'])){ + $this->cn = $_POST['cn']; + } + } + + function PrepareForCopyPaste($source) + { + plugin::PrepareForCopyPaste($source); + if(isset($source['macAddress'][0])){ + $this->netConfigDNS->macAddress = $source['macAddress'][0]; + } + if(isset($source['ipHostNumber'][0])){ + $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0]; + } + + $source_o = new printgeneric($this->config,$source['dn'],NULL,$this->parent); + foreach($this->attributes as $attr){ + $this->$attr = $source_o->$attr; + } + $this->member = $source_o -> member; + + $this->gotoPrinterPPD = ""; + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/admin/systems/goto/class_selectUserToPrinterDialog.inc b/gosa-core/plugins/admin/systems/goto/class_selectUserToPrinterDialog.inc new file mode 100644 index 000000000..1f110e355 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/class_selectUserToPrinterDialog.inc @@ -0,0 +1,198 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* attribute list for save action */ + var $ignore_account = TRUE; + var $attributes = array(); + var $objectclasses = array("whatever"); + var $regex = "*"; + var $subtree = FALSE; + var $depselect = "/"; + var $deplist = "/"; + + var $searchObjects = ""; + var $searchAttrs = ""; + var $searchAppend = ""; + var $baseAddition = ""; + var $type = ""; + var $search_cat = ""; + + function selectUserToPrinterDialog (&$config, $dn= NULL,$type=false ) + { + plugin::plugin ($config, $dn); + $this->depselect = $this->config->current['BASE']; + + switch($type){ + case "AddUser" : + $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))"; + $this->searchAttrs = array("cn","uid"); + $this->searchAppend = "uid"; + $this->baseAddition = get_people_ou(); + $this->search_cat = "users"; + ;break; + case "AddGroup" : + $this->searchObjects = "(objectClass=posixGroup)"; + $this->searchAttrs = array("cn","description"); + $this->searchAppend = "cn"; + $this->baseAddition = get_groups_ou(); + $this->search_cat = "groups"; + ;break; + case "AddAdminUser" : + $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))"; + $this->searchAttrs = array("cn","uid"); + $this->searchAppend = "uid"; + $this->baseAddition = get_people_ou(); + $this->search_cat = "users"; + ;break; + case "AddAdminGroup" : + $this->searchObjects = "(objectClass=posixGroup)"; + $this->searchAttrs = array("cn","description"); + $this->searchAppend = "cn"; + $this->baseAddition = get_groups_ou(); + $this->search_cat = "groups"; + ;break; + } + $this->type = $type; + + } + + function execute() + { + /* Call parent execute */ + plugin::execute(); + + /* Fill templating stuff */ + $smarty= get_smarty(); + $display= ""; + + if(isset($_POST['dialogissubmitted'])){ + $this->regex=$_POST['regexPrinter']; + $this->depselect = $_POST['depselectPrinter']; + } + $this->subtree= isset($_POST['SubSearch']); + + if((isset($_GET['search']))&&(!empty($_GET['search']))){ + $this->regex=$_GET['search']."*"; + $this->regex=preg_replace("/\*\*/","*",$this->regex); + } + + + /* Get all departments within this subtree */ + $base = $this->config->current['BASE']; + $deps_res[] = array("dn"=>$this->config->current['BASE']); + $deps_res= array_merge($deps_res,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", array("users","groups"), $this->config->current['BASE'], + array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH)); + + /* Load possible departments */ + $ui = get_userinfo(); + + /* Allowed user departments */ + $udeps = $ui->get_module_departments("users"); + + /* Allowed groups department */ + $gdeps = $ui->get_module_departments("groups"); + + /* Combine both arrays */ + $tdeps = array_unique(array_merge($udeps,$gdeps)); + + /* Create usable departments array */ + $ids = $this->config->idepartments; + $deps = array(); + foreach($deps_res as $dep){ + if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){ + $value = $ids[$dep['dn']]; + $deps[$dep['dn']] = $value; + } + } + if(!isset($deps[$this->depselect])){ + $this->depselect = key($deps); + } + + + + $tmp_printers= $this->getPrinter(); + natcasesort($tmp_printers); + $smarty->assign("regexPrinter" , $this->regex); + $smarty->assign("deplistPrinter" , $deps);;//deplist); + $smarty->assign("depselectPrinter" , $this->depselect); + $smarty->assign("gotoPrinters" , $tmp_printers); + $smarty->assign("gotoPrinterKeys" , array_flip($tmp_printers)); + $smarty->assign("apply" , apply_filter()); + $smarty->assign("alphabet" , generate_alphabet()); + $smarty->assign("search_image" , get_template_path('images/search.png')); + $smarty->assign("tree_image" , get_template_path('images/tree.png')); + $smarty->assign("infoimage" , get_template_path('images/info.png')); + $smarty->assign("launchimage" , get_template_path('images/small_filter.png')); + $smarty->assign("deplist" , $deps); + $smarty->assign("subtree", $this->subtree?"checked":""); + + $display.= $smarty->fetch(get_template_path('selectUserToPrinterDialog.tpl', TRUE,dirname(__FILE__))); + return($display); + } + + function check(){ + /* Call common method to give check the hook */ + $message= plugin::check(); + + if(empty($_POST['gotoPrinter'])){ + $message[] = _("Please select a printer or press cancel."); + } + return $message; + } + + /* Save to LDAP */ + function save() + { + $a_return['type']=$this->type; + + foreach($_POST['gotoPrinter'] as $name){ + $data = $this->getPrinter(true); + $a_return[$name]= $data[$name]; + } + return($a_return); + } + + /* This function generates the Printerlist + * All printers are returned that match regex and and depselect + */ + function getPrinter($detailed = false) + { + $a_return=array(); + + $filter = "(&".$this->searchObjects."(cn=".$this->regex."))"; + $base = $this->baseAddition.$this->depselect; + $attrs = $this->searchAttrs; + $cat = $this->search_cat; + + if ($this->subtree){ + $res= get_list($filter,$cat,$this->depselect,$attrs, GL_SUBSEARCH); + } else { + $res= get_list($filter,$cat,$base,$attrs); + } + foreach($res as $printer){ + if(($detailed ==true)){ + if(isset($printer[$this->searchAppend])){ + $a_return[$printer[$this->searchAppend][0]] = $printer; + } + }else{ + if(isset($printer[$this->searchAppend])){ + if(isset($printer['description'][0])){ + $a_return[$printer[$this->searchAppend][0]] = $printer['cn'][0]." - ".$printer['description'][0]; + }else{ + $a_return[$printer[$this->searchAppend][0]] = $printer['cn'][0]; + } + } + } + } + return($a_return); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/admin/systems/goto/class_terminalGeneric.inc b/gosa-core/plugins/admin/systems/goto/class_terminalGeneric.inc new file mode 100644 index 000000000..cdd9b8d68 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/class_terminalGeneric.inc @@ -0,0 +1,682 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* Generic terminal attributes */ + var $gotoMode= "disabled"; + var $gotoTerminalPath= ""; + var $gotoSwapServer= ""; + var $gotoSyslogServer= ""; + var $gotoSyslogServers = array(); + var $gotoNtpServer= array(); + var $gotoNtpServers= array(); + var $gotoSndModule= ""; + var $gotoFloppyEnable= ""; + var $gotoCdromEnable= ""; + var $ghCpuType= "-"; + var $ghMemSize= "-"; + var $ghUsbSupport= "-"; + var $ghNetNic= array(); + var $ghIdeDev= array(); + var $ghScsiDev= array(); + var $ghGfxAdapter= "-"; + var $ghSoundAdapter= "-"; + var $gotoLastUser= "-"; + var $netConfigDNS; + /* Needed values and lists */ + var $base= ""; + var $cn= ""; + var $orig_dn= ""; + + var $inheritTimeServer = true; + + /* Plugin side filled */ + var $modes= array(); + + /* attribute list for save action */ + var $ignore_account= TRUE; + var $attributes= array("gotoMode", "gotoTerminalPath", + "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer", + "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule", + "ghCpuType", "ghMemSize","ghUsbSupport", + "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser"); + var $objectclasses= array("top", "gotoTerminal", "GOhard"); + + var $mapActions = array("reboot" => "", + "instant_update" => "softupdate", + "update" => "sceduledupdate", + "reinstall" => "install", + "rescan" => "", + "memcheck" => "memcheck", + "sysinfo" => "sysinfo"); + + var $fai_activated = FALSE; + var $view_logged = FALSE; + + var $member_of_ogroup = FALSE; + + function termgeneric (&$config, $dn= NULL, $parent= NULL) + { + /* Check if FAI is activated */ + $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs')); + if(!empty($tmp)){ + $this->fai_activated = TRUE; + } + + plugin::plugin ($config, $dn, $parent); + + if(!isset($this->parent->by_object['ogroup'])){ + $ldap = $this->config->get_ldap_link(); + $ldap->cd ($this->config->current['BASE']); + $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))",array("cn")); + $this->member_of_ogroup = $ldap->count() >= 1; + } + + $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses); + /* Read arrays */ + foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){ + if (!isset($this->attrs[$val])){ + continue; + } + for ($i= 0; $i<$this->attrs[$val]['count']; $i++){ + array_push($this->$val, $this->attrs[$val][$i]); + } + } + + /* Create used ntp server array */ + $this->gotoNtpServer= array(); + if(isset($this->attrs['gotoNtpServer'])){ + $this->inheritTimeServer = false; + unset($this->attrs['gotoNtpServer']['count']); + foreach($this->attrs['gotoNtpServer'] as $server){ + $this->gotoNtpServer[$server] = $server; + } + } + + /* Set inherit checkbox state */ + if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){ + $this->inheritTimeServer = true; + $this->gotoNtpServer=array(); + } + + /* You can't inherit the NTP service, if we are not member in an object group */ + if(!$this->member_of_ogroup){ + $this->inheritTimeServer = FALSE; + } + + /* Create available ntp options */ + $this->gotoNtpServers = $this->config->data['SERVERS']['NTP']; + foreach($this->gotoNtpServers as $key => $server){ + if($server == "default"){ + unset($this->gotoNtpServers[$key]); + } + } + + $this->modes["disabled"]= _("disabled"); + $this->modes["text"]= _("text"); + $this->modes["graphic"]= _("graphic"); + + /* Set base */ + if ($this->dn == "new"){ + $ui= get_userinfo(); + $this->base= dn2base($ui->dn); + } else { + $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn); + } + + /* Create an array of all Syslog servers */ + $tmp = $this->config->data['SERVERS']['SYSLOG']; + foreach($tmp as $server){ + $visible = $server; + if($server == "default" && $this->member_of_ogroup) { + $visible = "["._("inherited")."]"; + } + $this->gotoSyslogServers[$server] = $visible; + } + + $this->orig_dn= $this->dn; + } + + function set_acl_base($base) + { + plugin::set_acl_base($base); + $this->netConfigDNS->set_acl_base($base); + } + + function set_acl_category($cat) + { + plugin::set_acl_category($cat); + $this->netConfigDNS->set_acl_category($cat); + } + + function execute() + { + /* Call parent execute */ + plugin::execute(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","terminal/".get_class($this),$this->dn); + } + + /* Do we need to flip is_account state? */ + if (isset($_POST['modify_state'])){ + $this->is_account= !$this->is_account; + } + + if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate")){ + + /* Set FAIstate */ + if($this->fai_activated && $this->dn != "new"){ + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->cat($this->dn,array("objectClass")); + $res = $ldap->fetch(); + + $attrs = array(); + $attrs['FAIstate'] = ""; + if(isset($this->mapActions[$_POST['saction']])){ + $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']]; + } + + for($i = 0; $i < $res['objectClass']['count'] ; $i ++){ + $attrs['objectClass'][] = $res['objectClass'][$i]; + } + + if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){ + $attrs['objectClass'][] = "FAIobject"; + } + + if($attrs['FAIstate'] == ""){ +#FIXME we should check if FAIobject is used anymore + $attrs['FAIstate'] = array(); + } + + $ldap->cd($this->dn); + $ldap->modify($attrs); + show_ldap_error($ldap->get_error(), sprintf(_("Saving of system terminal/generic (FAIstate) with dn '%s' failed."),$this->dn)); + } + + switch($_POST['saction']){ + case 'wake': + $cmd= $this->config->search("termgeneric", "WAKECMD",array('tabs')); + + if ($cmd == ""){ + print_red(_("No WAKECMD definition found in your gosa.conf")); + } else { + exec ($cmd." ".$this->netConfigDNS->macAddress, $dummy, $retval); + if ($retval != 0){ + print_red(sprintf(_("Execution of '%s' failed!"), $cmd)); + } + } + break; + + case 'reboot': + $cmd= $this->config->search("termgeneric", "REBOOTCMD",array('tabs')); + if ($cmd == ""){ + print_red(_("No REBOOTCMD definition found in your gosa.conf")); + } else { + exec ($cmd." ".$this->cn, $dummy, $retval); + if ($retval != 0){ + print_red(sprintf(_("Execution of '%s' failed!"), $cmd)); + } + } + break; + + case 'halt': + $cmd= $this->config->search("termgeneric", "HALTCMD",array('tabs')); + if ($cmd == ""){ + print_red(_("No HALTCMD definition found in your gosa.conf")); + } else { + exec ($cmd." ".$this->cn, $dummy, $retval); + if ($retval != 0){ + print_red(sprintf(_("Execution of '%s' failed!"), $cmd)); + } + } + break; + } + } + + /* Base select dialog */ + $once = true; + foreach($_POST as $name => $value){ + if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){ + $once = false; + $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases()); + $this->dialog->setCurrentBase($this->base); + } + } + + /* Dialog handling */ + if(is_object($this->dialog)){ + /* Must be called before save_object */ + $this->dialog->save_object(); + + if($this->dialog->isClosed()){ + $this->dialog = false; + }elseif($this->dialog->isSelected()){ + + /* A new base was selected, check if it is a valid one */ + $tmp = $this->get_allowed_bases(); + if(isset($tmp[$this->dialog->isSelected()])){ + $this->base = $this->dialog->isSelected(); + } + $this->dialog= false; + }else{ + return($this->dialog->execute()); + } + } + + /* Do we represent a valid terminal? */ + if (!$this->is_account && $this->parent === NULL){ + $display= "\"\" ". + _("This 'dn' has no terminal features.").""; + return($display); + } + + /* Add new ntp Server to our list */ + if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){ + $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers']; + } + + /* Delete selected NtpServer for list of used servers */ + if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){ + foreach($_POST['gotoNtpServerSelected'] as $name){ + unset($this->gotoNtpServer[$name]); + } + } + + /* Fill templating stuff */ + $smarty= get_smarty(); + + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL",$this->getacl($name)); + } + + $smarty->assign("cn", $this->cn); + $smarty->assign("staticAddress", ""); + + $smarty->assign("bases", $this->get_allowed_bases()); + + /* tell smarty the inherit checkbox state */ + $smarty->assign("inheritTimeServer",$this->inheritTimeServer); + + /* Check if terminal is online */ + $query= "fping -q -r 1 -t 500 ".$this->cn; + exec ($query, $dummy, $retval); + + /* Offline */ + if ($retval == 0){ + $smarty->assign("actions", array( "halt" => _("Switch off"), + "reboot" => _("Reboot"), + "memcheck" => _("Memory test"), + "sysinfo" => _("System analysis"))); + } else { + $smarty->assign("actions", array("wake" => _("Wake up"), + "memcheck" => _("Memory test"), + "sysinfo" => _("System analysis"))); + } + + /* Arrays */ + $smarty->assign("modes", $this->modes); + + $tmp2 = array(); + foreach($this->config->data['SERVERS']['NFS'] as $server){ + if($server != "default"){ + $tmp2[$server]= $server; + }else{ + if($this->member_of_ogroup){ + $tmp2[$server]="["._("inherited")."]"; + } + } + } + + $smarty->assign("nfsservers", $tmp2); + $smarty->assign("syslogservers", $this->gotoSyslogServers); + + $tmp = array(); + foreach($this->gotoNtpServers as $server){ + if(!in_array($server,$this->gotoNtpServer)){ + $tmp[$server] = $server; + } + } + + $smarty->assign("ntpservers", $tmp); + $smarty->assign("fai_activated",$this->fai_activated); + + /* Variables */ + foreach(array("base", "gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){ + $smarty->assign($val."_select", $this->$val); + } + + $smarty->assign("member_of_ogroup",$this->member_of_ogroup); + + /* Show main page */ + $str = $this->netConfigDNS->execute(); + if(is_object($this->netConfigDNS->dialog)){ + return($str); + } + $smarty->assign("netconfig", $str); + return($smarty->fetch (get_template_path('terminal.tpl', TRUE))); + } + + function remove_from_parent() + { + if($this->acl_is_removeable()){ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $ldap->cat($this->dn, array('dn')); + if($ldap->count()){ + $this->netConfigDNS->remove_from_parent(); + $ldap->rmDir($this->dn); + + new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + + show_ldap_error($ldap->get_error(), sprintf(_("Removing of object system terminal/generic with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); + + /* Delete references to object groups */ + $ldap->cd ($this->config->current['BASE']); + $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn")); + while ($ldap->fetch()){ + $og= new ogroup($this->config, $ldap->getDN()); + unset($og->member[$this->dn]); + $og->save (); + } + } + } + } + + + /* Save data to object */ + function save_object() + { + /* Create a base backup and reset the + base directly after calling plugin::save_object(); + Base will be set seperatly a few lines below */ + $base_tmp = $this->base; + plugin::save_object(); + $this->base = $base_tmp; + + /* Set new base if allowed */ + $tmp = $this->get_allowed_bases(); + if(isset($_POST['base'])){ + if(isset($tmp[$_POST['base']])){ + $this->base= $_POST['base']; + } + } + + $this->netConfigDNS->save_object(); + + /* Save terminal path to parent since it is used by termstartup, too */ + if(isset($this->parent->by_object['termstartup'])){ + $this->parent->by_object['termstartup']->gotoTerminalPath= $this->gotoTerminalPath; + } + + if(isset($_POST['termgeneric_posted'])){ + if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){ + $this->inheritTimeServer = true; + }else{ + $this->inheritTimeServer = false; + } + } + + if(isset($_POST["inheritAll"])){ + $this->set_everything_to_inherited(); + } + + } + + + /* Check supplied data */ + function check() + { + /* Call common method to give check the hook */ + $message= plugin::check(); + + /* Skip IP & Mac checks if this is a template */ + if($this->cn != "default"){ + $message= array_merge($message, $this->netConfigDNS->check()); + } + + /* Permissions for that base? */ + $this->dn= "cn=".$this->cn.",".get_ou('terminalou').$this->base; + + if ($this->cn == ""){ + $message[]= _("The required field 'Terminal name' is not set."); + } + + /* Check if given name is a valid host/dns name */ + if(!tests::is_dns_name($this->cn) ){ + $message[] = _("Please specify a valid name for this object."); + } + + if ($this->orig_dn == 'new'){ + $ldap= $this->config->get_ldap_link(); + $ldap->cd ($this->base); + + /* It is possible to have a 'default' terminal on every base */ + if($this->cn == "default"){ + $ldap->cat($this->dn); + }else{ + $ldap->search ("(&(objectClass=gotoTerminal)(cn=".$this->cn."))", array("cn")); + } + if ($ldap->count() != 0){ + while ($attrs= $ldap->fetch()){ + if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".normalizePreg(get_ou('incomingou'))."/", $ldap->getDN())){ + continue; + } else { + if ($attrs['dn'] != $this->orig_dn){ + $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); + break; + } + } + } + } + } + + /* Check for valid ntpServer selection */ + if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){ + $message[]= _("There must be at least one NTP server selected, or the inherit mode activated."); + } + + return ($message); + } + + + /* Save to LDAP */ + function save() + { + + /* Move object if requested */ + if( $this->orig_dn != 'new' && $this->dn != $this->orig_dn){ + $this->move($this->orig_dn, $this->dn); + } + + plugin::save(); + + /* Strip out 'default' values */ + foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){ + if(isset($this->attrs[$val])){ + if ($this->attrs[$val] == "default"){ + $this->attrs[$val]= array(); + } + } + } + + /* Add missing arrays */ + foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){ + if (isset ($this->$val) && count ($this->$val) != 0){ + $this->attrs["$val"]= $this->$val; + } + } + + /* Remove all empty values */ + if ($this->orig_dn == 'new'){ + $attrs= array(); + foreach ($this->attrs as $key => $val){ + if (is_array($val) && count($val) == 0){ + continue; + } + $attrs[$key]= $val; + } + $this->attrs= $attrs; + } + + /* Set ntpServers */ + $this->attrs['gotoNtpServer'] = array(); + if(!$this->inheritTimeServer){ + foreach($this->gotoNtpServer as $server){ + $this->attrs['gotoNtpServer'][] = $server; + } + } + + /* Append gosaAdministrativeUnitTag to objectClass if gosaUnitTag isset */ + if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){ + $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag"; + } + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + if ($this->orig_dn == 'new'){ + $ldap->cd($this->config->current['BASE']); + $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); + $ldap->cd($this->dn); + if (!count($this->attrs['gotoNtpServer'])){ + unset($this->attrs['gotoNtpServer']); + } + $ldap->add($this->attrs); + new log("create","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); + } else { + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); + } + + /* cn=default and macAddress=- indicates that this is a template */ + if($this->cn == "default"){ + $this->netConfigDNS->macAddress = "-"; + } + + $this->netConfigDNS->cn = $this->cn; + $this->netConfigDNS->save(); + show_ldap_error($ldap->get_error(), sprintf(_("Saving of object system terminal/generic with dn '%s' failed."),$this->dn)); + } + + + + + + /* Display generic part for server copy & paste */ + function getCopyDialog() + { + $vars = array("cn"); + $smarty = get_smarty(); + $smarty->assign("cn" ,$this->cn); + $smarty->assign("object","terminal"); + $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); + } + + + function saveCopyDialog() + { + if(isset($_POST['cn'])){ + $this->cn = $_POST['cn']; + } + } + + + function PrepareForCopyPaste($source) + { + plugin::PrepareForCopyPaste($source); + if(isset($source['macAddress'][0])){ + $this->netConfigDNS->macAddress = $source['macAddress'][0]; + } + if(isset($source['ipHostNumber'][0])){ + $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0]; + } + + /* Create used ntp server array */ + $this->gotoNtpServer= array(); + if(isset($source['gotoNtpServer'])){ + $this->inheritTimeServer = false; + unset($source['gotoNtpServer']['count']); + foreach($source['gotoNtpServer'] as $server){ + $this->gotoNtpServer[$server] = $server; + } + } + + /* Set inherit checkbox state */ + if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){ + $this->inheritTimeServer = true; + $this->gotoNtpServer=array(); + } + } + + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Terminal"), + "plDescription" => _("Terminal generic"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 1, + "plSection" => array("administration"), + "plCategory" => array("terminal" => array( "description" => _("Terminal"), + "objectClass" => "gotoTerminal")), + "plProvidedAcls"=> array( + "gotoMode" => _("Mode"), + "gotoTerminalPath" => _("Root server"), + "gotoSwapServer" => _("Swap server"), + "gotoSyslogServer" => _("Syslog server enabled"), + "gotoNtpServer" => _("Ntp server settings"), + "base" => _("Base"), + "cn" => _("Name"), + "gotoRootPasswd" => _("Root password"), + "FAIstate" => _("Action flag")) + )); + } + + + function set_everything_to_inherited() + { + $this->gotoTerminalPath = "default"; + $this->gotoSwapServer = "default" ; + $this->gotoSyslogServer = "default"; + $this->inheritTimeServer = TRUE; + + /* Set workstation service attributes to inherited */ + if($this->member_of_ogroup && isset($this->parent->by_object['termservice'])){ + foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant", + "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){ + $this->parent->by_object['termservice']->$name = "default"; + } + } + + /* Set workstation startup attributes to inherited */ + if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){ + $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited"; + $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited"; + } + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/admin/systems/goto/class_terminalInfo.inc b/gosa-core/plugins/admin/systems/goto/class_terminalInfo.inc new file mode 100644 index 000000000..0a21884d2 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/class_terminalInfo.inc @@ -0,0 +1,255 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* Generic terminal attributes */ + var $ghCpuType= "-"; + var $ghMemSize= "-"; + var $macAddress= "-"; + var $ghUsbSupport= "-"; + var $ghNetNic= array(); + var $ghIdeDev= array(); + var $ghScsiDev= array(); + var $ghGfxAdapter= "-"; + var $ghSoundAdapter= "-"; + var $ghInventoryNumber= "-"; + var $gotoLastUser= "-"; + var $gotoFloppyEnable= ""; + var $gotoCdromEnable= ""; + + /* Needed values and lists */ + var $base= ""; + var $cn= ""; + var $view_logged = FALSE; + + /* attribute list for save action */ + var $ignore_account= TRUE; + var $attributes= array("cn", "gotoMode", "gotoTerminalPath", "gotoFloppyEnable", + "gotoCdromEnable", "ghInventoryNumber", + "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer", + "ghCpuType", "ghMemSize", "macAddress", "ghUsbSupport", + "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser"); + var $objectclasses= array("GOhard"); + + function terminfo (&$config, $dn= NULL, $parent= NULL) + { + plugin::plugin ($config,$dn); + + /* Read arrays */ + foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){ + if (!isset($this->attrs[$val])){ + continue; + } + for ($i= 0; $i<$this->attrs[$val]['count']; $i++){ + array_push($this->$val, $this->attrs[$val][$i]); + } + } + + /* Fix USB entry */ + if ($this->ghUsbSupport == "true"){ + $this->ghUsbSupport= _("present"); + } + } + + + function execute() + { + /* Call parent execute */ + plugin::execute(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","terminal/".get_class($this),$this->dn); + } + + /* Do we represent a valid terminal? */ + if (!$this->is_account && $this->parent === NULL){ + echo "\"\" ". + _("This 'dn' has no terminal features.").""; + return; + } + + $smarty= get_smarty(); + $display= ""; + if(!is_callable("snmpget")){ + print_red(_("There is no php snmp module installed, can't gather any informations.")); + + $smarty->assign("load", progressbar(0,100,15,true)); + $smarty->assign("mem", progressbar(0,100,15,true)); + $smarty->assign("swap", progressbar(0,100,15,true)); + foreach(array("uptime", "sshd", "X", "saned", "artsd", "cupsd","status","ghNetNic", "ghIdeDev", "ghScsiDev","FloppyDevice", "CdromDevice","active") as $val){ + $smarty->assign("$val", ""._("unknown status").""); + } + + + $display =""; + }else + /* Default entry? */ + if ($this->cn == "default"){ + $display= "

"; + $display.= _("This is a virtual terminal which has no properties to show here."); + $display.= "
"; + } else { + + /* Get template object */ + $smarty->assign("staticAddress", ""); + + /* Prevent undefined variable .... */ + $smarty->assign("load", progressbar(0,100,15,true)); + $smarty->assign("mem", progressbar(0,100,15,true)); + $smarty->assign("swap", progressbar(0,100,15,true)); + + /* Check if terminal is online */ + $query= "fping -q -r 1 -t 500 ".$this->cn; + exec ($query, $dummy, $retval); + + if ($retval == 0){ + $smarty->assign("status", _("online")); + $smarty->assign("active", "true"); + + /* Fill data if we have snmp */ + $host= $this->cn; + + /* Use 'goto' as snmp community or the configured value from the config */ + $community= 'goto'; + $str = search_config($this->config->data['TABS'],"terminfo","SNMPCOMMUNITY"); + if(!empty($str)){ + $community = $str; + } + + /* Get memory informations */ + if(!is_callable("snmpget")){ + $MemFree = false; + }else{ + $MemFree= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memAvailReal.0"); + } + if ($MemFree != FALSE){ + $MemFree= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $MemFree); + $MemTotal= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memTotalReal.0"); + $MemTotal= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $MemTotal); + if ($MemTotal != 0){ + $smarty->assign("mem",progressbar( (int)(($MemTotal - $MemFree)*100/$MemTotal),100,15,true)); + ; + } + $SwapFree= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memAvailSwap.0"); + $SwapFree= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $SwapFree); + $SwapTotal= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memTotalSwap.0"); + $SwapTotal= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $SwapTotal); + if ($SwapTotal != 0){ +#$smarty->assign("swap", (int)(($SwapTotal - $SwapFree)*100/$SwapTotal)); + $smarty->assign("swap", progressbar(0,100,15,true)); + } + + /* Get system uptime */ + $sysup= @snmpget($host, $community, "SNMPv2-MIB::sysUpTime.0"); + $smarty->assign("uptime", preg_replace('/^.* ([0-9:]+)\..*$/', '\\1', $sysup)); + + /* Get system load */ + $sysload= @snmpget($host, $community, "UCD-SNMP-MIB::laLoad.2"); + $sysload= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $sysload); + + $smarty->assign("load", progressbar($sysload*100,100,15,true)); + + /* Get status for key processes */ + $processes= @snmpwalk($host, $community, "UCD-SNMP-MIB::prNames"); + $check4= array("sshd", "cupsd", "artsd", "X", "saned"); + foreach ($check4 as $pname){ + $eflag= -1; + foreach ($processes as $key => $val){ + $process= preg_replace('/^.*[:=] (.*)$/', '\\1', $val); + if ($process == $pname){ + $index= preg_replace('/^.*\.([0-9]+) [:=] .*$/', '\\1', $val); + $res= @snmpget($host, $community, "UCD-SNMP-MIB::prErrorFlag.$index"); + $eflag= preg_replace('/^.*[:=] /', '', $res); + break; + } + } + switch ($eflag){ + case 0: + $smarty->assign("$pname", "\""._("running")."\""); + break; + case 1: + $smarty->assign("$pname", "\""._("not"); + break; + default: + $smarty->assign("$pname", _("not defined")); + } + } + } else { + foreach(array("uptime", "sshd", "X", "saned", "artsd", "cupsd") as $val){ + $smarty->assign("$val", ""._("unknown status").""); + } + } + /* Check for mounted partitions (show max 8 partitions) */ + $partitions= ""; + for ($n= 1; $n<9; $n++){ + $device= @snmpget($host, $community, "UCD-SNMP-MIB::dskDevice.$n"); + if ($device == ""){ + break; + } + $device= preg_replace('/^STRING: */', '', $device); + $usage= @snmpget($host, $community, "UCD-SNMP-MIB::dskPercent.$n"); + $usage= preg_replace('/^INTEGER: */', '', $usage); + $partitions.= "$device".progressbar($usage,100,16,true)."\n"; + } + $smarty->assign("partitions", $partitions); + } else { + $smarty->assign("status", _("offline")); + $smarty->assign("active", "false"); + } + + /* Set floppy and cdrom status */ + foreach(array("Floppy", "Cdrom") as $val){ + $name= "goto".$val."Enable"; + if ($this->$name == "YES"){ + $status= _("present"); + } else { + $status= "-"; + } + $smarty->assign($val."Device", $status); + } + + /* Show main page */ + foreach(array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){ + if (!count($this->$val)){ + $this->$val= "-"; + } + $smarty->assign($val, $this->$val); + } + } + foreach(array("ghCpuType", "ghMemSize", "macAddress", "ghUsbSupport", + "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "ghInventoryNumber") as $val){ + + $smarty->assign($val, $this->$val); + } + $display= $smarty->fetch (get_template_path('info.tpl', TRUE)); + + return ($display); + } + + function remove_from_parent() + { + } + + + /* Save data to object */ + function save_object() + { + plugin::save_object(); + } + + + /* Save to LDAP */ + function save() + { + } + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/admin/systems/goto/class_terminalService.inc b/gosa-core/plugins/admin/systems/goto/class_terminalService.inc new file mode 100644 index 000000000..54e1d865d --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/class_terminalService.inc @@ -0,0 +1,527 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* Generic terminal attributes */ + var $gotoLpdEnable= FALSE; + var $gotoXMonitor= ""; + var $gotoXMethod= ""; + var $gotoXdmcpServer= ""; + var $gotoFontPath= ""; + var $gotoXDriver= ""; + var $gotoXResolution= ""; + var $gotoXColordepth= ""; + var $gotoXHsync= ""; + var $gotoXVsync= ""; + var $gotoXKbModel= ""; + var $gotoXKbLayout= ""; + var $gotoXKbVariant= ""; + var $gotoXMouseType= ""; + var $gotoXMouseport= ""; + var $gotoLpdServer= ""; + var $gotoScannerEnable= ""; + var $gotoScannerModel= ""; + var $gotoScannerClients= ""; + var $gotoScannerBackend= ""; + var $goFonHardware= "automatic"; + + var $AutoSync = false; + var $view_logged = FALSE; + + /* Needed values and lists */ + var $ignore_account= TRUE; + var $base= ""; + var $cn= ""; + var $orig_dn= ""; + var $XMethods= array(); + var $XDrivers= array(); + var $XResolutions= array(); + var $XColordepths= array(); + var $XKbModels= array (); + var $XKbLayouts= array (); + var $XKbVariants= array (); + var $MouseTypes= array(); + var $MousePorts= array(); + var $gotoScannerModels= array(); + var $hardware_list= array(); + var $used_hardware= array(); + + + /* attribute list for save action */ + var $attributes= array("cn", "gotoLpdEnable", "gotoXMonitor", "gotoXMethod", "gotoXdmcpServer", + "gotoFontPath", "gotoXDriver", "gotoXResolution", "gotoXColordepth", + "gotoXHsync", "gotoXVsync", "gotoLpdEnable", "gotoLpdServer", + "gotoScannerEnable", "gotoScannerModel", "gotoScannerClients", + "gotoScannerBackend", "gotoXKbModel", "gotoXKbLayout", "gotoXKbVariant", + "gotoXMouseType", "gotoXMouseport", "goFonHardware"); + var $objectclasses= array("GOhard"); + + + function termservice (&$config, $dn= NULL, $parent= NULL) + { + plugin::plugin ($config, $dn, $parent); + + /* Get list of available xdrivers */ + $this->XDrivers = $this->getListOfXDrivers(); + array_unshift($this->XDrivers, "["._("unknown")."]"); + + $this->XResolutions= array( + "default" => "["._("inherited")."]" , + "640x480" => "640x480", + "800x600" => "800x600", + "1024x768" => "1024x768", + "1152x864" => "1152x864", + "1280x1024" => "1280x1024", + "1400x1050" => "1400x1050", + "1600x1200" => "1600x1200"); + + if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){ + $file = $this->config->data['MAIN']['RESOLUTION_HOOK']; + + if(is_readable($file)){ + $str = file_get_contents($file); + $lines = split("\n",$str); + foreach($lines as $line){ + $line = trim($line); + if(!empty($line)){ + $this->XResolutions[$line]=$line; + } + } + //natcasesort($this->gotoXResolutions); + }else{ + print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file)); + } + } + + $this->XColordepths= array( + "default" => "["._("inherited")."]", + "8" => "8 " ._("bit"), + "15" => "15 "._("bit"), + "16" => "16 "._("bit"), + "24" => "24 "._("bit")); + + $this->XKbModels['default']= "["._("inherited")."]"; + foreach(array ("btc9000", "chicony", "compaq", "dell", "dell101", "everex", + "flexpro", "geniuscomfy", "hp", "itouch", "jp106", "logicordless", + "logiinetnav", "logiinternet", "macintosh", "microsoft", + "microsoftpro", "omnikey101", "pc101", "pc102", "pc104", + "pc105", "rapidaccess", "rapidaccess2", "winbook") as $type){ + $this->XKbModels[$type] = $type; + } + + /* Additional values will be extracted from CONFIG_DIR.keyboardLayouts */ + $this->XKbLayouts= array ("default"=>"["._("inherited")."]","de"=> "de","intl" =>"intl","us" =>"us"); + $this->XKbVariants= array ("default"=>"["._("inherited")."]", "nodeadkeys"=>"nodeadkeys", "basic"=>"basic"); + + $this->MouseTypes= array( "AUTO" => "["._("inherited")."]" , "ImPS/2" => "ImPS/2", + "PS/2" => "PS/2" , "Microsoft" => "Microsoft", + "Logitech" => "Logitech"); + + $this->MousePorts= array("AUTO" =>"["._("inherited")."]" , "/dev/ttyS0" => "/dev/ttyS0", + "/dev/ttyS1" => "/dev/ttyS1" , "/dev/psaux" => "/dev/psaux", + "/dev/input/mice" =>"/dev/input/mice"); + + + /* try to read additional keyboard layouts + */ + if(file_exists(CONFIG_DIR."/keyboardLayouts")){ + if(is_readable(CONFIG_DIR."/keyboardLayouts")){ + $str = file_get_contents(CONFIG_DIR."/keyboardLayouts"); + $tmp = split("\n",$str); + foreach($tmp as $entry){ + if((!empty($entry)) && (!preg_match("/^#/",$entry))){ + $entry = trim($entry); + $tmp2 = split ("\:",$entry); + $la = trim($tmp2[0]); // What would be saved to ldap + $da = trim($tmp2[1]); // This wis displayed in the listbox + $this->XKbLayouts [ $la] = $da; + } + } + } + } + + /* Load scanner models */ + $fcontents = file (CONFIG_DIR."/scanner-list"); + while (list ($line_num, $line) = each ($fcontents)) { + preg_match('/^(\w+) "([^"]+)" "([^"]+)" "([^"]+)"/', "$line", $matches); + $this->gotoScannerModels[$matches[2]." - ".$matches[3]]= $matches[1]."|".$matches[4]; + } + ksort ($this->gotoScannerModels); + + /* Initialize methods */ + $this->XMethods["default"]= _("default"); + $this->XMethods["indirect"]= _("show chooser"); + $this->XMethods["query"]= _("direct"); +#$this->XMethods["squery"]= _("direct via ssh"); +#$this->XMethods["nquery"]= _("direct via nx"); + $this->XMethods["load"]= _("load balanced"); +#$this->XMethods["sload"]= _("load balanced via ssh"); +#$this->XMethods["nload"]= _("load balanced via nx"); + $this->XMethods["rdp"]= _("Windows RDP"); + $this->XMethods["citrix"]= _("ICA client"); + + $this->orig_dn= $this->dn; + + /* Load hardware list */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(objectClass=goFonHardware)", array('cn', 'description')); + while ($attrs= $ldap->fetch()){ + $cn= $attrs['cn'][0]; + if (isset($attrs['description'])){ + $description= " - ".$attrs['description'][0]; + } else { + $description= ""; + } + $this->hardware_list[$cn]= "$cn$description"; + } + + /* Eventually colorize phones */ + $ldap->cd($this->config->current['BASE']); + $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware')); + while($attrs = $ldap->fetch()){ + $cn = $attrs['goFonHardware'][0]; + if(isset($this->hardware_list[$cn])){ + $this->used_hardware[$cn]= $cn; + } + } + + $this->hardware_list["automatic"]= _("automatic"); + ksort($this->hardware_list); + + /* 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']); + $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))"); + if ($ldap->count() == 1){ + $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout", + "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport"); + $attrs= $ldap->fetch(); + + foreach ($map as $name){ + if (!isset($attrs[$name][0])){ + continue; + } + + switch ($name){ + case 'gotoXResolution': + $this->XResolutions['default'] = _("inherited").' ['.$attrs[$name][0].']' ; + break; + case 'gotoXColordepth': + $this->XColordepths['default'] = _("inherited").' ['.$attrs[$name][0].' '._('Bit').']'; + break; + case 'gotoXKbModel': + $this->XKbModels['default'] = _("inherited").' ['.$attrs[$name][0].']'; + break; + case 'gotoXKbLayout': + $this->XKbLayouts['default'] = _("inherited").' ['.$attrs[$name][0].']'; + break; + case 'gotoXKbVariant': + $this->XKbVariants['default'] = _("inherited").' ['.$attrs[$name][0].']' ; + break; + case 'gotoXMouseType': + $this->MouseTypes['AUTO'] = _("inherited").' ['.$attrs[$name][0].']' ; + break; + case 'gotoXMouseport': + $this->MousePorts['AUTO'] = _("inherited").' ['.$attrs[$name][0].']' ; + break; + } + } + } + if(preg_match("/\+/",$this->gotoXHsync)){ + $this->AutoSync = true; + $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync); + $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync); + } + } + + function execute() + { + /* Call parent execute */ + plugin::execute(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","terminal/".get_class($this),$this->dn); + } + + /* Do we need to flip is_account state? */ + if (isset($_POST['modify_state'])){ + $this->is_account= !$this->is_account; + } + + /* Do we represent a valid terminal? */ + if (!$this->is_account && $this->parent === NULL){ + $display= "\"\" ". + _("This 'dn' has no terminal features.").""; + return ($display); + } + + /* Show main page */ + $smarty= get_smarty(); + + /* Assign acls */ + $tmp= $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL",$this->getacl($name)); + } + + + /* Arrays */ + foreach(array("XMethods", "XDrivers", "XResolutions", "XColordepths", + "gotoScannerModels", "XKbModels","XKbVariants", + "MouseTypes", "MousePorts") as $val){ + $smarty->assign("$val", $this->$val); + } + $smarty->assign("XKbLayouts", $this->XKbLayouts); + $smarty->assign("XKbLayoutKeys",array_flip($this->XKbLayouts)); + + $smarty->assign("xdmcpservers", $this->config->data['SERVERS']['TERMINAL']); + $smarty->assign("fontservers", $this->config->data['SERVERS']['FONT']); + $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']); + $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']); + + /* Variables - select */ + foreach(array("gotoXMethod", "gotoXdmcpServer", "gotoFontPath", + "gotoXDriver", "gotoXResolution", "gotoXColordepth", + "gotoLpdServer", "gotoScannerModel", "gotoXKbModel", "gotoXKbLayout", + "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){ + + $smarty->assign($val."_select", $this->$val); + } + + /* Variables */ + foreach(array("gotoXHsync", "gotoXVsync") as $val){ + $smarty->assign($val, $this->$val); + } + $smarty->assign("staticAddress", ""); + + /* Checkboxes */ + foreach(array("gotoLpdEnable", "gotoScannerEnable") as $val){ + if ($this->$val == TRUE) { + $smarty->assign("$val", "checked"); + } else { + $smarty->assign("$val", ""); + } + } + + /* Phone stuff */ + $smarty->assign ("goFonHardware", $this->goFonHardware); + $hl= "\n"; + $smarty->assign ("hardware_list", $hl); + $smarty->assign ("gotoXMonitor", $this->gotoXMonitor); + + $smarty->assign("AutoSyncACL",$this->getacl("AutoSync")); + + $smarty->assign("AutoSyncCHK"," "); + if($this->AutoSync){ + $smarty->assign("AutoSyncCHK"," checked "); + $smarty->assign("gotoXVsyncACL", preg_replace("/w/","",$this->getacl("gotoXVsync"))); + $smarty->assign("gotoXHsyncACL", preg_replace("/w/","",$this->getacl("gotoXHsync"))); + } + + /* Show main page */ + return($smarty->fetch (get_template_path('terminalService.tpl', TRUE))); + } + + function remove_from_parent() + { + new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs)); + $this->handle_post_events("remove"); + } + + + /* Save data to object */ + function save_object() + { + plugin::save_object(); + + /* Save checkbox state */ + if (isset ($_POST['gotoXMethod'])){ + foreach (array("gotoLpdEnable", "gotoScannerEnable") as $val){ + + if($this->acl_is_writeable($val)){ + if (!isset ($_POST["$val"])){ + $this->$val= FALSE; + } else { + $this->$val= TRUE; + } + } + } + } + + if(isset($_POST['gotoXDriver'])){ + if(isset($_POST['AutoSync'])){ + $this->AutoSync = true; + }else{ + $this->AutoSync = false; + } + } + + /* Default entries can use blank hsync/vsync entries */ + if ($this->dn != "" && $this->cn != "default" && $this->cn != "default"){ + + /* But only if no auto sync is enabled... */ + if (!$this->AutoSync){ + + /* Check vsync for correct usage */ + $val= preg_replace ("/\s/", "", $this->gotoXVsync); + if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXVsync")){ + + $message[]= _("Please specify a valid VSync range."); + } elseif ($this->acl_is_writeable("gotoXVsync")){ + list($v1,$v2)= preg_split ("/[-+]/", $val); + if ($v2 != ""){ + if ($v1 > $v2){ + $message[]= _("Please specify a valid VSync range."); + } + } + } + + /* Check hsync for correct usage */ + $val= preg_replace ("/\s/", "", $this->gotoXHsync); + if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXHsync")){ + + $message[]= _("Please specify a valid HSync range."); + } elseif ($this->acl_is_writeable("gotoXHsync")){ + list($v1,$v2)= preg_split ("/[-+]/", $val); + if ($v2 != ""){ + if ($v1 > $v2){ + $message[]= _("Please specify a valid HSync range."); + } + } + } + } + } + } + + + /* Check supplied data */ + function check() + { + /* Call common method to give check the hook */ + $message= plugin::check(); + return ($message); + } + + + /* Save to LDAP */ + function save() + { + /* Convert to string */ + $this->gotoLpdEnable= $this->gotoLpdEnable?"Yes":"No"; + + plugin::save(); + + /* Strip out 'default' values */ + foreach(array("gotoXMethod", "gotoXdmcpServer", "gotoFontPath", + "gotoXDriver", "gotoXResolution", "gotoXColordepth", + "gotoLpdServer", "gotoScannerModel", "gotoXKbModel", "gotoXKbLayout", + "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){ + + if ($this->attrs[$val] == "default"){ + $this->attrs[$val]= array(); + } + } + + if($this->AutoSync){ + $this->attrs['gotoXHsync'] = "30+55"; + $this->attrs['gotoXVsync'] = "50+70"; + } + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + + show_ldap_error($ldap->get_error(), sprintf(_("Saving of object system terminal/service with dn '%s' failed."),$this->dn)); + $this->handle_post_events("modify"); + } + + + function getListOfXDrivers() + { + $drivers = array(); + + /* Generate a list of xdrivers from CONFIG_DIR/xdrivers */ + if (file_exists(CONFIG_DIR.'/xdrivers')){ + $xdrivers = file (CONFIG_DIR.'/xdrivers'); + foreach ($xdrivers as $line){ + if (!preg_match ("/^#/", $line)){ + $drivers[]= trim($line); + } + } + } else { + $drivers = array("ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx", + "i128", "i740", "i810", "imstt", "mga", "neomagic", "newport", "nsc", "nv", "nvidia", + "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion", + "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware"); + } + return($drivers); + } + + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Service"), + "plDescription" => _("Terminal service"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 3, + "plSection" => array("administration"), + "plCategory" => array("terminal"), + + "plProvidedAcls"=> array( + "gotoXMonitor" => _("Monitor"), + "gotoXMethod" => _("Method"), + "gotoXdmcpServer" => _("Remote desktop"), + "gotoFontPath" => _("Font path"), + "gotoXDriver" => _("Gfx driver"), + "gotoXResolution" => _("Gfx resolution"), + "gotoXColordepth" => _("Gfx color depth"), + "gotoXHsync" => _("Hsync"), + "gotoXVsync" => _("Vsync"), + "AutoSync" => _("Auto-Sync"), + "gotoLpdEnable" => _("Printer service enabled"), + "gotoLpdServer" => _("Spool server"), + "gotoScannerEnable" => _("Scanner enabled"), + "gotoScannerModel" => _("Scanner model"), + "gotoXKbModel" => _("Keyboard model"), + "gotoXKbLayout" => _("Keyboard layout"), + "gotoXKbVariant" => _("Keyboard variant"), + "gotoXMouseType" => _("Mouse type"), + "gotoXMouseport" => _("Mouse port"), + "goFonHardware" => _("Telephone hardware")) + )); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/admin/systems/goto/class_terminalStartup.inc b/gosa-core/plugins/admin/systems/goto/class_terminalStartup.inc new file mode 100644 index 000000000..362bc7d8c --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/class_terminalStartup.inc @@ -0,0 +1,582 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* Generic terminal attributes */ + var $bootmode= "G"; + var $goLdapServerList= array(); + var $gotoBootKernel= "default-inherit"; + var $gotoKernelParameters= ""; + var $gotoLdapServer= ""; + var $gotoModules= array(); + var $gotoTerminalPath= ""; + var $gotoBootKernels= array(); + + /* Ldap server list */ + var $gotoLdapServers = array(); + var $gotoLdapServerList = array(); + var $gotoLdap_inherit = FALSE; + + /* Share */ + var $gotoShares = array();// Currently Share Option + var $gotoShare = ""; // currently selected Share Option + var $gotoShareSelections= array();// Available Shares for this account in Listbox format + var $gotoAvailableShares= array();// Available Shares for this account + + + /* attribute list for save action */ + var $attributes= array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters","gotoModules"); + var $objectclasses= array("GOhard"); + var $view_logged = FALSE; + + /* Helper */ + var $customParameters= ""; + var $orig_dn= ""; + var $ignore_account= TRUE; + + function termstartup (&$config, $dn= NULL, $parent= NULL) + { + plugin::plugin ($config, $dn, $parent); + + $this->gotoBootKernels = array("default-inherit"=>"["._("inherited")."]"); + + /* Get arrays */ + foreach (array("gotoModules") as $val){ + $this->$val = array(); + if (isset($this->attrs["$val"]["count"])){ + for ($i= 0; $i<$this->attrs["count"]; $i++){ + if (isset($this->attrs["$val"][$i])){ + array_push($this->$val, $this->attrs["$val"][$i]); + } + } + } + sort ($this->$val); + $this->$val= array_unique($this->$val); + } + + /* Parse Kernel Parameters to decide what boot mode is enabled */ + if (preg_match("/ splash=silent/", $this->gotoKernelParameters)){ + $this->bootmode= "G"; + } elseif (preg_match("/ debug/", $this->gotoKernelParameters)){ + $this->bootmode= "D"; + } elseif ($this->gotoKernelParameters == "") { + $this->bootmode= "G"; + } else { + $this->bootmode= "T"; + } + if (preg_match("/ o /", $this->gotoKernelParameters)){ + $this->customParameters= preg_replace ("/^.* o /", "", $this->gotoKernelParameters); + } else { + $this->customParameters= ""; + } + + /* Prepare Shares */ + if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){ + unset($this->attrs['gotoShare']['count']); + foreach($this->attrs['gotoShare'] as $share){ + $tmp = $tmp2 = array(); + $tmp = split("\|",$share); + $tmp2['server'] =$tmp[0]; + $tmp2['name'] =$tmp[1]; + $tmp2['mountPoint'] =$tmp[2]; + $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2; + } + } + + $this->gotoShareSelections= $config->getShareList(true); + $this->gotoAvailableShares= $config->getShareList(false); + + $this->orig_dn= $this->dn; + + /* Get list of boot kernels */ + if (isset($this->config->data['TABS'])){ + $command= $this->config->search(get_class($this), "KERNELS",array('tabs')); + + if (!check_command($command)){ + $message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command, + get_class($this)); + } else { + $fh= popen($command, "r"); + while (!feof($fh)) { + $buffer= trim(fgets($fh, 256)); + + if(!empty($buffer)){ + + $name=$value = $buffer; + + if(preg_match("/:/",$buffer)){ + $name = preg_replace("/:.*$/","",$buffer); + $value= preg_replace("/^.*:/","",$buffer); + $this->gotoBootKernels[$name]= $name.":".$value; + }else{ + $this->gotoBootKernels[$name]= $value; + } + } + } + pclose($fh); + } + + } + + foreach($this->config->data['SERVERS']['LDAP'] as $server) { + $this->gotoLdapServerList[]= $server; + } + if(isset($this->attrs['gotoLdapServer'])){ + unset($this->attrs['gotoLdapServer']['count']); + sort($this->attrs['gotoLdapServer']); + foreach($this->attrs['gotoLdapServer'] as $value){ + $this->gotoLdapServers[] = preg_replace("/^[0-9]*:/","",$value); + } + } + if(!count($this->gotoLdapServers)){ + $this->gotoLdap_inherit = TRUE; + } + + /* Load hardware list */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))"); + if ($ldap->count() == 1){ + $map= array("gotoLdapServer"); + $attrs= $ldap->fetch(); + + foreach ($map as $name){ + if (!isset($attrs[$name][0])){ + continue; + } + + switch ($name){ + case 'gotoLdapServer': + $this->goLdapServerList= array_merge(array('default-inherit' => _("inherited").' ['.$attrs[$name][0].']' ), $this->goLdapServerList); + break; + } + } + } + } + + function execute() + { + /* Call parent execute */ + plugin::execute(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","terminal/".get_class($this),$this->dn); + } + + /* Do we need to flip is_account state? */ + if (isset($_POST['modify_state'])){ + $this->is_account= !$this->is_account; + } + + /* Do we represent a valid terminal? */ + if (!$this->is_account && $this->parent === NULL){ + $display= "\"\" ". + _("This 'dn' has no terminal features.").""; + return ($display); + } + + /* Add module */ + if (isset ($_POST['add_module'])){ + if ($_POST['module'] != "" && $this->acl_is_writeable("gotoMode")){ + $this->add_list ($this->gotoModules, $_POST['module']); + } + } + + /* Delete module */ + if (isset ($_POST['delete_module'])){ + if (count($_POST['modules_list']) && $this->acl_is_writeable("gotoMode")){ + $this->del_list ($this->gotoModules, $_POST['modules_list']); + } + } + + /* Show main page */ + $smarty= get_smarty(); + + /* Assign acls */ + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL",$this->getacl($name)); + } + + + /* In this section server shares will be defined + * A user can select one of the given shares and a mount point + * and attach this combination to his setup. + */ + $smarty->assign("gotoShareSelections", $this->gotoShareSelections); + $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections)); + $smarty->assign("gotoBootKernels",$this->gotoBootKernels); + + /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry + * This entry will be, a combination of mountPoint and sharedefinitions + */ + if(isset($_POST['gotoShareAdd']) && $this->acl_is_writeable("gotoShare")){ + /* We assign a share to this user, if we don't know where to mount the share */ + if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){ + print_red(_("You must specify a valid mount point.")); + }else{ + $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']]; + $s_mount = $_POST['gotoShareMountPoint']; + /* Preparing the new assignment */ + $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share; + $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount; + } + } + + /* if the Post gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected) + * If there is no defined share selected, we will abort the deletion without any message + */ + if((isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare'])) && $this->acl_is_writeable("gotoShare")){ + unset($this->gotoShares[$_POST['gotoShare']]); + } + + $smarty->assign("gotoShares",$this->printOutAssignedShares()); + $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares())); + + /* Create divSelectBox for ldap server selection + */ + $SelectBoxLdapServer = new divSelectBox("LdapServer"); + $SelectBoxLdapServer->SetHeight(80); + + /* Add new ldap server to the list */ + if(!$this->gotoLdap_inherit && isset($_POST['add_ldap_server']) && isset($_POST['ldap_server_to_add'])){ + if(isset($this->gotoLdapServerList[$_POST['ldap_server_to_add']])){ + $to_add = $this->gotoLdapServerList[$_POST['ldap_server_to_add']]; + if(!in_array($to_add,$this->gotoLdapServers)){ + $this->gotoLdapServers[] = $to_add; + } + } + } + + /* Move ldap servers up and down */ + if(!$this->gotoLdap_inherit){ + foreach($_POST as $name => $value){ + if(preg_match("/sort_ldap_up_/",$name)){ + $id = preg_replace("/^sort_ldap_up_([0-9]*)_(x|y)$/","\\1",$name); + $from = $id; + $to = $id -1; + $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to); + if($tmp){ + $this->gotoLdapServers = $tmp; + } + break; + } + if(preg_match("/sort_ldap_down_/",$name)){ + $id = preg_replace("/^sort_ldap_down_([0-9]*)_(x|y)$/","\\1",$name); + $from = $id; + $to = $id +1; + $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to); + if($tmp){ + $this->gotoLdapServers = $tmp; + } + break; + } + if(preg_match("/gotoLdapRemove_/",$name)){ + $id = preg_replace("/^gotoLdapRemove_([0-9]*)_(x|y)$/","\\1",$name); + $value = $this->gotoLdapServers[$id]; + $this->gotoLdapServers = array_remove_entries(array($value),$this->gotoLdapServers); + break; + } + } + } + /* Add Entries + */ + foreach($this->gotoLdapServers as $key => $server){ + if(!in_array($server,$this->gotoLdapServerList)){ + $server = $server." (missing)"; + } + + $SelectBoxLdapServer->AddEntry( + array(array("string" => $server), + array("string" => + " ". + " ". + "", + "attach" => "style='text-align:right;width:40px;border-right:0px;'"))); + } + + if($this->gotoLdap_inherit){ + $smarty->assign("gotoLdapServerACL_inherit", preg_replace("/w/","",$this->getacl("gotoLdapServer")));; + }else{ + $smarty->assign("gotoLdapServerACL_inherit", $this->getacl("gotoLdapServer")); + } + + $list = array(); + foreach($this->gotoLdapServerList as $key => $entry){ + if(!in_array($entry,$this->gotoLdapServers)){ + $list[$key] = $entry; + } + } + $smarty->assign("gotoLdapServers", $SelectBoxLdapServer->DrawList()); + $smarty->assign("gotoLdapServerList", $list); + $smarty->assign("gotoLdap_inherit", $this->gotoLdap_inherit); + $smarty->assign("JS", session::get('js')); + + foreach (array("gotoModules" ) as $val){ + $smarty->assign("$val", $this->$val); + } + + /* Values */ + foreach(array("gotoBootKernel", "customParameters") as $val){ + $smarty->assign($val, $this->$val); + } + + /* Radio button group */ + if (preg_match("/G/", $this->bootmode)) { + $smarty->assign("graphicalbootup", "checked"); + } else { + $smarty->assign("graphicalbootup", ""); + } + if (preg_match("/T/", $this->bootmode)) { + $smarty->assign("textbootup", "checked"); + } else { + $smarty->assign("textbootup", ""); + } + if (preg_match("/D/", $this->bootmode)) { + $smarty->assign("debugbootup", "checked"); + } else { + $smarty->assign("debugbootup", ""); + } + + /* Show main page */ + return($smarty->fetch (get_template_path('terminalStartup.tpl', TRUE))); + } + + function remove_from_parent() + { + if($this->acl_is_removeable()){ + $this->handle_post_events("remove"); + new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs)); + } + } + + + /* Save data to object */ + function save_object() + { + plugin::save_object(); + + if(isset($_POST['TerminalStarttabPosted'])){ + if(isset($_POST['gotoLdap_inherit'])){ + $this->gotoLdap_inherit = TRUE; + }else{ + $this->gotoLdap_inherit = FALSE; + } + + /* Save group radio buttons */ + if ($this->acl_is_writeable("bootmode") && isset($_POST["bootmode"])){ + $this->bootmode= $_POST["bootmode"]; + } + + /* Save kernel parameters */ + if ($this->acl_is_writeable("gotoKernelParameters") && isset($_POST["customParameters"])){ + $this->customParameters= $_POST["customParameters"]; + } + } + } + + + /* Save to LDAP */ + function save() + { + /* Find proper terminal path for tftp configuration + FIXME: This is suboptimal when the default has changed to + another location! */ + if ($this->gotoTerminalPath == "default-inherit"){ + $ldap= $this->config->get_ldap_link(); + + /* Strip relevant part from dn, keep trailing ',' */ + $tmp= preg_replace("/^cn=[^,]+,".get_ou('terminalou')."/i", "", $this->dn); + $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp); + + /* Walk from top to base and try to load default values for + 'gotoTerminalPath'. Abort when an entry is found. */ + while (TRUE){ + $tmp= preg_replace ("/^[^,]+,/", "", $tmp); + + $ldap->cat("cn=default,".get_ou('terminalou').$tmp. + $this->config->current['BASE'], array('gotoTerminalPath')); + $attrs= $ldap->fetch(); + if (isset($attrs['gotoTerminalPath'])){ + $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0]; + break; + } + + /* Nothing left? */ + if ($tmp == ""){ + break; + } + } + } + + /* Add semi automatic values */ + // FIXME: LDAP Server may not be set here... + $this->gotoKernelParameters= "root=/dev/nfs nfsroot=". + $this->gotoTerminalPath. + ",ro,hard,nolock,fg,rsize=8192 ". + "ip=::::::dhcp ldap=".base64_encode($this->gotoLdapServer); + + switch ($this->bootmode){ + case "D": + $this->gotoKernelParameters.= " debug"; + break; + case "G": + $this->gotoKernelParameters.= " splash=silent"; + break; + } + if ($this->customParameters != ""){ + $this->gotoKernelParameters.= " o ".$this->customParameters; + } + + plugin::save(); + + /* Add missing arrays */ + foreach (array("gotoModules") as $val){ + if (isset ($this->$val) && count ($this->$val) != 0){ + + $this->attrs["$val"]= array_unique($this->$val); + } + if(!isset($this->attrs["$val"])){ + $this->attrs["$val"]=array(); + } + } + + /* Prepare list of ldap servers */ + $this->attrs['gotoLdapServer'] = array(); + if(!$this->gotoLdap_inherit){ + $i = 0; + foreach($this->gotoLdapServers as $server){ + $i ++; + $this->attrs['gotoLdapServer'][] = $i.":".$server; + } + } + + /* Strip out 'default' values */ + foreach(array("gotoBootKernel") as $value){ + if (!isset($this->attrs[$value]) || $this->attrs[$value] == "default-inherit"){ + $this->attrs[$value] = array(); + } + } + + /* prepare share settings */ + $tmp = array(); + foreach($this->gotoShares as $name => $settings){ + $tmp2 = split("\|",$name); + $name = $tmp2[0]; + $tmp[] = $settings['server']."|".$name."|".$settings['mountPoint']; + } + $this->attrs['gotoShare']=$tmp; + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + + $this->cleanup(); + $ldap->modify ($this->attrs); + + new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + + show_ldap_error($ldap->get_error(), sprintf(_("Saving of system terminal/startup with dn '%s' failed."),$this->dn)); + $this->handle_post_events("modify"); + } + + /* Add value to array, check if unique */ + function add_list (&$array, $value) + { + if ($value != ""){ + $array[]= $value; + sort($array); + array_unique ($array); + } + } + + + /* Delete value to array, check if unique */ + function del_list (&$array, $list) + { + $tmp= array(); + foreach ($array as $mod){ + if (!in_array($mod, $list)){ + $tmp[]= $mod; + } + } + $array= $tmp; + } + + /* Generate ListBox frindly output for the defined shares + * Possibly Add or remove an attribute here, + */ + function printOutAssignedShares() + { + $a_return = array(); + if(is_array($this->gotoShares)){ + foreach($this->gotoShares as $share){ + $a_return[$share['name']."|".$share['server']]= $share['name']." [".$share['server']."]"; + } + } + return($a_return); + } + + + function PrepareForCopyPaste($source) + { + plugin::PrepareForCopyPaste($source); + + $source_o = new termstartup ($this->config, $source['dn']); + + foreach(array("gotoModules", "gotoKernelParameters","gotoShares","customParameters","bootmode","gotoTerminalPath","gotoShares","goLdapServerList","gotoBootKernel","gotoLdapServer","gotoBootKernels") as $attr){ + $this->$attr = $source_o->$attr; + } + } + + + function array_switch_item($ar,$from,$to) + { + if(!is_array($ar)){ + return(false); + } + if(!isset($ar[$from])){ + return(false); + } + if(!isset($ar[$to])){ + return(false); + } + + $tmp = $ar[$from]; + $ar[$from] = $ar[$to]; + $ar[$to] = $tmp; + return($ar); + } + + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Startup"), + "plDescription" => _("Terminal startup"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 5, + "plSection" => array("administration"), + "plCategory" => array("terminal"), + + "plProvidedAcls"=> array( + "gotoLdapServer" => _("Ldap server"), + "gotoShare" => _("Shares"), + "gotoModules" => _("Kernel modules"), + "gotoBootKernel" => _("Boot kernel"), + "gotoKernelParameters"=> _("Kernel parameter")) + )); + } + + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/admin/systems/goto/class_workstationGeneric.inc b/gosa-core/plugins/admin/systems/goto/class_workstationGeneric.inc new file mode 100644 index 000000000..0f0f97a98 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/class_workstationGeneric.inc @@ -0,0 +1,663 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* Generic terminal attributes */ + var $gotoMode= "locked"; + var $gotoSyslogServer= ""; + var $gotoSyslogServers= array(); + var $gotoNtpServer= array(); + var $gotoNtpServers= array(); + var $gotoSndModule= ""; + var $gotoFloppyEnable= ""; + var $gotoCdromEnable= ""; + var $ghCpuType= "-"; + var $ghMemSize= "-"; + var $ghUsbSupport= "-"; + var $ghNetNic= array(); + var $ghIdeDev= array(); + var $ghScsiDev= array(); + var $ghGfxAdapter= "-"; + var $ghSoundAdapter= "-"; + var $gotoLastUser= "-"; + var $FAIscript= ""; + var $didAction= FALSE; + var $FAIstate= ""; + var $view_logged = FALSE; + + /* Needed values and lists */ + var $base= ""; + var $cn= ""; + var $l= ""; + var $orig_dn= ""; + + /* Plugin side filled */ + var $modes= array(); + + var $netConfigDNS; + + var $inheritTimeServer = true; + + /* attribute list for save action */ + var $ignore_account= TRUE; + var $attributes= array("gotoMode", "gotoSyslogServer", "gotoNtpServer", + "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule", + "ghCpuType", "ghMemSize", "ghUsbSupport", + "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l","FAIscript"); + var $objectclasses= array("top", "gotoWorkstation", "GOhard"); + + var $mapActions = array("reboot" => "", + "localboot" => "localboot", + "halt" => "", + "instant_update" => "softupdate", + "update" => "scheduledupdate", + "reinstall" => "install", + "rescan" => "", + "memcheck" => "memcheck", + "sysinfo" => "sysinfo"); + + + var $fai_activated = FALSE; + + var $member_of_ogroup = FALSE; + + function workgeneric (&$config, $dn= NULL, $parent= NULL) + { + $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs')); + if(!empty($tmp)){ + $this->fai_activated = TRUE; + } + + plugin::plugin ($config, $dn, $parent); + + if(!isset($this->parent->by_object['ogroup'])){ + $ldap = $this->config->get_ldap_link(); + $ldap->cd ($this->config->current['BASE']); + $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))",array("cn")); + $this->member_of_ogroup = $ldap->count() >= 1; + } + + $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses); + + /* Read arrays */ + foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){ + if (!isset($this->attrs[$val])){ + continue; + } + for ($i= 0; $i<$this->attrs[$val]['count']; $i++){ + array_push($this->$val, $this->attrs[$val][$i]); + } + } + + /* Create used ntp server array */ + $this->gotoNtpServer= array(); + if(isset($this->attrs['gotoNtpServer'])){ + $this->inheritTimeServer = false; + unset($this->attrs['gotoNtpServer']['count']); + foreach($this->attrs['gotoNtpServer'] as $server){ + $this->gotoNtpServer[$server] = $server; + } + } + + /* Set inherit checkbox state */ + if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer) == 0)){ + $this->inheritTimeServer = true; + $this->gotoNtpServer=array(); + } + + /* You can't inherit the NTP service, if we are not member in an object group */ + if(!$this->member_of_ogroup){ + $this->inheritTimeServer = FALSE; + } + + /* Create available ntp options */ + $tmp = $this->config->data['SERVERS']['NTP']; + $this->gotoNtpServers = array(); + foreach($tmp as $key => $server){ + if($server == "default") continue; + $this->gotoNtpServers[$server] = $server; + } + + $this->modes["active"]= _("Activated"); + $this->modes["locked"]= _("Locked"); + + /* Set base */ + if ($this->dn == "new"){ + $ui= get_userinfo(); + $this->base= dn2base($ui->dn); + } else { + $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn); + } + + /* Create an array of all Syslog servers */ + $tmp = $this->config->data['SERVERS']['SYSLOG']; + foreach($tmp as $server){ + $visible = $server; + if($server == "default" && $this->member_of_ogroup) { + $visible = "["._("inherited")."]"; + } + $this->gotoSyslogServers[$server] = $visible; + } + + /* Save 'dn' for later referal */ + $this->orig_dn= $this->dn; + } + + + function set_acl_base($base) + { + plugin::set_acl_base($base); + $this->netConfigDNS->set_acl_base($base); + } + + function set_acl_category($cat) + { + plugin::set_acl_category($cat); + $this->netConfigDNS->set_acl_category($cat); + } + + function execute() + { + /* Call parent execute */ + plugin::execute(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","workstation/".get_class($this),$this->dn); + } + + /* Do we need to flip is_account state? */ + if(isset($_POST['modify_state'])){ + if($this->is_account && $this->acl_is_removeable()){ + $this->is_account= FALSE; + }elseif(!$this->is_account && $this->acl_is_createable()){ + $this->is_account= TRUE; + } + } + + if ((isset($_POST['action'])) && ($this->acl_is_writeable("FAIstate"))){ + $cmd= $this->config->search("workgeneric", "ACTIONCMD",array('tabs')); + if ($cmd == ""){ + print_red(_("No ACTIONCMD definition found in your gosa.conf")); + } else { + exec ($cmd." ".$this->netConfigDNS->macAddress." ".escapeshellarg($_POST['saction']), $dummy, $retval); + if ($retval != 0){ + print_red(sprintf(_("Execution of '%s' failed!"), $cmd)); + } elseif ($_POST['saction'] != "wake") { + + /* Set FAIstate */ + if($this->fai_activated && $this->dn != "new"){ + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->cat($this->dn,array("objectClass")); + $res = $ldap->fetch(); + + $attrs = array(); + $attrs['FAIstate'] = $this->FAIstate; + if(isset($this->mapActions[$_POST['saction']]) && $this->mapActions[$_POST['saction']] != ""){ + $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']]; + } + + for($i = 0; $i < $res['objectClass']['count'] ; $i ++){ + $attrs['objectClass'][] = $res['objectClass'][$i]; + } + + if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){ + $attrs['objectClass'][] = "FAIobject"; + } + + if($attrs['FAIstate'] == ""){ +#FIXME we should check if FAIobject is not used anymore + $attrs['FAIstate'] = array(); + } + + $ldap->cd($this->dn); + $ldap->modify($attrs); + show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic (FAIstate) with dn '%s' failed."),$this->dn)); + + } + $this->didAction= TRUE; + } + } + } + + /* Do we represent a valid terminal? */ + if (!$this->is_account && $this->parent === NULL){ + $display= "\"\" ". + _("This 'dn' has no workstation features.").""; + return($display); + } + + /* Base select dialog */ + $once = true; + foreach($_POST as $name => $value){ + if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_writeable("base")){ + $once = false; + $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases()); + $this->dialog->setCurrentBase($this->base); + } + } + + /* Dialog handling */ + if(is_object($this->dialog)){ + /* Must be called before save_object */ + $this->dialog->save_object(); + + if($this->dialog->isClosed()){ + $this->dialog = false; + }elseif($this->dialog->isSelected()){ + + /* A new base was selected, check if it is a valid one */ + $tmp = $this->get_allowed_bases(); + if(isset($tmp[$this->dialog->isSelected()])){ + $this->base = $this->dialog->isSelected(); + } + + $this->dialog= false; + }else{ + return($this->dialog->execute()); + } + } + + /* Add new ntp Server to our list */ + if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){ + $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers']; + } + + /* Delete selected NtpServer for list of used servers */ + if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){ + foreach($_POST['gotoNtpServerSelected'] as $name){ + unset($this->gotoNtpServer[$name]); + } + } + + /* Fill templating stuff */ + $smarty= get_smarty(); + + /* Set acls */ + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL",$this->getacl($name)); + } + + $smarty->assign("cn", $this->cn); + $smarty->assign("l", $this->l); + $smarty->assign("bases", $this->get_allowed_bases()); + $smarty->assign("staticAddress", ""); + + $tmp = array(); + foreach($this->gotoNtpServers as $server){ + if(!in_array($server,$this->gotoNtpServer)){ + $tmp[$server] = $server; + } + } + $smarty->assign("gotoNtpServers",$tmp); + + /* Check if workstation is online */ + $query= "fping -q -r 1 -t 500 ".$this->cn; + exec ($query, $dummy, $retval); + + /* Offline */ + if ($retval == 0){ + $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"), + "instant_update" => _("Instant update"), + "update" => _("Scheduled update"), + "reinstall" => _("Reinstall"), + "rescan" => _("Rescan hardware"), + "memcheck" => _("Memory test"), + "localboot" => _("Force localboot"), + "sysinfo" => _("System analysis"))); + } else { + $smarty->assign("actions", array("wake" => _("Wake up"), + "reinstall" => _("Reinstall"), + "update" => _("Scheduled update"), + "memcheck" => _("Memory test"), + "localboot" => _("Force localboot"), + "sysinfo" => _("System analysis"))); + } + /* Arrays */ + $smarty->assign("modes", $this->modes); + $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']); + $smarty->assign("syslogservers", $this->gotoSyslogServers); + $smarty->assign("fai_activated",$this->fai_activated); + + $ntpser = array(); + foreach($this->gotoNtpServers as $server){ + if(!in_array($server,$this->gotoNtpServer)){ + $ntpser[$server] = $server; + } + } + $smarty->assign("gotoNtpServers", $ntpser); + + /* Variables */ + foreach(array("base", "gotoMode", "gotoSyslogServer", "gotoNtpServer") as $val){ + $smarty->assign($val."_select", $this->$val); + } + + /* tell smarty the inherit checkbox state */ + $smarty->assign("inheritTimeServer",$this->inheritTimeServer); + $smarty->assign("member_of_ogroup",$this->member_of_ogroup); + + $str = $this->netConfigDNS->execute(); + if(is_object($this->netConfigDNS->dialog)){ + return($str); + } + $smarty->assign("netconfig", $str); + + /* Show main page */ + return($smarty->fetch (get_template_path('workstation.tpl', TRUE))); + } + + function remove_from_parent() + { + if($this->acl_is_removeable()){ + + $this->netConfigDNS->remove_from_parent(); + $ldap= $this->config->get_ldap_link(); + $ldap->rmdir($this->dn); + new log("remove","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of system workstation/generic with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); + + /* Delete references to object groups */ + $ldap->cd ($this->config->current['BASE']); + $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn")); + while ($ldap->fetch()){ + $og= new ogroup($this->config, $ldap->getDN()); + unset($og->member[$this->dn]); + $og->save (); + } + } + + if(isset($_POST["inheritAll"])){ + $this->set_everything_to_inherited(); + } + } + + + /* Save data to object */ + function save_object() + { + + /* Create a base backup and reset the + base directly after calling plugin::save_object(); + Base will be set seperatly a few lines below */ + $base_tmp = $this->base; + plugin::save_object(); + $this->base = $base_tmp; + + /* Save base, since this is no LDAP attribute */ + $tmp = $this->get_allowed_bases(); + if(isset($_POST['base'])){ + if(isset($tmp[$_POST['base']])){ + $this->base= $_POST['base']; + } + } + + $this->netConfigDNS->save_object(); + + /* Set inherit mode */ + if((isset($_POST['workgeneric_posted'])) && ($this->acl_is_writeable("gotoNtpServer"))){ + if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){ + $this->inheritTimeServer = true; + }else{ + $this->inheritTimeServer = false; + } + } + + if(isset($_POST["inheritAll"])){ + $this->set_everything_to_inherited(); + } + } + + + /* Check supplied data */ + function check() + { + /* Call common method to give check the hook */ + $message= plugin::check(); + + /* Skip IP & Mac checks if this is a template */ + if($this->cn != "wdefault"){ + $message= array_merge($message, $this->netConfigDNS->check()); + } + + $this->dn= "cn=".$this->cn.",".get_ou('workstationou').$this->base; + + if ($this->cn == ""){ + $message[]= _("The required field 'Workstation name' is not set."); + } + + /* Check if given name is a valid host/dns name */ + if(!tests::is_dns_name($this->cn)){ + $message[] = _("Please specify a valid name for this object."); + } + + if ($this->orig_dn != $this->dn){ + $ldap= $this->config->get_ldap_link(); + $ldap->cd ($this->base); + + if($this->cn == "wdefault"){ + $ldap->cat($this->dn); + }else{ + $ldap->search ("(&(cn=".$this->cn.")(objectClass=gotoWorkstation))", array("cn")); + } + if ($ldap->count() != 0){ + while ($attrs= $ldap->fetch()){ + if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".get_ou('incomingou')."/", $ldap->getDN())){ + continue; + } else { + if ($attrs['dn'] != $this->orig_dn){ + $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); + break; + } + } + } + } + } + + /* Check for valid ntpServer selection */ + if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){ + $message[]= _("There must be at least one NTP server selected, or the inherit mode activated."); + } + + return ($message); + } + + + /* Save to LDAP */ + function save() + { + plugin::save(); + + /* Strip out 'default' values */ + foreach (array("gotoSyslogServer") as $val){ + + if (isset($this->attrs[$val]) && $this->attrs[$val] == "default"){ + $this->attrs[$val]= array(); + } + } + + /* Add missing arrays */ + foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){ + if (isset ($this->$val) && count ($this->$val) != 0){ + $this->attrs["$val"]= $this->$val; + } + } + + /* Remove all empty values */ + if ($this->orig_dn == 'new'){ + $attrs= array(); + foreach ($this->attrs as $key => $val){ + if (is_array($val) && count($val) == 0){ + continue; + } + $attrs[$key]= $val; + } + $this->attrs= $attrs; + } + + /* Update ntp server settings */ + if($this->inheritTimeServer){ + if($this->is_new){ + if(isset($this->attrs['gotoNtpServer'])){ + unset($this->attrs['gotoNtpServer']); + } + }else{ + $this->attrs['gotoNtpServer'] = array(); + } + }else{ + /* Set ntpServers */ + $this->attrs['gotoNtpServer'] = array(); + foreach($this->gotoNtpServer as $server){ + $this->attrs['gotoNtpServer'][] = $server; + } + } + + if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){ + $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag"; + } + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + if ($this->orig_dn == 'new'){ + $ldap->cd($this->config->current['BASE']); + $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); + $ldap->cd($this->dn); + $ldap->add($this->attrs); + new log("create","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn)); + if(!$this->didAction){ + $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); + } + } else { + if ($this->orig_dn != $this->dn){ + $this->move($this->orig_dn, $this->dn); + } + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + + if(!$this->didAction){ + $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); + } + } + + /* cn=default and macAddress=- indicates that this is a template */ + if($this->cn == "wdefault"){ + $this->netConfigDNS->macAddress = "-"; + } + + $this->netConfigDNS->cn = $this->cn; + $this->netConfigDNS->save(); + show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn)); + } + + + /* Display generic part for server copy & paste */ + function getCopyDialog() + { + $vars = array("cn"); + $smarty = get_smarty(); + $smarty->assign("cn" ,$this->cn); + $smarty->assign("object","workstation"); + $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); + } + + + function saveCopyDialog() + { + if(isset($_POST['cn'])){ + $this->cn = $_POST['cn']; + } + } + + + function PrepareForCopyPaste($source) + { + plugin::PrepareForCopyPaste($source); + if(isset($source['macAddress'][0])){ + $this->netConfigDNS->macAddress = $source['macAddress'][0]; + } + if(isset($source['ipHostNumber'][0])){ + $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0]; + } + + /* Create used ntp server array */ + $this->gotoNtpServer= array(); + if(isset($source['gotoNtpServer'])){ + $this->inheritTimeServer = false; + unset($source['gotoNtpServer']['count']); + foreach($source['gotoNtpServer'] as $server){ + $this->gotoNtpServer[$server] = $server; + } + } + + /* Set inherit checkbox state */ + if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){ + $this->inheritTimeServer = true; + $this->gotoNtpServer=array(); + } + } + + + /* Return plugin informations for acl handling + #FIXME FAIscript seams to ununsed within this class... */ + static function plInfo() + { + return (array( + "plShortName" => _("Generic"), + "plDescription" => _("Workstation generic"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 0, + "plSection" => array("administration"), + "plCategory" => array("workstation" => array("description" => _("Workstation"), + "objectClass" => "gotoWorkstation")), + "plProvidedAcls"=> array( + "cn" => _("Workstation name"), + "l" => _("Location") , + "base" => _("Base") , + "gotoMode" => _("Goto mode"), + "gotoSyslogServer" => _("Syslog server"), + "gotoNtpServer" => _("Ntp server"), + "gotoRootPasswd" => _("Root password"), + "FAIstate" => _("Action flag")) + )); + } + + function set_everything_to_inherited() + { + $this->gotoSyslogServer = "default"; + $this->inheritTimeServer = TRUE; + + /* Set workstation service attributes to inherited */ + if($this->member_of_ogroup && isset($this->parent->by_object['workservice'])){ + foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant", + "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){ + $this->parent->by_object['workservice']->$name = "default"; + } + } + + /* Set workstation startup attributes to inherited */ + if($this->member_of_ogroup && isset($this->parent->by_object['workstartup'])){ + $this->parent->by_object['workstartup']->gotoBootKernel = "default-inherited"; + $this->parent->by_object['workstartup']->gotoLdapServer = "default-inherited"; + $this->parent->by_object['workstartup']->FAIdebianMirror= "inherited"; + } + } +} + // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/admin/systems/goto/class_workstationService.inc b/gosa-core/plugins/admin/systems/goto/class_workstationService.inc new file mode 100644 index 000000000..815b52c0c --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/class_workstationService.inc @@ -0,0 +1,506 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + var $gotoScannerEnable; + /* Generic terminal attributes */ + var $gotoXMonitor= ""; + var $gotoXDriver= ""; + var $gotoXResolution= ""; + var $gotoXColordepth= ""; + var $gotoXHsync= ""; + var $gotoXVsync= ""; + var $AutoSync = false; + var $gotoXKbModel= ""; + var $gotoXKbLayout= ""; + var $gotoXKbVariant= ""; + var $gotoXMouseType= ""; + var $gotoXMouseport= ""; + var $gotoScannerClients= ""; + var $gotoScannerBackend= ""; + var $goFonHardware= "automatic"; + var $view_logged = FALSE; + + /* Needed values and lists */ + var $ignore_account= TRUE; + var $base= ""; + var $cn= ""; + var $orig_dn= ""; + var $XMethods= array(); + var $XDrivers= array(); + var $XResolutions = array(); + var $MouseTypes= array(); + var $MousePorts= array(); + var $hardware_list= array(); + var $used_hardware= array(); + + + /* attribute list for save action */ + var $attributes= array("gotoXMonitor", + "gotoXDriver", "gotoXResolution", "gotoXColordepth", + "gotoXHsync", "gotoXVsync", + "gotoScannerEnable", "gotoScannerClients", + "gotoScannerBackend", "gotoXKbModel", "gotoXKbLayout", "gotoXKbVariant", + "gotoXMouseType", "gotoXMouseport", "goFonHardware"); + var $objectclasses= array("GOhard"); + + var $XColordepths =array(); + var $XKbModels =array(); + var $XKbLayouts =array(); + var $XKbVariants =array(); + + function workservice (&$config, $dn= NULL, $parent= NULL) + { + plugin::plugin ($config, $dn, $parent); + + $this->XResolutions= array( + "640x480" => "640x480", + "800x600" => "800x600", + "1024x768" => "1024x768", + "1152x864" => "1152x864", + "1280x1024" => "1280x1024", + "1400x1050" => "1400x1050", + "1600x1200" => "1600x1200"); + + if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){ + $file = $this->config->data['MAIN']['RESOLUTION_HOOK']; + + if(is_readable($file)){ + $str = file_get_contents($file); + $lines = split("\n",$str); + foreach($lines as $line){ + $line = trim($line); + if(!empty($line)){ + $this->XResolutions[$line]=$line; + } + } + //natcasesort($this->gotoXResolutions); + }else{ + print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file)); + } + } + + /* Get list of available xdrivers */ + $this->XDrivers = $this->getListOfXDrivers(); + + array_unshift($this->XDrivers, "["._("unknown")."]"); + + $this->XColordepths= array( + "8" => "8 " ._("bit"), + "15" => "15 "._("bit"), + "16" => "16 "._("bit"), + "24" => "24 "._("bit")); + + foreach(array ("btc9000", "chicony", "compaq", "dell", "dell101", "everex", + "flexpro", "geniuscomfy", "hp", "itouch", "jp106", "logicordless", + "logiinetnav", "logiinternet", "macintosh", "microsoft", + "microsoftpro", "omnikey101", "pc101", "pc102", "pc104", + "pc105", "rapidaccess", "rapidaccess2", "winbook") as $type){ + $this->XKbModels[$type] = $type; + } + + $this->MouseTypes= array("ImPS/2" => "ImPS/2", "PS/2" => "PS/2", "Microsoft" => "Microsoft", + "Logitech" => "Logitech"); + + $this->MousePorts= array("/dev/ttyS0" =>"/dev/ttyS0", + "/dev/ttyS1" => "/dev/ttyS1", "/dev/psaux" =>"/dev/psaux", + "/dev/input/mice" => "/dev/input/mice"); + + /* Additional values will be extracted from CONFIG_DIR./keyboardLayouts */ + $this->XKbLayouts= array ("de"=> "de","intl" =>"intl","us" =>"us"); + $this->XKbVariants= array ("nodeadkeys"=>"nodeadkeys", "basic"=>"basic"); + + /* try to read additional keyboard layouts + */ + if(file_exists(CONFIG_DIR."/keyboardLayouts")){ + if(is_readable(CONFIG_DIR."/keyboardLayouts")){ + $str = file_get_contents(CONFIG_DIR."/keyboardLayouts"); + $tmp = split("\n",$str); + foreach($tmp as $entry){ + if((!empty($entry)) && (!preg_match("/^#/",$entry))){ + $entry = trim($entry); + $tmp2 = split ("\:",$entry); + $la = trim($tmp2[0]); // What would be saved to ldap + $da = trim($tmp2[1]); // This wis displayed in the listbox + $this->XKbLayouts [ $la] = $da; + } + } + } + } + + /* Initialize methods */ + $this->XMethods["indirect"]= _("show chooser"); + $this->XMethods["query"]= _("direct"); + #$this->XMethods["squery"]= _("direct via ssh"); + #$this->XMethods["nquery"]= _("direct via nx"); + $this->XMethods["load"]= _("load balanced"); + #$this->XMethods["sload"]= _("load balanced via ssh"); + #$this->XMethods["nload"]= _("load balanced via nx"); + $this->XMethods["rdp"]= _("Windows RDP"); + $this->XMethods["citrix"]= _("ICA client"); + + $this->orig_dn= $this->dn; + + /* Load hardware list */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(objectClass=goFonHardware)", array('cn', 'description')); + while ($attrs= $ldap->fetch()){ + $cn= $attrs['cn'][0]; + if (isset($attrs['description'])){ + $description= " - ".$attrs['description'][0]; + } else { + $description= ""; + } + $this->hardware_list[$cn]= "$cn$description"; + } + + /* Eventually colorize phones */ + $ldap->cd($this->config->current['BASE']); + $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware')); + while($attrs = $ldap->fetch()){ + $cn = $attrs['goFonHardware'][0]; + if(isset($this->hardware_list[$cn])){ + $this->used_hardware[$cn]= $cn; + } + } + + if(preg_match("/\+/",$this->gotoXHsync)){ + $this->AutoSync = true; + $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync); + $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync); + } + + $this->hardware_list["automatic"]= _("automatic"); + ksort($this->hardware_list); + + /* Load hardware list */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))"); + if ($ldap->count() == 1){ + $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout", + "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport"); + $attrs= $ldap->fetch(); + + foreach ($map as $name){ + if (!isset($attrs[$name][0])){ + continue; + } + + switch ($name){ + case 'gotoXResolution': + $this->XResolutions= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XResolutions; + break; + case 'gotoXColordepth': + $this->XColordepths= array('default' => _("inherited").' ['.$attrs[$name][0].' '._('Bit').']') + $this->XColordepths; + break; + case 'gotoXKbModel': + $this->XKbModels= array('default' => _("inherited").' ['.$attrs[$name][0].']') + $this->XKbModels; + break; + case 'gotoXKbLayout': + $this->XKbLayouts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbLayouts; + break; + case 'gotoXKbVariant': + $this->XKbVariants= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbVariants; + break; + case 'gotoXMouseType': + $this->MouseTypes= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes; + break; + case 'gotoXMouseport': + $this->MousePorts= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts; + break; + } + + } + + } + + /* Workaround to fill in inherited values if we've specified an objectclass */ + $SelectedSystemType = session::get("SelectedSystemType"); + if (isset($SelectedSystemType['ogroup']) && $SelectedSystemType['ogroup'] != 'none'){ + $this->XResolutions= array('default' => _("inherited")); + $this->XColordepths= array('default' => _("inherited")); + $this->XKbModels= array('default' => _("inherited")); + $this->XKbLayouts= array('default' => _("inherited")); + $this->XKbVariants= array('default' => _("inherited")); + $this->MouseTypes= array('AUTO' => _("inherited")); + $this->MousePorts= array('AUTO' => _("inherited")); + } + } + + function execute() + { + /* Call parent execute */ + plugin::execute(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","workstation/".get_class($this),$this->dn); + } + + /* Do we need to flip is_account state? */ + if (isset($_POST['modify_state'])){ + $this->is_account= !$this->is_account; + } + + /* Do we need to flip is_account state? */ + if(isset($_POST['modify_state'])){ + if($this->is_account && $this->acl_is_removeable()){ + $this->is_account= FALSE; + }elseif(!$this->is_account && $this->acl_is_createable()){ + $this->is_account= TRUE; + } + } + + /* Show main page */ + $smarty= get_smarty(); + + /* Assign ACLs */ + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translated){ + $smarty->assign($name."ACL",$this->getacl($name)); + } + + /* Arrays */ + foreach(array("XMethods", "XDrivers", "XResolutions", "XColordepths", + "XKbModels", "XKbVariants", + "MouseTypes", "MousePorts") as $val){ + $smarty->assign("$val", $this->$val); + } + $smarty->assign("XKbLayouts" ,$this->XKbLayouts); + $smarty->assign("XKbLayoutKeys" ,array_flip($this->XKbLayouts)); + + $smarty->assign("xdmcpservers", $this->config->data['SERVERS']['TERMINAL']); + $smarty->assign("fontservers", $this->config->data['SERVERS']['FONT']); + $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']); + $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']); + + /* Variables - select */ + foreach(array( + "gotoXDriver", "gotoXResolution", "gotoXColordepth", + "gotoXKbModel", "gotoXKbLayout","gotoScannerEnable", + "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){ + + $smarty->assign($val."_select", $this->$val); + } + + /* Variables */ + foreach(array("gotoXHsync", "gotoXVsync") as $val){ + $smarty->assign($val, $this->$val); + } + $smarty->assign("staticAddress", ""); + + /* Checkboxes */ + foreach(array("gotoScannerEnable") as $val){ + if ($this->$val == TRUE) { + $smarty->assign("$val", "checked"); + } else { + $smarty->assign("$val", ""); + } + } + + /* Phone stuff */ + $smarty->assign ("goFonHardware", $this->goFonHardware); + + $perms = ""; + if($this->acl_is_writeable("goFonHardware")){ + $perms = " disabled "; + } + + $hl= "\n"; + $smarty->assign ("hardware_list", $hl); + $smarty->assign ("gotoXMonitor", $this->gotoXMonitor); + + if($this->AutoSync){ + $smarty->assign("AutoSyncCHK"," checked "); + $smarty->assign("hiddenState"," disabled "); + }else{ + $smarty->assign("AutoSyncCHK"," "); + $smarty->assign("hiddenState",""); + } + + /* Show main page */ + return($smarty->fetch (get_template_path('workstationService.tpl',TRUE,dirname(__FILE__)))); + } + + function remove_from_parent() + { + $this->handle_post_events("remove"); + new log("remove","workstation/".get_class($this),$this->dn); + } + + /* Save data to object */ + function save_object() + { + plugin::save_object(); + + if((isset($_POST['gotoXDriver'])) && $this->acl_is_writeable("AutoSync")) { + if(isset($_POST['AutoSync'])){ + $this->AutoSync = true; + }else{ + $this->AutoSync = false; + } + } + } + + /* Check supplied data */ + function check() + { + /* Call common method to give check the hook */ + $message= plugin::check(); + + /* Default entries can use blank hsync/vsync entries */ + if ($this->dn != "" && $this->cn != "default" && $this->cn != "wdefault"){ + + /* But only if no auto sync is enabled... */ + if (!$this->AutoSync){ + + /* Check vsync for correct usage */ + $val= preg_replace ("/\s/", "", $this->gotoXVsync); + + if($this->acl_is_writeable("gotoXVsync")){ + if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){ + $message[]= _("Please specify a valid VSync range."); + } else{ + list($v1,$v2)= preg_split ("/[-+]/", $val); + if ($v2 != ""){ + if ($v1 > $v2){ + $message[]= _("Please specify a valid VSync range."); + } + } + } + } + + /* Check hsync for correct usage */ + $val= preg_replace ("/\s/", "", $this->gotoXHsync); + if($this->acl_is_writeable("gotoXHsync")){ + if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){ + $message[]= _("Please specify a valid HSync range."); + } else{ + list($v1,$v2)= preg_split ("/[-+]/", $val); + if ($v2 != ""){ + if ($v1 > $v2){ + $message[]= _("Please specify a valid HSync range."); + } + } + } + } + } + } + + return ($message); + } + + + /* Save to LDAP */ + function save() + { + /* remove objectclass GOhard if this is an ogroup tab */ + if(isset($this->parent->by_object['ogroup'])){ + $this->objectclasses = array(); + } + + plugin::save(); + + /* Strip out 'default' values */ + foreach(array( + "gotoXDriver", "gotoXResolution", "gotoXColordepth", + "gotoXKbModel", "gotoXKbLayout", + "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){ + + if ($this->attrs[$val] == "default"){ + $this->attrs[$val]= array(); + } + } + + if($this->AutoSync){ + $this->attrs['gotoXHsync'] = "30+55"; + $this->attrs['gotoXVsync'] = "50+70"; + } + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/service with dn '%s' failed."),$this->dn)); + $this->handle_post_events("modify"); + } + + + function getListOfXDrivers() + { + /* Generate a list of xdrivers from CONFIG_DIR./xdrivers */ + $drivers = array(); + if (file_exists(CONFIG_DIR.'/xdrivers')){ + $xdrivers = file (CONFIG_DIR.'/xdrivers'); + foreach ($xdrivers as $line){ + if (!preg_match ("/^#/", $line)){ + $drivers[]= trim($line); + } + } + } else { + $drivers = array("ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx", + "i128", "i740", "i810", "imstt", "mga", "neomagic", "newport", "nsc", "nv", "nvidia", + "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion", + "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware"); + } + return($drivers); + } + + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Service"), + "plDescription" => _("Workstation service"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 10, + "plSection" => array("administration"), + "plCategory" => array("workstation","ogroups"), + + "plProvidedAcls"=> array( + "gotoXMonitor" => _("Monitor"), + "gotoXDriver" => _("Gfx driver"), + "gotoXResolution" => _("Gfx resolution"), + "gotoXColordepth" => _("Gfx color depth"), + "gotoXHsync" => _("Hsync"), + "gotoXVsync" => _("Vsync"), + "AutoSync" => _("Use DDC"), + "gotoScannerEnable" => _("Scanner enabled"), + "gotoXKbModel" => _("Keyboard model"), + "gotoXKbLayout" => _("Keyboard layout"), + "gotoXKbVariant" => _("Keyboard variant"), + "gotoXMouseType" => _("Mouse type"), + "gotoXMouseport" => _("Mouse port"), + "goFonHardware" => _("Telephone hardware")) + )); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/admin/systems/goto/class_workstationStartup.inc b/gosa-core/plugins/admin/systems/goto/class_workstationStartup.inc new file mode 100644 index 000000000..c74b37617 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/class_workstationStartup.inc @@ -0,0 +1,1293 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* Ldap server list */ + var $gotoLdapServers = array(); + var $gotoLdapServerList = array(); + var $gotoLdap_inherit = FALSE; + + /* Generic terminal attributes */ + var $bootmode = "G"; + var $gotoBootKernel = "default-inherited"; + var $gotoKernelParameters = ""; + var $gotoLdapServer = "default-inherited"; + var $gotoModules = array(); + var $gotoAutoFs = array(); + var $gotoFilesystem = array(); + var $gotoTerminalPath = ""; + var $gotoBootKernels = array(); + + /* attribute list for save action */ + var $attributes = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", + "FAIclass", "FAIstatus", "gotoShare","FAIdebianMirror", "FAIrelease"); + var $objectclasses = array("GOhard", "FAIobject"); + + /* Share */ + var $gotoShares = array();// Currently Share Option + var $gotoShare = ""; // currently selected Share Option + var $gotoShareSelections= array();// Available Shares for this account in Listbox format + var $gotoAvailableShares= array();// Available Shares for this account + + /* Helper */ + var $customParameters = ""; + var $orig_dn = ""; + var $ignore_account = TRUE; + + /* FAI class selection */ + var $FAIclass = array(); // The currently selected classes + var $FAIrelease = ""; + var $FAIdebianMirror = "auto"; + + var $cache = array(); // Used as cache in fai mehtods + + var $FAIstatus = ""; + var $FAIclasses = array(); + + var $view_logged = FALSE; + + /* FAI class selection */ + var $InheritedFAIclass = array(); + var $InheritedFAIrelease = ""; + var $InheritedFAIdebianMirror= "auto"; + + var $CopyPasteVars = array("gotoModules","gotoShares"); + var $fai_activated = FALSE; + var $o_group_dn = ""; + var $member_of_ogroup = FALSE; + + function workstartup (&$config, $dn= NULL, $parent= NULL) + { + /* Check if FAI is active */ + $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs')); + if(!empty($tmp)){ + $this->fai_activated = TRUE; + }else{ + $this->attributes = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "gotoShare"); + $this->objectclasses = array("GOhard"); + } + + plugin::plugin ($config, $dn, $parent); + + /* Check object group membership */ + if(!isset($this->parent->by_object['ogroup'])){ + $ldap = $this->config->get_ldap_link(); + $ldap->cd ($this->config->current['BASE']); + $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))",array("cn","dn")); + if($ldap->count()){ + $this->member_of_ogroup = TRUE; + $attrs = $ldap->fetch(); + $this->o_group_dn = $attrs['dn']; + } + } + + /* Creating a list of valid Mirrors + * none will not be saved to ldap. + */ + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + foreach($this->config->data['SERVERS']['LDAP'] as $server) { + $this->gotoLdapServerList[]= $server; + } + + /* Get list of assigned ldap servers + */ + if(isset($this->attrs['gotoLdapServer'])){ + unset($this->attrs['gotoLdapServer']['count']); + sort($this->attrs['gotoLdapServer']); + foreach($this->attrs['gotoLdapServer'] as $value){ + $this->gotoLdapServers[] = preg_replace("/^[0-9]*:/","",$value); + } + } + if(!count($this->gotoLdapServers) && $this->member_of_ogroup){ + $this->gotoLdap_inherit = TRUE; + } + + /* FAI Initialization + Skip this if FAI is not activated + */ + if($this->fai_activated) { + + $this->update_fai_cache(TRUE); + + /* Parse used FAIclasses (stored as string). + * The single classes are seperated by ' '. + * There is also the release type given, after first + * occurrence of ':'. + */ + $this->FAIclass =array(); + if(isset($this->attrs['FAIclass'][0])){ + $tmp = split(" ",$this->attrs['FAIclass'][0]); + $tmp2 =array(); + + foreach($tmp as $class){ + if( ":" == $class[0] ) { + $this->FAIrelease = trim(substr($class, 1)); + }else{ + $tmp2[$class] = $class; + } + } + $this->FAIclass = $tmp2; + } + } + + /* Get arrays */ + foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){ + if (isset($this->attrs["$val"]["count"])){ + for ($i= 0; $i<$this->attrs["count"]; $i++){ + if (isset($this->attrs["$val"][$i])){ + array_push($this->$val, $this->attrs["$val"][$i]); + } + } + } + sort ($this->$val); + $this->$val= array_unique($this->$val); + } + + /* Parse Kernel Parameters to decide what boot mode is enabled */ + if (preg_match("/ splash=silent/", $this->gotoKernelParameters)){ + $this->bootmode= "G"; + } elseif (preg_match("/ debug/", $this->gotoKernelParameters)){ + $this->bootmode= "D"; + } elseif ($this->gotoKernelParameters == "") { + $this->bootmode= "G"; + } else { + $this->bootmode= "T"; + } + if (preg_match("/ o /", $this->gotoKernelParameters)){ + $this->customParameters= preg_replace ("/^.* o /", "", $this->gotoKernelParameters); + } else { + $this->customParameters= ""; + } + + /* Prepare Shares */ + if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){ + unset($this->attrs['gotoShare']['count']); + foreach($this->attrs['gotoShare'] as $share){ + $tmp = $tmp2 = array(); + $tmp = split("\|",$share); + $tmp2['server'] =$tmp[0]; + $tmp2['name'] =$tmp[1]; + $tmp2['mountPoint'] =$tmp[2]; + $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2; + } + } + + $this->gotoShareSelections= $config->getShareList(true); + $this->gotoAvailableShares= $config->getShareList(false); + $tmp2 = array(); + + + $this->orig_dn= $this->dn; + + /* Handle inheritance value "default" */ + if ($this->member_of_ogroup){ + $this->gotoBootKernels= array("default-inherited" => '['._("inherited").']'); + } + + /* If we are member in an object group, + * we have to handle inherited values. + * So you can see what is inherited. + */ + if ($this->member_of_ogroup){ + + if(count($this->FAIclass)==0 && $this->FAIrelease == ""){ + $this->FAIdebianMirror = "inherited"; + } + + if($this->fai_activated){ + $map= array("gotoBootKernel","FAIclass","FAIdebianMirror"); + }else{ + $map= array("gotoBootKernel"); + } + + $ldap = $this->config->get_ldap_link(); + $ldap->cat($this->o_group_dn); + $attrs= $ldap->fetch(); + + foreach ($map as $name){ + if (!isset($attrs[$name][0])){ + continue; + } + + switch ($name){ + case 'gotoBootKernel': + $this->gotoBootKernels['default-inherited']= _("inherited").' ['.$attrs[$name][0].']' ; + break; + + case 'FAIclass': + $str = split(":",$attrs[$name][0]); + $this->InheritedFAIclass = split("\ ",trim($str[0])); + $this->InheritedFAIrelease = trim($str[1]); + break; + + case 'FAIdebianMirror': + $this->InheritedFAIdebianMirror = $attrs[$name][0]; + break; + } + } + } + + + if($this->fai_activated){ + + /* Check if the current mirror is available + */ + if(!isset($this->cache['SERVERS'][$this->FAIdebianMirror])){ + if(count($this->FAIclass)){ + print_red(sprintf(_("The selected FAI mirror '%s' is no longer available, the mirror was set to 'auto'."), + $this->FAIdebianMirror)); + } + $this->FAIdebianMirror = "auto"; + $this->FAIrelease = key($this->cache['SERVERS'][$this->FAIdebianMirror]); + $this->cache =array(); + $this->update_fai_cache(); + + } + + /* Check if the current mirror is available + */ + if(!isset($this->cache['SERVERS'][$this->FAIdebianMirror][$this->FAIrelease])){ + $new_release = key($this->cache['SERVERS'][$this->FAIdebianMirror]); + if(count($this->FAIclass)){ + print_red(sprintf(_("The selected FAI release '%s' is not available for mirror '%s', the release was set to '%s'."), + $this->FAIrelease,$this->FAIdebianMirror,$new_release)); + } + $this->FAIrelease = $new_release; + $this->cache =array(); + $this->update_fai_cache(); + } + } + + /* Get list of boot kernels */ + if (isset($this->config->data['TABS'])){ + $command= $this->config->search(get_class($this), "KERNELS",array('tabs')); + if (!check_command($command)){ + $message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command, + get_class($this)); + } else { + $fh= popen($command, "r"); + while (!feof($fh)) { + $buffer= trim(fgets($fh, 256)); + if(!empty($buffer)){ + $name=$value = $buffer; + if(preg_match("/:/",$buffer)){ + $name = preg_replace("/:.*$/","",$buffer); + $value= preg_replace("/^.*:/","",$buffer); + $this->gotoBootKernels[$name]= $name.":".$value; + }else{ + $this->gotoBootKernels[$name]= $value; + } + } + } + pclose($fh); + } + } + + /* Turn to default, if we've nothing to inherit */ + if (!isset($this->gotoBootKernels['default-inherited']) && $this->gotoBootKernel == "default-inherited"){ + $this->gotoBootKernel= "default"; + } + } + + + function check() + { + $messages = array(); + + /* Call common method to give check the hook */ + $messages= plugin::check(); + + /* If there are packages selected, but no mirror show error */ + if(($this->FAIdebianMirror == "none")&&(count($this->FAIclass)>0)){ + $messages[]=_("Please select a 'FAI server' or remove the 'FAI classes'."); + } + + return($messages); + } + + function execute() + { + /* Call parent execute */ + plugin::execute(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","workstation/".get_class($this),$this->dn); + } + + /* Do we need to flip is_account state? */ + if(isset($_POST['modify_state'])){ + if($this->is_account && $this->acl_is_removeable()){ + $this->is_account= FALSE; + }elseif(!$this->is_account && $this->acl_is_createable()){ + $this->is_account= TRUE; + } + } + + /* Do we represent a valid terminal? */ + if (!$this->is_account && $this->parent === NULL){ + $display= "\"\" ". + _("This 'dn' has no terminal features.").""; + return ($display); + } + + /* Add module */ + if (isset ($_POST['add_module'])){ + if ($_POST['module'] != "" && $this->acl_is_writeable("gotoModule")){ + $this->add_list ($this->gotoModules, $_POST['module']); + } + } + + /* Delete module */ + if (isset ($_POST['delete_module'])){ + if (count($_POST['modules_list']) && $this->acl_is_writeable("gotoModule")){ + $this->del_list ($this->gotoModules, $_POST['modules_list']); + } + } + + /* FAI class management */ + if($this->fai_activated){ + if(((isset($_POST['AddClass']))&&(isset($_POST['FAIclassesSel']))) && ($this->acl_is_writeable("FAIclass"))){ + $found = 0 ; + + /* If this new class/profile will attach a second partition table + * to our list of classes, abort and show a message. + */ + foreach($this->FAIclass as $name){ + if(isset($this->FAIclassInfo[$name])){ + foreach($this->FAIclassInfo[$name] as $atr){ + if(isset($atr['obj'])){ + if($atr['obj'] == "FAIpartitionTable"){ + $found ++ ; + } + } + } + } + } + + if((isset($this->FAIclassInfo[$_POST['FAIclassesSel']]['FAIpartitionTable']))&&($found>0)){ + print_red(_("There is already a profile in your selection that contain partition table configurations.")); + }else{ + $this->FAIclass[$_POST['FAIclassesSel']]=$_POST['FAIclassesSel']; + } + } + + $sort = false; + + /* Move one used class class one position up or down */ + if($this->acl_is_writeable("FAIclass")){ + foreach($_POST as $name => $val){ + + $sort_type = false; + if((preg_match("/sort_up/",$name))&&(!$sort)){ + $sort_type = "sort_up_"; + } + if((preg_match("/sort_down/",$name))&&(!$sort)){ + $sort_type = "sort_down_"; + } + + if(($sort_type)&&(!$sort)){ + $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/".$sort_type."/i","",$name))); + $sort = true; + + $last = -1; + $change_down = -1; + + /* Create array with numeric index */ + $tmp = array(); + foreach($this->FAIclass as $class){ + $tmp [] = $class; + } + + /* Walk trough array */ + foreach($tmp as $key => $faiName){ + if($faiName == $value){ + if($sort_type == "sort_up_"){ + if($last != -1){ + $change_down= $last; + } + }else{ + if(isset($tmp[$key+1])){ + $change_down = $key; + } + } + } + $last = $key; + } + + $tmp2 = array(); + $skip = false; + + foreach($tmp as $ky => $vl){ + + if($ky == $change_down){ + $skip = $vl; + }else{ + $tmp2[$vl] = $vl; + } + if(($skip != false)&&($ky != $change_down)){ + $tmp2[$skip] = $skip; + $skip =false; + } + } + $this->FAIclass = $tmp2; + } + + if(preg_match("/fai_remove/i",$name)){ + $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/fai_remove_/i","",$name))); + unset($this->FAIclass[$value]); + } + } + } + + /* Delete selected class from our list */ + if($this->acl_is_writeable("FAIclass")){ + if((isset($_POST['DelClass']))&&(isset($_POST['FAIclassSel']))){ + if(isset($this->FAIclass[$_POST['FAIclassSel']])){ + unset($this->FAIclass[$_POST['FAIclassSel']]); + } + } + } + }// END fai handling + + /* Show main page */ + $smarty= get_smarty(); + + /* Assign ACLs to smarty */ + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL",$this->getacl($name)); + } + + $smarty->assign("member_of_ogroup",$this->member_of_ogroup); + + /* In this section server shares will be defined + * A user can select one of the given shares and a mount point + * and attach this combination to his setup. + */ + $smarty->assign("gotoShareSelections", $this->gotoShareSelections); + $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections)); + + /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry + * This entry will be, a combination of mountPoint and sharedefinitions + */ + if((isset($_POST['gotoShareAdd'])) && ($this->acl_is_writeable("gotoShare"))) { + /* We assign a share to this user, if we don't know where to mount the share */ + if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){ + print_red(_("You must specify a valid mount point.")); + }else{ + if(count($this->gotoAvailableShares)){ + $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']]; + $s_mount = $_POST['gotoShareMountPoint']; + /* Preparing the new assignment */ + $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share; + $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount; + } + } + } + + /* if the Post gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected) + * If there is no defined share selected, we will abort the deletion without any message + */ + if(($this->acl_is_writeable("gotoShare"))&& (isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare']))){ + unset($this->gotoShares[$_POST['gotoShare']]); + } + + $smarty->assign("gotoShares",$this->printOutAssignedShares()); + $smarty->assign("gotoSharesCount",count($this->printOutAssignedShares())); + $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares())); + $smarty->assign("gotoBootKernels",$this->gotoBootKernels); + + /* Create divSelectBox for ldap server selection + */ + $SelectBoxLdapServer = new divSelectBox("LdapServer"); + $SelectBoxLdapServer->SetHeight(130); + + /* Add new ldap server to the list */ + if(!$this->gotoLdap_inherit && isset($_POST['add_ldap_server']) && isset($_POST['ldap_server_to_add'])){ + if(isset($this->gotoLdapServerList[$_POST['ldap_server_to_add']])){ + $to_add = $this->gotoLdapServerList[$_POST['ldap_server_to_add']]; + if(!in_array($to_add,$this->gotoLdapServers)){ + $this->gotoLdapServers[] = $to_add; + } + } + } + + /* Move ldap servers up and down */ + if(!$this->gotoLdap_inherit){ + foreach($_POST as $name => $value){ + if(preg_match("/sort_ldap_up_/",$name)){ + $id = preg_replace("/^sort_ldap_up_([0-9]*)_(x|y)$/","\\1",$name); + $from = $id; + $to = $id -1; + $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to); + if($tmp){ + $this->gotoLdapServers = $tmp; + } + break; + } + if(preg_match("/sort_ldap_down_/",$name)){ + $id = preg_replace("/^sort_ldap_down_([0-9]*)_(x|y)$/","\\1",$name); + $from = $id; + $to = $id +1; + $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to); + if($tmp){ + $this->gotoLdapServers = $tmp; + } + break; + } + if(preg_match("/gotoLdapRemove_/",$name)){ + $id = preg_replace("/^gotoLdapRemove_([0-9]*)_(x|y)$/","\\1",$name); + $value = $this->gotoLdapServers[$id]; + $this->gotoLdapServers = array_remove_entries(array($value),$this->gotoLdapServers); + break; + } + } + } + + /* Add Entries + */ + foreach($this->gotoLdapServers as $key => $server){ + if(!in_array($server,$this->gotoLdapServerList)){ + $server = $server." (missing)"; + } + + $SelectBoxLdapServer->AddEntry( + array(array("string" => $server), + array("string" => + " ". + " ". + "", + "attach" => "style='text-align:right;width:40px;border-right:0px;'"))); + } + + if($this->gotoLdap_inherit){ + $smarty->assign("gotoLdapServerACL_inherit", preg_replace("/w/","",$this->getacl("gotoLdapServer")));; + }else{ + $smarty->assign("gotoLdapServerACL_inherit", $this->getacl("gotoLdapServer")); + } + + $list = array(); + foreach($this->gotoLdapServerList as $key => $entry){ + if(!in_array($entry,$this->gotoLdapServers)){ + $list[$key] = $entry; + } + } + $smarty->assign("gotoLdapServers", $SelectBoxLdapServer->DrawList()); + $smarty->assign("gotoLdapServerList", $list); + $smarty->assign("gotoLdap_inherit", $this->gotoLdap_inherit); + $smarty->assign("JS", session::get('js')); + + foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){ + $smarty->assign("$val", $this->$val); + } + + /* Values */ + foreach(array("gotoBootKernel", "customParameters", "gotoShare","FAIclasses","FAIclass","FAIdebianMirror","FAIrelease") as $val){ + $smarty->assign($val, $this->$val); + } + + $smarty->assign("fai_activated",$this->fai_activated); + + /* Create FAI output */ + if($this->fai_activated){ + + $this->update_fai_cache(); + + $smarty->assign("FAIservers" , $this->cache['SERVERS']); + $smarty->assign("FAIdebianMirror",$this->FAIdebianMirror); + $smarty->assign("FAIrelease" , $this->FAIrelease); + $smarty->assign("FAIclasses" , $this->selectable_classes()); + + $smarty->assign("InheritedFAIrelease",$this->InheritedFAIrelease); + + $div = new divSelectBox("WSFAIscriptClasses"); + $div -> SetHeight("110"); + $str_up = "  "; + $str_down = "  "; + $str_remove = "  "; + $str_empty = "  \"\""; + + /* Get classes */ + if($this->FAIdebianMirror == "inherited"){ + $tmp = $this->InheritedFAIclass; + }else{ + $tmp = $this->FAIclass; + } + + /* Get invalid classes */ + $invalid = $this->get_invalid_classes($tmp); + + /* Draw every single entry */ + $i = 1; + foreach($tmp as $class){ + + /* Mark invalid classes. (Not in selected release) + */ + $marker = ""; + if(in_array_ics($class,$invalid)){ + $marker = " ("._("Not available in current setup").")"; + } + + /* Create up/down priority icons + * Skip this, if we have inherited the FAI classes. + */ + if($this->FAIdebianMirror == "inherited"){ + $str = ""; + }else{ + if($i==1){ + $str = $str_empty.$str_down.$str_remove; + }elseif($i == count($this->FAIclass)){ + $str = $str_up.$str_empty.$str_remove; + }else{ + $str = $str_up.$str_down.$str_remove; + } + } + $i ++ ; + + /* Get Description tag + * There may be several FAI objects with the same class name, + * use the description from FAIprofile, if possible. + */ + $desc = ""; + if(isset($this->cache['CLASSES'][$this->FAIrelease][$class])){ + foreach($this->cache['CLASSES'][$this->FAIrelease][$class] as $types ){ + if(isset($types['Desc'])){ + $desc= $types['Desc']; + if($types['Type'] == "FAIprofile"){ + break; + } + } + } + } + if(!empty($desc)){ + $desc = " [".trim($desc)."]"; + } + + $div->AddEntry(array( + array("string"=>$class.$desc.$marker), + array("string"=>preg_replace("/\%s/",base64_encode($class),$str),"attach"=>"style='width:50px;border-right:none;'") + )); + } + $smarty->assign("FAIScriptlist",$div->DrawList()); + }// END FAI output generation + + /* Radio button group */ + if (preg_match("/G/", $this->bootmode)) { + $smarty->assign("graphicalbootup", "checked"); + } else { + $smarty->assign("graphicalbootup", ""); + } + if (preg_match("/T/", $this->bootmode)) { + $smarty->assign("textbootup", "checked"); + } else { + $smarty->assign("textbootup", ""); + } + if (preg_match("/D/", $this->bootmode)) { + $smarty->assign("debugbootup", "checked"); + } else { + $smarty->assign("debugbootup", ""); + } + + /* Show main page */ + return($smarty->fetch (get_template_path('workstationStartup.tpl', TRUE,dirname(__FILE__)))); + } + + + function remove_from_parent() + { + $this->handle_post_events("remove"); + new log("remove","workstation/".get_class($this),$this->dn); + } + + + /* Save data to object */ + function save_object() + { + $old_mirror = $this->FAIdebianMirror; + plugin::save_object(); + + /* Update release */ + if($old_mirror != $this->FAIdebianMirror){ + if(!isset($this->cache['SERVERS'][$this->FAIdebianMirror][$this->FAIrelease])){ + $this->FAIrelease = key($this->cache['SERVERS'][$this->FAIdebianMirror]); + } + } + + if(isset($_POST['WorkstationStarttabPosted'])){ + if(isset($_POST['gotoLdap_inherit'])){ + $this->gotoLdap_inherit = TRUE; + }else{ + $this->gotoLdap_inherit = FALSE; + } + + /* Save group radio buttons */ + if ($this->acl_is_writeable("bootmode") && isset($_POST["bootmode"])){ + $this->bootmode= $_POST["bootmode"]; + } + + /* Save kernel parameters */ + if ($this->acl_is_writeable("gotoKernelParameters") && isset($_POST["customParameters"])){ + $this->customParameters= $_POST["customParameters"]; + } + } + } + + + /* Save to LDAP */ + function save() + { + + /* Depending on the baseobject (Ogroup / WS) we + * use another set of objectClasses + * In case of WS itself, we use "array("GOhard", "FAIobject");" + * if we are currently editing from ogroup menu we use (array("gotWorkstationTemplate","GOhard", "FAIobject")) + */ + if(isset($this->parent->by_object['ogroup'])){ + $this->objectclasses = array("gotoWorkstationTemplate"); + }elseif(isset($this->parent->by_object['workgeneric'])){ + $this->objectclasses = array("GOhard"); + }elseif(isset($this->parent->by_object['servgeneric'])){ + $this->objectclasses = array("GOhard","gotoWorkstationTemplate"); + }else{ + print "Object Type Configuration : unknown"; + exit(); + } + + /* Append FAI class */ + if($this->fai_activated){ + $this->objectclasses[] = "FAIobject"; + } + + /* Find proper terminal path for tftp configuration + FIXME: This is suboptimal when the default has changed to + another location! */ + if (($this->gotoTerminalPath == "default")){ + $ldap= $this->config->get_ldap_link(); + + /* Strip relevant part from dn, keep trailing ',' */ + $tmp= preg_replace("/^cn=[^,]+,".get_ou('terminalou')."/i", "", $this->dn); + $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp); + + /* Walk from top to base and try to load default values for + 'gotoTerminalPath'. Abort when an entry is found. */ + while (TRUE){ + $tmp= preg_replace ("/^[^,]+,/", "", $tmp); + + $ldap->cat("cn=default,".get_ou('terminalou').$tmp. + $this->config->current['BASE'], array('gotoTerminalPath')); + $attrs= $ldap->fetch(); + if (isset($attrs['gotoTerminalPath'])){ + $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0]; + break; + } + + /* Nothing left? */ + if ($tmp == ""){ + break; + } + } + } + + /* Add semi automatic values */ + // FIXME: LDAP Server may not be set here... + $this->gotoKernelParameters= "ldap=".base64_encode($this->gotoLdapServer); + + switch ($this->bootmode){ + case "D": + $this->gotoKernelParameters.= " debug"; + break; + case "G": + $this->gotoKernelParameters.= " splash=silent"; + break; + } + if ($this->customParameters != ""){ + $this->gotoKernelParameters.= " o ".$this->customParameters; + } + + plugin::save(); + + unset( $this->attrs['FAIrelease'] ); + + $str = ""; + + /* Skip FAI attribute handling if not necessary */ + if($this->fai_activated){ + if($this->FAIdebianMirror == "inherited"){ + $this->attrs['FAIclass'] = $this->attrs['FAIrelease'] = $this->attrs['FAIdebianMirror'] = array(); + }else{ + foreach($this->FAIclass as $class){ + $str .= $class." "; + } + $str .= ":" . $this->FAIrelease; + $this->attrs['FAIclass']= ""; + $this->attrs['FAIclass']= trim($str); + + if(empty($this->attrs['FAIclass'])){ + $this->attrs['FAIclass'] = array(); + } + } + } + + /* Add missing arrays */ + foreach (array("gotoFilesystem", "gotoAutoFs", "gotoModules") as $val){ + if (isset ($this->$val) && count ($this->$val) != 0){ + + $this->attrs["$val"]= array_unique($this->$val); + } + if(!isset($this->attrs["$val"])) $this->attrs["$val"]=array(); + } + + /* Prepare list of ldap servers */ + $this->attrs['gotoLdapServer'] = array(); + if(!$this->gotoLdap_inherit){ + $i = 0; + foreach($this->gotoLdapServers as $server){ + $i ++; + $this->attrs['gotoLdapServer'][] = $i.":".$server; + } + } + + if (($this->attrs['gotoBootKernel'] == "default-inherited") || ($this->attrs['gotoBootKernel'] == "%default%")){ + $this->attrs['gotoBootKernel']= array(); + } + + /* if mirror == none stop saving this attribute */ + if($this->FAIdebianMirror == "none"){ + $this->FAIdebianMirror = ""; + } + + /* Get FAIstate from object, the generic tab could have changed it during execute */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + + + /* Skip FAI attribute handling if not necessary */ + if($this->fai_activated){ + $ldap->cat($this->dn,array("FAIstate")); + $checkFAIstate = $ldap->fetch(); + + /* Remove FAI objects if no FAI class is selected */ + if((count($this->FAIclass)==0) && (!isset($checkFAIstate['FAIstate']))){ + $this->attrs['FAIclass'] = array(); + $this->attrs['FAIdebianMirror'] = array(); + } + } + + + /* prepare share settings */ + $tmp = array(); + foreach($this->gotoShares as $name => $settings){ + $tmp2= split("\|",$name); + $name = $tmp2[0]; + $tmp[] = $settings['server']."|".$name."|".$settings['mountPoint']; + } + $this->attrs['gotoShare']=$tmp; + + $this->cleanup(); + $ldap->modify ($this->attrs); + new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + + show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/startup with dn '%s' failed."),$this->dn)); + $this->handle_post_events("modify"); + } + + + /* Add value to array, check if unique */ + function add_list (&$array, $value) + { + if ($value != ""){ + $array[]= $value; + sort($array); + array_unique ($array); + } + } + + + /* Delete value to array, check if unique */ + function del_list (&$array, $list) + { + $tmp= array(); + foreach ($array as $mod){ + if (!in_array($mod, $list)){ + $tmp[]= $mod; + } + } + $array= $tmp; + } + + /* Generate ListBox frindly output for the defined shares + * Possibly Add or remove an attribute here, + */ + function printOutAssignedShares() + { + $a_return = array(); + if(is_array($this->gotoShares)){ + foreach($this->gotoShares as $share){ + $a_return[$share['name']."|".$share['server']]= $share['name']." [".$share['server']."]"; + } + } + return($a_return); + } + + + + function PrepareForCopyPaste($source) + { + plugin::PrepareForCopyPaste($source); + $source_o = new workstartup ($this->config, $source['dn']); + foreach(array("FAIclass","gotoModules", "gotoAutoFs", "gotoFilesystem", + "gotoKernelParameters","gotoShares","customParameters") as $attr){ + $this->$attr = $source_o->$attr; + } + } + + + function array_switch_item($ar,$from,$to) + { + if(!is_array($ar)){ + return(false); + } + if(!isset($ar[$from])){ + return(false); + } + if(!isset($ar[$to])){ + return(false); + } + + $tmp = $ar[$from]; + $ar[$from] = $ar[$to]; + $ar[$to] = $tmp; + return($ar); + } + + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Startup"), + "plDescription" => _("System startup"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 9, + "plSection" => array("administration"), + "plCategory" => array("workstation","server","ogroups"), + + "plProvidedAcls"=> array( + "gotoLdapServer" => _("Ldap server"), + "gotoBootKernel" => _("Boot kernel"), + "gotoKernelParameters" => _("Kernel parameter"), + + "gotoModules" => _("Kernel modules"), + "gotoShare" => _("Shares"), + + "FAIclass" => _("FAI classes"), + "FAIdebianMirror" => _("Debian mirror"), + "FAIrelease" => _("Debian release"), + + "FAIstatus" => _("FAI status flag")) // #FIXME is this acl realy necessary ? + )); + } + + + /* Updates release dns + * and reads all classes for the current release, + * if not already done ($this->cache). + */ + function update_fai_cache($first_call = FALSE) + { + $force = FALSE; + + /* Get the list of available servers and their releases. + */ + if($force || !isset($this->cache['SERVERS'])){ + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(FAIrepository=*)(objectClass=FAIrepositoryServer))",array("FAIrepository")); + $this->cache['SERVERS'] = array(); + + /* Only add inherit option, if we are part in an object group + */ + if($this->member_of_ogroup){ + $this->cache['SERVERS']['inherited']=array(); + } + + /* Add auto value + */ + $this->cache['SERVERS']['auto'] = array(); + $sort_by = array("auto"); + $server_tmp = array("auto"=>array()); + while($attr = $ldap->fetch()){ + if(isset($attr['FAIrepository'])){ + for($i = 0 ; $i < $attr['FAIrepository']['count'] ; $i ++ ){ + $rep = $attr['FAIrepository'][$i]; + $tmp = split("\|",$rep); + if(count($tmp)==4){ + $sections = split(",",$tmp[3]); + $release = $tmp[2]; + $server = $tmp[1]; + $url = $tmp[0]; + $server_tmp[$url][$release]=$release; + $server_tmp['auto'][$release]=$release; + $sort_by[$url] = $url; + } + } + } + } + natcasesort($sort_by); + foreach($sort_by as $name){ + $releases = $server_tmp[$name]; + natcasesort($releases); + $this->cache['SERVERS'][$name] = $releases; + } + } + + /* Build up arrays, without checks */ + if(!$first_call){ + + /* Check if the selected mirror is available */ + if(!isset($this->cache['SERVERS'][$this->FAIdebianMirror])){ + $this->FAIdebianMirror = "auto"; + $this->FAIrelease = key($this->cache['SERVERS'][$this->FAIdebianMirror]); + trigger_error("There was a problem with the selected FAIdebianMirror. This mirror ('".$this->FAIdebianMirror."') is not available"); + } + + /* Check if the selected release is available */ + if($this->FAIdebianMirror != "inherited" && !isset($this->cache['SERVERS'][$this->FAIdebianMirror][$this->FAIrelease])){ + trigger_error("There was a problem with the selected FAIrelease. This release ('".$this->FAIrelease."') is not available"); + $this->FAIrelease = key($this->cache['SERVERS'][$this->FAIdebianMirror]); + } + } + + /* Get classes for release from cache. + * Or build cache + */ + if($this->FAIdebianMirror == "inherited"){ + $release = $this->InheritedFAIrelease; + }else{ + $release = $this->FAIrelease; + } + if($force || !isset($this->cache['CLASSES'][$release])){ + + /* Create a list of available releases. + * $this->cache['RELEASE_DNS'][ou=siga...,c=de] = "siga"; + * $this->cache['RELEASE_DNS'][ou=siga,ou=rc1,...,c=de] = "siga/rc1"; + */ + if($force || !isset($this->cache['RELEASE_DNS'])){ + $this->cache['RELEASE_DNS'] = array(); + $fai_ou_parts = preg_replace("/\/.*$/","",$this->FAIrelease); + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(objectClass=FAIbranch)",array("ou")); + while($attrs = $ldap->fetch()){ + if(preg_match("/".normalizePreg(get_ou("faiou"))."/",$attrs['dn'])){ + $this->cache['RELEASE_DNS'][$attrs['dn']] = $this->dn_to_release_name($attrs['dn']); + } + } + } + + /* Create list of available classes for the currenlty selected release. + */ + $base = array_search($release,$this->cache['RELEASE_DNS']); + $this->cache['CLASSES'][$release] = array(); + + if(class_exists("FAI")){ + if(!empty($base)){ + $filter = "(|(objectClass=FAIpackageList)(objectClass=FAItemplate)(objectClass=FAIvariable)". + "(objectClass=FAIscript)(objectClass=FAIhook)(objectClass=FAIprofile)". + "(objectClass=FAIpartitionTable))"; + $list = FAI::get_all_objects_for_given_base($base,$filter,TRUE); + foreach($list as $attrs){ + $info = $this->analyse_fai_object($attrs); + if(count($info)){ + $this->cache['CLASSES'][$release][$attrs['cn'][0]][] = $info; + } + } + } + }else{ + print_red(_("Could not load available classes, the fai extension plugin seems not to be installed.")); + } + + /* Add object caught from external hook + */ + $lines= $this->GetHookElements(); + foreach ($lines as $hline){ + $entries= split(";", $hline); + $server = $entries['0']; + $url = $entries['1']; + if (!empty($url)){ + + /* Split releases */ + if (isset($entries[2])){ + $releases= split(",", $entries[2]); + + foreach ($releases as $release_data){ + $release= preg_replace('/:.*$/', '', $release_data); + $sections = split(':', preg_replace('/^[^:]+:([^|]+)|.*$/', '\1', $release_data)); + $classes = split('\|', preg_replace('/^[^|]+\|(.*)$/', '\1', $release_data)); + $this->cache['SERVERS'][$url][$release]=$release; + $this->cache['SERVERS']['auto'][$release]=$release; + foreach ($classes as $class){ + if ($class != ""){ + $this->cache['CLASSES'][$release][$class]= array(); + } + } + } + } + } + } + } + } + + + /* This function return an array containing all + * invalid classes for the selected server/release + */ + function get_invalid_classes($classes) + { + $this->update_fai_cache(); + if($this->FAIdebianMirror == "inherited"){ + $release_classes = $this->cache['CLASSES'][$this->InheritedFAIrelease]; + }else{ + $release_classes = $this->cache['CLASSES'][$this->FAIrelease]; + } + + + /* Detect all classes that are not valid + * for the selected release + */ + $NA = array(); + foreach($classes as $class){ + if(!isset($release_classes[$class])){ + $NA[] = $class; + } + } + return($NA); + } + + + /* Get all selectable classes for the ui select box + */ + function selectable_classes() + { + $this->update_fai_cache(); + + if($this->FAIdebianMirror == "inherited"){ + $classes = $this->cache['CLASSES'][$this->InheritedFAIrelease]; + }else{ + $classes = $this->cache['CLASSES'][$this->FAIrelease]; + } + + $Abbr =""; + $ret= array(); + foreach($classes as $class_name => $class_types){ + if(!in_array($class_name,$this->FAIclass)){ + foreach($class_types as $type){ + if(!preg_match("/".$type['Abbr']."/",$Abbr)){ + $Abbr .= $type['Abbr']." "; + } + } + $ret[$class_name] = trim($Abbr); + } + } + uksort($ret, 'strnatcasecmp'); + return($ret); + } + + + /* Analyse FAI object and return an array with usefull informations like + * FAIobject type. + */ + function analyse_fai_object($attr) + { + $tmp2 = array(); + if(!isset($attr['description'])){ + $attr['description'][0] =""; + } + if(in_array('FAIpackageList',$attr['objectClass'])){ + $tmp2["Type"] = 'FAIpackageList'; + $tmp2["Abbr"] = 'Pl'; + $tmp2["Desc"] = $attr['description'][0]; + } + if(in_array('FAItemplate',$attr['objectClass'])){ + $tmp2["Type"] = 'FAItemplate'; + $tmp2["Abbr"] = 'T'; + $tmp2["Desc"] = $attr['description'][0]; + } + if(in_array('FAIvariable',$attr['objectClass'])){ + $tmp2["Type"] = 'FAIvariable'; + $tmp2["Abbr"] = 'V'; + $tmp2["Desc"] = $attr['description'][0]; + } + if(in_array('FAIscript',$attr['objectClass'])){ + $tmp2["Type"] = 'FAIscript'; + $tmp2["Abbr"] = 'S'; + $tmp2["Desc"] = $attr['description'][0]; + } + if(in_array('FAIhook',$attr['objectClass'])){ + $tmp2["Type"] = 'FAIhook'; + $tmp2["Abbr"] = 'H'; + $tmp2["Desc"] = $attr['description'][0]; + } + if(in_array('FAIpartitionTable',$attr['objectClass'])){ + $tmp2["Type"]= 'FAIpartitionTable'; + $tmp2["Abbr"]= 'Pt'; + $tmp2["Desc"] = $attr['description'][0]; + } + if(in_array('FAIprofile',$attr['objectClass'])){ + $tmp2["Type"]= 'FAIprofile'; + $tmp2["Abbr"]= 'P'; + $tmp2["Desc"] = $attr['description'][0]; + } + return($tmp2); + } + + + /* Return repository hook output, if possible. + */ + function GetHookElements() + { + $ret = array(); + $cmd= $this->config->search("servrepository", "REPOSITORY_HOOK",array('tabs')); + if(!empty($cmd)){ + $res = shell_exec($cmd); + $res2 = trim($res); + if((!$res)){ + print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s' please check your gosa.conf."),$cmd)); + }elseif(empty($res2)){ + print_red(sprintf(_("The specified REPOSITORY_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd)); + }else{ + $tmp = split("\n",$res); + foreach($tmp as $line){ + if(empty($line)) continue; + $ret[]= $line; + } + } + } + return($ret); + } + + + /* This function creates the release name out of a dn + * e.g. "ou=1.0rc2,ou=siga,ou=fai,..." => "siga/1.0rc2" + */ + function dn_to_release_name($dn) + { + $relevant = preg_replace("/,".normalizePreg(get_ou("faiou")).".*$/","",$dn); + $parts = array_reverse(split("\,",$relevant)); + $str =""; + foreach($parts as $part){ + $str .= preg_replace("/^ou=/","",$part)."/"; + } + return(preg_replace("/\/$/","",$str)); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/admin/systems/goto/gencd.tpl b/gosa-core/plugins/admin/systems/goto/gencd.tpl new file mode 100644 index 000000000..f0c449677 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/gencd.tpl @@ -0,0 +1,20 @@ +

+ {t}CD-Install-Image generation{/t} +

+

+ {t}This option enables you to generate FAI install CD images for the selected workstation. The procedure may take about 10 minutes to complete, so please be patient after pressing the 'Create ISO-Image' button.{/t} +

+ +

+ +   + +

+ + + diff --git a/gosa-core/plugins/admin/systems/goto/gencd_frame.tpl b/gosa-core/plugins/admin/systems/goto/gencd_frame.tpl new file mode 100644 index 000000000..4c53bdab5 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/gencd_frame.tpl @@ -0,0 +1,3 @@ + diff --git a/gosa-core/plugins/admin/systems/goto/info.tpl b/gosa-core/plugins/admin/systems/goto/info.tpl new file mode 100644 index 000000000..e088c595a --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/info.tpl @@ -0,0 +1,135 @@ +

{t}System information{/t}

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
{t}CPU{/t}{$ghCpuType}
{t}Memory{/t}{$ghMemSize}
{t}Boot MAC{/t}{$macAddress}
{t}USB support{/t}{$ghUsbSupport}
{t}System status{/t}{$status}
{t}Inventory number{/t}{$ghInventoryNumber}
{t}Last login{/t}{$gotoLastUser}
+
+   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{t}Network devices{/t} + {foreach item=netcard from=$ghNetNic} + {$netcard}
+ {/foreach} +
{t}IDE devices{/t} + {foreach item=idedev from=$ghIdeDev} + {$idedev}
+ {/foreach} +
{t}SCSI devices{/t} + {foreach item=scsidev from=$ghScsiDev} + {$scsidev}
+ {/foreach} +
{t}Floppy device{/t}{$FloppyDevice}
{t}CDROM device{/t}{$CdromDevice}
{t}Graphic device{/t}{$ghGfxAdapter}
{t}Audio device{/t}{$ghSoundAdapter}
+
+ +{if $active eq "true"} +
+

{t}System status{/t}

+ + + + + + +
+ + + + + + + + + + + + + + + + + {$partitions} +
{t}Up since{/t}{$uptime}
{t}CPU load{/t}{$load}
{t}Memory usage{/t}{$mem}
{t}Swap usage{/t}{$swap}
 
+
+   + + + + + + + + + + + + + + + + + +
{t}SSH service{/t}{$sshd}
{t}Print service{/t}{$cupsd}
{t}Scan service{/t}{$saned}
{t}Sound service{/t}{$artsd}
{t}GUI{/t}{$X}
+
+{/if} + diff --git a/gosa-core/plugins/admin/systems/goto/printer.tpl b/gosa-core/plugins/admin/systems/goto/printer.tpl new file mode 100644 index 000000000..e4ba965b9 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/printer.tpl @@ -0,0 +1,150 @@ + + + + + +
+{if $StandAlone } +

{t}General{/t}

+ + + + + + + + + + + + + + + + +
{$must} +{render acl=$cnACL} + +{/render} +
+{render acl=$descriptionACL} + +{/render} +
 
{$must} +{render acl=$baseACL} + +{/render} +{render acl=$baseACL disable_picture='images/folder_gray.png'} + +{/render} +
+
+{/if} +

{t}Details{/t}

+ + + + + + + + + +
+{render acl=$lACL} + +{/render} +
{$must} +{render acl=$labeledURIACL} + +{/render} +
+ + + + +
+
+ {t}Driver{/t}: {$driverInfo}  +{render acl=$gotoPrinterPPDACL mode=read_active} + +{/render} +{render acl=$gotoPrinterPPDACL} + +{/render} +
+
+ +

 

+ +

{t}Permissions{/t}

+ + + + + +
+ + + + +
+ {t}Users which are allowed to use this printer{/t}
+{render acl=$gotoUserPrinterACL} +
+{/render} +{render acl=$gotoUserPrinterACL} + +{/render} +{render acl=$gotoUserPrinterACL} + +{/render} +{render acl=$gotoUserPrinterACL} + +{/render} +
+ +
+ + + + +
+ {t}Users which are allowed to administrate this printer{/t}
+{render acl=$gotoUserPrinterACL} +
+{/render} +{render acl=$gotoUserPrinterACL} + +{/render} +{render acl=$gotoUserPrinterACL} + +{/render} +{render acl=$gotoUserPrinterACL} + +{/render} + +
+ +
+ + +{if $netconfig ne ''} +

 

+{$netconfig} +{/if} + + + diff --git a/gosa-core/plugins/admin/systems/goto/scanner-list b/gosa-core/plugins/admin/systems/goto/scanner-list new file mode 100644 index 000000000..3ebf2a102 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/scanner-list @@ -0,0 +1,533 @@ +abaton "Abaton" "Scan 300/GS" "SCSI" +abaton "Abaton" "Scan 300/S" "SCSI" +agfafocus "AGFA" "Focus GS Scanner" "SCSI" +agfafocus "AGFA" "Focus Lineart Scanner" "SCSI" +agfafocus "AGFA" "Focus II" "SCSI" +agfafocus "AGFA" "Focus Color" "SCSI" +agfafocus "AGFA" "Focus Color Plus" "SCSI" +agfafocus "Siemens" "S9036" "SCSI" +apple "Apple" "Apple Scanner" "SCSI" +apple "Apple" "OneScanner" "SCSI" +apple "Apple" "ColorOneScanner" "SCSI" +artec "Artec/Ultima" "AT3" "SCSI" +artec "Artec/Ultima" "A6000C" "SCSI" +artec "Artec/Ultima" "A6000C PLUS" "SCSI" +artec "Artec/Ultima" "AT6" "SCSI" +artec "Artec/Ultima" "AT12" "SCSI" +artec "Artec/Ultima" "AM12S" "SCSI" +artec "BlackWidow" "BW4800SP" "SCSI" +artec "Plustek" "OpticPro 19200S" "SCSI" +artec_eplus48u "Artec" "E+ 48U" "USB" +artec_eplus48u "Tevion" "MD9693" "USB" +artec_eplus48u "Medion" "MD9693" "USB" +artec_eplus48u "Medion" "MD9705" "USB" +artec_eplus48u "Medion" "MD4394" "USB" +artec_eplus48u "Trust" "Easy Webscan 19200" "USB" +artec_eplus48u "Memorex" "Mem 48 u" "USB" +as6e "Artec/Ultima" "AS6E" "Parport" +avision "Avision" "AV100CS" "SCSI" +avision "Avision" "AV100IIICS" "SCSI" +avision "Avision" "AV100S" "SCSI" +avision "Avision" "AV240SC" "SCSI" +avision "Avision" "AV260CS" "SCSI" +avision "Avision" "AV360CS" "SCSI" +avision "Avision" "AV363CS" "SCSI" +avision "Avision" "AV420CS" "SCSI" +avision "Avision" "AV6120" "SCSI" +avision "Avision" "AV620CS" "SCSI" +avision "Avision" "AV620CS Plus" "SCSI" +avision "Avision" "AV630CS" "SCSI" +avision "Avision" "AV630CSL" "SCSI" +avision "Avision" "AV6240" "SCSI" +avision "Avision" "AV600U" "USB" +avision "Avision" "AV660S" "USB" +avision "Avision" "AV680S" "USB" +avision "Avision" "AV690U" "USB" +avision "Avision" "AV800S" "SCSI" +avision "Avision" "AV810C" "SCSI" +avision "Avision" "AV820" "SCSI" +avision "Avision" "AV820C" "SCSI" +avision "Avision" "AV820C Plus" "SCSI" +avision "Avision" "AV830C" "SCSI" +avision "Avision" "AV830C Plus" "SCSI" +avision "Avision" "AV880" "SCSI" +avision "Avision" "AV880C" "SCSI" +avision "Avision" "AV8000S" "SCSI" +avision "Avision" "AVA3" "SCSI" +avision "Hewlett-Packard" "ScanJet 5300C" "USB" +avision "Hewlett-Packard" "ScanJet 5370C" "USB" +avision "Hewlett-Packard" "ScanJet 7400c" "USB" +avision "Minolta" "FS-V1" "USB" +avision "Mitsubishi" "MCA-ADFC" "SCSI" +avision "Mitsubishi" "S1200C" "SCSI" +avision "Mitsubishi" "S600C" "SCSI" +avision "Mitsubishi" "SS600" "SCSI" +avision "Fujitsu" "ScanPartner" "SCSI" +avision "Fujitsu" "ScanPartner 10" "SCSI" +avision "Fujitsu" "ScanPartner 10C" "SCSI" +avision "Fujitsu" "ScanPartner 15C" "SCSI" +avision "Fujitsu" "ScanPartner 300C" "SCSI" +avision "Fujitsu" "ScanPartner 600C" "SCSI" +avision "Fujitsu" "ScanPartner Jr" "SCSI" +bh "Bell and Howell" "COPISCAN II 6338" "SCSI" +bh "Bell and Howell" "COPISCAN II 2135" "SCSI" +bh "Bell and Howell" "COPISCAN II 2137(A)" "SCSI" +bh "Bell and Howell" "COPISCAN II 2138A" "SCSI" +bh "Bell and Howell" "COPISCAN II 3238" "SCSI" +bh "Bell and Howell" "COPISCAN II 3338(A)" "SCSI" +canon "Canon" "CanoScan 300" "SCSI" +canon "Canon" "CanoScan 600" "SCSI" +canon "Canon" "CanoScan 620S" "SCSI" +canon "Canon" "CanoScan 2700F" "SCSI" +canon "Canon" "CanoScan 2710" "SCSI" +canon630u "Canon" "CanoScan fb630u" "USB" +canon630u "Canon" "CanoScan fb636u" "USB" +canon_pp "Canon" "CanoScan FB310P" "Parport (ECP)" +canon_pp "Canon" "CanoScan FB610P" "Parport (ECP)" +canon_pp "Canon" "CanoScan FB320P" "Parport (ECP)" +canon_pp "Canon" "CanoScan FB620P" "Parport (ECP)" +canon_pp "Canon" "CanoScan FB330P" "Parport (ECP)" +canon_pp "Canon" "CanoScan FB630P" "Parport (ECP)" +canon_pp "Canon" "CanoScan N340P" "Parport (ECP)" +canon_pp "Canon" "CanoScan N640P" "Parport (ECP)" +canon_pp "Canon" "CanoScan N640P ex" "Parport (ECP)" +coolscan "Nikon" "LS-20" "SCSI" +coolscan "Nikon" "LS-30" "SCSI" +coolscan "Nikon" "LS-2000" "SCSI" +coolscan "Nikon" "LS-1000" "SCSI" +coolscan2 "Nikon" "LS 30" "SCSI" +coolscan2 "Nikon" "LS 2000" "SCSI" +coolscan2 "Nikon" "LS 40 ED" "USB" +coolscan2 "Nikon" "LS 4000 ED" "IEEE1394" +coolscan2 "Nikon" "LS 8000 ED" "IEEE1394" +dc210 "Kodak" "DC210" "Serial port" +dc240 "Kodak" "DC240" "Serial port" +dc25 "Kodak" "DC25" "Serial port" +dc25 "Kodak" "DC20" "Serial port" +dmc "Polaroid" "DMC" "SCSI" +epson "Epson" "GT-5000" "Parport" +epson "Epson" "Actionscanner II" "Parport" +epson "Epson" "GT-6000" "SCSI Parport" +epson "Epson" "ES-300C" "SCSI Parport" +epson "Epson" "GT-5500" "SCSI" +epson "Epson" "GT-6500" "Parport" +epson "Epson" "ES-600C" "Parport" +epson "Epson" "ES-1200C" "Parport" +epson "Epson" "GT-7000" "SCSI" +epson "Epson" "GT-8000" "SCSI" +epson "Epson" "ES-8500" "SCSI" +epson "Epson" "Perfection 636S" "SCSI" +epson "Epson" "Perfection 636U" "USB" +epson "Epson" "Perfection 610" "USB" +epson "Epson" "Perfection 640" "USB" +epson "Epson" "Perfection 1200S" "SCSI" +epson "Epson" "Perfection 1200U" "USB" +epson "Epson" "Perfection 1200Photo" "USB" +epson "Epson" "Perfection 1240" "SCSI USB" +epson "Epson" "Perfection 1640" "SCSI USB" +epson "Epson" "Perfection 1650" "USB" +epson "Epson" "Perfection 1660" "USB" +epson "Epson" "Perfection 2400" "USB" +epson "Epson" "Perfection 2450" "USB IEEE-1394" +epson "Epson" "Perfection 3200" "USB" +epson "Epson" "Expression 636" "SCSI" +epson "Epson" "Expression 800" "SCSI" +epson "Epson" "Expression 1600" "SCSI USB IEEE-1394" +epson "Epson" "Expression 1680" "SCSI USB IEEE-1394" +epson "Epson" "FilmScan 200" "SCSI" +epson "Epson" "CX-3200" "USB" +epson "Epson" "CX-5200" "USB" +fujitsu "Fujitsu" "M3096G" "SCSI" +fujitsu "Fujitsu" "M3091DCd" "SCSI" +fujitsu "Fujitsu" "M3092DCd" "SCSI" +fujitsu "Fujitsu" "M3093GXim" "SCSI" +fujitsu "Fujitsu" "M3093GDim" "SCSI" +fujitsu "Fujitsu" "M4097" "SCSI" +fujitsu "Fujitsu" "fi-4340C" "SCSI" +gt68xx "Mustek" "BearPaw 1200 CS" "USB" +gt68xx "Mustek" "BearPaw 1200 CU" "USB" +gt68xx "Mustek" "BearPaw 1200 CU Plus" "USB" +gt68xx "Mustek" "BearPaw 1200 TA" "USB" +gt68xx "Mustek" "BearPaw 2400 CS" "USB" +gt68xx "Mustek" "BearPaw 2400 CS Plus" "USB" +gt68xx "Mustek" "BearPaw 2400 CU" "USB" +gt68xx "Mustek" "BearPaw 2400 CU Plus" "USB" +gt68xx "Mustek" "BearPaw 2400 TA" "USB" +gt68xx "Mustek" "BearPaw 2400 TA Plus" "USB" +gt68xx "Mustek" "ScanExpress 1200 UB Plus" "USB" +gt68xx "Mustek" "ScanExpress A3 USB" "USB" +gt68xx "Mustek" "ScanExpress 2400 USB" "USB" +gt68xx "Plustek" "OpticPro 1248U" "USB" +gt68xx "Plustek" "OpticPro UT16B" "USB" +gt68xx "Artec" "Ultima 2000" "USB" +gt68xx "Artec" "Ultima 2000 e+" "USB" +gt68xx "Boeder" "Sm@rtScan Slim Edition" "USB" +gt68xx "Packard Bell" "Diamond 1200" "USB" +gt68xx "Medion/Lifetec/Tevion/Cytron" "LT 9452" "USB" +gt68xx "Medion/Lifetec/Tevion/Cytron" "MD/LT 9375" "USB" +gt68xx "Medion/Lifetec/Tevion/Cytron" "MD/LT 9385" "USB" +gt68xx "Medion/Lifetec/Tevion/Cytron" "MD 9458" "USB" +gt68xx "Trust" "Flat Scan USB 19200" "USB" +gt68xx "Trust" "Compact Scan USB 19200" "USB" +gt68xx "Lexmark" "X70" "USB" +gt68xx "Lexmark" "X73" "USB" +gt68xx "Genius" "Colorpage Vivid3x" "USB" +hp "Hewlett-Packard" "ScanJet Plus" "Propietary" +hp "Hewlett-Packard" "ScanJet IIc" "SCSI" +hp "Hewlett-Packard" "ScanJet IIp" "SCSI" +hp "Hewlett-Packard" "ScanJet IIcx" "SCSI" +hp "Hewlett-Packard" "ScanJet 3c" "SCSI" +hp "Hewlett-Packard" "ScanJet 3p" "SCSI" +hp "Hewlett-Packard" "ScanJet 4c" "SCSI" +hp "Hewlett-Packard" "ScanJet 4p" "SCSI" +hp "Hewlett-Packard" "ScanJet 4100C" "USB" +hp "Hewlett-Packard" "ScanJet 5p" "SCSI" +hp "Hewlett-Packard" "ScanJet 5100C" "Parport" +hp "Hewlett-Packard" "ScanJet 5200C" "Parport USB" +hp "Hewlett-Packard" "ScanJet 6100C" "SCSI" +hp "Hewlett-Packard" "ScanJet 6200C" "SCSI USB" +hp "Hewlett-Packard" "ScanJet 6250C" "SCSI USB" +hp "Hewlett-Packard" "ScanJet 6300C" "SCSI USB" +hp "Hewlett-Packard" "ScanJet 6350C" "SCSI USB" +hp "Hewlett-Packard" "ScanJet 6390C" "SCSI USB" +hp "Hewlett-Packard" "PhotoSmart PhotoScanner" "SCSI" +hpsj5s "Hewlett-Packard" "ScanJet 5s" "Parport (EPP)" +leo "LEO" "LEOScan S3" "SCSI" +leo "Across Technologies" "FS-1130" "SCSI" +leo "Genius" "FS-1130 Colorpage Scanner" "SCSI" +matsushita "Panasonic" "KV-SS25" "SCSI" +matsushita "Panasonic" "KV-SS25D" "SCSI" +matsushita "Panasonic" "KV-SS50" "SCSI" +matsushita "Panasonic" "KV-SS55" "SCSI" +matsushita "Panasonic" "KV-SS50EX" "SCSI" +matsushita "Panasonic" "KV-SS55EX" "SCSI" +matsushita "Panasonic" "KV-SS850" "SCSI" +matsushita "Panasonic" "KV-SS855" "SCSI" +microtek "Microtek" "Scanmaker E6" "SCSI" +microtek "Microtek" "Scanmaker E3" "SCSI" +microtek "Microtek" "Scanmaker E2" "SCSI" +microtek "Microtek" "Scanmaker 35t+" "SCSI" +microtek "Microtek" "Scanmaker 45t" "SCSI" +microtek "Microtek" "Scanmaker 35" "SCSI" +microtek "Microtek" "Scanmaker III" "SCSI" +microtek "Microtek" "Scanmaker IISP" "SCSI" +microtek "Microtek" "Scanmaker IIHR" "SCSI" +microtek "Microtek" "Scanmaker IIG" "SCSI" +microtek "Microtek" "Scanmaker II" "SCSI" +microtek "Microtek" "Scanmaker 600Z(S)" "SCSI" +microtek "Microtek" "Scanmaker 600G(S)" "SCSI" +microtek "Microtek" "Color PageWiz" "SCSI (Parport)" +microtek "Agfa" "Arcus II" "SCSI" +microtek "Agfa" "StudioScan" "SCSI" +microtek "Agfa" "StudioScan II" "SCSI" +microtek "Agfa" "StudioScan IIsi" "SCSI" +microtek "Agfa" "DuoScan" "SCSI" +microtek2 "Microtek" "ScanMaker E3plus" "Parport" +microtek2 "Microtek" "ScanMaker E3plus" "SCSI" +microtek2 "Microtek" "ScanMaker X6" "SCSI" +microtek2 "Microtek" "ScanMaker X6EL" "SCSI" +microtek2 "Microtek" "ScanMaker X6USB" "USB" +microtek2 "Microtek" "ScanMaker V300" "SCSI" +microtek2 "Microtek" "ScanMaker V300" "Parport" +microtek2 "Microtek" "ScanMaker V310" "SCSI" +microtek2 "Microtek" "ScanMaker V310" "Parport" +microtek2 "Microtek" "ScanMaker V600" "SCSI" +microtek2 "Microtek" "ScanMaker V600" "Parport" +microtek2 "Microtek" "ScanMaker 330" "SCSI" +microtek2 "Microtek" "ScanMaker 630" "SCSI" +microtek2 "Microtek" "ScanMaker 636" "SCSI" +microtek2 "Microtek" "ScanMaker 9600XL" "SCSI" +microtek2 "Microtek" "ScanMaker 9600XL" "SCSI" +microtek2 "Microtek" "Phantom 330CX" "Parport" +microtek2 "Microtek" "SlimScan C3" "Parport" +microtek2 "Microtek" "Phantom 636" "SCSI" +microtek2 "Microtek" "Phantom 636CX" "Parport" +microtek2 "Microtek" "SlimScan C6" "USB" +microtek2 "Microtek" "ScanMaker V6USL" "SCSI" +microtek2 "Microtek" "ScanMaker V6USL" "USB" +microtek2 "Microtek" "ScanMaker X12USL" "SCSI" +microtek2 "Vobis" "HighScan" "SCSI" +microtek2 "Scanport" "SQ300" "Parport?" +microtek2 "Scanport" "SQ2030" "Parport" +microtek2 "Scanport" "SQ4836" "SCSI" +mustek "Mustek" "Paragon MFS-6000CX" "SCSI" +mustek "Mustek" "Paragon MFS-12000CX" "SCSI" +mustek "Mustek" "Paragon MFC-600S" "SCSI" +mustek "Mustek" "Paragon 600 II CD" "SCSI" +mustek "Mustek" "ScanMagic 600 II SP" "SCSI" +mustek "Mustek" "Paragon MFC-800S" "SCSI" +mustek "Mustek" "Paragon 800 II SP" "SCSI" +mustek "Mustek" "Paragon MFS-6000SP" "SCSI" +mustek "Mustek" "Paragon MFS-8000SP" "SCSI" +mustek "Mustek" "Paragon MFS-1200SP" "SCSI" +mustek "Mustek" "Paragon MFS-12000SP" "SCSI" +mustek "Mustek" "ScanExpress 6000SP" "SCSI" +mustek "Mustek" "ScanExpress 12000SP" "SCSI" +mustek "Mustek" "ScanExpress 12000SP Plus" "SCSI" +mustek "Mustek" "Paragon 1200 III SP" "SCSI" +mustek "Mustek" "Paragon 1200 LS" "SCSI" +mustek "Mustek" "ScanMagic 9636S" "SCSI" +mustek "Mustek" "ScanMagic 9636S Plus" "SCSI" +mustek "Mustek" "ScanExpress A3 SP" "SCSI" +mustek "Mustek" "Paragon 1200 SP Pro" "SCSI" +mustek "Mustek" "Paragon 1200 A3 Pro" "SCSI" +mustek "Mustek" "Paragon 600 II N" "Proprietary" +mustek "Trust" "Imagery 1200" "SCSI" +mustek "Trust" "Imagery 1200 SP" "SCSI" +mustek "Trust" "Imagery 4800 SP" "SCSI" +mustek "Trust" "SCSI Connect 19200" "SCSI" +mustek "Trust" "SCSI excellence series 19200" "SCSI" +mustek "Primax" "Compact 4800 SCSI" "SCSI" +mustek_pp "Mustek" "ScanExpress 6000 P" "Parport (EPP)" +mustek_pp "Mustek" "ScanExpress 600 SEP" "Parport (EPP)" +mustek_pp "Mustek" "ScanMagic 4800 P" "Parport (EPP)" +mustek_pp "Mustek" "600 III EP Plus" "Parport (EPP)" +mustek_pp "Mustek" "ScanExpress 600 CP" "Parport (EPP)" +mustek_pp "Mustek" "ScanMagic 600 CP" "Parport (EPP)" +mustek_pp "Mustek" "1200 CP" "Parport (EPP)" +mustek_pp "Mustek" "1200 CP+" "Parport (EPP)" +mustek_pp "Medion/Tevion/LifeTec" "MD 9848" "Parport (EPP)" +mustek_pp "Medion/Tevion/LifeTec" "MD/LT 935x" "Parport (EPP)" +mustek_pp "Medion/Tevion/LifeTec" "MD/LT 985x" "Parport (EPP)" +mustek_pp "Medion/Tevion/LifeTec" "MD/LT 9890" "Parport (EPP)" +mustek_pp "Targa" "Funline TS12 EP" "Parport (EPP)" +mustek_pp "Targa" "Funline TS6 EP" "Parport (EPP)" +mustek_pp "Trust Easy Connect" "9600+" "Parport (EPP)" +mustek_pp "Viviscan" "Compact II" "Parport (EPP)" +mustek_pp "Cybercom" "9352" "Parport (EPP)" +mustek_pp "Gallery" "4800" "Parport (EPP)" +mustek_usb "Mustek" "ScanExpress 600 CU" "USB" +mustek_usb "Mustek" "ScanExpress 1200 CU" "USB" +mustek_usb "Mustek" "ScanExpress 1200 CU Plus" "USB" +mustek_usb "Mustek" "ScanExpress 1200 UB" "USB" +mustek_usb "Trust" "Compact Scan USB 19200" "USB" +nec "NEC" "PC-IN500/4C" "SCSI" +pie "Devcom" "9636PRO" "SCSI" +pie "Devcom" "9636S" "SCSI" +pie "Devcom" "9630S" "SCSI" +pie "PIE" "ScanAce 1236S" "SCSI" +pie "PIE" "ScanAce 1230S" "SCSI" +pie "PIE" "ScanAce II" "SCSI" +pie "PIE" "ScanAce III" "SCSI" +pie "PIE" "ScanAce Plus" "SCSI" +pie "PIE" "ScanAce II Plus" "SCSI" +pie "PIE" "ScanAce III Plus" "SCSI" +pie "PIE" "ScanAce V" "SCSI" +pie "PIE" "ScanAce ScanMedia" "SCSI" +pie "PIE" "ScanAce ScanMedia II" "SCSI" +pie "PIE" "ScanAce 630S" "SCSI" +pie "PIE" "ScanAce 636S" "SCSI" +pie "Adlib" "JetScan630" "SCSI" +pie "Adlib" "JetScan636PRO" "SCSI" +plustek "Plustek" "OpticPro 4800P" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro 4830P" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro 600P/6000P" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro 4831P" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro 9630P" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro 9630PL" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro 9600P" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro 1236P" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro 12000P/96000P" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro 9636P" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro 9636P+/Turbo" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro 9636T" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro 12000T" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro AI3" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro P8" "Parport" +plustek "Plustek" "OpticPro P12" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro PT12" "Parport (SPP, EPP)" +plustek "Plustek" "OpticPro U12" "USB" +plustek "Plustek" "OpticPro UT12" "USB" +plustek "Plustek" "OpticPro UT16" "USB" +plustek "Plustek" "OpticPro U24" "USB" +plustek "Plustek" "OpticPro UT24" "USB" +plustek "Plustek" "OpticPro 19200S" "SCSI" +plustek "Primax" "Colorado 4800" "Parport (SPP, EPP)" +plustek "Primax" "Compact 4800 Direct" "Parport (SPP, EPP)" +plustek "Primax" "Compact 4800 Direct-30" "Parport (SPP, EPP)" +plustek "Primax" "Compact 9600 Direct-30" "Parport (SPP, EPP)" +plustek "Genius" "Colorpage Vivid III V2" "Parport (SPP, EPP)" +plustek "Genius" "Colorpage Vivid Pro II Film" "Parport (SPP, EPP)" +plustek "Genius" "Colorpage HR6 V2" "USB" +plustek "Genius" "Colorpage HR7" "USB" +plustek "Genius" "Colorpage HR6A" "USB" +plustek "Genius" "Colorpage HR7LE" "USB" +plustek "Genius" "Colorpage HR6X" "USB" +plustek "Aries" "Scan-It Pro 4800" "Parport (SPP, EPP)" +plustek "BrightScan" "BrighScan OpticPro" "Parport (SPP, EPP)" +plustek "Mustek" "BearPaw 1200" "USB" +plustek "Mustek" "BearPaw 2400" "USB" +plustek "Hewlett-Packard" "ScanJet 2100C" "USB" +plustek "Hewlett-Packard" "ScanJet 2200C" "USB" +plustek "Epson" "Perfection 1250" "USB" +plustek "Epson" "Perfection 1250Photo" "USB" +plustek "Epson" "Perfection 1260" "USB" +plustek "Epson" "Perfection 1260Photo" "USB" +plustek "Umax" "UMAX 3400" "USB" +plustek "Umax" "UMAX 5400" "USB" +plustek "Canon" "CanoScan N650U/N656U" "USB" +plustek "Canon" "CanoScan N1220U" "USB" +plustek "Canon" "CanoScan N670U/N676U" "USB" +plustek "Canon" "CanoScan N1240U" "USB" +plustek "Canon" "CanoScan LiDE20" "USB" +plustek "Canon" "CanoScan LiDE30" "USB" +qcam "Connectix" "Color QuickCam" "Parport" +qcam "Connectix" "Greyscale QuickCam" "Parport" +ricoh "Ricoh" "Ricoh IS50" "SCSI" +ricoh "Ricoh" "Ricoh IS60" "SCSI" +s9036 "Siemens" "9036 Flatbed scanner" "SCSI" +sceptre "Sceptre" "Vividscan S1200" "SCSI" +sceptre "Komodo" "S1200" "SCSI" +sharp "Sharp" "JX-610" "SCSI" +sharp "Sharp" "JX-250" "SCSI" +sharp "Sharp" "JX-320" "SCSI" +sharp "Sharp" "JX-325" "SCSI" +sharp "Sharp" "JX-330" "SCSI" +sharp "Sharp" "JX-350" "SCSI" +sm3600 "Microtek" "ScanMaker 3600" "USB" +sm3600 "Microtek" "ScanMaker 3700" "USB" +sm3600 "Microtek" "ScanMaker 3750" "USB" +SnapScan "AGFA" "SnapScan 300" "SCSI" +SnapScan "AGFA" "SnapScan 310" "SCSI" +SnapScan "AGFA" "SnapScan 600" "SCSI" +SnapScan "AGFA" "SnapScan 1236s" "SCSI" +SnapScan "AGFA" "SnapScan 1236u" "USB" +SnapScan "AGFA" "SnapScan 1212u" "USB" +SnapScan "AGFA" "SnapScan e10" "USB" +SnapScan "AGFA" "SnapScan e20" "USB" +SnapScan "AGFA" "SnapScan e25" "USB" +SnapScan "AGFA" "SnapScan e26" "USB" +SnapScan "AGFA" "SnapScan e40" "USB" +SnapScan "AGFA" "SnapScan e42" "USB" +SnapScan "AGFA" "SnapScan e50" "USB" +SnapScan "AGFA" "SnapScan e52" "USB" +SnapScan "AGFA" "SnapScan e60" "USB" +SnapScan "Benq" "300f" "SCSI" +SnapScan "Benq" "310s" "SCSI" +SnapScan "Benq" "610s" "SCSI" +SnapScan "Benq" "610plus" "SCSI" +SnapScan "Benq" "620s" "SCSI" +SnapScan "Benq" "310u" "USB" +SnapScan "Benq" "320u" "USB" +SnapScan "Benq" "340u" "USB" +SnapScan "Benq" "620u" "USB" +SnapScan "Benq" "640u" "USB" +SnapScan "Benq" "640bu" "USB" +SnapScan "Benq" "1240" "USB" +SnapScan "Benq" "3300" "USB" +SnapScan "Benq" "4300" "USB" +SnapScan "Benq" "5000" "USB" +SnapScan "Benq" "5300" "USB" +SnapScan "Guillemot / Hercules" "Maxi Scan A4 Deluxe (SCSI)" "SCSI" +SnapScan "Guillemot / Hercules" "Scan@home Touch 1248 (USB)" "USB" +SnapScan "Mitsubishi" "Diamondview 648UT" "USB" +SnapScan "Mitsubishi" "Diamondview 650U" "USB" +sp15c "Fujitsu" "SP15C" "SCSI" +st400 "Siemens" "ST400" "SCSI" +st400 "Siemens" "ST800" "SCSI" +tamarack "Tamarack" "Artiscan 6000C" "SCSI" +tamarack "Tamarack" "Artiscan 8000C" "SCSI" +tamarack "Tamarack" "Artiscan 12000C" "SCSI" +teco1 "Relisys" "RELI 2412" "SCSI" +teco1 "Relisys" "AVEC 2400" "SCSI" +teco1 "Relisys" "RELI 4830" "SCSI" +teco1 "Relisys" "AVEC 2412" "SCSI" +teco1 "Relisys" "AVEC 4800" "SCSI" +teco1 "Relisys" "AVEC 4816" "SCSI" +teco1 "Relisys" "RELI DS6" "SCSI" +teco1 "Relisys" "RELI DS15" "SCSI" +teco1 "Relisys" "RELI 2400" "SCSI" +teco1 "Relisys" "RELI 4816" "SCSI" +teco1 "Relisys" "RELI 9600" "SCSI" +teco1 "Relisys" "RELI 9612" "SCSI" +teco1 "Relisys" "RELI 9624" "SCSI" +teco1 "Relisys" "RELI 9630" "SCSI" +teco1 "Actown" "ACT Scan I 30" "SCSI" +teco1 "Dextra" "DF-600P" "SCSI" +teco1 "Dextra" "DF-1200T+" "SCSI" +teco1 "Dextra" "DF-4830T" "SCSI" +teco1 "Dextra" "DF-9624" "SCSI" +teco2 "Relisys" "AVEC Super 3" "SCSI" +teco2 "Relisys" "SCORPIO Super 3" "SCSI" +teco2 "Relisys" "APOLLO Express 6" "SCSI" +teco2 "Relisys" "SCORPIO Pro" "SCSI" +teco2 "Relisys" "SCORPIO Pro-S" "SCSI" +teco2 "Primax" "Profi 9600" "SCSI" +teco2 "Primax" "Profi 19200" "SCSI" +teco3 "Relisys" "Infinity Scorpio" "SCSI" +teco3 "Plustek" "OpticPro 2400SP" "SCSI" +teco3 "PIOTECH" "Splendeur 3024" "SCSI" +teco3 "Trust" "Imagery 2400 SP" "SCSI" +teco3 "Trust" "Imagery 4800 SP+" "SCSI" +teco3 "Trust" "Imagery 9600 SP" "SCSI" +umax "UMAX" "Vista S6" "SCSI" +umax "UMAX" "Vista S6E" "SCSI" +umax "UMAX" "UMAX S-6E" "SCSI" +umax "UMAX" "UMAX S-6EG" "SCSI" +umax "UMAX" "Vista-S8" "SCSI" +umax "UMAX" "Supervista S-12" "SCSI" +umax "UMAX" "UMAX S-12" "SCSI" +umax "UMAX" "UMAX S-12G" "SCSI" +umax "UMAX" "Astra 600S" "SCSI" +umax "UMAX" "Astra 610S" "SCSI" +umax "UMAX" "Astra 1200S" "SCSI" +umax "UMAX" "Astra 1220S" "SCSI" +umax "UMAX" "Astra 2100S" "SCSI" +umax "UMAX" "Astra 2200 (SU)" "SCSI" +umax "UMAX" "Astra 2200 (SU)" "USB" +umax "UMAX" "Astra 2400S" "SCSI" +umax "UMAX" "Astra 6400" "IEEE-1394" +umax "UMAX" "Astra 6450" "IEEE-1394" +umax "UMAX" "Astra MX3" "SCSI" +umax "UMAX" "Astra MX3" "USB" +umax "UMAX" "Mirage D-16L" "SCSI" +umax "UMAX" "Mirage II" "SCSI" +umax "UMAX" "Mirage IIse" "SCSI" +umax "UMAX" "PSD" "SCSI" +umax "UMAX" "PowerLook" "SCSI" +umax "UMAX" "PL-II" "SCSI" +umax "UMAX" "PowerLook III" "SCSI" +umax "UMAX" "PowerLook 270" "SCSI" +umax "UMAX" "PowerLook 270plus" "SCSI" +umax "UMAX" "PowerLook 1100" "IEEE-1394" +umax "UMAX" "PowerLook 2000" "SCSI" +umax "UMAX" "PowerLook 2100XL" "SCSI" +umax "UMAX" "PowerLook 3000" "SCSI" +umax "UMAX" "Gemini D-16" "SCSI" +umax "UMAX" "UMAX VT600" "SCSI" +umax "UMAX" "Vista-T630" "SCSI" +umax "UMAX" "UC 630" "SCSI" +umax "UMAX" "UG 630" "SCSI" +umax "UMAX" "UG 80" "SCSI" +umax "UMAX" "UC 840" "SCSI" +umax "UMAX" "UC 1200S" "SCSI" +umax "UMAX" "UC 1200SE" "SCSI" +umax "UMAX" "UC 1260" "SCSI" +umax "Linotype Hell" "Jade" "SCSI" +umax "Linotype Hell" "Jade" "SCSI" +umax "Linotype Hell" "Jade2" "SCSI" +umax "Linotype Hell" "Saphir" "SCSI" +umax "Linotype Hell" "Saphir2" "SCSI" +umax "Linotype Hell" "Saphir3" "SCSI" +umax "Linotype Hell" "Saphir Ultra" "SCSI" +umax "Linotype Hell" "Saphir Ultra II" "SCSI" +umax "Linotype Hell" "Saphir HiRes" "SCSI" +umax "Linotype Hell" "Opal" "SCSI" +umax "Linotype Hell" "Opal Ultra" "SCSI" +umax "Linotype Hell" "Linoscan 1400" "SCSI" +umax "Vobis" "Highscreen Scanboostar Premium" "SCSI" +umax "EDGE" "KTX-9600US" "SCSI" +umax "Epson" "Perfection 600" "SCSI" +umax "Escom" "Image Scanner 256" "SCSI" +umax "Escort" "Galleria 600" "SCSI" +umax "Genius" "ColorPage-HR5 (Pro)" "SCSI" +umax "Nikon" "AX-110 / Scantouch 110" "SCSI" +umax "Nikon" "AX-210" "SCSI" +umax1220u "UMAX" "Astra 1220U" "USB" +umax1220u "UMAX" "Astra 2000U" "USB" +umax1220u "UMAX" "Astra 2200U" "USB" +umax_pp "UMAX" "Astra 1220P" "Parport (EPP)" +umax_pp "UMAX" "Astra 2000P" "Parport (EPP)" +umax_pp "UMAX" "Astra 1600P" "Parport (EPP)" +umax_pp "UMAX" "Astra 610P" "Parport (EPP)" +umax_pp "Hewlett-Packard" "Scanjet 3200C" "Parport (EPP)" diff --git a/gosa-core/plugins/admin/systems/goto/selectUserToPrinterDialog.tpl b/gosa-core/plugins/admin/systems/goto/selectUserToPrinterDialog.tpl new file mode 100644 index 000000000..c60be2297 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/selectUserToPrinterDialog.tpl @@ -0,0 +1,70 @@ + + + + + + + +
+
+

+ +

+
+
+

+
+

+
+
+
+

[F]{t}Filters{/t}

+
+
+ + {$alphabet} +
+ + + + +
+  {t}Search in subtrees{/t} +
+ + + + + +
+ + + +
+ + + + + +
+ + + +
+ {$apply} +
+
+ +

 

+

+ + +

+ diff --git a/gosa-core/plugins/admin/systems/goto/tabs_printers.inc b/gosa-core/plugins/admin/systems/goto/tabs_printers.inc new file mode 100644 index 000000000..739777a7e --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/tabs_printers.inc @@ -0,0 +1,62 @@ +dn= $dn; + $this->config= $config; + + $baseobject= NULL; + + foreach ($data as $tab){ + $this->by_name[$tab['CLASS']]= $tab['NAME']; + + if ($baseobject === NULL){ + $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this); + $this->by_object[$tab['CLASS']]= $baseobject; + } else { + $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this); + } + + $this->by_object[$tab['CLASS']]->parent= &$this; + $this->by_object[$tab['CLASS']]->set_acl_category($category); + + /* Initialize current */ + if ($this->current == ""){ + $this->current= $tab['CLASS']; + } + } + + /* Add references/acls/snapshots */ + $this->addSpecialTabs(); + } + + function save_object($save_current= FALSE) + { + tabs::save_object($save_current); + } + + + function save($ignore_account= FALSE) + { + /* Check for new 'dn', in order to propagate the + 'dn' to all plugins */ + $baseobject= $this->by_object['printgeneric']; + $this->dn= "cn=$baseobject->cn,".get_ou('printerou').$baseobject->base; + $baseobject->dn= $this->dn; + + foreach ($this->by_object as $key => $obj){ + $this->by_object[$key]->dn= $this->dn; + } + + tabs::save(FALSE); + } + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/admin/systems/goto/tabs_terminal.inc b/gosa-core/plugins/admin/systems/goto/tabs_terminal.inc new file mode 100644 index 000000000..ea9207faf --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/tabs_terminal.inc @@ -0,0 +1,77 @@ +dn= $dn; + $this->config= $config; + + $baseobject= NULL; + + foreach ($data as $tab){ + $this->by_name[$tab['CLASS']]= $tab['NAME']; + + if ($baseobject === NULL){ + $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this); + $this->by_object[$tab['CLASS']]= $baseobject; + } else { + $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this); + } + + $this->by_object[$tab['CLASS']]->parent= &$this; + $this->by_object[$tab['CLASS']]->set_acl_category($category); + + /* Initialize current */ + if ($this->current == ""){ + $this->current= $tab['CLASS']; + } + } + + /* Add references/acls/snapshots */ + $this->addSpecialTabs(); + } + + function save_object($save_current= FALSE) + { + tabs::save_object($save_current); + + /* Update reference, transfer variables */ + if(isset($this->by_object['termstartup'])){ + $this->by_object['termstartup']->gotoTerminalPath= $this->by_object['termgeneric']->gotoTerminalPath; + } + + $base_obj = $this->by_object['termgeneric']; + foreach($this->by_object as $name => $plug){ + $this->by_object[$name]->cn = $base_obj->cn; + } + } + + + function save($ignore_account= FALSE) + { + /* Check for new 'dn', in order to propagate the + 'dn' to all plugins */ + $baseobject= $this->by_object['termgeneric']; + $this->dn= "cn=".$baseobject->cn.",".get_ou('terminalou').$baseobject->base; + $baseobject->dn= $this->dn; + + foreach ($this->by_object as $key => $obj){ + $this->by_object[$key]->dn= $this->dn; + $this->by_object[$key]->cn= $baseobject->cn; + } + + tabs::save(TRUE); + if(isset($this->by_object['printgeneric'])){ + if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){ + $this->by_object['printgeneric']->remove_from_parent(); + } + } + } + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/admin/systems/goto/tabs_workstation.inc b/gosa-core/plugins/admin/systems/goto/tabs_workstation.inc new file mode 100644 index 000000000..3d6bac27c --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/tabs_workstation.inc @@ -0,0 +1,75 @@ +dn= $dn; + $this->config= $config; + + $baseobject= NULL; + + foreach ($data as $tab){ + $this->by_name[$tab['CLASS']]= $tab['NAME']; + + if ($baseobject === NULL){ + $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this); + $this->by_object[$tab['CLASS']]= $baseobject; + } else { + $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this); + } + + $this->by_object[$tab['CLASS']]->parent= &$this; + $this->by_object[$tab['CLASS']]->set_acl_category($category); + + /* Initialize current */ + if ($this->current == ""){ + $this->current= $tab['CLASS']; + } + } + + /* Add references/acls/snapshots */ + $this->addSpecialTabs(); + } + + function save_object($save_current= FALSE) + { + tabs::save_object($save_current); + + /* Assign current cn */ + $baseobject= $this->by_object['workgeneric']; + foreach ($this->by_object as $key => $obj){ + $this->by_object[$key]->cn= $baseobject->cn; + } + } + + + function save($ignore_account= FALSE) + { + /* Check for new 'dn', in order to propagate the + 'dn' to all plugins */ + $baseobject= $this->by_object['workgeneric']; + $this->dn= "cn=".$baseobject->cn.",".get_ou('workstationou').$baseobject->base; + $baseobject->dn= $this->dn; + + foreach ($this->by_object as $key => $obj){ + $this->by_object[$key]->dn= $this->dn; + $this->by_object[$key]->cn= $baseobject->cn; + } + + tabs::save(TRUE); + + if(isset($this->by_object['printgeneric'])){ + if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){ + $this->by_object['printgeneric']->remove_from_parent(); + } + } + } + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/admin/systems/goto/terminal.tpl b/gosa-core/plugins/admin/systems/goto/terminal.tpl new file mode 100644 index 000000000..dc088f867 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/terminal.tpl @@ -0,0 +1,176 @@ +

{t}Properties{/t}

+ + + + + +
+ + + {if $cn eq 'default'} + + {else} + + + {/if} + + + + + +
{t}Terminal template{/t}{$must} +{render acl=$cnACL} + +{/render} +
{$must} + +{render acl=$baseACL} + +{/render} +{render acl=$baseACL disable_picture='images/folder_gray.png'} + +{/render} +
+{if $member_of_ogroup} +
+
+
+ +{/if} +
+ + + + + + + + + +
+{render acl=$gotoModeACL} + +{/render} +
+{render acl=$gotoSyslogServerACL} + +{/render} +
+
+

 

+ + + + + +
+ + + + + + + + + +
+{render acl=$gotoTerminalPathACL} + +{/render} +
+{render acl=$gotoSwapServerACL} + +{/render} +
+
+ + + + + + + +
+{if $member_of_ogroup} +{render acl=$gotoNtpServerACL} + {t}Inherit time server attributes{/t} +{/render} +{else} + {t}Inherit time server attributes{/t} +{/if} +

+{render acl=$gotoNtpServerACL} + +{/render} +
+{render acl=$gotoNtpServerACL} + +{/render} +{render acl=$gotoNtpServerACL} + +{/render} +{render acl=$gotoNtpServerACL} + +{/render} +
+ +
+ +{if $cn neq 'default'} +

 

+ +{$netconfig} +{/if} + +{if $fai_activated} +

 

+

{t}Action{/t}

+ + + + + +
+{render acl=$gotoNtpServerACL} + +{/render} + +{render acl=$gotoNtpServerACL} + +{/render} +
+{/if} + + + + diff --git a/gosa-core/plugins/admin/systems/goto/terminalService.tpl b/gosa-core/plugins/admin/systems/goto/terminalService.tpl new file mode 100644 index 000000000..72ba28b1a --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/terminalService.tpl @@ -0,0 +1,269 @@ + + + + + + + + + + + + +
+

{t}Keyboard{/t}

+ + + + + + + + + + + + + +
+{render acl=$gotoXKbModelACL} + +{/render} +
+{render acl=$gotoXKbLayoutACL} + +{/render} +
+{render acl=$gotoXKbVariantACL} + +{/render} +
+ +
+   + +

{t}Mouse{/t}

+ + + + + + + + + +
+{render acl=$gotoXMouseTypeACL} + +{/render} +
+{render acl=$gotoXMouseportACL} + +{/render} +
+ +
+   + +

{t}Telephone hardware{/t}

+ + + + +
{t}Telephone{/t}  +{render acl=$goFonHardwareACL} + {$hardware_list} +{/render} +
+ +
+ + + + + + + + + + + + + +

+

{t}Graphic device{/t}

+ + + + + + + + + + + + + +
+{render acl=$gotoXDriverACL} + +{/render} +
+{render acl=$gotoXResolutionACL} + +{/render } +
+{render acl=$gotoXColordepthACL} + +{/render} +
+
+   + +

{t}Display device{/t}

+ + + + + + + + + + + + +{/render} + + + + +{/render} + +
{t}Type{/t}{$gotoXMonitor}
+{render acl=$AutoSyncACL} + +{/render} + {t}Use DDC for automatic detection{/t}
+{render acl=$gotoXHsyncACL} + kHz
+{render acl=$gotoXVsyncACL} + Hz
+ +
+   + +

{t}Remote desktop{/t}

+ + + + + + + + + + + + + + + + +
+{render acl=$gotoXMethodACL} + +{/render} +
+{render acl=$gotoXdmcpServerACL} + +{/render} +
+{render acl=$gotoFontPathACL} + +{/render} +
+ +
+ + + + + + + + + +

+

+{render acl=$gotoLpdEnableACL} + +{/render} + {t}Provide print services{/t} +
+ + + + + + + +
+{render acl=$gotoLpdServerACL} + +{/render} +
+ +
+   + +

{t}Scan device{/t}

+{render acl=$gotoScannerEnableACL} + +{/render} + {t}Provide scan services{/t} +
+ + + + + + +
+{render acl=$gotoScannerEnableACL} + +{/render} +
+ +
+ +
diff --git a/gosa-core/plugins/admin/systems/goto/terminalStartup.tpl b/gosa-core/plugins/admin/systems/goto/terminalStartup.tpl new file mode 100644 index 000000000..ccfacfbaa --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/terminalStartup.tpl @@ -0,0 +1,142 @@ +

{t}Boot parameters{/t}

+ + + + + + + + +
+ + + + + + + + + +{/render} + + + + +
+{render acl=$gotoBootKernelACL} + +{/render} +
+{render acl=$gotoKernelParametersACL} +
+{render acl=$gotoLdapServerACL} +( + {t}inherit from group{/t}) +{if !$JS} + +{/if} +{/render} +{render acl=$gotoLdapServerACL_inherit} + {$gotoLdapServers} +{/render} +{render acl=$gotoLdapServerACL_inherit} + +{/render} +{render acl=$gotoLdapServerACL_inherit} + +{/render} +
+ +
+   + +{render acl=$gotoKernelParametersACL} + +{/render} + {t}use graphical bootup{/t} +
+{render acl=$gotoKernelParametersACL} + +{/render} + {t}use standard linux textual bootup{/t} +
+{render acl=$gotoKernelParametersACL} + +{/render} + {t}use debug mode for startup{/t} +
+ + + + + + + + + +

+

+ {t}Kernel modules (format: name parameters){/t} +

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

 

+ + + + +
+{render acl=$gotoShareACL} + +{/render} +
+{render acl=$gotoShareACL} + +{/render} +{render acl=$gotoShareACL} + +{/render} +{render acl=$gotoShareACL} + +{/render} +{render acl=$gotoShareACL} + +{/render} +
+
+ + + + diff --git a/gosa-core/plugins/admin/systems/goto/workstation.tpl b/gosa-core/plugins/admin/systems/goto/workstation.tpl new file mode 100644 index 000000000..ba8489947 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/workstation.tpl @@ -0,0 +1,157 @@ +

{t}Properties{/t}

+ + + + + +
+ + +{if $cn eq 'wdefault'} + +{else} + + +{/if} + + + + + + + + + +
{t}Workstation template{/t}{$must} +{render acl=$cnACL} + +{/render} +
+{render acl=$lACL} + +{/render} +
{$must} +{render acl=$baseACL} + +{/render} +{render acl=$baseACL disable_picture='images/folder_gray.png'} + +{/render} +
+{if $member_of_ogroup} +
+
+
+ +{/if} +
+ + + + + + + + + +
{t}Mode{/t} +{render acl=$gotoModeACL} + +{/render} +
+{render acl=$gotoSyslogServerACL} + +{/render} +
+

 

+ + + + + + + +
+{if $member_of_ogroup} +{render acl=$gotoNtpServerACL} + {t}Inherit time server attributes{/t} +{/render} +{else} + {t}Inherit time server attributes{/t} +{/if} +

+{render acl=$gotoNtpServerACL} + +{/render} +
+{render acl=$gotoNtpServerACL} + +{/render} +{render acl=$gotoNtpServerACL} + +{/render} +{render acl=$gotoNtpServerACL} + +{/render} +
+
+{if $cn neq 'wdefault'} +

 

+ +{$netconfig} +{/if} +

 

+ +{if $fai_activated} +

{t}Action{/t}

+ + + + + +
+{render acl=$FAIstateACL} + +{/render} + + +
+{/if} + + {if $cn eq 'wdefault'} + + + {else} + + {/if} + diff --git a/gosa-core/plugins/admin/systems/goto/workstationService.tpl b/gosa-core/plugins/admin/systems/goto/workstationService.tpl new file mode 100644 index 000000000..e5171fe01 --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/workstationService.tpl @@ -0,0 +1,224 @@ + + + + + + + + + + + + +
+

{t}Keyboard{/t}

+ + + + + + + + + + + + + +
+ +{render acl=$gotoXKbModelACL} + +{/render} + +
+ +{render acl=$gotoXKbLayoutACL} + +{/render} + +
+ +{render acl=$gotoXKbVariantACL} + +{/render} + +
+ +
+   + +

{t}Mouse{/t}

+ + + + +{/render} + + + + + + +
+ +{render acl=$gotoXMouseTypeACL} + +
+ +{render acl=$gotoXMouseportACL} + +{/render} + +
+ +
+   + +

{t}Telephone hardware{/t}

+ + + + +
{t}Telephone{/t}  + +{render acl=$goFonHardwareACL} + {$hardware_list} +{/render} + +
+ +
+ + + + + + + + + + + + + +

+

{t}Graphic device{/t}

+ + + + + + + + + + + + + +
+ +{render acl=$gotoXDriverACL} + +{/render} + +
+ +{render acl=$gotoXResolutionACL} + +{/render} + +
+ +{render acl=$gotoXColordepthACL} + +{/render} + +
+
+   + +

{t}Display device{/t}

+ + + + + + + + + + + + + + + + + +
{t}Type{/t}{if $gotoXMonitor==""}{t}unknown{/t}{/if}{$gotoXMonitor}
+ +{render acl=$AutoSyncACL} + +{/render} + + {t}Use DDC for automatic detection{/t}
+ +{render acl=$gotoXHsyncACL} + kHz +{/render} + +
+ +{render acl=$gotoXVsyncACL} + Hz +{/render} + +
+ +
+   + + + +

{t}Scan device{/t}

+ +{render acl=$gotoScannerEnableACL} + +{/render} + + {t}Provide scan services{/t} +
+
+ + +
+ + + + + + diff --git a/gosa-core/plugins/admin/systems/goto/workstationStartup.tpl b/gosa-core/plugins/admin/systems/goto/workstationStartup.tpl new file mode 100644 index 000000000..0801a091b --- /dev/null +++ b/gosa-core/plugins/admin/systems/goto/workstationStartup.tpl @@ -0,0 +1,232 @@ + + + + + + + + +
+

{t}Boot parameters{/t}

+ + + + + + + + + + + + + +
+{render acl=$gotoBootKernelACL} + +{/render} +
+{render acl=$gotoKernelParametersACL} + +{/render} +
+{render acl=$gotoLdapServerACL} +{if $member_of_ogroup} +( + {t}inherit from group{/t}) +{if !$JS} + +{/if} +{/if} +{/render} +{render acl=$gotoLdapServerACL_inherit} + {$gotoLdapServers} +{/render} +{render acl=$gotoLdapServerACL_inherit} + +{/render} +{render acl=$gotoLdapServerACL_inherit} + +{/render} +
+ +
+   + + + {if $fai_activated} + + {if $FAIdebianMirror == "inherited"} + + + + + + + + + + +
+

 {t}FAI server{/t} +

+
+

 {t}Release{/t} +

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

+  {t}Assigned FAI classes{/t} +

+ {render acl=$FAIclassACL} + {$FAIScriptlist} + {/render} + {else} + + + + + + + + + + +
+

 {t}FAI server{/t} +

+
+

 {t}Release{/t} +

+
+ {render acl=$FAIdebianMirrorACL} + + {/render} + {if $javascript eq 'false'} + {render acl=$FAIdebianMirrorACL} + + {/render} + {/if} + + {render acl=$FAIreleaseACL} + + {/render} +
+

+  {t}Assigned FAI classes{/t} +

+ {render acl=$FAIclassACL} + {$FAIScriptlist} + {/render} + + {render acl=$FAIclassACL} + + {/render} + {render acl=$FAIclassACL} + + {/render} + + {/if} + + {else} + +

{t}FAI Object assignment disabled. You can't use this feature until FAI is activated.{/t}

+ + {/if} +
+ + + + + + + + + +

+

+ {t}Kernel modules (format: name parameters){/t} +

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

 

+ + + + +
+{render acl=$gotoShareACL} + +{/render} +
+{render acl=$gotoShareACL} + +{/render} +{render acl=$gotoShareACL} + +{/render} +{render acl=$gotoShareACL} + +{/render} +{render acl=$gotoShareACL} + +{/render} +
+
+ + + diff --git a/gosa-core/plugins/admin/systems/info.tpl b/gosa-core/plugins/admin/systems/info.tpl deleted file mode 100644 index e088c595a..000000000 --- a/gosa-core/plugins/admin/systems/info.tpl +++ /dev/null @@ -1,135 +0,0 @@ -

{t}System information{/t}

- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
{t}CPU{/t}{$ghCpuType}
{t}Memory{/t}{$ghMemSize}
{t}Boot MAC{/t}{$macAddress}
{t}USB support{/t}{$ghUsbSupport}
{t}System status{/t}{$status}
{t}Inventory number{/t}{$ghInventoryNumber}
{t}Last login{/t}{$gotoLastUser}
-
-   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{t}Network devices{/t} - {foreach item=netcard from=$ghNetNic} - {$netcard}
- {/foreach} -
{t}IDE devices{/t} - {foreach item=idedev from=$ghIdeDev} - {$idedev}
- {/foreach} -
{t}SCSI devices{/t} - {foreach item=scsidev from=$ghScsiDev} - {$scsidev}
- {/foreach} -
{t}Floppy device{/t}{$FloppyDevice}
{t}CDROM device{/t}{$CdromDevice}
{t}Graphic device{/t}{$ghGfxAdapter}
{t}Audio device{/t}{$ghSoundAdapter}
-
- -{if $active eq "true"} -
-

{t}System status{/t}

- - - - - - -
- - - - - - - - - - - - - - - - - {$partitions} -
{t}Up since{/t}{$uptime}
{t}CPU load{/t}{$load}
{t}Memory usage{/t}{$mem}
{t}Swap usage{/t}{$swap}
 
-
-   - - - - - - - - - - - - - - - - - -
{t}SSH service{/t}{$sshd}
{t}Print service{/t}{$cupsd}
{t}Scan service{/t}{$saned}
{t}Sound service{/t}{$artsd}
{t}GUI{/t}{$X}
-
-{/if} - diff --git a/gosa-core/plugins/admin/systems/printer.tpl b/gosa-core/plugins/admin/systems/printer.tpl deleted file mode 100644 index e4ba965b9..000000000 --- a/gosa-core/plugins/admin/systems/printer.tpl +++ /dev/null @@ -1,150 +0,0 @@ - - - - - -
-{if $StandAlone } -

{t}General{/t}

- - - - - - - - - - - - - - - - -
{$must} -{render acl=$cnACL} - -{/render} -
-{render acl=$descriptionACL} - -{/render} -
 
{$must} -{render acl=$baseACL} - -{/render} -{render acl=$baseACL disable_picture='images/folder_gray.png'} - -{/render} -
-
-{/if} -

{t}Details{/t}

- - - - - - - - - -
-{render acl=$lACL} - -{/render} -
{$must} -{render acl=$labeledURIACL} - -{/render} -
- - - - -
-
- {t}Driver{/t}: {$driverInfo}  -{render acl=$gotoPrinterPPDACL mode=read_active} - -{/render} -{render acl=$gotoPrinterPPDACL} - -{/render} -
-
- -

 

- -

{t}Permissions{/t}

- - - - - -
- - - - -
- {t}Users which are allowed to use this printer{/t}
-{render acl=$gotoUserPrinterACL} -
-{/render} -{render acl=$gotoUserPrinterACL} - -{/render} -{render acl=$gotoUserPrinterACL} - -{/render} -{render acl=$gotoUserPrinterACL} - -{/render} -
- -
- - - - -
- {t}Users which are allowed to administrate this printer{/t}
-{render acl=$gotoUserPrinterACL} -
-{/render} -{render acl=$gotoUserPrinterACL} - -{/render} -{render acl=$gotoUserPrinterACL} - -{/render} -{render acl=$gotoUserPrinterACL} - -{/render} - -
- -
- - -{if $netconfig ne ''} -

 

-{$netconfig} -{/if} - - - diff --git a/gosa-core/plugins/admin/systems/scanner-list b/gosa-core/plugins/admin/systems/scanner-list deleted file mode 100644 index 3ebf2a102..000000000 --- a/gosa-core/plugins/admin/systems/scanner-list +++ /dev/null @@ -1,533 +0,0 @@ -abaton "Abaton" "Scan 300/GS" "SCSI" -abaton "Abaton" "Scan 300/S" "SCSI" -agfafocus "AGFA" "Focus GS Scanner" "SCSI" -agfafocus "AGFA" "Focus Lineart Scanner" "SCSI" -agfafocus "AGFA" "Focus II" "SCSI" -agfafocus "AGFA" "Focus Color" "SCSI" -agfafocus "AGFA" "Focus Color Plus" "SCSI" -agfafocus "Siemens" "S9036" "SCSI" -apple "Apple" "Apple Scanner" "SCSI" -apple "Apple" "OneScanner" "SCSI" -apple "Apple" "ColorOneScanner" "SCSI" -artec "Artec/Ultima" "AT3" "SCSI" -artec "Artec/Ultima" "A6000C" "SCSI" -artec "Artec/Ultima" "A6000C PLUS" "SCSI" -artec "Artec/Ultima" "AT6" "SCSI" -artec "Artec/Ultima" "AT12" "SCSI" -artec "Artec/Ultima" "AM12S" "SCSI" -artec "BlackWidow" "BW4800SP" "SCSI" -artec "Plustek" "OpticPro 19200S" "SCSI" -artec_eplus48u "Artec" "E+ 48U" "USB" -artec_eplus48u "Tevion" "MD9693" "USB" -artec_eplus48u "Medion" "MD9693" "USB" -artec_eplus48u "Medion" "MD9705" "USB" -artec_eplus48u "Medion" "MD4394" "USB" -artec_eplus48u "Trust" "Easy Webscan 19200" "USB" -artec_eplus48u "Memorex" "Mem 48 u" "USB" -as6e "Artec/Ultima" "AS6E" "Parport" -avision "Avision" "AV100CS" "SCSI" -avision "Avision" "AV100IIICS" "SCSI" -avision "Avision" "AV100S" "SCSI" -avision "Avision" "AV240SC" "SCSI" -avision "Avision" "AV260CS" "SCSI" -avision "Avision" "AV360CS" "SCSI" -avision "Avision" "AV363CS" "SCSI" -avision "Avision" "AV420CS" "SCSI" -avision "Avision" "AV6120" "SCSI" -avision "Avision" "AV620CS" "SCSI" -avision "Avision" "AV620CS Plus" "SCSI" -avision "Avision" "AV630CS" "SCSI" -avision "Avision" "AV630CSL" "SCSI" -avision "Avision" "AV6240" "SCSI" -avision "Avision" "AV600U" "USB" -avision "Avision" "AV660S" "USB" -avision "Avision" "AV680S" "USB" -avision "Avision" "AV690U" "USB" -avision "Avision" "AV800S" "SCSI" -avision "Avision" "AV810C" "SCSI" -avision "Avision" "AV820" "SCSI" -avision "Avision" "AV820C" "SCSI" -avision "Avision" "AV820C Plus" "SCSI" -avision "Avision" "AV830C" "SCSI" -avision "Avision" "AV830C Plus" "SCSI" -avision "Avision" "AV880" "SCSI" -avision "Avision" "AV880C" "SCSI" -avision "Avision" "AV8000S" "SCSI" -avision "Avision" "AVA3" "SCSI" -avision "Hewlett-Packard" "ScanJet 5300C" "USB" -avision "Hewlett-Packard" "ScanJet 5370C" "USB" -avision "Hewlett-Packard" "ScanJet 7400c" "USB" -avision "Minolta" "FS-V1" "USB" -avision "Mitsubishi" "MCA-ADFC" "SCSI" -avision "Mitsubishi" "S1200C" "SCSI" -avision "Mitsubishi" "S600C" "SCSI" -avision "Mitsubishi" "SS600" "SCSI" -avision "Fujitsu" "ScanPartner" "SCSI" -avision "Fujitsu" "ScanPartner 10" "SCSI" -avision "Fujitsu" "ScanPartner 10C" "SCSI" -avision "Fujitsu" "ScanPartner 15C" "SCSI" -avision "Fujitsu" "ScanPartner 300C" "SCSI" -avision "Fujitsu" "ScanPartner 600C" "SCSI" -avision "Fujitsu" "ScanPartner Jr" "SCSI" -bh "Bell and Howell" "COPISCAN II 6338" "SCSI" -bh "Bell and Howell" "COPISCAN II 2135" "SCSI" -bh "Bell and Howell" "COPISCAN II 2137(A)" "SCSI" -bh "Bell and Howell" "COPISCAN II 2138A" "SCSI" -bh "Bell and Howell" "COPISCAN II 3238" "SCSI" -bh "Bell and Howell" "COPISCAN II 3338(A)" "SCSI" -canon "Canon" "CanoScan 300" "SCSI" -canon "Canon" "CanoScan 600" "SCSI" -canon "Canon" "CanoScan 620S" "SCSI" -canon "Canon" "CanoScan 2700F" "SCSI" -canon "Canon" "CanoScan 2710" "SCSI" -canon630u "Canon" "CanoScan fb630u" "USB" -canon630u "Canon" "CanoScan fb636u" "USB" -canon_pp "Canon" "CanoScan FB310P" "Parport (ECP)" -canon_pp "Canon" "CanoScan FB610P" "Parport (ECP)" -canon_pp "Canon" "CanoScan FB320P" "Parport (ECP)" -canon_pp "Canon" "CanoScan FB620P" "Parport (ECP)" -canon_pp "Canon" "CanoScan FB330P" "Parport (ECP)" -canon_pp "Canon" "CanoScan FB630P" "Parport (ECP)" -canon_pp "Canon" "CanoScan N340P" "Parport (ECP)" -canon_pp "Canon" "CanoScan N640P" "Parport (ECP)" -canon_pp "Canon" "CanoScan N640P ex" "Parport (ECP)" -coolscan "Nikon" "LS-20" "SCSI" -coolscan "Nikon" "LS-30" "SCSI" -coolscan "Nikon" "LS-2000" "SCSI" -coolscan "Nikon" "LS-1000" "SCSI" -coolscan2 "Nikon" "LS 30" "SCSI" -coolscan2 "Nikon" "LS 2000" "SCSI" -coolscan2 "Nikon" "LS 40 ED" "USB" -coolscan2 "Nikon" "LS 4000 ED" "IEEE1394" -coolscan2 "Nikon" "LS 8000 ED" "IEEE1394" -dc210 "Kodak" "DC210" "Serial port" -dc240 "Kodak" "DC240" "Serial port" -dc25 "Kodak" "DC25" "Serial port" -dc25 "Kodak" "DC20" "Serial port" -dmc "Polaroid" "DMC" "SCSI" -epson "Epson" "GT-5000" "Parport" -epson "Epson" "Actionscanner II" "Parport" -epson "Epson" "GT-6000" "SCSI Parport" -epson "Epson" "ES-300C" "SCSI Parport" -epson "Epson" "GT-5500" "SCSI" -epson "Epson" "GT-6500" "Parport" -epson "Epson" "ES-600C" "Parport" -epson "Epson" "ES-1200C" "Parport" -epson "Epson" "GT-7000" "SCSI" -epson "Epson" "GT-8000" "SCSI" -epson "Epson" "ES-8500" "SCSI" -epson "Epson" "Perfection 636S" "SCSI" -epson "Epson" "Perfection 636U" "USB" -epson "Epson" "Perfection 610" "USB" -epson "Epson" "Perfection 640" "USB" -epson "Epson" "Perfection 1200S" "SCSI" -epson "Epson" "Perfection 1200U" "USB" -epson "Epson" "Perfection 1200Photo" "USB" -epson "Epson" "Perfection 1240" "SCSI USB" -epson "Epson" "Perfection 1640" "SCSI USB" -epson "Epson" "Perfection 1650" "USB" -epson "Epson" "Perfection 1660" "USB" -epson "Epson" "Perfection 2400" "USB" -epson "Epson" "Perfection 2450" "USB IEEE-1394" -epson "Epson" "Perfection 3200" "USB" -epson "Epson" "Expression 636" "SCSI" -epson "Epson" "Expression 800" "SCSI" -epson "Epson" "Expression 1600" "SCSI USB IEEE-1394" -epson "Epson" "Expression 1680" "SCSI USB IEEE-1394" -epson "Epson" "FilmScan 200" "SCSI" -epson "Epson" "CX-3200" "USB" -epson "Epson" "CX-5200" "USB" -fujitsu "Fujitsu" "M3096G" "SCSI" -fujitsu "Fujitsu" "M3091DCd" "SCSI" -fujitsu "Fujitsu" "M3092DCd" "SCSI" -fujitsu "Fujitsu" "M3093GXim" "SCSI" -fujitsu "Fujitsu" "M3093GDim" "SCSI" -fujitsu "Fujitsu" "M4097" "SCSI" -fujitsu "Fujitsu" "fi-4340C" "SCSI" -gt68xx "Mustek" "BearPaw 1200 CS" "USB" -gt68xx "Mustek" "BearPaw 1200 CU" "USB" -gt68xx "Mustek" "BearPaw 1200 CU Plus" "USB" -gt68xx "Mustek" "BearPaw 1200 TA" "USB" -gt68xx "Mustek" "BearPaw 2400 CS" "USB" -gt68xx "Mustek" "BearPaw 2400 CS Plus" "USB" -gt68xx "Mustek" "BearPaw 2400 CU" "USB" -gt68xx "Mustek" "BearPaw 2400 CU Plus" "USB" -gt68xx "Mustek" "BearPaw 2400 TA" "USB" -gt68xx "Mustek" "BearPaw 2400 TA Plus" "USB" -gt68xx "Mustek" "ScanExpress 1200 UB Plus" "USB" -gt68xx "Mustek" "ScanExpress A3 USB" "USB" -gt68xx "Mustek" "ScanExpress 2400 USB" "USB" -gt68xx "Plustek" "OpticPro 1248U" "USB" -gt68xx "Plustek" "OpticPro UT16B" "USB" -gt68xx "Artec" "Ultima 2000" "USB" -gt68xx "Artec" "Ultima 2000 e+" "USB" -gt68xx "Boeder" "Sm@rtScan Slim Edition" "USB" -gt68xx "Packard Bell" "Diamond 1200" "USB" -gt68xx "Medion/Lifetec/Tevion/Cytron" "LT 9452" "USB" -gt68xx "Medion/Lifetec/Tevion/Cytron" "MD/LT 9375" "USB" -gt68xx "Medion/Lifetec/Tevion/Cytron" "MD/LT 9385" "USB" -gt68xx "Medion/Lifetec/Tevion/Cytron" "MD 9458" "USB" -gt68xx "Trust" "Flat Scan USB 19200" "USB" -gt68xx "Trust" "Compact Scan USB 19200" "USB" -gt68xx "Lexmark" "X70" "USB" -gt68xx "Lexmark" "X73" "USB" -gt68xx "Genius" "Colorpage Vivid3x" "USB" -hp "Hewlett-Packard" "ScanJet Plus" "Propietary" -hp "Hewlett-Packard" "ScanJet IIc" "SCSI" -hp "Hewlett-Packard" "ScanJet IIp" "SCSI" -hp "Hewlett-Packard" "ScanJet IIcx" "SCSI" -hp "Hewlett-Packard" "ScanJet 3c" "SCSI" -hp "Hewlett-Packard" "ScanJet 3p" "SCSI" -hp "Hewlett-Packard" "ScanJet 4c" "SCSI" -hp "Hewlett-Packard" "ScanJet 4p" "SCSI" -hp "Hewlett-Packard" "ScanJet 4100C" "USB" -hp "Hewlett-Packard" "ScanJet 5p" "SCSI" -hp "Hewlett-Packard" "ScanJet 5100C" "Parport" -hp "Hewlett-Packard" "ScanJet 5200C" "Parport USB" -hp "Hewlett-Packard" "ScanJet 6100C" "SCSI" -hp "Hewlett-Packard" "ScanJet 6200C" "SCSI USB" -hp "Hewlett-Packard" "ScanJet 6250C" "SCSI USB" -hp "Hewlett-Packard" "ScanJet 6300C" "SCSI USB" -hp "Hewlett-Packard" "ScanJet 6350C" "SCSI USB" -hp "Hewlett-Packard" "ScanJet 6390C" "SCSI USB" -hp "Hewlett-Packard" "PhotoSmart PhotoScanner" "SCSI" -hpsj5s "Hewlett-Packard" "ScanJet 5s" "Parport (EPP)" -leo "LEO" "LEOScan S3" "SCSI" -leo "Across Technologies" "FS-1130" "SCSI" -leo "Genius" "FS-1130 Colorpage Scanner" "SCSI" -matsushita "Panasonic" "KV-SS25" "SCSI" -matsushita "Panasonic" "KV-SS25D" "SCSI" -matsushita "Panasonic" "KV-SS50" "SCSI" -matsushita "Panasonic" "KV-SS55" "SCSI" -matsushita "Panasonic" "KV-SS50EX" "SCSI" -matsushita "Panasonic" "KV-SS55EX" "SCSI" -matsushita "Panasonic" "KV-SS850" "SCSI" -matsushita "Panasonic" "KV-SS855" "SCSI" -microtek "Microtek" "Scanmaker E6" "SCSI" -microtek "Microtek" "Scanmaker E3" "SCSI" -microtek "Microtek" "Scanmaker E2" "SCSI" -microtek "Microtek" "Scanmaker 35t+" "SCSI" -microtek "Microtek" "Scanmaker 45t" "SCSI" -microtek "Microtek" "Scanmaker 35" "SCSI" -microtek "Microtek" "Scanmaker III" "SCSI" -microtek "Microtek" "Scanmaker IISP" "SCSI" -microtek "Microtek" "Scanmaker IIHR" "SCSI" -microtek "Microtek" "Scanmaker IIG" "SCSI" -microtek "Microtek" "Scanmaker II" "SCSI" -microtek "Microtek" "Scanmaker 600Z(S)" "SCSI" -microtek "Microtek" "Scanmaker 600G(S)" "SCSI" -microtek "Microtek" "Color PageWiz" "SCSI (Parport)" -microtek "Agfa" "Arcus II" "SCSI" -microtek "Agfa" "StudioScan" "SCSI" -microtek "Agfa" "StudioScan II" "SCSI" -microtek "Agfa" "StudioScan IIsi" "SCSI" -microtek "Agfa" "DuoScan" "SCSI" -microtek2 "Microtek" "ScanMaker E3plus" "Parport" -microtek2 "Microtek" "ScanMaker E3plus" "SCSI" -microtek2 "Microtek" "ScanMaker X6" "SCSI" -microtek2 "Microtek" "ScanMaker X6EL" "SCSI" -microtek2 "Microtek" "ScanMaker X6USB" "USB" -microtek2 "Microtek" "ScanMaker V300" "SCSI" -microtek2 "Microtek" "ScanMaker V300" "Parport" -microtek2 "Microtek" "ScanMaker V310" "SCSI" -microtek2 "Microtek" "ScanMaker V310" "Parport" -microtek2 "Microtek" "ScanMaker V600" "SCSI" -microtek2 "Microtek" "ScanMaker V600" "Parport" -microtek2 "Microtek" "ScanMaker 330" "SCSI" -microtek2 "Microtek" "ScanMaker 630" "SCSI" -microtek2 "Microtek" "ScanMaker 636" "SCSI" -microtek2 "Microtek" "ScanMaker 9600XL" "SCSI" -microtek2 "Microtek" "ScanMaker 9600XL" "SCSI" -microtek2 "Microtek" "Phantom 330CX" "Parport" -microtek2 "Microtek" "SlimScan C3" "Parport" -microtek2 "Microtek" "Phantom 636" "SCSI" -microtek2 "Microtek" "Phantom 636CX" "Parport" -microtek2 "Microtek" "SlimScan C6" "USB" -microtek2 "Microtek" "ScanMaker V6USL" "SCSI" -microtek2 "Microtek" "ScanMaker V6USL" "USB" -microtek2 "Microtek" "ScanMaker X12USL" "SCSI" -microtek2 "Vobis" "HighScan" "SCSI" -microtek2 "Scanport" "SQ300" "Parport?" -microtek2 "Scanport" "SQ2030" "Parport" -microtek2 "Scanport" "SQ4836" "SCSI" -mustek "Mustek" "Paragon MFS-6000CX" "SCSI" -mustek "Mustek" "Paragon MFS-12000CX" "SCSI" -mustek "Mustek" "Paragon MFC-600S" "SCSI" -mustek "Mustek" "Paragon 600 II CD" "SCSI" -mustek "Mustek" "ScanMagic 600 II SP" "SCSI" -mustek "Mustek" "Paragon MFC-800S" "SCSI" -mustek "Mustek" "Paragon 800 II SP" "SCSI" -mustek "Mustek" "Paragon MFS-6000SP" "SCSI" -mustek "Mustek" "Paragon MFS-8000SP" "SCSI" -mustek "Mustek" "Paragon MFS-1200SP" "SCSI" -mustek "Mustek" "Paragon MFS-12000SP" "SCSI" -mustek "Mustek" "ScanExpress 6000SP" "SCSI" -mustek "Mustek" "ScanExpress 12000SP" "SCSI" -mustek "Mustek" "ScanExpress 12000SP Plus" "SCSI" -mustek "Mustek" "Paragon 1200 III SP" "SCSI" -mustek "Mustek" "Paragon 1200 LS" "SCSI" -mustek "Mustek" "ScanMagic 9636S" "SCSI" -mustek "Mustek" "ScanMagic 9636S Plus" "SCSI" -mustek "Mustek" "ScanExpress A3 SP" "SCSI" -mustek "Mustek" "Paragon 1200 SP Pro" "SCSI" -mustek "Mustek" "Paragon 1200 A3 Pro" "SCSI" -mustek "Mustek" "Paragon 600 II N" "Proprietary" -mustek "Trust" "Imagery 1200" "SCSI" -mustek "Trust" "Imagery 1200 SP" "SCSI" -mustek "Trust" "Imagery 4800 SP" "SCSI" -mustek "Trust" "SCSI Connect 19200" "SCSI" -mustek "Trust" "SCSI excellence series 19200" "SCSI" -mustek "Primax" "Compact 4800 SCSI" "SCSI" -mustek_pp "Mustek" "ScanExpress 6000 P" "Parport (EPP)" -mustek_pp "Mustek" "ScanExpress 600 SEP" "Parport (EPP)" -mustek_pp "Mustek" "ScanMagic 4800 P" "Parport (EPP)" -mustek_pp "Mustek" "600 III EP Plus" "Parport (EPP)" -mustek_pp "Mustek" "ScanExpress 600 CP" "Parport (EPP)" -mustek_pp "Mustek" "ScanMagic 600 CP" "Parport (EPP)" -mustek_pp "Mustek" "1200 CP" "Parport (EPP)" -mustek_pp "Mustek" "1200 CP+" "Parport (EPP)" -mustek_pp "Medion/Tevion/LifeTec" "MD 9848" "Parport (EPP)" -mustek_pp "Medion/Tevion/LifeTec" "MD/LT 935x" "Parport (EPP)" -mustek_pp "Medion/Tevion/LifeTec" "MD/LT 985x" "Parport (EPP)" -mustek_pp "Medion/Tevion/LifeTec" "MD/LT 9890" "Parport (EPP)" -mustek_pp "Targa" "Funline TS12 EP" "Parport (EPP)" -mustek_pp "Targa" "Funline TS6 EP" "Parport (EPP)" -mustek_pp "Trust Easy Connect" "9600+" "Parport (EPP)" -mustek_pp "Viviscan" "Compact II" "Parport (EPP)" -mustek_pp "Cybercom" "9352" "Parport (EPP)" -mustek_pp "Gallery" "4800" "Parport (EPP)" -mustek_usb "Mustek" "ScanExpress 600 CU" "USB" -mustek_usb "Mustek" "ScanExpress 1200 CU" "USB" -mustek_usb "Mustek" "ScanExpress 1200 CU Plus" "USB" -mustek_usb "Mustek" "ScanExpress 1200 UB" "USB" -mustek_usb "Trust" "Compact Scan USB 19200" "USB" -nec "NEC" "PC-IN500/4C" "SCSI" -pie "Devcom" "9636PRO" "SCSI" -pie "Devcom" "9636S" "SCSI" -pie "Devcom" "9630S" "SCSI" -pie "PIE" "ScanAce 1236S" "SCSI" -pie "PIE" "ScanAce 1230S" "SCSI" -pie "PIE" "ScanAce II" "SCSI" -pie "PIE" "ScanAce III" "SCSI" -pie "PIE" "ScanAce Plus" "SCSI" -pie "PIE" "ScanAce II Plus" "SCSI" -pie "PIE" "ScanAce III Plus" "SCSI" -pie "PIE" "ScanAce V" "SCSI" -pie "PIE" "ScanAce ScanMedia" "SCSI" -pie "PIE" "ScanAce ScanMedia II" "SCSI" -pie "PIE" "ScanAce 630S" "SCSI" -pie "PIE" "ScanAce 636S" "SCSI" -pie "Adlib" "JetScan630" "SCSI" -pie "Adlib" "JetScan636PRO" "SCSI" -plustek "Plustek" "OpticPro 4800P" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro 4830P" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro 600P/6000P" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro 4831P" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro 9630P" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro 9630PL" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro 9600P" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro 1236P" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro 12000P/96000P" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro 9636P" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro 9636P+/Turbo" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro 9636T" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro 12000T" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro AI3" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro P8" "Parport" -plustek "Plustek" "OpticPro P12" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro PT12" "Parport (SPP, EPP)" -plustek "Plustek" "OpticPro U12" "USB" -plustek "Plustek" "OpticPro UT12" "USB" -plustek "Plustek" "OpticPro UT16" "USB" -plustek "Plustek" "OpticPro U24" "USB" -plustek "Plustek" "OpticPro UT24" "USB" -plustek "Plustek" "OpticPro 19200S" "SCSI" -plustek "Primax" "Colorado 4800" "Parport (SPP, EPP)" -plustek "Primax" "Compact 4800 Direct" "Parport (SPP, EPP)" -plustek "Primax" "Compact 4800 Direct-30" "Parport (SPP, EPP)" -plustek "Primax" "Compact 9600 Direct-30" "Parport (SPP, EPP)" -plustek "Genius" "Colorpage Vivid III V2" "Parport (SPP, EPP)" -plustek "Genius" "Colorpage Vivid Pro II Film" "Parport (SPP, EPP)" -plustek "Genius" "Colorpage HR6 V2" "USB" -plustek "Genius" "Colorpage HR7" "USB" -plustek "Genius" "Colorpage HR6A" "USB" -plustek "Genius" "Colorpage HR7LE" "USB" -plustek "Genius" "Colorpage HR6X" "USB" -plustek "Aries" "Scan-It Pro 4800" "Parport (SPP, EPP)" -plustek "BrightScan" "BrighScan OpticPro" "Parport (SPP, EPP)" -plustek "Mustek" "BearPaw 1200" "USB" -plustek "Mustek" "BearPaw 2400" "USB" -plustek "Hewlett-Packard" "ScanJet 2100C" "USB" -plustek "Hewlett-Packard" "ScanJet 2200C" "USB" -plustek "Epson" "Perfection 1250" "USB" -plustek "Epson" "Perfection 1250Photo" "USB" -plustek "Epson" "Perfection 1260" "USB" -plustek "Epson" "Perfection 1260Photo" "USB" -plustek "Umax" "UMAX 3400" "USB" -plustek "Umax" "UMAX 5400" "USB" -plustek "Canon" "CanoScan N650U/N656U" "USB" -plustek "Canon" "CanoScan N1220U" "USB" -plustek "Canon" "CanoScan N670U/N676U" "USB" -plustek "Canon" "CanoScan N1240U" "USB" -plustek "Canon" "CanoScan LiDE20" "USB" -plustek "Canon" "CanoScan LiDE30" "USB" -qcam "Connectix" "Color QuickCam" "Parport" -qcam "Connectix" "Greyscale QuickCam" "Parport" -ricoh "Ricoh" "Ricoh IS50" "SCSI" -ricoh "Ricoh" "Ricoh IS60" "SCSI" -s9036 "Siemens" "9036 Flatbed scanner" "SCSI" -sceptre "Sceptre" "Vividscan S1200" "SCSI" -sceptre "Komodo" "S1200" "SCSI" -sharp "Sharp" "JX-610" "SCSI" -sharp "Sharp" "JX-250" "SCSI" -sharp "Sharp" "JX-320" "SCSI" -sharp "Sharp" "JX-325" "SCSI" -sharp "Sharp" "JX-330" "SCSI" -sharp "Sharp" "JX-350" "SCSI" -sm3600 "Microtek" "ScanMaker 3600" "USB" -sm3600 "Microtek" "ScanMaker 3700" "USB" -sm3600 "Microtek" "ScanMaker 3750" "USB" -SnapScan "AGFA" "SnapScan 300" "SCSI" -SnapScan "AGFA" "SnapScan 310" "SCSI" -SnapScan "AGFA" "SnapScan 600" "SCSI" -SnapScan "AGFA" "SnapScan 1236s" "SCSI" -SnapScan "AGFA" "SnapScan 1236u" "USB" -SnapScan "AGFA" "SnapScan 1212u" "USB" -SnapScan "AGFA" "SnapScan e10" "USB" -SnapScan "AGFA" "SnapScan e20" "USB" -SnapScan "AGFA" "SnapScan e25" "USB" -SnapScan "AGFA" "SnapScan e26" "USB" -SnapScan "AGFA" "SnapScan e40" "USB" -SnapScan "AGFA" "SnapScan e42" "USB" -SnapScan "AGFA" "SnapScan e50" "USB" -SnapScan "AGFA" "SnapScan e52" "USB" -SnapScan "AGFA" "SnapScan e60" "USB" -SnapScan "Benq" "300f" "SCSI" -SnapScan "Benq" "310s" "SCSI" -SnapScan "Benq" "610s" "SCSI" -SnapScan "Benq" "610plus" "SCSI" -SnapScan "Benq" "620s" "SCSI" -SnapScan "Benq" "310u" "USB" -SnapScan "Benq" "320u" "USB" -SnapScan "Benq" "340u" "USB" -SnapScan "Benq" "620u" "USB" -SnapScan "Benq" "640u" "USB" -SnapScan "Benq" "640bu" "USB" -SnapScan "Benq" "1240" "USB" -SnapScan "Benq" "3300" "USB" -SnapScan "Benq" "4300" "USB" -SnapScan "Benq" "5000" "USB" -SnapScan "Benq" "5300" "USB" -SnapScan "Guillemot / Hercules" "Maxi Scan A4 Deluxe (SCSI)" "SCSI" -SnapScan "Guillemot / Hercules" "Scan@home Touch 1248 (USB)" "USB" -SnapScan "Mitsubishi" "Diamondview 648UT" "USB" -SnapScan "Mitsubishi" "Diamondview 650U" "USB" -sp15c "Fujitsu" "SP15C" "SCSI" -st400 "Siemens" "ST400" "SCSI" -st400 "Siemens" "ST800" "SCSI" -tamarack "Tamarack" "Artiscan 6000C" "SCSI" -tamarack "Tamarack" "Artiscan 8000C" "SCSI" -tamarack "Tamarack" "Artiscan 12000C" "SCSI" -teco1 "Relisys" "RELI 2412" "SCSI" -teco1 "Relisys" "AVEC 2400" "SCSI" -teco1 "Relisys" "RELI 4830" "SCSI" -teco1 "Relisys" "AVEC 2412" "SCSI" -teco1 "Relisys" "AVEC 4800" "SCSI" -teco1 "Relisys" "AVEC 4816" "SCSI" -teco1 "Relisys" "RELI DS6" "SCSI" -teco1 "Relisys" "RELI DS15" "SCSI" -teco1 "Relisys" "RELI 2400" "SCSI" -teco1 "Relisys" "RELI 4816" "SCSI" -teco1 "Relisys" "RELI 9600" "SCSI" -teco1 "Relisys" "RELI 9612" "SCSI" -teco1 "Relisys" "RELI 9624" "SCSI" -teco1 "Relisys" "RELI 9630" "SCSI" -teco1 "Actown" "ACT Scan I 30" "SCSI" -teco1 "Dextra" "DF-600P" "SCSI" -teco1 "Dextra" "DF-1200T+" "SCSI" -teco1 "Dextra" "DF-4830T" "SCSI" -teco1 "Dextra" "DF-9624" "SCSI" -teco2 "Relisys" "AVEC Super 3" "SCSI" -teco2 "Relisys" "SCORPIO Super 3" "SCSI" -teco2 "Relisys" "APOLLO Express 6" "SCSI" -teco2 "Relisys" "SCORPIO Pro" "SCSI" -teco2 "Relisys" "SCORPIO Pro-S" "SCSI" -teco2 "Primax" "Profi 9600" "SCSI" -teco2 "Primax" "Profi 19200" "SCSI" -teco3 "Relisys" "Infinity Scorpio" "SCSI" -teco3 "Plustek" "OpticPro 2400SP" "SCSI" -teco3 "PIOTECH" "Splendeur 3024" "SCSI" -teco3 "Trust" "Imagery 2400 SP" "SCSI" -teco3 "Trust" "Imagery 4800 SP+" "SCSI" -teco3 "Trust" "Imagery 9600 SP" "SCSI" -umax "UMAX" "Vista S6" "SCSI" -umax "UMAX" "Vista S6E" "SCSI" -umax "UMAX" "UMAX S-6E" "SCSI" -umax "UMAX" "UMAX S-6EG" "SCSI" -umax "UMAX" "Vista-S8" "SCSI" -umax "UMAX" "Supervista S-12" "SCSI" -umax "UMAX" "UMAX S-12" "SCSI" -umax "UMAX" "UMAX S-12G" "SCSI" -umax "UMAX" "Astra 600S" "SCSI" -umax "UMAX" "Astra 610S" "SCSI" -umax "UMAX" "Astra 1200S" "SCSI" -umax "UMAX" "Astra 1220S" "SCSI" -umax "UMAX" "Astra 2100S" "SCSI" -umax "UMAX" "Astra 2200 (SU)" "SCSI" -umax "UMAX" "Astra 2200 (SU)" "USB" -umax "UMAX" "Astra 2400S" "SCSI" -umax "UMAX" "Astra 6400" "IEEE-1394" -umax "UMAX" "Astra 6450" "IEEE-1394" -umax "UMAX" "Astra MX3" "SCSI" -umax "UMAX" "Astra MX3" "USB" -umax "UMAX" "Mirage D-16L" "SCSI" -umax "UMAX" "Mirage II" "SCSI" -umax "UMAX" "Mirage IIse" "SCSI" -umax "UMAX" "PSD" "SCSI" -umax "UMAX" "PowerLook" "SCSI" -umax "UMAX" "PL-II" "SCSI" -umax "UMAX" "PowerLook III" "SCSI" -umax "UMAX" "PowerLook 270" "SCSI" -umax "UMAX" "PowerLook 270plus" "SCSI" -umax "UMAX" "PowerLook 1100" "IEEE-1394" -umax "UMAX" "PowerLook 2000" "SCSI" -umax "UMAX" "PowerLook 2100XL" "SCSI" -umax "UMAX" "PowerLook 3000" "SCSI" -umax "UMAX" "Gemini D-16" "SCSI" -umax "UMAX" "UMAX VT600" "SCSI" -umax "UMAX" "Vista-T630" "SCSI" -umax "UMAX" "UC 630" "SCSI" -umax "UMAX" "UG 630" "SCSI" -umax "UMAX" "UG 80" "SCSI" -umax "UMAX" "UC 840" "SCSI" -umax "UMAX" "UC 1200S" "SCSI" -umax "UMAX" "UC 1200SE" "SCSI" -umax "UMAX" "UC 1260" "SCSI" -umax "Linotype Hell" "Jade" "SCSI" -umax "Linotype Hell" "Jade" "SCSI" -umax "Linotype Hell" "Jade2" "SCSI" -umax "Linotype Hell" "Saphir" "SCSI" -umax "Linotype Hell" "Saphir2" "SCSI" -umax "Linotype Hell" "Saphir3" "SCSI" -umax "Linotype Hell" "Saphir Ultra" "SCSI" -umax "Linotype Hell" "Saphir Ultra II" "SCSI" -umax "Linotype Hell" "Saphir HiRes" "SCSI" -umax "Linotype Hell" "Opal" "SCSI" -umax "Linotype Hell" "Opal Ultra" "SCSI" -umax "Linotype Hell" "Linoscan 1400" "SCSI" -umax "Vobis" "Highscreen Scanboostar Premium" "SCSI" -umax "EDGE" "KTX-9600US" "SCSI" -umax "Epson" "Perfection 600" "SCSI" -umax "Escom" "Image Scanner 256" "SCSI" -umax "Escort" "Galleria 600" "SCSI" -umax "Genius" "ColorPage-HR5 (Pro)" "SCSI" -umax "Nikon" "AX-110 / Scantouch 110" "SCSI" -umax "Nikon" "AX-210" "SCSI" -umax1220u "UMAX" "Astra 1220U" "USB" -umax1220u "UMAX" "Astra 2000U" "USB" -umax1220u "UMAX" "Astra 2200U" "USB" -umax_pp "UMAX" "Astra 1220P" "Parport (EPP)" -umax_pp "UMAX" "Astra 2000P" "Parport (EPP)" -umax_pp "UMAX" "Astra 1600P" "Parport (EPP)" -umax_pp "UMAX" "Astra 610P" "Parport (EPP)" -umax_pp "Hewlett-Packard" "Scanjet 3200C" "Parport (EPP)" diff --git a/gosa-core/plugins/admin/systems/selectUserToPrinterDialog.tpl b/gosa-core/plugins/admin/systems/selectUserToPrinterDialog.tpl deleted file mode 100644 index c60be2297..000000000 --- a/gosa-core/plugins/admin/systems/selectUserToPrinterDialog.tpl +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - -
-
-

- -

-
-
-

-
-

-
-
-
-

[F]{t}Filters{/t}

-
-
- - {$alphabet} -
- - - - -
-  {t}Search in subtrees{/t} -
- - - - - -
- - - -
- - - - - -
- - - -
- {$apply} -
-
- -

 

-

- - -

- diff --git a/gosa-core/plugins/admin/systems/tabs_printers.inc b/gosa-core/plugins/admin/systems/tabs_printers.inc deleted file mode 100644 index 739777a7e..000000000 --- a/gosa-core/plugins/admin/systems/tabs_printers.inc +++ /dev/null @@ -1,62 +0,0 @@ -dn= $dn; - $this->config= $config; - - $baseobject= NULL; - - foreach ($data as $tab){ - $this->by_name[$tab['CLASS']]= $tab['NAME']; - - if ($baseobject === NULL){ - $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this); - $this->by_object[$tab['CLASS']]= $baseobject; - } else { - $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this); - } - - $this->by_object[$tab['CLASS']]->parent= &$this; - $this->by_object[$tab['CLASS']]->set_acl_category($category); - - /* Initialize current */ - if ($this->current == ""){ - $this->current= $tab['CLASS']; - } - } - - /* Add references/acls/snapshots */ - $this->addSpecialTabs(); - } - - function save_object($save_current= FALSE) - { - tabs::save_object($save_current); - } - - - function save($ignore_account= FALSE) - { - /* Check for new 'dn', in order to propagate the - 'dn' to all plugins */ - $baseobject= $this->by_object['printgeneric']; - $this->dn= "cn=$baseobject->cn,".get_ou('printerou').$baseobject->base; - $baseobject->dn= $this->dn; - - foreach ($this->by_object as $key => $obj){ - $this->by_object[$key]->dn= $this->dn; - } - - tabs::save(FALSE); - } - -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/tabs_terminal.inc b/gosa-core/plugins/admin/systems/tabs_terminal.inc deleted file mode 100644 index ea9207faf..000000000 --- a/gosa-core/plugins/admin/systems/tabs_terminal.inc +++ /dev/null @@ -1,77 +0,0 @@ -dn= $dn; - $this->config= $config; - - $baseobject= NULL; - - foreach ($data as $tab){ - $this->by_name[$tab['CLASS']]= $tab['NAME']; - - if ($baseobject === NULL){ - $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this); - $this->by_object[$tab['CLASS']]= $baseobject; - } else { - $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this); - } - - $this->by_object[$tab['CLASS']]->parent= &$this; - $this->by_object[$tab['CLASS']]->set_acl_category($category); - - /* Initialize current */ - if ($this->current == ""){ - $this->current= $tab['CLASS']; - } - } - - /* Add references/acls/snapshots */ - $this->addSpecialTabs(); - } - - function save_object($save_current= FALSE) - { - tabs::save_object($save_current); - - /* Update reference, transfer variables */ - if(isset($this->by_object['termstartup'])){ - $this->by_object['termstartup']->gotoTerminalPath= $this->by_object['termgeneric']->gotoTerminalPath; - } - - $base_obj = $this->by_object['termgeneric']; - foreach($this->by_object as $name => $plug){ - $this->by_object[$name]->cn = $base_obj->cn; - } - } - - - function save($ignore_account= FALSE) - { - /* Check for new 'dn', in order to propagate the - 'dn' to all plugins */ - $baseobject= $this->by_object['termgeneric']; - $this->dn= "cn=".$baseobject->cn.",".get_ou('terminalou').$baseobject->base; - $baseobject->dn= $this->dn; - - foreach ($this->by_object as $key => $obj){ - $this->by_object[$key]->dn= $this->dn; - $this->by_object[$key]->cn= $baseobject->cn; - } - - tabs::save(TRUE); - if(isset($this->by_object['printgeneric'])){ - if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){ - $this->by_object['printgeneric']->remove_from_parent(); - } - } - } - -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/tabs_workstation.inc b/gosa-core/plugins/admin/systems/tabs_workstation.inc deleted file mode 100644 index 3d6bac27c..000000000 --- a/gosa-core/plugins/admin/systems/tabs_workstation.inc +++ /dev/null @@ -1,75 +0,0 @@ -dn= $dn; - $this->config= $config; - - $baseobject= NULL; - - foreach ($data as $tab){ - $this->by_name[$tab['CLASS']]= $tab['NAME']; - - if ($baseobject === NULL){ - $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this); - $this->by_object[$tab['CLASS']]= $baseobject; - } else { - $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this); - } - - $this->by_object[$tab['CLASS']]->parent= &$this; - $this->by_object[$tab['CLASS']]->set_acl_category($category); - - /* Initialize current */ - if ($this->current == ""){ - $this->current= $tab['CLASS']; - } - } - - /* Add references/acls/snapshots */ - $this->addSpecialTabs(); - } - - function save_object($save_current= FALSE) - { - tabs::save_object($save_current); - - /* Assign current cn */ - $baseobject= $this->by_object['workgeneric']; - foreach ($this->by_object as $key => $obj){ - $this->by_object[$key]->cn= $baseobject->cn; - } - } - - - function save($ignore_account= FALSE) - { - /* Check for new 'dn', in order to propagate the - 'dn' to all plugins */ - $baseobject= $this->by_object['workgeneric']; - $this->dn= "cn=".$baseobject->cn.",".get_ou('workstationou').$baseobject->base; - $baseobject->dn= $this->dn; - - foreach ($this->by_object as $key => $obj){ - $this->by_object[$key]->dn= $this->dn; - $this->by_object[$key]->cn= $baseobject->cn; - } - - tabs::save(TRUE); - - if(isset($this->by_object['printgeneric'])){ - if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){ - $this->by_object['printgeneric']->remove_from_parent(); - } - } - } - -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/terminal.tpl b/gosa-core/plugins/admin/systems/terminal.tpl deleted file mode 100644 index dc088f867..000000000 --- a/gosa-core/plugins/admin/systems/terminal.tpl +++ /dev/null @@ -1,176 +0,0 @@ -

{t}Properties{/t}

- - - - - -
- - - {if $cn eq 'default'} - - {else} - - - {/if} - - - - - -
{t}Terminal template{/t}{$must} -{render acl=$cnACL} - -{/render} -
{$must} - -{render acl=$baseACL} - -{/render} -{render acl=$baseACL disable_picture='images/folder_gray.png'} - -{/render} -
-{if $member_of_ogroup} -
-
-
- -{/if} -
- - - - - - - - - -
-{render acl=$gotoModeACL} - -{/render} -
-{render acl=$gotoSyslogServerACL} - -{/render} -
-
-

 

- - - - - -
- - - - - - - - - -
-{render acl=$gotoTerminalPathACL} - -{/render} -
-{render acl=$gotoSwapServerACL} - -{/render} -
-
- - - - - - - -
-{if $member_of_ogroup} -{render acl=$gotoNtpServerACL} - {t}Inherit time server attributes{/t} -{/render} -{else} - {t}Inherit time server attributes{/t} -{/if} -

-{render acl=$gotoNtpServerACL} - -{/render} -
-{render acl=$gotoNtpServerACL} - -{/render} -{render acl=$gotoNtpServerACL} - -{/render} -{render acl=$gotoNtpServerACL} - -{/render} -
- -
- -{if $cn neq 'default'} -

 

- -{$netconfig} -{/if} - -{if $fai_activated} -

 

-

{t}Action{/t}

- - - - - -
-{render acl=$gotoNtpServerACL} - -{/render} - -{render acl=$gotoNtpServerACL} - -{/render} -
-{/if} - - - - diff --git a/gosa-core/plugins/admin/systems/terminalService.tpl b/gosa-core/plugins/admin/systems/terminalService.tpl deleted file mode 100644 index 72ba28b1a..000000000 --- a/gosa-core/plugins/admin/systems/terminalService.tpl +++ /dev/null @@ -1,269 +0,0 @@ - - - - - - - - - - - - -
-

{t}Keyboard{/t}

- - - - - - - - - - - - - -
-{render acl=$gotoXKbModelACL} - -{/render} -
-{render acl=$gotoXKbLayoutACL} - -{/render} -
-{render acl=$gotoXKbVariantACL} - -{/render} -
- -
-   - -

{t}Mouse{/t}

- - - - - - - - - -
-{render acl=$gotoXMouseTypeACL} - -{/render} -
-{render acl=$gotoXMouseportACL} - -{/render} -
- -
-   - -

{t}Telephone hardware{/t}

- - - - -
{t}Telephone{/t}  -{render acl=$goFonHardwareACL} - {$hardware_list} -{/render} -
- -
- - - - - - - - - - - - - -

-

{t}Graphic device{/t}

- - - - - - - - - - - - - -
-{render acl=$gotoXDriverACL} - -{/render} -
-{render acl=$gotoXResolutionACL} - -{/render } -
-{render acl=$gotoXColordepthACL} - -{/render} -
-
-   - -

{t}Display device{/t}

- - - - - - - - - - - - -{/render} - - - - -{/render} - -
{t}Type{/t}{$gotoXMonitor}
-{render acl=$AutoSyncACL} - -{/render} - {t}Use DDC for automatic detection{/t}
-{render acl=$gotoXHsyncACL} - kHz
-{render acl=$gotoXVsyncACL} - Hz
- -
-   - -

{t}Remote desktop{/t}

- - - - - - - - - - - - - - - - -
-{render acl=$gotoXMethodACL} - -{/render} -
-{render acl=$gotoXdmcpServerACL} - -{/render} -
-{render acl=$gotoFontPathACL} - -{/render} -
- -
- - - - - - - - - -

-

-{render acl=$gotoLpdEnableACL} - -{/render} - {t}Provide print services{/t} -
- - - - - - - -
-{render acl=$gotoLpdServerACL} - -{/render} -
- -
-   - -

{t}Scan device{/t}

-{render acl=$gotoScannerEnableACL} - -{/render} - {t}Provide scan services{/t} -
- - - - - - -
-{render acl=$gotoScannerEnableACL} - -{/render} -
- -
- -
diff --git a/gosa-core/plugins/admin/systems/terminalStartup.tpl b/gosa-core/plugins/admin/systems/terminalStartup.tpl deleted file mode 100644 index ccfacfbaa..000000000 --- a/gosa-core/plugins/admin/systems/terminalStartup.tpl +++ /dev/null @@ -1,142 +0,0 @@ -

{t}Boot parameters{/t}

- - - - - - - - -
- - - - - - - - - -{/render} - - - - -
-{render acl=$gotoBootKernelACL} - -{/render} -
-{render acl=$gotoKernelParametersACL} -
-{render acl=$gotoLdapServerACL} -( - {t}inherit from group{/t}) -{if !$JS} - -{/if} -{/render} -{render acl=$gotoLdapServerACL_inherit} - {$gotoLdapServers} -{/render} -{render acl=$gotoLdapServerACL_inherit} - -{/render} -{render acl=$gotoLdapServerACL_inherit} - -{/render} -
- -
-   - -{render acl=$gotoKernelParametersACL} - -{/render} - {t}use graphical bootup{/t} -
-{render acl=$gotoKernelParametersACL} - -{/render} - {t}use standard linux textual bootup{/t} -
-{render acl=$gotoKernelParametersACL} - -{/render} - {t}use debug mode for startup{/t} -
- - - - - - - - - -

-

- {t}Kernel modules (format: name parameters){/t} -

-{render acl=$gotoModulesACL} - -{/render} -
-{render acl=$gotoModulesACL} - -{/render} -{render acl=$gotoModulesACL} -   -{/render} -{render acl=$gotoModulesACL} - -{/render} -
-

 

- - - - -
-{render acl=$gotoShareACL} - -{/render} -
-{render acl=$gotoShareACL} - -{/render} -{render acl=$gotoShareACL} - -{/render} -{render acl=$gotoShareACL} - -{/render} -{render acl=$gotoShareACL} - -{/render} -
-
- - - - diff --git a/gosa-core/plugins/admin/systems/workstation.tpl b/gosa-core/plugins/admin/systems/workstation.tpl deleted file mode 100644 index ba8489947..000000000 --- a/gosa-core/plugins/admin/systems/workstation.tpl +++ /dev/null @@ -1,157 +0,0 @@ -

{t}Properties{/t}

- - - - - -
- - -{if $cn eq 'wdefault'} - -{else} - - -{/if} - - - - - - - - - -
{t}Workstation template{/t}{$must} -{render acl=$cnACL} - -{/render} -
-{render acl=$lACL} - -{/render} -
{$must} -{render acl=$baseACL} - -{/render} -{render acl=$baseACL disable_picture='images/folder_gray.png'} - -{/render} -
-{if $member_of_ogroup} -
-
-
- -{/if} -
- - - - - - - - - -
{t}Mode{/t} -{render acl=$gotoModeACL} - -{/render} -
-{render acl=$gotoSyslogServerACL} - -{/render} -
-

 

- - - - - - - -
-{if $member_of_ogroup} -{render acl=$gotoNtpServerACL} - {t}Inherit time server attributes{/t} -{/render} -{else} - {t}Inherit time server attributes{/t} -{/if} -

-{render acl=$gotoNtpServerACL} - -{/render} -
-{render acl=$gotoNtpServerACL} - -{/render} -{render acl=$gotoNtpServerACL} - -{/render} -{render acl=$gotoNtpServerACL} - -{/render} -
-
-{if $cn neq 'wdefault'} -

 

- -{$netconfig} -{/if} -

 

- -{if $fai_activated} -

{t}Action{/t}

- - - - - -
-{render acl=$FAIstateACL} - -{/render} - - -
-{/if} - - {if $cn eq 'wdefault'} - - - {else} - - {/if} - diff --git a/gosa-core/plugins/admin/systems/workstationService.tpl b/gosa-core/plugins/admin/systems/workstationService.tpl deleted file mode 100644 index e5171fe01..000000000 --- a/gosa-core/plugins/admin/systems/workstationService.tpl +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - - - - - -
-

{t}Keyboard{/t}

- - - - - - - - - - - - - -
- -{render acl=$gotoXKbModelACL} - -{/render} - -
- -{render acl=$gotoXKbLayoutACL} - -{/render} - -
- -{render acl=$gotoXKbVariantACL} - -{/render} - -
- -
-   - -

{t}Mouse{/t}

- - - - -{/render} - - - - - - -
- -{render acl=$gotoXMouseTypeACL} - -
- -{render acl=$gotoXMouseportACL} - -{/render} - -
- -
-   - -

{t}Telephone hardware{/t}

- - - - -
{t}Telephone{/t}  - -{render acl=$goFonHardwareACL} - {$hardware_list} -{/render} - -
- -
- - - - - - - - - - - - - -

-

{t}Graphic device{/t}

- - - - - - - - - - - - - -
- -{render acl=$gotoXDriverACL} - -{/render} - -
- -{render acl=$gotoXResolutionACL} - -{/render} - -
- -{render acl=$gotoXColordepthACL} - -{/render} - -
-
-   - -

{t}Display device{/t}

- - - - - - - - - - - - - - - - - -
{t}Type{/t}{if $gotoXMonitor==""}{t}unknown{/t}{/if}{$gotoXMonitor}
- -{render acl=$AutoSyncACL} - -{/render} - - {t}Use DDC for automatic detection{/t}
- -{render acl=$gotoXHsyncACL} - kHz -{/render} - -
- -{render acl=$gotoXVsyncACL} - Hz -{/render} - -
- -
-   - - - -

{t}Scan device{/t}

- -{render acl=$gotoScannerEnableACL} - -{/render} - - {t}Provide scan services{/t} -
-
- - -
- - - - - - diff --git a/gosa-core/plugins/admin/systems/workstationStartup.tpl b/gosa-core/plugins/admin/systems/workstationStartup.tpl deleted file mode 100644 index 0801a091b..000000000 --- a/gosa-core/plugins/admin/systems/workstationStartup.tpl +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - - - -
-

{t}Boot parameters{/t}

- - - - - - - - - - - - - -
-{render acl=$gotoBootKernelACL} - -{/render} -
-{render acl=$gotoKernelParametersACL} - -{/render} -
-{render acl=$gotoLdapServerACL} -{if $member_of_ogroup} -( - {t}inherit from group{/t}) -{if !$JS} - -{/if} -{/if} -{/render} -{render acl=$gotoLdapServerACL_inherit} - {$gotoLdapServers} -{/render} -{render acl=$gotoLdapServerACL_inherit} - -{/render} -{render acl=$gotoLdapServerACL_inherit} - -{/render} -
- -
-   - - - {if $fai_activated} - - {if $FAIdebianMirror == "inherited"} - - - - - - - - - - -
-

 {t}FAI server{/t} -

-
-

 {t}Release{/t} -

-
- {render acl=$FAIdebianMirrorACL} - - {/render} - - -
-

-  {t}Assigned FAI classes{/t} -

- {render acl=$FAIclassACL} - {$FAIScriptlist} - {/render} - {else} - - - - - - - - - - -
-

 {t}FAI server{/t} -

-
-

 {t}Release{/t} -

-
- {render acl=$FAIdebianMirrorACL} - - {/render} - {if $javascript eq 'false'} - {render acl=$FAIdebianMirrorACL} - - {/render} - {/if} - - {render acl=$FAIreleaseACL} - - {/render} -
-

-  {t}Assigned FAI classes{/t} -

- {render acl=$FAIclassACL} - {$FAIScriptlist} - {/render} - - {render acl=$FAIclassACL} - - {/render} - {render acl=$FAIclassACL} - - {/render} - - {/if} - - {else} - -

{t}FAI Object assignment disabled. You can't use this feature until FAI is activated.{/t}

- - {/if} -
- - - - - - - - - -

-

- {t}Kernel modules (format: name parameters){/t} -

-{render acl=$gotoModulesACL} - -{/render} -
-{render acl=$gotoModulesACL} - -{/render} -{render acl=$gotoModulesACL} -   -{/render} -{render acl=$gotoModulesACL} - -{/render} -
-

 

- - - - -
-{render acl=$gotoShareACL} - -{/render} -
-{render acl=$gotoShareACL} - -{/render} -{render acl=$gotoShareACL} - -{/render} -{render acl=$gotoShareACL} - -{/render} -{render acl=$gotoShareACL} - -{/render} -
-
- - -