Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.php |
— | — | @@ -44,11 +44,12 @@ |
45 | 45 | |
46 | 46 | class SFTextInput extends SFFormInput { |
47 | 47 | static function uploadLinkHTML( $input_id, $delimiter = null, $default_filename = null ) { |
48 | | - global $wgOut, $sfgScriptPath, $sfgFancyBoxIncluded; |
| 48 | + global $wgOut, $sfgScriptPath, $sfgFancyBoxInputs; |
49 | 49 | |
50 | 50 | $upload_window_page = SpecialPage::getPage( 'UploadWindow' ); |
51 | 51 | $query_string = "sfInputID=$input_id"; |
52 | 52 | $fancybox_id = "fancybox_$input_id"; |
| 53 | + $sfgFancyBoxInputs[] = $input_id; |
53 | 54 | if ( $delimiter != null ) |
54 | 55 | $query_string .= "&sfDelimiter=$delimiter"; |
55 | 56 | if ( $default_filename != null ) |
— | — | @@ -61,31 +62,7 @@ |
62 | 63 | else |
63 | 64 | $style = ''; |
64 | 65 | |
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>"; |
90 | 67 | return $text; |
91 | 68 | } |
92 | 69 | |
— | — | @@ -583,7 +560,6 @@ |
584 | 561 | $text .= <<<END |
585 | 562 | <span id="$info_id" class="errorMessage"></span> |
586 | 563 | <div class="page_name_auto_complete" id="$div_name"></div> |
587 | | -<script type="text/javascript">/* <![CDATA[ */ |
588 | 564 | |
589 | 565 | END; |
590 | 566 | |
— | — | @@ -607,9 +583,13 @@ |
608 | 584 | $cur_value = str_replace( '"', '\"', $cur_value ); |
609 | 585 | $cur_value = str_replace( "\n", '\n', $cur_value ); |
610 | 586 | $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; |
612 | 593 | } |
613 | | - $text .= '/* ]]> */</script>'; |
614 | 594 | return array( $text, null ); |
615 | 595 | } |
616 | 596 | |