steffen: server/kolab-webadmin/kolab-webadmin/php/admin/include form.class.php, 1.18.2.3, 1.18.2.4

cvs at kolab.org cvs at kolab.org
Fri Dec 8 22:13:00 CET 2006


Author: steffen

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

Modified Files:
      Tag: kolab_2_0_branch
	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.18.2.3
retrieving revision 1.18.2.4
diff -u -d -r1.18.2.3 -r1.18.2.4
--- form.class.php	13 Oct 2005 01:50:24 -0000	1.18.2.3
+++ form.class.php	8 Dec 2006 21:12:58 -0000	1.18.2.4
@@ -44,6 +44,18 @@
       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() {
     $str = '<div class="contentform">';
@@ -69,7 +81,6 @@
 		// Default is text
 		$value['type'] = 'text';
 	  }
-
       switch( $value['type'] ) {
       case 'hidden': continue;
       case 'password':
@@ -88,14 +99,14 @@
 		  $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 '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':
@@ -106,7 +117,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':
@@ -117,7 +128,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 'select':
@@ -137,7 +148,7 @@
 		  $str .= '</select>';
 		  $str .= '</td>';
 		}
-        $str .= '<td>'.$value['comment'].'</td>';
+        $str .= '<td>'.KolabForm::comment_helper($value).'</td>';
 		$str .= '</tr>'."\n";
 		break;
       case 'aclselect': // Special Kolab entry for ACLs
@@ -168,7 +179,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
@@ -218,7 +229,7 @@
 		  }
 		}
 		$str .= '</table></td>';
-        $str .= '<td>'.$value['comment'].'</td>';
+        $str .= '<td>'.KolabForm::comment_helper($value).'</td>';
 		$str .= '</tr>'."\n";
 		break;
       }
@@ -235,6 +246,7 @@
       }
     }
     $str .= '</form>';
+	$str .= '<div class="required_asterisk">'._('* Required field.').'</div>';
     $str .= '</div>';
     return $str;
   }





More information about the commits mailing list