- Timestamp:
- Jun 4, 2006 10:56:30 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/module_maker/validation.cli.php
r136 r145 48 48 $type = preg_replace('/^(\w+).*$/', '\\1', $col[1]); 49 49 $is_primary_key = ('PRI' == $col[3]); 50 $unsigned = preg_match('/\s *unsigned\s*$/i', $col[1]);50 $unsigned = preg_match('/\s+unsigned\s*$/i', $col[1]); 51 51 52 52 if (in_array($field, $exclude)) { … … 55 55 56 56 // ----------- isEmpty ------------ 57 $o[] = "\$fv-> isEmpty('$field', _(\"<strong>$title</strong> cannot be blank.\"));";57 $o[] = "\$fv->notEmpty('$field', sprintf(_(\"%s cannot be blank.\"), _(\"$title\")));"; 58 58 59 59 // ----------- stringLength ------------ … … 184 184 } 185 185 if ($max_length > 0 && $len_type == 'setenum') { 186 $o[] = "\$fv->stringLength('$field', 0, $max_length, _(\" <strong>$title</strong>has an invalid selection.\"));";186 $o[] = "\$fv->stringLength('$field', 0, $max_length, _(\"$title has an invalid selection.\"));"; 187 187 } 188 188 if ($max_length > 0 && $len_type == 'string') { 189 $o[] = "\$fv->stringLength('$field', 0, $max_length, _(\"<strong>$title</strong> must contain less than " . ($max_length+1) . " characters.\"));";189 $o[] = "\$fv->stringLength('$field', 0, $max_length, sprintf(_(\"%s must be %f-to-%f characters in length.\"), _(\"$title\"), 0, $max_length));"; 190 190 } 191 191 if ($len_type == 'num') { 192 $o[] = "\$fv->numericRange('$field', $min, $max, _(\"<strong>$title</strong> must be a valid number between $min and $max.\"));";192 $o[] = "\$fv->numericRange('$field', $min, $max, sprintf(_(\"%s must be a number between %f and %f.\"), _(\"$title\"), $min, $max));"; 193 193 } 194 194 … … 224 224 case 'bigint' : 225 225 $negative_ok = $unsigned ? '' : ', true'; 226 $o[] = "\$fv->isInteger('$field', _(\"<strong>$title</strong> must be an integer.\")$negative_ok);";226 $o[] = "\$fv->isInteger('$field', sprintf(_(\"%s must be an integer.\"), _(\"$title\"))$negative_ok);"; 227 227 break; 228 228 … … 236 236 case 'numeric' : 237 237 $negative_ok = $unsigned ? '' : ', true'; 238 $o[] = "\$fv->isFloat('$field', _(\"<strong>$title</strong> must be a valid number.\")$negative_ok);";238 $o[] = "\$fv->isFloat('$field', sprintf(_(\"%s must be a valid number.\"), _(\"$title\"))$negative_ok);"; 239 239 break; 240 240 241 241 case 'date' : 242 242 case 'datetime' : 243 $o[] = "\$fv->validateStrDate('$field', _(\"<strong>$title</strong> must be a valid date in YYYY-MM-DD format.\"));"; 244 $o[] = "\$fv->checkRegex('$field', '/^\d{4}-\d{2}-\d{2}$/', true, _(\"<strong>$title</strong> must be a valid date in YYYY-MM-DD format.\"));"; 243 // \$fv->validateStrDate('$field', sprintf(_(\"%s must be a valid date in YYYY-MM-DD format.\"), _(\"$field\"))); 244 $o[] = "\$fv->validateStrDate('$field', sprintf(_(\"%s must be a valid date in YYYY-MM-DD format.\"), _(\"$field\")));"; 245 $o[] = "\$fv->checkRegex('$field', '/^\d{4}-\d{2}-\d{2}$/', true, sprintf(_(\"%s must be in YYYY-MM-DD format.\"), _(\"$field\")));"; 245 246 break; 246 247 247 248 case 'timestamp' : 248 $o[] = "\$fv->checkRegex('$field', '/^\d{14}$/', true, _(\"<strong>$title</strong> must be a valid mysql timestamp in YYYYMMDDhhmmss format.\"));";249 $o[] = "\$fv->checkRegex('$field', '/^\d{14}$/', true, sprintf(_(\"%s must be a valid mysql timestamp in YYYYMMDDhhmmss format.\"), _(\"$field\")));"; 249 250 break; 250 251 251 252 case 'time' : 252 $o[] = "\$fv->checkRegex('$field', '/^\d{1,3}:\d{2}:\d{2}$/', true, _(\"<strong>$title</strong> must be a valid time in hh:mm:ss format.\"));";253 $o[] = "\$fv->checkRegex('$field', '/^\d{1,3}:\d{2}:\d{2}$/', true, sprintf(_(\"%s must be a valid time in hh:mm:ss format.\"), _(\"$field\")));"; 253 254 break; 254 255 255 256 case 'year' : 256 $o[] = "\$fv->checkRegex('$field', '/^\d{4}$/', true, _(\"<strong>$title</strong> must be a valid year in YYYY format.\"));";257 $o[] = "\$fv->checkRegex('$field', '/^\d{4}$/', true, sprintf(_(\"%s must be a valid year in YYYY format.\"), _(\"$field\")));"; 257 258 break; 258 259
Note: See TracChangeset
for help on using the changeset viewer.