From e28f40cb6ed2c3921668b84bd24248d3bee39cf5 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 11 Aug 2006 07:23:42 +0000 Subject: [PATCH] Added ability to add more than one section name at once. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4482 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/class_servRepositorySetup.inc | 19 ++++++++++++++++++- plugins/admin/systems/servRepositorySetup.tpl | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/plugins/admin/systems/class_servRepositorySetup.inc b/plugins/admin/systems/class_servRepositorySetup.inc index 8fec23baa..6bbfb4348 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} - + -- 2.30.2