Code

Added ability to add more than one section name at once.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 11 Aug 2006 07:23:42 +0000 (07:23 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 11 Aug 2006 07:23:42 +0000 (07:23 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4482 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_servRepositorySetup.inc
plugins/admin/systems/servRepositorySetup.tpl

index 8fec23baad07671634fe52e988f494a63209d1a5..6bbfb43483c57af16ed7b8474d89d583fb634d95 100644 (file)
@@ -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){
index bdc8b7bdc568176b258396c9d895b61c8f858872..a87c7b151f335ecb113c2b9ad1452bafc96ebe9b 100644 (file)
@@ -32,7 +32,7 @@
                <td>
                        {t}Sections{/t}<br>
                        {$Sections}
-                       <input type="text"              name="SectionName" value="">
+                       <input type="text"      name="SectionName" value="" style='width:100%;'>
                        <input type="submit"    name="AddSection"  value="{t}Add{/t}">
                </td>
        </tr>