Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.php |
— | — | @@ -10,59 +10,6 @@ |
11 | 11 | |
12 | 12 | class SFFormUtils { |
13 | 13 | |
14 | | - static function chooserJavascript() { |
15 | | - $javascript_text = <<<END |
16 | | -<script type="text/javascript">/* <![CDATA[ */ |
17 | | - |
18 | | -function updatechooserbutton(f,n) |
19 | | -{ |
20 | | - document.getElementById(n).disabled = (f.options[f.selectedIndex].value=="invalid"); |
21 | | -} |
22 | | - |
23 | | -function addInstanceFromChooser(chooserid) |
24 | | -{ |
25 | | - var chooser = document.getElementById(chooserid); |
26 | | - var optionstring = chooser.options[chooser.selectedIndex].value; |
27 | | - var pos = optionstring.indexOf(","); |
28 | | - var tabindex = optionstring.substr(0,pos); |
29 | | - var chooservalue = optionstring.substr(pos+1); |
30 | | - addInstance('starter_' + chooservalue, 'main_' + chooservalue, parseInt(tabindex)); |
31 | | -} |
32 | | - |
33 | | -//The fieldset containing the given element was just updated. If the fieldset is associated with a chooser, |
34 | | -//ensure that the fieldset is hidden if and only if there are no template instances inside. |
35 | | -function hideOrShowFieldset(element) |
36 | | -{ |
37 | | - //Find fieldset |
38 | | - while (element.tagName.toLowerCase() != "fieldset") |
39 | | - element = element.parentNode; |
40 | | - //Bail out if fieldset is not part of chooser |
41 | | - if (!element.getAttribute("haschooser")) |
42 | | - return; |
43 | | - //Now look for "input" or "select" tags that don't look like they're part of the starter template |
44 | | - var inputs = element.getElementsByTagName("input"); |
45 | | - var x; |
46 | | - var show = false; |
47 | | - for (x=0;x<inputs.length;x++) |
48 | | - { |
49 | | - if (inputs[x].type=="text" && inputs[x].name.indexOf("[num]") == -1) |
50 | | - show = true; |
51 | | - } |
52 | | - var selects = element.getElementsByTagName("select"); |
53 | | - for (x=0;x<selects.length;x++) |
54 | | - { |
55 | | - if (selects[x].name.indexOf("[num]") == -1) |
56 | | - show = true; |
57 | | - } |
58 | | - //Now show or hide fieldset |
59 | | - element.style.display = (show?"block":"none"); |
60 | | -} |
61 | | -/* ]]> */ </script> |
62 | | - |
63 | | -END; |
64 | | - return $javascript_text; |
65 | | - } |
66 | | - |
67 | 14 | /** |
68 | 15 | * All the Javascript calls to validate both the type of each |
69 | 16 | * form field and their presence, for mandatory fields |
— | — | @@ -243,7 +190,7 @@ |
244 | 191 | return $javascript_text; |
245 | 192 | } |
246 | 193 | |
247 | | - static function instancesJavascript( $using_choosers ) { |
| 194 | + static function instancesJavascript() { |
248 | 195 | $remove_text = wfMsg( 'sf_formedit_remove' ); |
249 | 196 | $javascript_text = <<<END |
250 | 197 | |
— | — | @@ -311,9 +258,6 @@ |
312 | 259 | |
313 | 260 | //In order to add the new instances in multiple floatBox (multiple templates) |
314 | 261 | fb.tagAnchors(self.document); |
315 | | - if ($using_choosers) { |
316 | | - hideOrShowFieldset(new_div); |
317 | | - } |
318 | 262 | } |
319 | 263 | |
320 | 264 | function removeInstanceEventHandler(this_div_id) |
— | — | @@ -327,8 +271,6 @@ |
328 | 272 | var olddiv = document.getElementById(div_id); |
329 | 273 | var parent = olddiv.parentNode; |
330 | 274 | parent.removeChild(olddiv); |
331 | | - if ($using_choosers) |
332 | | - hideOrShowFieldset(parent); |
333 | 275 | } |
334 | 276 | |
335 | 277 | END; |
— | — | @@ -752,6 +694,7 @@ |
753 | 695 | |
754 | 696 | static function mainFCKJavascript( $showFCKEditor ) { |
755 | 697 | global $wgUser, $wgScriptPath, $wgFCKEditorExtDir, $wgFCKEditorDir, $wgFCKEditorToolbarSet, $wgFCKEditorHeight; |
| 698 | + global $wgHooks, $wgExtensionFunctions; |
756 | 699 | |
757 | 700 | $newWinMsg = wfMsg( 'rich_editor_new_window' ); |
758 | 701 | $javascript_text = ' |
— | — | @@ -766,6 +709,17 @@ |
767 | 710 | var RTE_TOGGLE_LINK = ' . RTE_TOGGLE_LINK . '; |
768 | 711 | var RTE_POPUP = ' . RTE_POPUP . '; |
769 | 712 | '; |
| 713 | + |
| 714 | + $showRef = 'false'; |
| 715 | + if ( (isset($wgHooks['ParserFirstCallInit']) && in_array('wfCite',$wgHooks['ParserFirstCallInit'])) || (isset($wgExtensionFunctions) && in_array('wfCite',$wgExtensionFunctions)) ) { |
| 716 | + $showRef = 'true'; |
| 717 | + } |
| 718 | + |
| 719 | + $showSource = 'false'; |
| 720 | + if ( (isset ($wgHooks['ParserFirstCallInit']) && in_array('efSyntaxHighlight_GeSHiSetup', $wgHooks['ParserFirstCallInit'])) |
| 721 | + || (isset ($wgExtensionFunctions) && in_array('efSyntaxHighlight_GeSHiSetup', $wgExtensionFunctions)) ) { |
| 722 | + $showSource = 'true'; |
| 723 | + } |
770 | 724 | |
771 | 725 | $javascript_text .= <<<END |
772 | 726 | var oFCKeditor = new FCKeditor( "free_text" ); |
— | — | @@ -774,6 +728,8 @@ |
775 | 729 | oFCKeditor.BasePath = '$wgScriptPath/$wgFCKEditorDir/'; |
776 | 730 | oFCKeditor.Config["CustomConfigurationsPath"] = "$wgScriptPath/$wgFCKEditorExtDir/fckeditor_config.js" ; |
777 | 731 | oFCKeditor.Config["EditorAreaCSS"] = "$wgScriptPath/$wgFCKEditorExtDir/css/fckeditor.css" ; |
| 732 | +oFCKeditor.Config["showreferences"] = '$showRef'; |
| 733 | +oFCKeditor.Config["showsource"] = '$showSource'; |
778 | 734 | oFCKeditor.ToolbarSet = "$wgFCKEditorToolbarSet" ; |
779 | 735 | oFCKeditor.ready = true; |
780 | 736 | |