<?php if (!defined('PmWiki')) exit(); /* * Created on Aug 4, 2005 * * Rich text editor support for PmWiki. */ define( 'RichEdit_Version', '0.1'); // Constants for action names. SDV( $RichEdit_EditAction, 'edit' ); SDV( $RichEdit_BrowseAction, 'browse' ); // Whether or not the rich text functionality is enabled. SDV( $RichEdit_Enabled, true ); // Whether or not individual pages should be enabled. // This is compatible with the sectionedit recipe, // and is enabled or disabled independently of // RichEdit. It is included here because the recipe // was incompatible with this one. SDV( $RichEdit_SectionEditEnabled, true); // Whether or not the rich text editor is the default for // authors. SDV( $RichEdit_EnabledByDefault, true ); // Disable significant-whitespace markup. DisableMarkup('^ '); // Load functions to enable and disable the rich text editor. include_once("$FarmC/richedit/selecteditor.php"); // Load markup boxing functions, so that they can be used in config.php // whether or not the user is using the rich text editor. include_once("$FarmC/richedit/boxmarkup.php"); // The preview skin and the code that makes it work SDV( $RichEdit_PreviewSkin, 'preview' ); include_once("$FarmC/richedit/preview.php"); if( isset($_REQUEST['editor']) ) { if( $_REQUEST['editor'] == 'richtext' ) { RichEdit_Enable(); } else if ( $_REQUEST['editor'] == 'plaintext' ) { RichEdit_Disable(); } } // Check if the user has enabled the rich text editor $RichEdit_Enabled = RichEdit_GetRichTextEnabled(); $Conditions['richedit'] = $RichEdit_Enabled; $Conditions['richedit_installed'] = true; // If the rich text editor is enabled, load all of its // accoutrements. if($RichEdit_Enabled) { // Reconfigure the (:e_textarea:) control, // to avoid Firefox flicker bug when using // TinyMCE. $InputTags['e_textarea'] = array( ':html' => "<div style=\"clear:both;overflow:auto;position:relative;\"><textarea \$InputFormArgs onkeydown='if (event.keyCode==27) event.returnValue=false;' >\$EditText</textarea></div>", 'name' => 'text', 'id' => 'text', 'width' => '100%', height=>'500px'); SDV( $RichEdit_RichTextFieldName, 'richText'); SDV( $RichEdit_PlainTextFieldName, 'text'); SDV( $RichEdit_TextFieldName, 'text'); // Load array utility functions, so that we can insert into // the action array. include_once("$FarmC/richedit/arrayutils.php"); // Insert our functions after the call to RestorePage() $EditFunctions = RichEdit_Util_ArrayInsertAfter( 'RestorePage', $EditFunctions, array( 'RichEdit_SetHeader','RichEdit_OnEdit', 'RichEdit_DecodeHtmlSpecials', 'RichEdit_OnSave') ); // Path to the wiki, minus the actual script. // This allows the editor JavaScripts to know where they should load from. SDV( $RichEdit_WikiDir, preg_replace('#/[^/]*$#','',$ScriptUrl,1) ); #SDV( $RichEdit_ContentCSS, $RichEdit_WikiDir . '/cookbook/richedit/css/content.css'); SDV( $RichEdit_ContentCSS, "$FarmC/richedit/css/content.css"); // Relative URL to the editor script. This has to be removed // from certain URLs. SDV( $RichEdit_RelativeScriptUrl, $_SERVER['SCRIPT_NAME'] ); $RichEdit_RichTextFieldName = $RichEdit_PlainTextFieldName = $RichEdit_TextFieldName = 'text'; // Directory in which Perl scripts are to be found and run. // This should be a path, NOT a url, and the directory should // contain the Perl scripts included with this package, // as well as WikiConverter.php. SDV( $RichEdit_PerlDirectory, $FarmS . "/" . "../cgi-bin/" ); include_once( $RichEdit_PerlDirectory . 'WikiConverter.php'); include_once("$FarmC/richedit/editfunctions.php"); SDV( $RichEdit_HeaderInsertFunction, 'RichEdit_Editor_TinyMCE_GetEditorInsertHtml'); // The two editors supported by this script include_once("$FarmC/richedit/editorxinha.php" ); include_once("$FarmC/richedit/editortinymce.php" ); } if( $RichEdit_SectionEditEnabled ) { include_once("$FarmC/richedit/sectioneditfunctions.php"); } ?>