Code

Handle a special case in debconf configuration
[gosa.git] / trunk / gosa-plugins / fai / admin / fai / class_debconfTemplate.inc
index bbbbbadf202cdcdc9b48333d1bf9a35d63c23b9f..2e9fca6b30ed59dea9958207e5274ef074f77d56 100644 (file)
@@ -190,7 +190,10 @@ class debconf
         if ((isset($entry['Type']))&&(isset($types[$entry['Type']]))){
 
           /* Produce type specific output */
-          $fn= "render_".$entry['Type'];
+          $entry_type = $entry['Type'];
+
+          $fn= sprintf("render_%s", $entry_type);
+
           $str = $this->$fn($entry);
           if(!empty($str)){
             $result.=$str."<tr><td colspan='2'><p class='seperator'>&nbsp;</p></td></tr>";
@@ -241,6 +244,7 @@ class debconf
   {
     $post_name= $data['post_name'];
     if (preg_match('/\$\{/', $data['Choices'])){
+      $data['Description'] .= '<br><br><b>' . _('This debconf question is dynamically generated during package installation and requires choosing between specific options which cannot be presented here. The entered text needs to be one of the valid choices in order to take effect.') . '</b>';
       $result= $this->render_string($data);
     } else {
       $choices= "";
@@ -301,37 +305,37 @@ class debconf
     $post_name= $data['post_name'];
 
     if (preg_match('/\$\{/', $data['Choices'])){
-      $choices= array("Need to use some text...");
+      $result = $this->render_multiselect($data);
     } else {
       $choices= "";
       foreach (split(", ", $data['Choices']) as $choice){
         $choices[]= $choice;
       }
-    }
 
 
-    $result="
-      
-      <tr>
-      <td valign='top'>
-      <h2>".$data['Topic']."</h2>".$data['Description']."
-      </td>
-      <td  valign='top'  style=\"white-space:nowrap; border-left: 1px solid rgb(160, 160, 160);\">
-      ";
+      $result="
+        
+        <tr>
+        <td valign='top'>
+        <h2>".$data['Topic']."</h2>".$data['Description']."
+        </td>
+        <td  valign='top'  style=\"white-space:nowrap; border-left: 1px solid rgb(160, 160, 160);\">
+        ";
 
-    foreach($choices as $value){
-      if($data['Default'] == $value){
-        $result.="\n<input type='radio' name='".$post_name."' value='".htmlentities($value)."' checked >".htmlentities($value)."<br>";
-      }else{
-        $result.="\n<input type='radio' name='".$post_name."' value='".htmlentities($value)."'>".htmlentities($value)."<br>";
+      foreach($choices as $value){
+        if($data['Default'] == $value){
+          $result.="\n<input type='radio' name='".$post_name."' value='".htmlentities($value)."' checked >".htmlentities($value)."<br>";
+        }else{
+          $result.="\n<input type='radio' name='".$post_name."' value='".htmlentities($value)."'>".htmlentities($value)."<br>";
+        }
       }
-    }
 
-    $result.= "
-      
-      </td>
-      </tr>
-      ";
+      $result.= "
+        
+        </td>
+        </tr>
+        ";
+    }
 
     return ($result);
   }