r77625 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77624‎ | r77625 | r77626 >
Date:00:24, 3 December 2010
Author:yaron
Status:deferred
Tags:
Comment:
Moved FancyBox handling out of this file and into SemanticForms.js, so it no longer happens inline
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormInputs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.php
@@ -44,11 +44,12 @@
4545
4646 class SFTextInput extends SFFormInput {
4747 static function uploadLinkHTML( $input_id, $delimiter = null, $default_filename = null ) {
48 - global $wgOut, $sfgScriptPath, $sfgFancyBoxIncluded;
 48+ global $wgOut, $sfgScriptPath, $sfgFancyBoxInputs;
4949
5050 $upload_window_page = SpecialPage::getPage( 'UploadWindow' );
5151 $query_string = "sfInputID=$input_id";
5252 $fancybox_id = "fancybox_$input_id";
 53+ $sfgFancyBoxInputs[] = $input_id;
5354 if ( $delimiter != null )
5455 $query_string .= "&sfDelimiter=$delimiter";
5556 if ( $default_filename != null )
@@ -61,31 +62,7 @@
6263 else
6364 $style = '';
6465
65 - if ( !$sfgFancyBoxIncluded && !class_exists( 'ResourceLoader' ) ) {
66 - $sfgFancyBoxIncluded = true;
67 - global $wgOut;
68 - $wgOut->addScriptFile( "$sfgScriptPath/libs/jquery.fancybox-1.3.1.js" );
69 - }
70 -
71 - $fancybox_js =<<<END
72 -<script type="text/javascript">
73 -jQuery(document).ready(function() {
74 - jQuery("#$fancybox_id").fancybox({
75 - 'width' : '75%',
76 - 'height' : '75%',
77 - 'autoScale' : false,
78 - 'transitionIn' : 'none',
79 - 'transitionOut' : 'none',
80 - 'type' : 'iframe',
81 - 'overlayColor' : '#222',
82 - 'overlayOpacity' : '0.8'
83 - });
84 -});
85 -</script>
86 -END;
87 - $wgOut->addScript($fancybox_js);
88 -
89 - $text = " <a id = \"$fancybox_id\" href=\"$upload_window_url\" title=\"$upload_label\" rev=\"$style\">$upload_label</a>";
 66+ $text = " <a id=\"$fancybox_id\" href=\"$upload_window_url\" title=\"$upload_label\" rev=\"$style\">$upload_label</a>";
9067 return $text;
9168 }
9269
@@ -583,7 +560,6 @@
584561 $text .= <<<END
585562 <span id="$info_id" class="errorMessage"></span>
586563 <div class="page_name_auto_complete" id="$div_name"></div>
587 -<script type="text/javascript">/* <![CDATA[ */
588564
589565 END;
590566
@@ -607,9 +583,13 @@
608584 $cur_value = str_replace( '"', '\"', $cur_value );
609585 $cur_value = str_replace( "\n", '\n', $cur_value );
610586 $cur_value = str_replace( "\r", '\r', $cur_value );
611 - $text .= "document.getElementById('$input_id').value = \"$cur_value\"\n";
 587+ $text .= <<<END
 588+ <script type="text/javascript">/* <![CDATA[ */
 589+ document.getElementById('$input_id').value = "$cur_value"
 590+ /* ]]> */</script>
 591+
 592+END;
612593 }
613 - $text .= '/* ]]> */</script>';
614594 return array( $text, null );
615595 }
616596

Status & tagging log