steffen: server/kolab-webadmin/kolab-webadmin/php/admin/include form.class.php, 1.27, 1.28

cvs at kolab.org cvs at kolab.org
Fri Dec 8 23:02:37 CET 2006


Author: steffen

Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include
In directory doto:/tmp/cvs-serv22713/kolab-webadmin/php/admin/include

Modified Files:
	form.class.php 
Log Message:
Fix for issue1418 (Field customisation issue)

Index: form.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/form.class.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- form.class.php	11 Jul 2006 16:02:24 -0000	1.27
+++ form.class.php	8 Dec 2006 22:02:35 -0000	1.28
@@ -44,8 +44,21 @@
       if( !isset( $value['attrs'] ) ) $this->entries[$key]['attrs'] = '';
     }
   }
+
+  /*private*/function comment_helper( &$value ) {
+	  $ast = '';
+	  if( isset($value['validation'])){
+		  if( is_array( $value['validation'] ) && in_array( 'notempty', $value['validation']) ) {
+			  $ast = '<span class="required_asterisk">*</span> ';
+		  } else if( $value['validation'] == 'notempty' ) {
+			  $ast = '<span class="required_asterisk">*</span> ';			  
+		  }
+	  }
+	  return $ast.$value['comment'];
+  }
   
   function outputForm() {
+	  debug_var_dump($this->entries);
     $str = '<div class="contentform">';
     /*
     if( count( $this->errors ) > 0 ) {
@@ -83,7 +96,7 @@
 		  $str .= '<td><input name="'.$key.'" type="'.$value['type'].'" value="'.MySmarty::htmlentities($value['value']).'" '
 			.MySmarty::htmlentities($value['attrs']).' size="'.$size.'" /></td>';
 		}
-		$str .= '<td>'.$value['comment'].'</td>';
+		$str .= '<td>'.KolabForm::comment_helper($value).'</td>';
 		$str .= '</tr>'."\n";
 		break;
 	  case 'email':
@@ -116,14 +129,14 @@
 			$str .= '</td>';
 		  }
 		}
-		$str .= '<td>'.$value['comment'].'</td>';
+		$str .= '<td>'.KolabForm::comment_helper($value).'</td>';
 		$str .= '</tr>'."\n";
 		break;
 	  case 'comment':
 		$str .= '<tr>';
 		$str .= '<td>'.$value['name'].'</td>';
 		$str .= '<td>'.$value['value'].'</td>';
-		$str .= '<td>'.$value['comment'].'</td>';
+		$str .= '<td>'.KolabForm::comment_helper($value).'</td>';
 		$str .= '</tr>'."\n";
 		break;
       case 'textarea':
@@ -134,7 +147,7 @@
 		} else {
 		  $str .= '<td><textarea name="'.$key.'" rows="5" cols="'.$size.'" '.$value['attrs'].' onkeypress="javascript:textareakeypress()">'.MySmarty::htmlentities($value['value']).'</textarea></td>';
 		}
-		$str .= '<td>'.$value['comment'].'</td>';
+		$str .= '<td>'.KolabForm::comment_helper($value).'</td>';
 		$str .= '</tr>'."\n";
 		break;	
       case 'checkbox':
@@ -145,7 +158,7 @@
 		} else {
 		  $str .= '<td><input name="'.$key.'" type="'.$value['type'].'" value="on" '.($value['value']?'checked':'').' '.$value['attrs'].' /></td>';
 		}
-        $str .= '<td>'.$value['comment'].'</td>';
+        $str .= '<td>'.KolabForm::comment_helper($value).'</td>';
 		$str .= '</tr>'."\n";
 		break;	
 	  case 'checklist':
@@ -184,7 +197,7 @@
 		  $str .= '</select>';
 		  $str .= '</td>';
 		}
-        $str .= '<td>'.$value['comment'].'</td>';
+        $str .= '<td>'.KolabForm::comment_helper($value).'</td>';
 		$str .= '</tr>'."\n";
 		break;
 	  case 'foldertypeselect':
@@ -240,7 +253,7 @@
 		  $str .= '</select>';
 		  $str .= '</td>';
 		}
-		$str .= '<td>'.$value['comment'].'</td>';
+		$str .= '<td>'.KolabForm::comment_helper($value).'</td>';
 		$str .= '</tr>'."\n";	
 		break;
 	  case 'resourcepolicy': // Special Kolab entry for group/resource policies
@@ -290,7 +303,7 @@
 		  }
 		}
 		$str .= '</table></td>';
-        $str .= '<td>'.$value['comment'].'</td>';
+        $str .= '<td>'.KolabForm::comment_helper($value).'</td>';
 		$str .= '</tr>'."\n";
 		break;
       }
@@ -307,6 +320,7 @@
       }
     }
     $str .= '</form>';
+	$str .= '<div class="required_asterisk">'._('* Required field.').'</div>';
     $str .= '</div>';
     return $str;
   }





More information about the commits mailing list