From: hickert Date: Fri, 11 Aug 2006 07:25:43 +0000 (+0000) Subject: Added ability to add more than one section name at once. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=93f7dd7fbe322c2b5bd17e98acd329cd3b566b19;p=gosa.git Added ability to add more than one section name at once. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4483 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_servRepositorySetup.inc b/plugins/admin/systems/class_servRepositorySetup.inc index 8fec23baa..a1c62e7ba 100644 --- a/plugins/admin/systems/class_servRepositorySetup.inc +++ b/plugins/admin/systems/class_servRepositorySetup.inc @@ -61,7 +61,24 @@ class servRepositorySetup extends plugin $smarty= get_smarty(); if((isset($_POST['AddSection']))&&(isset($_POST['SectionName']))&&(!empty($_POST['SectionName']))){ - $this->Sections[$_POST['SectionName']]=$_POST['SectionName']; + + /* Replace multiple spaces with a single, and cut of white spaces (trim)*/ + $val = preg_replace("/\ \ * /" , " ", trim($_POST['SectionName'])); + + /* check if there are more than one entry given ( "section1 section2 )*/ + if(preg_match("/ /",$val)){ + + /* Generate list of new section names */ + $vals = split(" ",$val); + + /* Add new entries */ + foreach($vals as $entry){ + $entry = trim($entry); + $this->Sections[$entry]=$entry; + } + }else{ + $this->Sections[$val]=$val; + } } foreach($_POST as $name => $value){ diff --git a/plugins/admin/systems/servRepositorySetup.tpl b/plugins/admin/systems/servRepositorySetup.tpl index bdc8b7bdc..a87c7b151 100644 --- a/plugins/admin/systems/servRepositorySetup.tpl +++ b/plugins/admin/systems/servRepositorySetup.tpl @@ -32,7 +32,7 @@ {t}Sections{/t}
{$Sections} - +