From 6b91b672cbe6c4da8178152aea5e84075a168db7 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 24 Nov 2005 09:55:55 +0000 Subject: [PATCH] Some style fixes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2039 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_debconfTemplate.inc | 110 ++++++++++++++---------------- 1 file changed, 50 insertions(+), 60 deletions(-) diff --git a/include/class_debconfTemplate.inc b/include/class_debconfTemplate.inc index 7438df7ca..7b586b28c 100644 --- a/include/class_debconfTemplate.inc +++ b/include/class_debconfTemplate.inc @@ -172,10 +172,10 @@ class debconf { /* Walk through all template variables */ foreach($this->template as $post_name => $entry){ - + /* Check if this var is set*/ if(isset($_POST[$entry['post_name']])){ - + /* special handling for arrays */ if(is_array($_POST[$entry['post_name']])){ $str = ""; @@ -189,7 +189,20 @@ class debconf } } } - + + foreach($this->template as $post_name => $entry){ + if(isset($_POST["multi-".$entry['post_name']])){ + $this->template[$post_name]['Default']= ""; + foreach($_POST as $name => $value){ + if(preg_match("/".$entry['post_name']."-multi-/",$name)){ + $this->template[$post_name]['Default'] .= $value.", "; + } + } + $this->template[$post_name]['Default'] = preg_replace("/, $/","",$this->template[$post_name]['Default']); + } + } + + } @@ -210,7 +223,7 @@ class debconf function get_dialog() { if ($this->has_template){ - $result= ""; + $result= ""; foreach ($this->template as $post_name => $entry){ @@ -222,13 +235,17 @@ class debconf /* Produce type specific output */ $fn= "render_".$entry['Type']; - $result.= $this->$fn($entry); + $str = $this->$fn($entry); + if(!empty($str)){ + $result.=$str.""; + } } else { //php_error(E_WARNING, "An unknown type has been specified in the debconf template. Please fix."); } } - $result .= ""; + + $result .= "
  

 

"; return ($result); } else { return _("This package has no debconf options."); @@ -241,12 +258,11 @@ class debconf $post_name= $data['post_name']; $result=" - - - - - -
- ".$data['Topic']." + ".$data['Topic']."
".$data['Description']."
"; + "; foreach(array("true","false") as $value){ if($data['Default'] == $value){ @@ -259,13 +275,8 @@ class debconf $result.= "
".$data['Description']." -
"; + "; - $result.= "

 

"; return ($result); } @@ -282,36 +293,27 @@ class debconf } } - $result=" - - + $result .= " - - - -
- ".$data['Topic']." + ".$data['Topic']."
".$data['Description']."
- + + "; + $defs = split(", ",$data['Default']); - foreach($choices as $value){ if(in_array($value,$defs)){ - $result.="\n"; + $result.="\n".$value."
"; }else{ - $result.="\n"; + $result.="\n".$value."
"; } } - $result.= " - -
".$data['Description']." -
"; - $result.= "

 

"; + "; return ($result); } @@ -327,12 +329,11 @@ class debconf function render_password($data) { - $result= ""; + $result= ""; $result.= "
"; - $result.= "".$data['Topic']." 

"; + $result.= "".$data['Topic']."
".$data['Description']."
 

"; $result.= $data['Description']; - $result.= "
"; - $result.= "

 

"; + $result.= ""; return ($result); } @@ -353,32 +354,27 @@ class debconf $result=" - + - - - - -
- ".$data['Topic']." + ".$data['Topic']."
".$data['Description']."
- + "; foreach($choices as $value){ if($data['Default'] == $value){ - $result.="\n"; + $result.="\n".htmlentities($value)."
"; }else{ - $result.="\n"; + $result.="\n".htmlentities($value)."
"; } } $result.= " - -
".$data['Description']." +
"; - $result.= "

 

"; + "; return ($result); } @@ -386,22 +382,16 @@ class debconf function render_string($data) { - $result= " + $result= " - - - - -
- ".$data['Topic']."  + ".$data['Topic']." 
".$data['Description']."
+
- ".$data['Description']." -
"; - $result.= "

 

"; + "; return ($result); } -- 2.30.2