From dcb33d859d455c355c6adf6151ee8ea1630f03ae Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 8 Jan 2010 12:41:58 +0000 Subject: [PATCH] Added system filter git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15125 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_filterSYSTEMS.inc | 81 +++++++++++++++++++ .../systems/admin/systems/system-filter.xml | 1 + .../systems/admin/systems/system-list.xml | 25 ++++++ 3 files changed, 107 insertions(+) create mode 100644 gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc diff --git a/gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc b/gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc new file mode 100644 index 000000000..725d549eb --- /dev/null +++ b/gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc @@ -0,0 +1,81 @@ + $entry){ + if(preg_match("/".preg_quote(get_ou('systemIncomingRDN'),'/')."/i", $entry['dn'])){ + + // Detect incoming types + if(in_array('gotoWorkstation', $entry['objectClass'])){ + $entries[$key]['objectClass'][] = 'FAKE_OC_NewWorkstation'; + $entries[$key]['cn'][0].= " ("._("New workstation").")"; + }elseif(in_array('gotoTerminal', $entry['objectClass'])){ + $entries[$key]['objectClass'][] = 'FAKE_OC_NewTerminal'; + $entries[$key]['cn'][0].= " ("._("New terminal").")"; + }elseif(in_array('GOhard', $entry['objectClass']) && !isset($entry['gotoMode'][0])){ + $entries[$key]['objectClass'][] = 'FAKE_OC_NewUnknownDevice'; + $entries[$key]['cn'][0].= " ("._("New unknown device").")"; + }elseif(in_array('GOhard', $entry['objectClass'])){ + $entries[$key]['objectClass'][] = 'FAKE_OC_NewDevice'; + $entries[$key]['cn'][0].= " ("._("New device").")"; + } + + // Detect SAMBA machines + }elseif(in_array('sambaSamAccount', $entry['objectClass']) && preg_match("/\$$/", $entry['cn'][0])){ + $entries[$key]['objectClass'][] = 'FAKE_OC_winstation'; + + // Detect Workstation templates + }elseif(in_array('gotoWorkstation', $entry['objectClass'])){ + if(!isset($entry['macAddress'][0]) || $entry['macAddress'][0] == "-"){ + $entries[$key]['objectClass'][] = 'FAKE_OC_WorkstationTemplate'; + } + + // Detect Terminal templates + }elseif(in_array('gotoTerminal', $entry['objectClass'])){ + if(!isset($entry['macAddress'][0]) || $entry['macAddress'][0] == "-"){ + $entries[$key]['objectClass'][] = 'FAKE_OC_TerminalTemplate'; + } + + // Detect Server templates + }elseif(in_array('goServer', $entry['objectClass'])){ + if(!isset($entry['macAddress'][0]) || $entry['macAddress'][0] == "-"){ + $entries[$key]['objectClass'][] = 'FAKE_OC_ServerTemplate'; + } + } + + // Detect object states + foreach(array('gotoWorkstation','gotoTerminal','goServer') as $type){ + if(in_array($type, $entry['objectClass'])){ + + if(isset($entry['gotoMode'][0]) && preg_match("/locked/i", $entry['gotoMode'][0])){ + $entries[$key]['objectClass'][] = $type."__IS_LOCKED"; + }elseif(isset($entry['FAIstate'][0])){ + switch (preg_replace('/:.*$/', '', $entry['FAIstate'][0])) { + case 'error': + $state= '__IS_ERROR'; + break; + case 'installing': + case 'install': + case 'sysinfo': + case 'softupdate': + case 'scheduledupdate': + $state= '__IS_BUSY'; + break; + default: $state =""; + } + if(!empty($state)) $entries[$key]['objectClass'][] = $type.$state; + } + } + } + } + + return($entries); + } + +} + +?> diff --git a/gosa-plugins/systems/admin/systems/system-filter.xml b/gosa-plugins/systems/admin/systems/system-filter.xml index bb9f5942c..583e9a2c3 100644 --- a/gosa-plugins/systems/admin/systems/system-filter.xml +++ b/gosa-plugins/systems/admin/systems/system-filter.xml @@ -16,6 +16,7 @@ cn description gotoMode + FAIstate macAddress auto diff --git a/gosa-plugins/systems/admin/systems/system-list.xml b/gosa-plugins/systems/admin/systems/system-list.xml index 9d004b6be..ad2068a0c 100644 --- a/gosa-plugins/systems/admin/systems/system-list.xml +++ b/gosa-plugins/systems/admin/systems/system-list.xml @@ -19,6 +19,31 @@ plugins/systems/images/select_new_workstation.png + + + goServer__IS_LOCKED + server + servgeneric + plugins/systems/images/server_locked.png + + + + + gotoWorkstation + workstation + workgeneric + plugins/systems/images/workstation_locked.png + + + + + gotoTerminal + terminal + termgeneric + plugins/systems/images/terminal_locked.png + + + FAKE_OC_NewTerminal -- 2.30.2