From f9a3dec5529c89bd002b0add259a3d33d9bb41cd Mon Sep 17 00:00:00 2001 From: cajus Date: Tue, 23 May 2006 14:07:49 +0000 Subject: [PATCH] * Moved external_hook to repository_hook * Introduced new format to handle start tab, too git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3510 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/class_servRepositorySetup.inc | 12 ++--- .../systems/class_workstationStartup.inc | 53 ++++++++++++++++++- plugins/admin/systems/servRepositorySetup.tpl | 12 ++--- plugins/admin/systems/workstationStartup.tpl | 1 - 4 files changed, 64 insertions(+), 14 deletions(-) diff --git a/plugins/admin/systems/class_servRepositorySetup.inc b/plugins/admin/systems/class_servRepositorySetup.inc index 24f1c92bd..4b885bbd9 100644 --- a/plugins/admin/systems/class_servRepositorySetup.inc +++ b/plugins/admin/systems/class_servRepositorySetup.inc @@ -162,23 +162,23 @@ class servRepositorySetup extends plugin function GetHookElements() { $ret = array(); - $cmd= search_config($this->config->data['TABS'], "servrepository", "EXTERNAL_HOOK"); + $cmd= search_config($this->config->data['TABS'], "servrepository", "REPOSITORY_HOOK"); if(!empty($cmd)){ $res = shell_exec($cmd); $res2 = trim($res); if((!$res)){ - print_red(sprintf(_("Can't execute specified EXTERNAL_HOOK '%s' please check your gosa.conf."),$cmd)); + print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s' please check your gosa.conf."),$cmd)); }elseif(empty($res2)){ - print_red(sprintf(_("The specified EXTERNAL_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd)); + 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 $hook){ /* skip empty */ if(empty($hook)) continue; - if(preg_match("/\:/",$hook)){ - $hookinfo = split(":",$hook); - $ret[$hookinfo[1]] = $hookinfo[0]; + if(preg_match("/;/",$hook)){ + $hookinfo = split(";",$hook); + $ret[$hookinfo[0]] = $hookinfo[0]; }else{ $ret[$hook] = $hook; } diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc index f33fcae8f..71e39672e 100644 --- a/plugins/admin/systems/class_workstationStartup.inc +++ b/plugins/admin/systems/class_workstationStartup.inc @@ -154,7 +154,35 @@ class workstartup extends plugin } } } - $this->FAIServRepConfig =$test; + + /* Add possible elements from hook */ + $lines= $this->GetHookElements(); + foreach ($lines as $hline){ + $entries= split(";", $hline); + if (isset($entries[1]) && !isset($test[$entries[1]])){ + $test[$entries[1]]['RELEASE']= array(); + + /* Split releases */ + if (isset($entries[2])){ + $releases= split(",", $entries[2]); + + foreach ($releases as $release){ + $rname= preg_replace('/:.*$/', '', $release); + $sections= split(':', preg_replace('/^[^:]+:([^|]+)|.*$/', '\1', $release)); + $classes= split('\|', preg_replace('/^[^|]+\|(.*)$/', '\1', $release)); + $test[$entries[1]]['RELEASE'][$rname]= array(); + $test[$entries[1]]['RELEASE'][$rname]['SECTION']= $sections; + foreach ($classes as $class){ + if ($class != ""){ + $test[$entries[1]]['RELEASE'][$rname]['PACKAGES'][$class]= $class; + } + } + } + } + } + } + + $this->FAIServRepConfig= $test; /* Get arrays */ foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){ @@ -968,6 +996,29 @@ class workstartup extends plugin return($a_return); } + + function GetHookElements() + { + $ret = array(); + $cmd= search_config($this->config->data['TABS'], "servrepository", "REPOSITORY_HOOK"); + 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); + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/plugins/admin/systems/servRepositorySetup.tpl b/plugins/admin/systems/servRepositorySetup.tpl index e65ee4d9e..bdc8b7bdc 100644 --- a/plugins/admin/systems/servRepositorySetup.tpl +++ b/plugins/admin/systems/servRepositorySetup.tpl @@ -5,19 +5,19 @@ - - diff --git a/plugins/admin/systems/workstationStartup.tpl b/plugins/admin/systems/workstationStartup.tpl index c27a8ce2a..e9ae1070d 100644 --- a/plugins/admin/systems/workstationStartup.tpl +++ b/plugins/admin/systems/workstationStartup.tpl @@ -39,7 +39,6 @@

 {t}Release{/t}

{t}Release{/t} + {t}Parent server{/t} - +
{t}Parent server{/t} + {t}Release{/t} - +
-