r45422 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45421‎ | r45422 | r45423 >
Date:18:28, 5 January 2009
Author:yaron
Status:deferred
Tags:
Comment:
Fix from Maxim Ilinykh for template parsing, fix from Serhiy Kutnii for Javascript validation,
removed obsolete "no SMW installed" handling
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc
@@ -316,7 +316,7 @@
317317 }
318318 // handle an end to a field and/or template declaration
319319 $template_ended = ($uncompleted_curly_brackets == 0 && $uncompleted_square_brackets == 0);
320 - $field_ended = ($c == '|' && $uncompleted_square_brackets == 0);
 320+ $field_ended = ($c == '|' && $uncompleted_square_brackets == 0 && $uncompleted_curly_brackets <= 2);
321321 if ($template_ended || $field_ended) {
322322 // if this was the last character in the template, remove
323323 // the closing curly brackets
@@ -759,7 +759,11 @@
760760 }
761761 } else {
762762 if ($allow_multiple) {
763 - $sfgJSValidationCalls[] = "validate_multiple_mandatory_fields($sfgFieldNum)";
 763+ if ($all_instances_printed) {
 764+ $sfgJSValidationCalls[] = "validate_multiple_mandatory_fields($sfgFieldNum)";
 765+ } else {
 766+ $sfgJSValidationCalls[] = "validate_mandatory_field(\"input_$sfgFieldNum\", \"info_$sfgFieldNum\")";
 767+ }
764768 } elseif (($form_field->template_field->is_list && $form_field->template_field->field_type == 'enumeration' && $input_type != 'listbox') || ($input_type == 'checkboxes')) {
765769 $sfgJSValidationCalls[] = "validate_mandatory_checkboxes('$input_id', '$info_id')";
766770 // if it's not a radiobutton...
@@ -1148,12 +1152,6 @@
11491153 // first, so that if there's a conflict they'll be overridden
11501154 $funcArgs[] = array_merge($default_args, $other_args);
11511155 list($text, $javascript_text) = call_user_func_array($hook_values[0], $funcArgs);
1152 - // escape out here if user doesn't have SMW installed
1153 - } elseif ($smwgContLang == null) {
1154 - $size = $template_field->field_args['size'];
1155 - if ($size == null) $size = 35;
1156 - $field_args = array('size' => $size);
1157 - list($text, $javascript_text) = SFFormInputs::textEntryHTML($cur_value, $form_field->input_name, $form_field->is_mandatory, $form_field->is_disabled, $field_args);
11581156 } else { // input type not defined in form
11591157 $field_type = $template_field->field_type;
11601158 $is_list = ($form_field->is_list || $template_field->is_list);

Status & tagging log