diff --git a/e107_plugins/tinymce/admin_config.php b/e107_plugins/tinymce/admin_config.php index 203107842..be744fa46 100644 --- a/e107_plugins/tinymce/admin_config.php +++ b/e107_plugins/tinymce/admin_config.php @@ -9,8 +9,8 @@ * Plugin Administration - gsitemap * * $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/admin_config.php,v $ - * $Revision: 1.1 $ - * $Date: 2009-07-01 02:52:08 $ + * $Revision: 1.2 $ + * $Date: 2009-07-01 04:19:55 $ * $Author: e107coders $ * */ @@ -22,11 +22,10 @@ if(!getperms("P") || !plugInstalled('tinymce')) } $e_wysiwyg = 'content'; -require_once(e_ADMIN."auth.php"); require_once (e_HANDLER.'message_handler.php'); $emessage = &eMessage::getInstance(); -if($_POST['save_settings']) +if($_POST['save_settings']) // Needs to be saved before e_meta.php is loaded by auth.php. { $pref['tinymce']['customjs'] = $_POST['customjs']; $pref['tinymce']['theme_advanced_buttons1'] = $_POST['theme_advanced_buttons1']; @@ -36,12 +35,18 @@ if($_POST['save_settings']) $pref['tinymce']['plugins'] = $_POST['mce_plugins']; save_prefs(); - - $emessage->add(LAN_UPDATED, E_MESSAGE_SUCCESS); - $e107->ns->tablerender(LAN_UPDATED, $emessage->render()); - } +require_once(e_ADMIN."auth.php"); + + +if($_POST['save_settings']) // is there an if $emessage? $emessage->hasMessage doesn't return TRUE. +{ + $emessage->add(LAN_UPDATED, E_MESSAGE_SUCCESS); + $e107->ns->tablerender(LAN_UPDATED, $emessage->render()); +} + + require_once(e_HANDLER."file_class.php"); $fl = new e_file; @@ -62,7 +67,7 @@ if($_POST['save_settings']) if(!$pref['tinymce']['theme_advanced_buttons3']) { - $pref['tinymce']['theme_advanced_buttons3'] = "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen"; + $pref['tinymce']['theme_advanced_buttons3'] = "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen,emoticons"; } if(!$pref['tinymce']['theme_advanced_buttons4']) @@ -77,7 +82,7 @@ if($_POST['save_settings']) - + diff --git a/e107_plugins/tinymce/plugins/emoticons/editor_plugin.js b/e107_plugins/tinymce/plugins/emoticons/editor_plugin.js index f05bc502d..e289bd92b 100644 --- a/e107_plugins/tinymce/plugins/emoticons/editor_plugin.js +++ b/e107_plugins/tinymce/plugins/emoticons/editor_plugin.js @@ -1,56 +1,81 @@ +/** + * $Id: editor_plugin.js,v 1.2 2009-07-01 04:19:55 e107coders Exp $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ -tinyMCE.importPluginLanguagePack('emoticons', 'en'); +(function() { + // Load plugin specific language pack + tinymce.PluginManager.requireLangPack('emoticons'); -// Plucin static class -var TinyMCE_emoticonsPlugin = { - getInfo : function() { - return { - longname : 'emoticons', - author : 'CaMer0n', - authorurl : 'http://e107coders.org', - infourl : 'http://www.e107.org', - version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion - }; - }, + tinymce.create('tinymce.plugins.EmoticonsPlugin', { + /** + * Initializes the plugin, this will be executed after the plugin has been created. + * This call is done before the editor instance has finished it's initialization so use the onInit event + * of the editor instance to intercept that event. + * + * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. + * @param {string} url Absolute URL to where the plugin is located. + */ + init : function(ed, url) { + // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample'); + ed.addCommand('mceEmotion', function() { + ed.windowManager.open({ + file : url + '/emoticons.php', + width : 220 + parseInt(ed.getLang('emoticons.delta_width', 0)), + height : 220 + parseInt(ed.getLang('emoticons.delta_height', 0)), + inline : 1 + }, { + plugin_url : url, // Plugin absolute URL + some_custom_arg : 'custom arg' // Custom argument + }); + }); - /** - * Returns the HTML contents of the emoticons control. - */ - getControlHTML : function(cn) { - switch (cn) { - case "emoticons": - return tinyMCE.getButtonHTML(cn, 'lang_emoticons_desc', '{$pluginurl}/images/emoticons.png', 'mceEmotion'); + // Register example button + ed.addButton('emoticons', { + title : 'emoticons.desc', + cmd : 'mceEmotion', + image : url + '/images/emoticons.png' + }); + + // Add a node change handler, selects the button in the UI when a image is selected + ed.onNodeChange.add(function(ed, cm, n) { + cm.setActive('emoticons', n.nodeName == 'IMG'); + }); + }, + + /** + * Creates control instances based in the incomming name. This method is normally not + * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons + * but you sometimes need to create more complex controls like listboxes, split buttons etc then this + * method can be used to create those. + * + * @param {String} n Name of the control to create. + * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control. + * @return {tinymce.ui.Control} New control instance or null if no control was created. + */ + createControl : function(n, cm) { + return null; + }, + + /** + * Returns information about the plugin as a name/value array. + * The current keys are longname, author, authorurl, infourl and version. + * + * @return {Object} Name/value array containing information about the plugin. + */ + getInfo : function() { + return { + longname : 'Emoticons plugin', + author : 'CaMer0n', + authorurl : 'http://e107coders.org', + infourl : '', + version : "1.0" + }; } + }); - return ""; - }, - - /** - * Executes the mceEmotion command. - */ - execCommand : function(editor_id, element, command, user_interface, value) { - // Handle commands - switch (command) { - case "mceEmotion": - var template = new Array(); - - template['file'] = '../../plugins/emoticons/emoticons.php'; // Relative to theme - template['width'] = 200; - template['height'] = 200; - - // Language specific width and height addons - template['width'] += tinyMCE.getLang('lang_emoticons_delta_width', 0); - template['height'] += tinyMCE.getLang('lang_emoticons_delta_height', 0); - - tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"}); - - return true; - } - - // Pass to next handler in chain - return false; - } -}; - -// Register plugin -tinyMCE.addPlugin('emoticons', TinyMCE_emoticonsPlugin); \ No newline at end of file + // Register plugin + tinymce.PluginManager.add('emoticons', tinymce.plugins.EmoticonsPlugin); +})(); \ No newline at end of file diff --git a/e107_plugins/tinymce/plugins/emoticons/emoticons.php b/e107_plugins/tinymce/plugins/emoticons/emoticons.php index c24041b91..2a3f91beb 100644 --- a/e107_plugins/tinymce/plugins/emoticons/emoticons.php +++ b/e107_plugins/tinymce/plugins/emoticons/emoticons.php @@ -8,7 +8,7 @@ require_once(HEADERF); $emotes = $sysprefs->getArray("emote_".$pref['emotepack']); - $str = "
"; + $str = "
"; foreach($emotes as $key => $value){ $key = str_replace("!", ".", $key); $key = preg_replace("#_(\w{3})$#", ".\\1", $key); @@ -17,7 +17,8 @@ require_once(HEADERF); $str .= "\n\"\" "; } - $str .= "
"; + $str .= "
+
"; echo $str; diff --git a/e107_plugins/tinymce/plugins/emoticons/langs/en.js b/e107_plugins/tinymce/plugins/emoticons/langs/en.js index b88cc6352..adf84e486 100644 --- a/e107_plugins/tinymce/plugins/emoticons/langs/en.js +++ b/e107_plugins/tinymce/plugins/emoticons/langs/en.js @@ -1,5 +1,5 @@ // UK lang variables -tinyMCELang['lang_insert_emoticons_title'] = 'Insert emotion'; -tinyMCELang['lang_emoticons_desc'] = 'Emotions'; - +tinyMCE.addI18n('en.emoticons',{ + desc : 'Insert emotion' +}); \ No newline at end of file diff --git a/e107_plugins/tinymce/wysiwyg.php b/e107_plugins/tinymce/wysiwyg.php index 649611c3a..39ba84bec 100644 --- a/e107_plugins/tinymce/wysiwyg.php +++ b/e107_plugins/tinymce/wysiwyg.php @@ -4,8 +4,8 @@ | e107 website system - Tiny MCE controller file. | | $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/wysiwyg.php,v $ -| $Revision: 1.9 $ -| $Date: 2009-07-01 02:52:08 $ +| $Revision: 1.10 $ +| $Date: 2009-07-01 04:19:55 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -45,9 +45,9 @@ $thescript = (strpos($_SERVER['SERVER_SOFTWARE'],"mod_gzip")) ? "tiny_mce_gzip.p $text = "\n"; $text .= "\n ";
PreviewPreview

[Refresh Preview]