diff --git a/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc b/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc
index 815b52c0cfb3f1a6fdf04468b6abda308e8101e5..2164fbdacd9e4a411411212214c2edf30a0cd20c 100644 (file)
class workservice extends plugin
{
- /* CLI vars */
- var $cli_summary= "Manage terminal service aspects";
- var $cli_description= "Some longer text\nfor help";
- var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
var $gotoScannerEnable;
/* Generic terminal attributes */
var $gotoXMonitor= "";
"1400x1050" => "1400x1050",
"1600x1200" => "1600x1200");
- if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
- $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
+ if($this->config->get_cfg_value("resolutions") != ""){
+ $file = $this->config->get_cfg_value("resolutions");
if(is_readable($file)){
$str = file_get_contents($file);
}
//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));
+ msg_dialog::display(_("Configuration error"), msgPool::cannotReadFile($file), WARNING_DIALOG);
}
}
$this->XKbModels[$type] = $type;
}
- $this->MouseTypes= array("ImPS/2" => "ImPS/2", "PS/2" => "PS/2", "Microsoft" => "Microsoft",
- "Logitech" => "Logitech");
+ $this->MouseTypes= array("auto" => "auto",
+ "explorerps/2" => "explorerps/2",
+ "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");
+ $this->MousePorts= array("/dev/input/mice" => "/dev/input/mice",
+ "/dev/mouse" => "/dev/mouse",
+ "/dev/psaux" => "/dev/psaux",
+ "/dev/ttyS0" => "/dev/ttyS0",
+ "/dev/ttyS1" => "/dev/ttyS1",);
/* Additional values will be extracted from CONFIG_DIR./keyboardLayouts */
$this->XKbLayouts= array ("de"=> "de","intl" =>"intl","us" =>"us");
$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()){
+ /* Load phone hardware list
+ */
+ $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("phoneou")),
+ $this->config->current['BASE'],array("cn","description"), GL_NO_ACL_CHECK);
+ foreach($tmp as $attrs){
$cn= $attrs['cn'][0];
+ $description= "";
if (isset($attrs['description'])){
$description= " - ".$attrs['description'][0];
- } else {
- $description= "";
}
$this->hardware_list[$cn]= "$cn$description";
}
+ $this->hardware_list["automatic"]= _("automatic");
+ ksort($this->hardware_list);
- /* 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;
- }
+ /* These departments may contain objects that have
+ goFonHardware set.
+ */
+ $deps_a = array(
+ get_people_ou(),
+ get_ou("ogroupou"),
+ get_ou("serverou"),
+ get_ou("terminalou"),
+ get_ou("workstationou"),
+ get_ou("printerou"),
+ get_ou("componentou"),
+ get_ou("phoneou"));
+
+ $tmp = get_sub_list("(goFonHardware=*)","",$deps_a,$this->config->current['BASE'],
+ array('cn','dn','goFonHardware'),GL_NO_ACL_CHECK);
+ foreach($tmp as $attrs){
+ $cn = $attrs['goFonHardware'][0];
+ if(isset($this->hardware_list[$cn])){
+ $this->used_hardware[$cn]= $cn;
+ }
}
if(preg_match("/\+/",$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']);
$this->XKbVariants= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbVariants;
break;
case 'gotoXMouseType':
- $this->MouseTypes= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes;
+ $this->MouseTypes= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes;
break;
case 'gotoXMouseport':
- $this->MousePorts= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts;
+ $this->MousePorts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts;
break;
}
$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"));
+ $this->MouseTypes= array('default' => _("inherited"));
+ $this->MousePorts= array('default' => _("inherited"));
}
}
$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']);
$smarty->assign ("goFonHardware", $this->goFonHardware);
$perms = "";
- if($this->acl_is_writeable("goFonHardware")){
+ if(!$this->acl_is_writeable("goFonHardware")){
$perms = " disabled ";
}
if($this->acl_is_writeable("gotoXVsync")){
if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
- $message[]= _("Please specify a valid VSync range.");
+ $message[]= msgPool::invalid(_("VSync"));
} else{
list($v1,$v2)= preg_split ("/[-+]/", $val);
if ($v2 != ""){
if ($v1 > $v2){
- $message[]= _("Please specify a valid VSync range.");
+ $message[]= msgPool::invalid(_("VSync"));
}
}
}
$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.");
+ $message[]= msgPool::invalid(_("HSync"));
} else{
list($v1,$v2)= preg_split ("/[-+]/", $val);
if ($v2 != ""){
if ($v1 > $v2){
- $message[]= _("Please specify a valid HSync range.");
+ $message[]= msgPool::invalid(_("HSync"));
}
}
}
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->dn);
$this->cleanup();
+
+ /* Send SI event to reload goto settings if some options have changed.
+ */
+ if(count($this->attrs) && class_available("DaemonEvent")){
+ $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
+
+ $o_queue = new gosaSupportDaemon();
+ if(isset($events['TRIGGERED']['DaemonEvent_goto_reload'])){
+ $evt = $events['TRIGGERED']['DaemonEvent_goto_reload'];
+ $macs = array();
+
+ /* Get list of macAddresses
+ */
+ if(isset($this->parent->by_object['ogroup'])){
+
+ /* If we are an object group, add all member macs
+ */
+ $p = $this->parent->by_object['ogroup'];
+ foreach($p->memberList as $dn => $obj){
+ if(preg_match("/".normalizePreg(get_ou("incomingou"))."/",$dn)) continue;
+ if(isset($p->objcache[$dn]['macAddress']) && !empty($p->objcache[$dn]['macAddress'])){
+ $macs[] = $p->objcache[$dn]['macAddress'];
+ }
+ }
+ }elseif(isset($this->parent->by_object['workgeneric']->netConfigDNS->macAddress)){
+
+ /* We are a workstation. Add current mac.
+ */
+ $mac = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress;
+ if(!empty($mac) && !preg_match("/".normalizePreg(get_ou("incomingou"))."/",$this->orig_dn)){
+ $macs[] = $mac;
+ }
+ }
+
+ /* Trigger event for all member objects
+ */
+ if(count($macs)){
+ $tmp = new $evt['CLASS_NAME']($this->config);
+ $tmp->set_type(TRIGGERED_EVENT);
+ $tmp->add_targets($macs);
+ if(!$o_queue->append($tmp)){
+ msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
+ }
+ }
+ }
+ }
+
+ /* Send goto reload event to gosaSupportDaemon */
+ if(count($this->attrs)){
+ $this->send_goto_reload();
+ }
+
$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));
+ if (!$ldap->success()){
+ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
+ }
$this->handle_post_events("modify");
}
}
} else {
$drivers = array("ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx",
- "i128", "i740", "i810", "imstt", "mga", "neomagic", "newport", "nsc", "nv", "nvidia",
+ "i128", "i740", "i810", "intel", "imstt", "mga", "neomagic", "newport", "nsc", "nv", "nvidia",
"r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion",
"sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware");
}
"gotoXDriver" => _("Gfx driver"),
"gotoXResolution" => _("Gfx resolution"),
"gotoXColordepth" => _("Gfx color depth"),
- "gotoXHsync" => _("Hsync"),
- "gotoXVsync" => _("Vsync"),
+ "gotoXHsync" => _("HSync"),
+ "gotoXVsync" => _("VSync"),
"AutoSync" => _("Use DDC"),
"gotoScannerEnable" => _("Scanner enabled"),
"gotoXKbModel" => _("Keyboard model"),
"goFonHardware" => _("Telephone hardware"))
));
}
+
+
+ /*! \brief Send goto_reload event to support daemon
+ */
+ function send_goto_reload()
+ {
+ $targets = array();
+ if(isset($this->parent) && ($this->parent instanceOf worktabs)){
+ $targets[] = $this->parent->by_object['workgeneric']->netConfigDNS->ipHostNumber;
+ }
+ if(isset($this->parent) && ($this->parent instanceOf ogrouptabs)){
+ $member = $this->parent->by_object['ogroup']->member;
+ $oc = $this->parent->by_object['ogroup']->objcache;
+ foreach($member as $mem){
+ if(isset($oc[$mem]['macAddress'])){
+ $targets[] = $oc[$mem]['macAddress'];
+ }
+ }
+ }
+ if(count($targets) && class_available("gosaSupportDaemon") && class_available("DaemonEvent_goto_reload")){
+ $o_g = new gosaSupportDaemon();
+ $evt = new DaemonEvent_goto_reload($this->config);
+ $evt -> set_type(TRIGGERED_EVENT);
+ $evt -> add_targets($targets);
+ $o_g->append($evt);
+ }
+ }
+
+
+ function PrepareForCopyPaste($source)
+ {
+ plugin::PrepareForCopyPaste($source);
+
+ if(preg_match("/\+/",$this->gotoXHsync)){
+ $this->AutoSync = true;
+ $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
+ $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
+ }
+ }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: