r84753 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84752‎ | r84753 | r84754 >
Date:17:13, 25 March 2011
Author:yaron
Status:deferred
Tags:
Comment:
Added fix for handling of default values, when used with FCKeditor, with a patch from Stephan Robotta; also some minor formatting improvements
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -365,9 +365,9 @@
366366 // }
367367 // Otherwise, parse it.
368368 // if ( ! $got_form_def_from_cache ) {
369 - $form_def = $wgParser->recursiveTagParse( $form_def );
 369+ $form_def = $wgParser->recursiveTagParse( $form_def );
370370 $form_def = $wgParser->mStripState->unstripBoth( $form_def );
371 - $form_def = $wgParser -> doBlockLevels( $form_def, true );
 371+ $form_def = $wgParser->doBlockLevels( $form_def, true );
372372 wfRunHooks( 'ParserAfterTidy', array( &$wgParser, &$form_def ) );
373373 // } else {
374374 // $form_def = $wgParser->parse( $form_def, $this->mPageTitle, $wgParser->mOptions )->getText();
@@ -680,7 +680,7 @@
681681 if ( $sub_components[0] == 'input type' ) {
682682 $input_type = $sub_components[1];
683683 } elseif ( $sub_components[0] == 'default' ) {
684 - $default_value = $wgParser -> recursiveTagParse( $sub_components[1] );
 684+ $default_value = $wgParser->recursiveTagParse( $sub_components[1] );
685685 } elseif ( $sub_components[0] == 'preload' ) {
686686 // free text field has special handling
687687 if ( $field_name == 'free text' || $field_name == '<freetext>' ) {
@@ -836,6 +836,16 @@
837837 $default_value = '!free_text!';
838838 } else {
839839 $default_value = $cur_value;
 840+ // If the FCKeditor extension is installed and
 841+ // active, the default value needs to be parsed
 842+ // for use in the editor.
 843+ global $wgFCKEditorDir;
 844+ if ( $wgFCKEditorDir && strpos( $existing_page_content, '__NORICHEDITOR__' ) === false ) {
 845+ $showFCKEditor = SFFormUtils::getShowFCKEditor();
 846+ if ( !$form_submitted && ( $showFCKEditor & RTE_VISIBLE ) ) {
 847+ $default_value = SFFormUtils::prepareTextForFCK( $cur_value );
 848+ }
 849+ }
840850 }
841851 $new_text = SFTextAreaInput::getHTML( $default_value, 'free_text', false, ( $form_is_disabled || $is_restricted ), $field_args );
842852 if ( in_array( 'edittools', $free_text_components ) ) {