r39950 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39949‎ | r39950 | r39951 >
Date:16:35, 25 August 2008
Author:yaron
Status:old
Tags:
Comment:
Added handling for Javascript for free text field (theoretical, at this point)
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc
@@ -158,7 +158,7 @@
159159 // remove the '<nowiki>' tags, leaving us with what we need
160160 global $sfgDisableWikiTextParsing;
161161 if (! $sfgDisableWikiTextParsing) {
162 - $form_def = strtr($form_def, array('{{{' => '<nowiki>{{{', '}}}' => '}}}</nowiki>'));
 162+ $form_def = "__NOEDITSECTION__\n" . strtr($form_def, array('{{{' => '<nowiki>{{{', '}}}' => '}}}</nowiki>'));
163163 $wgParser->mOptions = new ParserOptions();
164164 $wgParser->mOptions->initialiseFromUser($wgUser);
165165 $form_def = $wgParser->parse($form_def, $this->mPageTitle, $wgParser->mOptions)->getText();
@@ -172,6 +172,11 @@
173173 $free_text_was_included = false;
174174 $free_text_preload_page = null;
175175 $all_values_for_template = array();
 176+ // replace HTML-encoded representations of curly brackets with actual
 177+ // curly brackets - this is a hack to allow for forms to include
 178+ // templates that themselves contain form elements - the escaping is
 179+ // needed to make sure that those elements don't get parsed too early
 180+ $form_def = str_replace(array('&#123;', '&#125;'), array('{', '}'), $form_def);
176181 while ($brackets_loc = strpos($form_def, "{{{", $start_position)) {
177182 $brackets_end_loc = strpos($form_def, "}}}", $brackets_loc);
178183 $bracketed_string = substr($form_def, $brackets_loc + 3, $brackets_end_loc - ($brackets_loc + 3));
@@ -505,6 +510,7 @@
506511 $sfgTabIndex++;
507512 $sfgFieldNum++;
508513 list($new_text, $new_javascript_text) = SFFormInputs::textAreaHTML('<free_text>', 'free_text', false, ($form_is_disabled || $is_restricted), $field_args);
 514+ $fields_javascript_text .= $new_javascript_text;
509515 }
510516 $free_text_was_included = true;
511517 // add a similar placeholder to the data text

Status & tagging log