Index: trunk/extensions/SemanticForms/SemanticForms.php |
— | — | @@ -229,6 +229,11 @@ |
230 | 230 | 'styles' => 'skins/SF_collapsible.css', |
231 | 231 | 'dependencies' => array( 'jquery' ), |
232 | 232 | ), |
| 233 | + 'ext.semanticforms.wikieditor' => $sfgResourceTemplate + array( |
| 234 | + 'scripts' => 'libs/SF_wikieditor.js', |
| 235 | +// 'styles' => 'skins/SF_wikieditor.css', // no styles necessary? |
| 236 | + 'dependencies' => array('jquery.wikiEditor'), |
| 237 | + ), |
233 | 238 | ); |
234 | 239 | } |
235 | 240 | |
Index: trunk/extensions/SemanticForms/specials/SF_FormEdit.php |
— | — | @@ -90,6 +90,7 @@ |
91 | 91 | static function printForm( &$form_name, &$target_name, $alt_forms = array(), $redirectOnError = false ) { |
92 | 92 | global $wgOut, $wgRequest, $wgUser, $sfgFormPrinter; |
93 | 93 | |
| 94 | + wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) ); |
94 | 95 | SFUtils::loadMessages(); |
95 | 96 | |
96 | 97 | // If we have no form name we might as well stop right away |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaWithAutocompleteInput.php |
— | — | @@ -117,6 +117,20 @@ |
118 | 118 | } |
119 | 119 | $text = "\n" . Xml::tags( 'span', array( 'class' => $spanClass ), $text ); |
120 | 120 | |
| 121 | + |
| 122 | + if ( array_key_exists( 'wikieditor', $other_args ) && |
| 123 | + array_search( 'jquery.wikiEditor', $wgOut->getResourceLoader()->getModuleNames() ) !== FALSE ) { |
| 124 | + |
| 125 | + $wgOut->addModules( 'ext.semanticforms.wikieditor' ); |
| 126 | + |
| 127 | + $jstext = <<<JAVASCRIPT |
| 128 | +jQuery(function(){ jQuery('#input_$sfgFieldNum').SemanticForms_registerInputInit( ext.wikieditor.init, null ); }); |
| 129 | +JAVASCRIPT; |
| 130 | + |
| 131 | + // write JS code directly to the page's code |
| 132 | + $wgOut->addScript( '<script type="text/javascript">' . $jstext . '</script>' ); |
| 133 | + } |
| 134 | + |
121 | 135 | return $text; |
122 | 136 | } |
123 | 137 | |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaInput.php |
— | — | @@ -29,6 +29,7 @@ |
30 | 30 | } |
31 | 31 | |
32 | 32 | public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
| 33 | + global $wgOut; |
33 | 34 | global $sfgTabIndex, $sfgFieldNum; |
34 | 35 | |
35 | 36 | $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput'; |
— | — | @@ -99,6 +100,20 @@ |
100 | 101 | $spanClass .= ' mandatoryFieldSpan'; |
101 | 102 | } |
102 | 103 | $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text ); |
| 104 | + |
| 105 | + if ( array_key_exists( 'wikieditor', $other_args ) && |
| 106 | + array_search( 'jquery.wikiEditor', $wgOut->getResourceLoader()->getModuleNames() ) !== FALSE ) { |
| 107 | + |
| 108 | + $wgOut->addModules( 'ext.semanticforms.wikieditor' ); |
| 109 | + |
| 110 | + $jstext = <<<JAVASCRIPT |
| 111 | +jQuery(function(){ jQuery('#input_$sfgFieldNum').SemanticForms_registerInputInit( ext.wikieditor.init, null ); }); |
| 112 | +JAVASCRIPT; |
| 113 | + |
| 114 | + // write JS code directly to the page's code |
| 115 | + $wgOut->addScript( '<script type="text/javascript">' . $jstext . '</script>' ); |
| 116 | + } |
| 117 | + |
103 | 118 | return $text; |
104 | 119 | } |
105 | 120 | |
Index: trunk/extensions/SemanticForms/libs/SF_wikieditor.js |
— | — | @@ -0,0 +1,31 @@ |
| 2 | +// setup wikieditor functionality |
| 3 | +jQuery(function(){ |
| 4 | + ext.wikieditor.setup(); |
| 5 | +}); |
| 6 | + |
| 7 | +// create ext if it does not exist yet |
| 8 | +if ( typeof( window[ 'ext' ] ) == "undefined" ) { |
| 9 | + window[ 'ext' ] = {}; |
| 10 | +} |
| 11 | + |
| 12 | +window.ext.wikieditor = new function(){ |
| 13 | + |
| 14 | + var config; |
| 15 | + |
| 16 | + // common setup for all editor instances |
| 17 | + function setup () { |
| 18 | + config = jQuery.wikiEditor.modules.toolbar.config.getDefaultConfig(); |
| 19 | + config.toolbar.advanced.groups.insert.tools.table.filters = ['textarea:not(#wpTextbox1):not(.toolbar-dialogs)']; |
| 20 | + } |
| 21 | + |
| 22 | + // initialize the wikieditor on the specified element |
| 23 | + function init ( input_id, params ) { |
| 24 | + var input = jQuery( '#' + input_id ); |
| 25 | + input.wikiEditor( 'addModule', config ); |
| 26 | + } |
| 27 | + |
| 28 | + // export public funcitons |
| 29 | + this.setup = setup; |
| 30 | + this.init = init; |
| 31 | + |
| 32 | +}; |
Property changes on: trunk/extensions/SemanticForms/libs/SF_wikieditor.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 33 | + native |