mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Fixed Emoticon Plugin and preview code
This commit is contained in:
@@ -9,8 +9,8 @@
|
|||||||
* Plugin Administration - gsitemap
|
* Plugin Administration - gsitemap
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/admin_config.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/admin_config.php,v $
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
* $Date: 2009-07-01 02:52:08 $
|
* $Date: 2009-07-01 04:19:55 $
|
||||||
* $Author: e107coders $
|
* $Author: e107coders $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -22,11 +22,10 @@ if(!getperms("P") || !plugInstalled('tinymce'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$e_wysiwyg = 'content';
|
$e_wysiwyg = 'content';
|
||||||
require_once(e_ADMIN."auth.php");
|
|
||||||
require_once (e_HANDLER.'message_handler.php');
|
require_once (e_HANDLER.'message_handler.php');
|
||||||
$emessage = &eMessage::getInstance();
|
$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']['customjs'] = $_POST['customjs'];
|
||||||
$pref['tinymce']['theme_advanced_buttons1'] = $_POST['theme_advanced_buttons1'];
|
$pref['tinymce']['theme_advanced_buttons1'] = $_POST['theme_advanced_buttons1'];
|
||||||
@@ -36,12 +35,18 @@ if($_POST['save_settings'])
|
|||||||
$pref['tinymce']['plugins'] = $_POST['mce_plugins'];
|
$pref['tinymce']['plugins'] = $_POST['mce_plugins'];
|
||||||
|
|
||||||
save_prefs();
|
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");
|
require_once(e_HANDLER."file_class.php");
|
||||||
$fl = new e_file;
|
$fl = new e_file;
|
||||||
|
|
||||||
@@ -62,7 +67,7 @@ if($_POST['save_settings'])
|
|||||||
|
|
||||||
if(!$pref['tinymce']['theme_advanced_buttons3'])
|
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'])
|
if(!$pref['tinymce']['theme_advanced_buttons4'])
|
||||||
@@ -77,7 +82,7 @@ if($_POST['save_settings'])
|
|||||||
<table style='".ADMIN_WIDTH."' class='fborder'>
|
<table style='".ADMIN_WIDTH."' class='fborder'>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style='width:20%' class='forumheader3'>Preview</td>
|
<td style='width:20%' class='forumheader3'>Preview<br /><br />[<a href='javascript:start_tinyMce();'>Refresh Preview</a>]</td>
|
||||||
<td style='width:80%' class='forumheader3'>
|
<td style='width:80%' class='forumheader3'>
|
||||||
<textarea id='content' rows='10' cols='10' name='name3' class='tbox' style='width:80%'> </textarea>
|
<textarea id='content' rows='10' cols='10' name='name3' class='tbox' style='width:80%'> </textarea>
|
||||||
</td>
|
</td>
|
||||||
|
@@ -1,56 +1,81 @@
|
|||||||
|
/**
|
||||||
|
* $Id: editor_plugin.js,v 1.2 2009-07-01 04:19:55 e107coders Exp $
|
||||||
|
*
|
||||||
|
* @author Moxiecode
|
||||||
|
* @copyright Copyright <20> 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
|
tinymce.create('tinymce.plugins.EmoticonsPlugin', {
|
||||||
var TinyMCE_emoticonsPlugin = {
|
/**
|
||||||
getInfo : function() {
|
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||||
return {
|
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||||
longname : 'emoticons',
|
* of the editor instance to intercept that event.
|
||||||
author : 'CaMer0n',
|
*
|
||||||
authorurl : 'http://e107coders.org',
|
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||||
infourl : 'http://www.e107.org',
|
* @param {string} url Absolute URL to where the plugin is located.
|
||||||
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
*/
|
||||||
};
|
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
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
// Register example button
|
||||||
* Returns the HTML contents of the emoticons control.
|
ed.addButton('emoticons', {
|
||||||
*/
|
title : 'emoticons.desc',
|
||||||
getControlHTML : function(cn) {
|
cmd : 'mceEmotion',
|
||||||
switch (cn) {
|
image : url + '/images/emoticons.png'
|
||||||
case "emoticons":
|
});
|
||||||
return tinyMCE.getButtonHTML(cn, 'lang_emoticons_desc', '{$pluginurl}/images/emoticons.png', 'mceEmotion');
|
|
||||||
|
// 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 "";
|
// Register plugin
|
||||||
},
|
tinymce.PluginManager.add('emoticons', tinymce.plugins.EmoticonsPlugin);
|
||||||
|
})();
|
||||||
/**
|
|
||||||
* 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);
|
|
@@ -8,7 +8,7 @@ require_once(HEADERF);
|
|||||||
|
|
||||||
|
|
||||||
$emotes = $sysprefs->getArray("emote_".$pref['emotepack']);
|
$emotes = $sysprefs->getArray("emote_".$pref['emotepack']);
|
||||||
$str = "<div class='spacer' style='white-space:wrap;width:130px;text-align:center'>";
|
$str = "<div style='text-align:center'><div class='spacer' style='white-space:wrap;width:130px;text-align:center'>";
|
||||||
foreach($emotes as $key => $value){
|
foreach($emotes as $key => $value){
|
||||||
$key = str_replace("!", ".", $key);
|
$key = str_replace("!", ".", $key);
|
||||||
$key = preg_replace("#_(\w{3})$#", ".\\1", $key);
|
$key = preg_replace("#_(\w{3})$#", ".\\1", $key);
|
||||||
@@ -17,7 +17,8 @@ require_once(HEADERF);
|
|||||||
$str .= "\n<a href='javascript:void(0);' onmousedown=\"javascript:insertEmotion('$key')\"><img src=\"".e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/$key\" style=\"border:0; padding-top:2px;\" alt=\"\" /></a> ";
|
$str .= "\n<a href='javascript:void(0);' onmousedown=\"javascript:insertEmotion('$key')\"><img src=\"".e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/$key\" style=\"border:0; padding-top:2px;\" alt=\"\" /></a> ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$str .= "</div>";
|
$str .= "</div>
|
||||||
|
</div>";
|
||||||
|
|
||||||
echo $str;
|
echo $str;
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
// UK lang variables
|
// UK lang variables
|
||||||
|
|
||||||
tinyMCELang['lang_insert_emoticons_title'] = 'Insert emotion';
|
tinyMCE.addI18n('en.emoticons',{
|
||||||
tinyMCELang['lang_emoticons_desc'] = 'Emotions';
|
desc : 'Insert emotion'
|
||||||
|
});
|
@@ -4,8 +4,8 @@
|
|||||||
| e107 website system - Tiny MCE controller file.
|
| e107 website system - Tiny MCE controller file.
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/wysiwyg.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/wysiwyg.php,v $
|
||||||
| $Revision: 1.9 $
|
| $Revision: 1.10 $
|
||||||
| $Date: 2009-07-01 02:52:08 $
|
| $Date: 2009-07-01 04:19:55 $
|
||||||
| $Author: e107coders $
|
| $Author: e107coders $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -45,9 +45,9 @@ $thescript = (strpos($_SERVER['SERVER_SOFTWARE'],"mod_gzip")) ? "tiny_mce_gzip.p
|
|||||||
$text = "<script type='text/javascript' src='".e_PLUGIN."tinymce/".$thescript."'></script>\n";
|
$text = "<script type='text/javascript' src='".e_PLUGIN."tinymce/".$thescript."'></script>\n";
|
||||||
|
|
||||||
$text .= "<script type='text/javascript'>\n
|
$text .= "<script type='text/javascript'>\n
|
||||||
//<![CDATA[
|
|
||||||
|
|
||||||
|
|
||||||
|
function start_tinyMce() {
|
||||||
|
//<![CDATA[
|
||||||
tinyMCE.init({\n";
|
tinyMCE.init({\n";
|
||||||
|
|
||||||
$text .= "language : '".$tinylang[$lang]."',\n";
|
$text .= "language : '".$tinylang[$lang]."',\n";
|
||||||
@@ -128,7 +128,13 @@ if($pref['tinymce']['customjs'])
|
|||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
|
|
||||||
});
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
start_tinyMce();
|
||||||
|
|
||||||
function tinymce_html_bbcode_control(type, source) {
|
function tinymce_html_bbcode_control(type, source) {
|
||||||
|
|
||||||
@@ -198,6 +204,9 @@ function triggerSave()
|
|||||||
tinyMCE.triggerSave();
|
tinyMCE.triggerSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>\n
|
</script>\n
|
||||||
";
|
";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user