Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php |
— | — | @@ -58,12 +58,13 @@ |
59 | 59 | /** |
60 | 60 | * Register all information about the passed-in form input class. |
61 | 61 | * |
62 | | - * @param Class $inputTypeClass The class representing the new input. Must be derived from SFFormInput. |
| 62 | + * @param Class $inputTypeClass The class representing the new input. |
| 63 | + * Must be derived from SFFormInput. |
63 | 64 | */ |
64 | 65 | public function registerInputType( $inputTypeClass ) { |
65 | 66 | global $smwgContLang; |
66 | 67 | global $sfgInitJSFunctions, $sfgValidationJSFunctions; |
67 | | - |
| 68 | + |
68 | 69 | $inputTypeName = call_user_func( array( $inputTypeClass, 'getName' ) ); |
69 | 70 | $this->mInputTypeClasses[$inputTypeName] = $inputTypeClass; |
70 | 71 | $this->setInputTypeHook( $inputTypeName, array( $inputTypeClass, 'getHTML' ), array() ); |
— | — | @@ -362,7 +363,7 @@ |
363 | 364 | $wgParser = unserialize( serialize( $oldParser ) ); // deep clone of parser |
364 | 365 | $wgParser->clearState(); |
365 | 366 | |
366 | | - // Get the form definition from the cache, if we're using caching and it's |
| 367 | + // Get the form definition from the cache, if we're using caching and it's |
367 | 368 | // there. |
368 | 369 | // $got_form_def_from_cache = false; |
369 | 370 | // global $sfgCacheFormDefinitions; |
— | — | @@ -1359,6 +1360,8 @@ |
1360 | 1361 | $free_text = trim( $free_text ); |
1361 | 1362 | $data_text = str_replace( '!free_text!', '<onlyinclude>!free_text!</onlyinclude>', $data_text ); |
1362 | 1363 | } |
| 1364 | + |
| 1365 | + wfRunHooks( 'sfModifyFreeTextField', array( &$free_text, $existing_page_content ) ); |
1363 | 1366 | // if the FCKeditor extension is installed, use that for the free text input |
1364 | 1367 | global $wgFCKEditorDir; |
1365 | 1368 | if ( $wgFCKEditorDir && strpos( $existing_page_content, '__NORICHEDITOR__' ) === false ) { |
— | — | @@ -1374,8 +1377,8 @@ |
1375 | 1378 | $form_text = str_replace( '!free_text!', $escaped_free_text, $form_text ); |
1376 | 1379 | $data_text = str_replace( '!free_text!', $free_text, $data_text ); |
1377 | 1380 | |
1378 | | - // add a warning in, if we're editing an existing page and that page |
1379 | | - // appears to not have been created with this form |
| 1381 | + // Add a warning in, if we're editing an existing page and that |
| 1382 | + // page appears to not have been created with this form. |
1380 | 1383 | if ( $this->mPageTitle->exists() && ( $existing_page_content != '' ) && ! $source_page_matches_this_form ) { |
1381 | 1384 | $form_text = "\t" . '<div class="warningMessage">' . wfMsg( 'sf_formedit_formwarning', $this->mPageTitle->getFullURL() ) . "</div>\n" . $form_text; |
1382 | 1385 | } |
— | — | @@ -1396,10 +1399,14 @@ |
1397 | 1400 | } |
1398 | 1401 | $form_text .= "\t</form>\n"; |
1399 | 1402 | |
1400 | | - // add Javascript code for form-wide use |
| 1403 | + // Add general Javascript code. |
| 1404 | + wfRunHooks( 'sfAddJavascriptToForm', array( &$javascript_text ) ); |
| 1405 | + |
| 1406 | + // @TODO The FCKeditor Javascript should be handled within |
| 1407 | + // the FCKeditor extension itself, using the hook. |
1401 | 1408 | $javascript_text = ""; |
1402 | 1409 | if ( $free_text_was_included && $showFCKEditor > 0 ) { |
1403 | | - $javascript_text .= SFFormUtils::mainFCKJavascript( $showFCKEditor ); |
| 1410 | + $javascript_text .= SFFormUtils::mainFCKJavascript( $showFCKEditor, $field_args ); |
1404 | 1411 | if ( $showFCKEditor & ( RTE_TOGGLE_LINK | RTE_POPUP ) ) { |
1405 | 1412 | $javascript_text .= SFFormUTils::FCKToggleJavascript(); |
1406 | 1413 | } |
— | — | @@ -1408,8 +1415,8 @@ |
1409 | 1416 | } |
1410 | 1417 | } |
1411 | 1418 | |
1412 | | - // Send the autocomplete values to the browser, along with the mappings |
1413 | | - // of which values should apply to which fields. |
| 1419 | + // Send the autocomplete values to the browser, along with the |
| 1420 | + // mappings of which values should apply to which fields. |
1414 | 1421 | // If doing a replace, the data text is actually the modified original page |
1415 | 1422 | if ( $wgRequest->getCheck( 'partial' ) ) |
1416 | 1423 | $data_text = $existing_page_content; |