tinyMCE 2.0.5 coming at you live. fixes #2598

git-svn-id: http://svn.automattic.com/wordpress/trunk@3664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-03-30 07:50:33 +00:00
parent 73ef659763
commit a7337fded7
84 changed files with 12391 additions and 6362 deletions

View File

@ -57,9 +57,7 @@ var manager = new dbxManager('linkmeta');
</script>
<script type="text/javascript" src="../wp-includes/js/dbx-key.js"></script>
<?php } ?>
<?php if ( $editing && user_can_richedit() ) { ?>
<script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php?ver=20051211"></script>
<?php } ?>
<?php if ( $editing && user_can_richedit() ) { tinymce_include(); } ?>
<?php if ( $cat_js ) { ?>
<script type="text/javascript" src="cat-js.php"></script>
<?php } ?>

View File

@ -143,55 +143,7 @@ endforeach;
<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
<legend><?php _e('Post') ?></legend>
<?php
$rows = get_settings('default_post_edit_rows');
if (($rows < 3) || ($rows > 100)) {
$rows = 12;
}
?>
<?php the_quicktags(); ?>
<div><textarea <?php if ( user_can_richedit() ) echo 'title="true" '; ?>rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div>
</fieldset>
<script type="text/javascript">
<!--
edCanvas = document.getElementById('content');
<?php if ( user_can_richedit() ) : ?>
// This code is meant to allow tabbing from Title to Post (TinyMCE).
if ( tinyMCE.isMSIE )
document.getElementById('title').onkeydown = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
else
document.getElementById('title').onkeypress = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
<?php endif; ?>
//-->
</script>
<?php the_editor($post->post_content); ?>
<?php echo $form_pingback ?>
<?php echo $form_prevstatus ?>

View File

@ -37,56 +37,9 @@ addLoadEvent(focusit);
<fieldset style="clear: both;">
<legend><?php _e('Comment') ?></legend>
<?php the_quicktags(); ?>
<?php
$rows = get_settings('default_post_edit_rows');
if (($rows < 3) || ($rows > 100)) {
$rows = 10;
}
?>
<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content" style="width: 99%"><?php echo user_can_richedit() ? wp_richedit_pre($comment->comment_content) : $comment->comment_content; ?></textarea></div>
<?php the_editor($comment->comment_content, 'content', 'newcomment_author_url'); ?>
</fieldset>
<script type="text/javascript">
<!--
edCanvas = document.getElementById('content');
<?php if ( user_can_richedit() ) : ?>
// This code is meant to allow tabbing from Author URL to Post (TinyMCE).
if ( tinyMCE.isMSIE )
document.getElementById('newcomment_author_url').onkeydown = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
else
document.getElementById('newcomment_author_url').onkeypress = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
<?php endif; ?>
//-->
</script>
<p class="submit"><input type="submit" name="editcomment" id="editcomment" value="<?php echo $submitbutton_text ?>" style="font-weight: bold;" tabindex="6" />
<input name="referredby" type="hidden" id="referredby" value="<?php echo $_SERVER['HTTP_REFERER']; ?>" />
</p>

View File

@ -130,56 +130,9 @@ endforeach;
<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
<legend><?php _e('Page Content') ?></legend>
<?php
$rows = get_settings('default_post_edit_rows');
if (($rows < 3) || ($rows > 100)) {
$rows = 10;
}
?>
<?php the_quicktags(); ?>
<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div>
<?php the_editor($post->post_content); ?>
</fieldset>
<script type="text/javascript">
<!--
edCanvas = document.getElementById('content');
<?php if ( user_can_richedit() ) : ?>
// This code is meant to allow tabbing from Title to Post (TinyMCE).
if ( tinyMCE.isMSIE )
document.getElementById('title').onkeydown = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
else
document.getElementById('title').onkeypress = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
<?php endif; ?>
//-->
</script>
<p class="submit">
<input name="save" type="submit" id="save" tabindex="3" value="<?php _e('Save and Continue Editing'); ?>" />
<input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" />

View File

@ -1028,4 +1028,82 @@ function do_all_pings() {
//Do Update Services/Generic Pings
generic_ping();
}
/**
* Places two script links in <head>: one to get tinyMCE (big), one to configure and start it (small)
*/
function tinymce_include() {
$src1 = get_settings('siteurl') . '/wp-includes/js/tinymce/tiny_mce_gzip.php';
$src2 = get_settings('siteurl') . '/wp-includes/js/tinymce/tiny_mce_config.php';
echo "<script type='text/javascript' src='$src1'></script>\n";
echo "<script type='text/javascript' src='$src2'></script>\n";
}
/**
* Places a textarea according to the current user's preferences, filled with $content.
* Also places a script block that enables tabbing between Title and Content.
*
* @param string Editor contents
* @param string (optional) Previous form field's ID (for tabbing support)
*/
function the_editor($content, $id = 'content', $prev_id = 'title') {
$rows = get_settings('default_post_edit_rows');
if (($rows < 3) || ($rows > 100))
$rows = 12;
$rows = "rows='$rows'";
the_quicktags();
if ( user_can_richedit() )
add_filter('the_editor_content', 'wp_richedit_pre');
$the_editor = apply_filters('the_editor', "<div><textarea class='mceEditor' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n");
$the_editor_content = apply_filters('the_editor_content', $content);
printf($the_editor, $the_editor_content);
?>
<script type="text/javascript">
//<!--
edCanvas = document.getElementById('<?php echo $id; ?>');
<?php if ( user_can_richedit() ) : ?>
// This code is meant to allow tabbing from Title to Post (TinyMCE).
if ( tinyMCE.isMSIE )
document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
else
document.getElementById('<?php echo $prev_id; ?>').onkeypress = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
<?php endif; ?>
//-->
</script>
<?php
}
?>

View File

@ -1,47 +1,41 @@
// UK lang variables
if (navigator.userAgent.indexOf('Mac OS') != -1) {
// Mac OS browsers use Ctrl to hit accesskeys
var metaKey = 'Ctrl';
}
else {
var metaKey = 'Alt';
}
tinyMCELang['lang_bold_desc'] = 'Bold (' + metaKey + '+b)';
tinyMCELang['lang_italic_desc'] = 'Italic (' + metaKey + '+i)';
tinyMCELang['lang_underline_desc'] = 'Underline';
tinyMCELang['lang_striketrough_desc'] = 'Striketrough (' + metaKey + '-d)';
tinyMCELang['lang_justifyleft_desc'] = 'Align left (' + metaKey + '-f)';
tinyMCELang['lang_justifycenter_desc'] = 'Align center (' + metaKey + '-c)';
tinyMCELang['lang_justifyright_desc'] = 'Align right (' + metaKey + '-r)';
tinyMCELang['lang_justifyfull_desc'] = 'Align full';
tinyMCELang['lang_bullist_desc'] = 'Unordered list (' + metaKey + '-l)';
tinyMCELang['lang_numlist_desc'] = 'Ordered list (' + metaKey + '-o)';
tinyMCELang['lang_outdent_desc'] = 'Outdent (' + metaKey + '-w)';
tinyMCELang['lang_indent_desc'] = 'Indent/Blockquote (' + metaKey + '-q)';
tinyMCELang['lang_undo_desc'] = 'Undo (' + metaKey + '-u)';
tinyMCELang['lang_redo_desc'] = 'Redo (' + metaKey + '-y)';
tinyMCELang['lang_link_desc'] = 'Insert/edit link (' + metaKey + '-a)';
tinyMCELang['lang_unlink_desc'] = 'Unlink (' + metaKey + '-s)';
tinyMCELang['lang_image_desc'] = 'Insert/edit image (' + metaKey + '-m)';
tinyMCELang['lang_cleanup_desc'] = 'Cleanup messy code';
tinyMCELang['lang_focus_alert'] = 'A editor instance must be focused before using this command.';
tinyMCELang['lang_edit_confirm'] = 'Do you want to use the WYSIWYG mode for this textarea?';
tinyMCELang['lang_insert_link_title'] = 'Insert/edit link';
tinyMCELang['lang_insert'] = 'Insert';
tinyMCELang['lang_update'] = 'Update';
tinyMCELang['lang_cancel'] = 'Cancel';
tinyMCELang['lang_insert_link_url'] = 'Link URL';
tinyMCELang['lang_insert_link_target'] = 'Target';
tinyMCELang['lang_insert_link_target_same'] = 'Open link in the same window';
tinyMCELang['lang_insert_link_target_blank'] = 'Open link in a new window';
tinyMCELang['lang_insert_image_title'] = 'Insert/edit image';
tinyMCELang['lang_insert_image_src'] = 'Image URL';
tinyMCELang['lang_insert_image_alt'] = 'Image description';
tinyMCELang['lang_help_desc'] = 'Help';
tinyMCELang['lang_bold_img'] = "bold.gif";
tinyMCELang['lang_italic_img'] = "italic.gif";
tinyMCELang['lang_underline_img'] = "underline.gif";
tinyMCELang['lang_clipboard_msg'] = 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?';
tinyMCELang['lang_popup_blocked'] = 'Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.';
tinyMCE.addToLang('',{
bold_desc : 'Bold (Ctrl+B)',
italic_desc : 'Italic (Ctrl+I)',
underline_desc : 'Underline (Ctrl+U)',
striketrough_desc : 'Strikethrough',
justifyleft_desc : 'Align left',
justifycenter_desc : 'Align center',
justifyright_desc : 'Align right',
justifyfull_desc : 'Align full',
bullist_desc : 'Unordered list',
numlist_desc : 'Ordered list',
outdent_desc : 'Outdent',
indent_desc : 'Indent',
undo_desc : 'Undo (Ctrl+Z)',
redo_desc : 'Redo (Ctrl+Y)',
link_desc : 'Insert/edit link',
unlink_desc : 'Unlink',
image_desc : 'Insert/edit image',
cleanup_desc : 'Cleanup messy code',
focus_alert : 'A editor instance must be focused before using this command.',
edit_confirm : 'Do you want to use the WYSIWYG mode for this textarea?',
insert_link_title : 'Insert/edit link',
insert : 'Insert',
update : 'Update',
cancel : 'Cancel',
insert_link_url : 'Link URL',
insert_link_target : 'Target',
insert_link_target_same : 'Open link in the same window',
insert_link_target_blank : 'Open link in a new window',
insert_image_title : 'Insert/edit image',
insert_image_src : 'Image URL',
insert_image_alt : 'Image description',
help_desc : 'Help',
bold_img : "bold.gif",
italic_img : "italic.gif",
underline_img : "underline.gif",
clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
popup_blocked : 'Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.'
});

View File

@ -1,2 +1,48 @@
/**
* $RCSfile: editor_plugin_src.js,v $
* $Revision: 1.11 $
* $Date: 2006/03/22 12:21:21 $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('autosave','en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');function TinyMCE_autosave_getInfo(){return{longname:'Auto save',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};};function TinyMCE_autosave_beforeUnloadHandler(){var msg=tinyMCE.getLang("lang_autosave_unload_msg");var anyDirty=false;for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(inst.isDirty())return msg;}return;}window.onbeforeunload=TinyMCE_autosave_beforeUnloadHandler;
tinyMCE.importPluginLanguagePack('autosave', 'en,tr,sv,cs,he,nb,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,nn,fi,cy,es,is,pl,pt_br');
var TinyMCE_AutoSavePlugin = {
getInfo : function() {
return {
longname : 'Auto save',
author : 'Moxiecode Systems',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
// Private plugin internal methods
_beforeUnloadHandler : function() {
var n, inst, anyDirty = false, msg = tinyMCE.getLang("lang_autosave_unload_msg");
if (tinyMCE.getParam("fullscreen_is_enabled"))
return;
for (n in tinyMCE.instances) {
inst = tinyMCE.instances[n];
if (!tinyMCE.isInstance(inst))
continue;
if (inst.isDirty())
return msg;
}
return;
}
};
window.onbeforeunload = TinyMCE_AutoSavePlugin._beforeUnloadHandler;
tinyMCE.addPlugin("autosave", TinyMCE_AutoSavePlugin);

View File

@ -0,0 +1,69 @@
/* Window classes */
.mceWindow {
position: absolute;
left: 0;
top: 0;
border: 1px solid black;
background-color: #D4D0C8;
}
.mceWindowHead {
background-color: #334F8D;
width: 100%;
height: 18px;
cursor: move;
overflow: hidden;
}
.mceWindowBody {
clear: both;
background-color: white;
}
.mceWindowStatusbar {
background-color: #D4D0C8;
height: 12px;
border-top: 1px solid black;
}
.mceWindowTitle {
float: left;
font-family: "MS Sans Serif";
font-size: 9pt;
font-weight: bold;
line-height: 18px;
color: white;
margin-left: 2px;
overflow: hidden;
}
.mceWindowHeadTools {
margin-right: 2px;
}
.mceWindowClose, .mceWindowMinimize, .mceWindowMaximize {
display: block;
float: right;
overflow: hidden;
margin-top: 2px;
}
.mceWindowClose {
margin-left: 2px;
}
.mceWindowMinimize {
}
.mceWindowMaximize {
}
.mceWindowResize {
display: block;
float: right;
overflow: hidden;
cursor: se-resize;
width: 12px;
height: 12px;
}

View File

@ -0,0 +1,662 @@
/**
* $RCSfile: editor_plugin_src.js,v $
* $Revision: 1.8 $
* $Date: 2006/02/06 20:02:38 $
*
* Moxiecode DHTML Windows script.
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
// Patch openWindow, closeWindow TinyMCE functions
var TinyMCE_InlinePopupsPlugin = {
getInfo : function() {
return {
longname : 'Inline Popups',
author : 'Moxiecode Systems',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
}
};
tinyMCE.addPlugin("inlinepopups", TinyMCE_InlinePopupsPlugin);
// Patch openWindow, closeWindow TinyMCE functions
TinyMCE_Engine.prototype.orgOpenWindow = TinyMCE_Engine.prototype.openWindow;
TinyMCE_Engine.prototype.openWindow = function(template, args) {
// Does the caller support inline
if (args['inline'] != "yes" || tinyMCE.isOpera || tinyMCE.getParam("plugins").indexOf('inlinepopups') == -1) {
mcWindows.selectedWindow = null;
args['mce_inside_iframe'] = false;
this.orgOpenWindow(template, args);
return;
}
var url, resizable, scrollbars;
args['mce_inside_iframe'] = true;
tinyMCE.windowArgs = args;
if (template['file'].charAt(0) != '/' && template['file'].indexOf('://') == -1)
url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template['file'];
else
url = template['file'];
if (!(width = parseInt(template['width'])))
width = 320;
if (!(height = parseInt(template['height'])))
height = 200;
resizable = (args && args['resizable']) ? args['resizable'] : "no";
scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no";
height += 18;
// Replace all args as variables in URL
for (var name in args) {
if (typeof(args[name]) == 'function')
continue;
url = tinyMCE.replaceVar(url, name, escape(args[name]));
}
var elm = document.getElementById(this.selectedInstance.editorId + '_parent');
var pos = tinyMCE.getAbsPosition(elm);
// Center div in editor area
pos.absLeft += Math.round((elm.firstChild.clientWidth / 2) - (width / 2));
pos.absTop += Math.round((elm.firstChild.clientHeight / 2) - (height / 2));
mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop);
};
TinyMCE_Engine.prototype.orgCloseWindow = TinyMCE_Engine.prototype.closeWindow;
TinyMCE_Engine.prototype.closeWindow = function(win) {
if (mcWindows.selectedWindow != null)
mcWindows.selectedWindow.close();
else
this.orgCloseWindow(win);
};
TinyMCE_Engine.prototype.setWindowTitle = function(win_ref, title) {
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (win_ref.name == win.id + "_iframe")
window.frames[win.id + "_iframe"].document.getElementById(win.id + '_title').innerHTML = title;
}
};
// * * * * * TinyMCE_Windows classes below
// Windows handler
function TinyMCE_Windows() {
this.settings = new Array();
this.windows = new Array();
this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
this.isMac = navigator.userAgent.indexOf('Mac') != -1;
this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
this.action = "none";
this.selectedWindow = null;
this.lastSelectedWindow = null;
this.zindex = 100;
this.mouseDownScreenX = 0;
this.mouseDownScreenY = 0;
this.mouseDownLayerX = 0;
this.mouseDownLayerY = 0;
this.mouseDownWidth = 0;
this.mouseDownHeight = 0;
this.idCounter = 0;
};
TinyMCE_Windows.prototype.init = function(settings) {
this.settings = settings;
if (this.isMSIE)
this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
else
this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
this.doc = document;
};
TinyMCE_Windows.prototype.getParam = function(name, default_value) {
var value = null;
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
// Fix bool values
if (value == "true" || value == "false")
return (value == "true");
return value;
};
TinyMCE_Windows.prototype.eventDispatcher = function(e) {
e = typeof(e) == "undefined" ? window.event : e;
if (mcWindows.selectedWindow == null)
return;
// Switch focus
if (mcWindows.isGecko && e.type == "mousedown") {
var elm = e.currentTarget;
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (win.headElement == elm || win.resizeElement == elm) {
win.focus();
break;
}
}
}
switch (e.type) {
case "mousemove":
mcWindows.selectedWindow.onMouseMove(e);
break;
case "mouseup":
mcWindows.selectedWindow.onMouseUp(e);
break;
case "mousedown":
mcWindows.selectedWindow.onMouseDown(e);
break;
case "focus":
mcWindows.selectedWindow.onFocus(e);
break;
}
};
TinyMCE_Windows.prototype.addEvent = function(obj, name, handler) {
if (this.isMSIE)
obj.attachEvent("on" + name, handler);
else
obj.addEventListener(name, handler, true);
};
TinyMCE_Windows.prototype.cancelEvent = function(e) {
if (this.isMSIE) {
e.returnValue = false;
e.cancelBubble = true;
} else
e.preventDefault();
};
TinyMCE_Windows.prototype.parseFeatures = function(opts) {
// Cleanup the options
opts = opts.toLowerCase();
opts = opts.replace(/;/g, ",");
opts = opts.replace(/[^0-9a-z=,]/g, "");
var optionChunks = opts.split(',');
var options = new Array();
options['left'] = "10";
options['top'] = "10";
options['width'] = "300";
options['height'] = "300";
options['resizable'] = "yes";
options['minimizable'] = "yes";
options['maximizable'] = "yes";
options['close'] = "yes";
options['movable'] = "yes";
options['statusbar'] = "yes";
options['scrollbars'] = "auto";
options['modal'] = "no";
if (opts == "")
return options;
for (var i=0; i<optionChunks.length; i++) {
var parts = optionChunks[i].split('=');
if (parts.length == 2)
options[parts[0]] = parts[1];
}
options['left'] = parseInt(options['left']);
options['top'] = parseInt(options['top']);
options['width'] = parseInt(options['width']);
options['height'] = parseInt(options['height']);
return options;
};
TinyMCE_Windows.prototype.open = function(url, name, features) {
this.lastSelectedWindow = this.selectedWindow;
var win = new TinyMCE_Window();
var winDiv, html = "", id;
var imgPath = this.getParam("images_path");
features = this.parseFeatures(features);
// Create div
id = "mcWindow_" + name;
win.deltaHeight = 18;
if (features['statusbar'] == "yes") {
win.deltaHeight += 13;
if (this.isMSIE)
win.deltaHeight += 1;
}
width = parseInt(features['width']);
height = parseInt(features['height'])-win.deltaHeight;
if (this.isMSIE)
width -= 2;
// Setup first part of window
win.id = id;
win.url = url;
win.name = name;
win.features = features;
this.windows[name] = win;
iframeWidth = width;
iframeHeight = height;
// Create inner content
html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
html += '<html>';
html += '<head>';
html += '<title>Wrapper iframe</title>';
html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
html += '<link href="' + this.getParam("css_file") + '" rel="stylesheet" type="text/css" />';
html += '</head>';
html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
html += '<div id="' + id + '_container" class="mceWindow">';
html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
html += ' <div id="' + id + '_title" class="mceWindowTitle"';
html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;"></div>';
html += ' <div class="mceWindowHeadTools">';
html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" target="_self" onmousedown="return false;" class="mceWindowClose"><img border="0" src="' + imgPath + '/window_close.gif" /></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" target="_self" onmousedown="return false;" class="mceWindowMaximize"></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" target="_self" onmousedown="return false;" class="mceWindowMinimize"></a>';
html += ' </div>';
html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe" scrolling="' + features['scrollbars'] + '"></iframe></div>';
if (features['statusbar'] == "yes") {
html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
if (features['resizable'] == "yes") {
if (this.isGecko)
html += '<div id="' + id + '_resize" class="mceWindowResize"><div style="background-image: url(\'' + imgPath + '/window_resize.gif\'); width: 12px; height: 12px;"></div></div>';
else
html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="' + imgPath + '/window_resize.gif" /></div>';
}
html += '</div>';
}
html += '</div>';
html += '</body>';
html += '</html>';
// Create iframe
this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
};
// Blocks the document events by placing a image over the whole document
TinyMCE_Windows.prototype.setDocumentLock = function(state) {
if (state) {
var elm = document.getElementById('mcWindowEventBlocker');
if (elm == null) {
elm = document.createElement("div");
elm.id = "mcWindowEventBlocker";
elm.style.position = "absolute";
elm.style.left = "0";
elm.style.top = "0";
document.body.appendChild(elm);
}
elm.style.display = "none";
var imgPath = this.getParam("images_path");
var width = document.body.clientWidth;
var height = document.body.clientHeight;
elm.style.width = width;
elm.style.height = height;
elm.innerHTML = '<img src="' + imgPath + '/spacer.gif" width="' + width + '" height="' + height + '" />';
elm.style.zIndex = mcWindows.zindex-1;
elm.style.display = "block";
} else {
var elm = document.getElementById('mcWindowEventBlocker');
if (mcWindows.windows.length == 0)
elm.parentNode.removeChild(elm);
else
elm.style.zIndex = mcWindows.zindex-1;
}
};
// Gets called when wrapper iframe is initialized
TinyMCE_Windows.prototype.onLoad = function(name) {
var win = mcWindows.windows[name];
var id = "mcWindow_" + name;
var wrapperIframe = window.frames[id + "_iframe"].frames[0];
var wrapperDoc = window.frames[id + "_iframe"].document;
var doc = window.frames[id + "_iframe"].document;
var winDiv = document.getElementById("mcWindow_" + name + "_div");
var realIframe = window.frames[id + "_iframe"].frames[0];
// Set window data
win.id = "mcWindow_" + name;
win.winElement = winDiv;
win.bodyElement = doc.getElementById(id + '_body');
win.iframeElement = doc.getElementById(id + '_iframe');
win.headElement = doc.getElementById(id + '_head');
win.titleElement = doc.getElementById(id + '_title');
win.resizeElement = doc.getElementById(id + '_resize');
win.containerElement = doc.getElementById(id + '_container');
win.left = win.features['left'];
win.top = win.features['top'];
win.frame = window.frames[id + '_iframe'].frames[0];
win.wrapperFrame = window.frames[id + '_iframe'];
win.wrapperIFrameElement = document.getElementById(id + "_iframe");
// Add event handlers
mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
if (win.resizeElement != null)
mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
if (mcWindows.isMSIE) {
mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
}
for (var i=0; i<window.frames.length; i++) {
if (!window.frames[i]._hasMouseHandlers) {
if (mcWindows.isMSIE) {
mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
}
window.frames[i]._hasMouseHandlers = true;
}
}
if (mcWindows.isMSIE) {
mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
}
// Dispatch open window event
var func = this.getParam("on_open_window", "");
if (func != "")
eval(func + "(win);");
win.focus();
if (win.features['modal'] == "yes")
mcWindows.setDocumentLock(true);
};
TinyMCE_Windows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
var iframe = document.createElement("iframe");
var div = document.createElement("div");
width = parseInt(width);
height = parseInt(height)+1;
// Create wrapper div
div.setAttribute("id", id_prefix + "_div");
div.setAttribute("width", width);
div.setAttribute("height", (height));
div.style.position = "absolute";
div.style.left = left + "px";
div.style.top = top + "px";
div.style.width = width + "px";
div.style.height = (height) + "px";
div.style.backgroundColor = "white";
div.style.display = "none";
if (this.isGecko) {
iframeWidth = width + 2;
iframeHeight = height + 2;
} else {
iframeWidth = width;
iframeHeight = height + 1;
}
// Create iframe
iframe.setAttribute("id", id_prefix + "_iframe");
iframe.setAttribute("name", id_prefix + "_iframe");
iframe.setAttribute("border", "0");
iframe.setAttribute("frameBorder", "0");
iframe.setAttribute("marginWidth", "0");
iframe.setAttribute("marginHeight", "0");
iframe.setAttribute("leftMargin", "0");
iframe.setAttribute("topMargin", "0");
iframe.setAttribute("width", iframeWidth);
iframe.setAttribute("height", iframeHeight);
// iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
// iframe.setAttribute("allowtransparency", "false");
iframe.setAttribute("scrolling", "no");
iframe.style.width = iframeWidth + "px";
iframe.style.height = iframeHeight + "px";
iframe.style.backgroundColor = "white";
div.appendChild(iframe);
document.body.appendChild(div);
// Fixed MSIE 5.0 issue
div.innerHTML = div.innerHTML;
if (this.isSafari) {
// Give Safari some time to setup
window.setTimeout(function() {
doc = window.frames[id_prefix + '_iframe'].document;
doc.open();
doc.write(html);
doc.close();
}, 10);
} else {
doc = window.frames[id_prefix + '_iframe'].window.document;
doc.open();
doc.write(html);
doc.close();
}
div.style.display = "block";
return div;
};
// Window instance
function TinyMCE_Window() {
};
TinyMCE_Window.prototype.focus = function() {
if (this != mcWindows.selectedWindow) {
this.winElement.style.zIndex = ++mcWindows.zindex;
mcWindows.lastSelectedWindow = mcWindows.selectedWindow;
mcWindows.selectedWindow = this;
}
};
TinyMCE_Window.prototype.minimize = function() {
};
TinyMCE_Window.prototype.maximize = function() {
};
TinyMCE_Window.prototype.startResize = function() {
mcWindows.action = "resize";
};
TinyMCE_Window.prototype.startMove = function(e) {
mcWindows.action = "move";
};
TinyMCE_Window.prototype.close = function() {
if (this.frame && this.frame['tinyMCEPopup'])
this.frame['tinyMCEPopup'].restoreSelection();
if (mcWindows.lastSelectedWindow != null)
mcWindows.lastSelectedWindow.focus();
var mcWindowsNew = new Array();
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (win.name != this.name)
mcWindowsNew[n] = win;
}
mcWindows.windows = mcWindowsNew;
// alert(mcWindows.doc.getElementById(this.id + "_iframe"));
var e = mcWindows.doc.getElementById(this.id + "_iframe");
e.parentNode.removeChild(e);
var e = mcWindows.doc.getElementById(this.id + "_div");
e.parentNode.removeChild(e);
mcWindows.setDocumentLock(false);
};
TinyMCE_Window.prototype.onMouseMove = function(e) {
var scrollX = 0;//this.doc.body.scrollLeft;
var scrollY = 0;//this.doc.body.scrollTop;
// Calculate real X, Y
var dx = e.screenX - mcWindows.mouseDownScreenX;
var dy = e.screenY - mcWindows.mouseDownScreenY;
switch (mcWindows.action) {
case "resize":
width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX);
height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY);
width = width < 100 ? 100 : width;
height = height < 100 ? 100 : height;
this.wrapperIFrameElement.style.width = width+2;
this.wrapperIFrameElement.style.height = height+2;
this.wrapperIFrameElement.width = width+2;
this.wrapperIFrameElement.height = height+2;
this.winElement.style.width = width;
this.winElement.style.height = height;
height = height - this.deltaHeight;
this.containerElement.style.width = width;
this.iframeElement.style.width = width;
this.iframeElement.style.height = height;
this.bodyElement.style.width = width;
this.bodyElement.style.height = height;
this.headElement.style.width = width;
//this.statusElement.style.width = width;
mcWindows.cancelEvent(e);
break;
case "move":
this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
this.winElement.style.left = this.left + "px";
this.winElement.style.top = this.top + "px";
mcWindows.cancelEvent(e);
break;
}
};
function debug(msg) {
document.getElementById('debug').value += msg + "\n";
}
TinyMCE_Window.prototype.onMouseUp = function(e) {
mcWindows.action = "none";
};
TinyMCE_Window.prototype.onFocus = function(e) {
// Gecko only handler
var winRef = e.currentTarget;
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (winRef.name == win.id + "_iframe") {
win.focus();
return;
}
}
};
TinyMCE_Window.prototype.onMouseDown = function(e) {
var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
var scrollX = 0;//this.doc.body.scrollLeft;
var scrollY = 0;//this.doc.body.scrollTop;
mcWindows.mouseDownScreenX = e.screenX;
mcWindows.mouseDownScreenY = e.screenY;
mcWindows.mouseDownLayerX = this.left;
mcWindows.mouseDownLayerY = this.top;
mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
if (this.resizeElement != null && elm == this.resizeElement.firstChild)
this.startResize(e);
else
this.startMove(e);
mcWindows.cancelEvent(e);
};
// Global instance
var mcWindows = new TinyMCE_Windows();
// Initialize windows
mcWindows.init({
images_path : tinyMCE.baseURL + "/plugins/inlinepopups/images",
css_file : tinyMCE.baseURL + "/plugins/inlinepopups/css/inlinepopup.css"
});

View File

@ -0,0 +1,455 @@
/**
* $RCSfile: mcwindows.js,v $
* $Revision: 1.2 $
* $Date: 2005/10/18 13:59:43 $
*
* Moxiecode DHTML Windows script.
*
* @author Moxiecode
* @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
*/
// Windows handler
function MCWindows() {
this.settings = new Array();
this.windows = new Array();
this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
this.isMac = navigator.userAgent.indexOf('Mac') != -1;
this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
this.action = "none";
this.selectedWindow = null;
this.zindex = 100;
this.mouseDownScreenX = 0;
this.mouseDownScreenY = 0;
this.mouseDownLayerX = 0;
this.mouseDownLayerY = 0;
this.mouseDownWidth = 0;
this.mouseDownHeight = 0;
};
MCWindows.prototype.init = function(settings) {
this.settings = settings;
if (this.isMSIE)
this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
else
this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
};
MCWindows.prototype.getParam = function(name, default_value) {
var value = null;
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
// Fix bool values
if (value == "true" || value == "false")
return (value == "true");
return value;
};
MCWindows.prototype.eventDispatcher = function(e) {
e = typeof(e) == "undefined" ? window.event : e;
if (mcWindows.selectedWindow == null)
return;
// Switch focus
if (mcWindows.isGecko && e.type == "mousedown") {
var elm = e.currentTarget;
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (win.headElement == elm || win.resizeElement == elm) {
win.focus();
break;
}
}
}
switch (e.type) {
case "mousemove":
mcWindows.selectedWindow.onMouseMove(e);
break;
case "mouseup":
mcWindows.selectedWindow.onMouseUp(e);
break;
case "mousedown":
mcWindows.selectedWindow.onMouseDown(e);
break;
case "focus":
mcWindows.selectedWindow.onFocus(e);
break;
}
}
MCWindows.prototype.addEvent = function(obj, name, handler) {
if (this.isMSIE)
obj.attachEvent("on" + name, handler);
else
obj.addEventListener(name, handler, true);
};
MCWindows.prototype.cancelEvent = function(e) {
if (this.isMSIE) {
e.returnValue = false;
e.cancelBubble = true;
} else
e.preventDefault();
};
MCWindows.prototype.parseFeatures = function(opts) {
// Cleanup the options
opts = opts.toLowerCase();
opts = opts.replace(/;/g, ",");
opts = opts.replace(/[^0-9a-z=,]/g, "");
var optionChunks = opts.split(',');
var options = new Array();
options['left'] = 10;
options['top'] = 10;
options['width'] = 300;
options['height'] = 300;
options['resizable'] = true;
options['minimizable'] = true;
options['maximizable'] = true;
options['close'] = true;
options['movable'] = true;
if (opts == "")
return options;
for (var i=0; i<optionChunks.length; i++) {
var parts = optionChunks[i].split('=');
if (parts.length == 2)
options[parts[0]] = parts[1];
}
return options;
};
MCWindows.prototype.open = function(url, name, features) {
var win = new MCWindow();
var winDiv, html = "", id;
features = this.parseFeatures(features);
// Create div
id = "mcWindow_" + name;
width = parseInt(features['width']);
height = parseInt(features['height'])-12-19;
if (this.isMSIE)
width -= 2;
// Setup first part of window
win.id = id;
win.url = url;
win.name = name;
win.features = features;
this.windows[name] = win;
iframeWidth = width;
iframeHeight = height;
// Create inner content
html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
html += '<html>';
html += '<head>';
html += '<title>Wrapper iframe</title>';
html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
html += '<link href="../jscripts/tiny_mce/themes/advanced/css/editor_ui.css" rel="stylesheet" type="text/css" />';
html += '</head>';
html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
html += '<div id="' + id + '_container" class="mceWindow">';
html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
html += ' <div id="' + id + '_title" class="mceWindowTitle"';
html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;">No name window</div>';
html += ' <div class="mceWindowHeadTools">';
html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" onmousedown="return false;" class="mceWindowClose"><img border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_close.gif" /></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" onmousedown="return false;" class="mceWindowMaximize"></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" onmousedown="return false;" class="mceWindowMinimize"></a>';
html += ' </div>';
html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" onfocus="parent.mcWindows.windows[\'' + name + '\'].focus();" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe"></iframe></div>';
html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_resize.gif" /></div>';
html += '</div>';
html += '</div>';
html += '</body>';
html += '</html>';
// Create iframe
this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
};
// Gets called when wrapper iframe is initialized
MCWindows.prototype.onLoad = function(name) {
var win = mcWindows.windows[name];
var id = "mcWindow_" + name;
var wrapperIframe = window.frames[id + "_iframe"].frames[0];
var wrapperDoc = window.frames[id + "_iframe"].document;
var doc = window.frames[id + "_iframe"].document;
var winDiv = document.getElementById("mcWindow_" + name + "_div");
var realIframe = window.frames[id + "_iframe"].frames[0];
// Set window data
win.id = "mcWindow_" + name + "_iframe";
win.winElement = winDiv;
win.bodyElement = doc.getElementById(id + '_body');
win.iframeElement = doc.getElementById(id + '_iframe');
win.headElement = doc.getElementById(id + '_head');
win.titleElement = doc.getElementById(id + '_title');
win.resizeElement = doc.getElementById(id + '_resize');
win.containerElement = doc.getElementById(id + '_container');
win.left = win.features['left'];
win.top = win.features['top'];
win.frame = window.frames[id + '_iframe'].frames[0];
win.wrapperFrame = window.frames[id + '_iframe'];
win.wrapperIFrameElement = document.getElementById(id + "_iframe");
// Add event handlers
mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
if (mcWindows.isMSIE) {
mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
}
for (var i=0; i<window.frames.length; i++) {
if (!window.frames[i]._hasMouseHandlers) {
if (mcWindows.isMSIE) {
mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
}
window.frames[i]._hasMouseHandlers = true;
}
}
if (mcWindows.isMSIE) {
mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
}
this.selectedWindow = win;
};
MCWindows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
var iframe = document.createElement("iframe");
var div = document.createElement("div");
width = parseInt(width);
height = parseInt(height)+1;
// Create wrapper div
div.setAttribute("id", id_prefix + "_div");
div.setAttribute("width", width);
div.setAttribute("height", (height));
div.style.position = "absolute";
div.style.left = left + "px";
div.style.top = top + "px";
div.style.width = width + "px";
div.style.height = (height) + "px";
div.style.backgroundColor = "white";
div.style.display = "none";
if (this.isGecko) {
iframeWidth = width + 2;
iframeHeight = height + 2;
} else {
iframeWidth = width;
iframeHeight = height + 1;
}
// Create iframe
iframe.setAttribute("id", id_prefix + "_iframe");
iframe.setAttribute("name", id_prefix + "_iframe");
iframe.setAttribute("border", "0");
iframe.setAttribute("frameBorder", "0");
iframe.setAttribute("marginWidth", "0");
iframe.setAttribute("marginHeight", "0");
iframe.setAttribute("leftMargin", "0");
iframe.setAttribute("topMargin", "0");
iframe.setAttribute("width", iframeWidth);
iframe.setAttribute("height", iframeHeight);
// iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
// iframe.setAttribute("allowtransparency", "false");
iframe.setAttribute("scrolling", "no");
iframe.style.width = iframeWidth + "px";
iframe.style.height = iframeHeight + "px";
iframe.style.backgroundColor = "white";
div.appendChild(iframe);
document.body.appendChild(div);
// Fixed MSIE 5.0 issue
div.innerHTML = div.innerHTML;
if (this.isSafari) {
// Give Safari some time to setup
window.setTimeout(function() {
doc = window.frames[id_prefix + '_iframe'].document;
doc.open();
doc.write(html);
doc.close();
}, 10);
} else {
doc = window.frames[id_prefix + '_iframe'].window.document
doc.open();
doc.write(html);
doc.close();
}
div.style.display = "block";
return div;
};
// Window instance
function MCWindow() {
};
MCWindow.prototype.focus = function() {
this.winElement.style.zIndex = mcWindows.zindex++;
mcWindows.selectedWindow = this;
};
MCWindow.prototype.minimize = function() {
};
MCWindow.prototype.maximize = function() {
};
MCWindow.prototype.startResize = function() {
mcWindows.action = "resize";
};
MCWindow.prototype.startMove = function(e) {
mcWindows.action = "move";
};
MCWindow.prototype.close = function() {
document.body.removeChild(this.winElement);
mcWindows.windows[this.name] = null;
};
MCWindow.prototype.onMouseMove = function(e) {
var scrollX = 0;//this.doc.body.scrollLeft;
var scrollY = 0;//this.doc.body.scrollTop;
// Calculate real X, Y
var dx = e.screenX - mcWindows.mouseDownScreenX;
var dy = e.screenY - mcWindows.mouseDownScreenY;
switch (mcWindows.action) {
case "resize":
width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX);
height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY);
width = width < 100 ? 100 : width;
height = height < 100 ? 100 : height;
this.wrapperIFrameElement.style.width = width+2;
this.wrapperIFrameElement.style.height = height+2;
this.wrapperIFrameElement.width = width+2;
this.wrapperIFrameElement.height = height+2;
this.winElement.style.width = width;
this.winElement.style.height = height;
height = height-12-19;
this.containerElement.style.width = width;
this.iframeElement.style.width = width;
this.iframeElement.style.height = height;
this.bodyElement.style.width = width;
this.bodyElement.style.height = height;
this.headElement.style.width = width;
//this.statusElement.style.width = width;
mcWindows.cancelEvent(e);
break;
case "move":
this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
this.winElement.style.left = this.left + "px";
this.winElement.style.top = this.top + "px";
mcWindows.cancelEvent(e);
break;
}
};
MCWindow.prototype.onMouseUp = function(e) {
mcWindows.action = "none";
};
MCWindow.prototype.onFocus = function(e) {
// Gecko only handler
var winRef = e.currentTarget;
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (winRef.name == win.id) {
win.focus();
return;
}
}
};
MCWindow.prototype.onMouseDown = function(e) {
var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
var scrollX = 0;//this.doc.body.scrollLeft;
var scrollY = 0;//this.doc.body.scrollTop;
mcWindows.mouseDownScreenX = e.screenX;
mcWindows.mouseDownScreenY = e.screenY;
mcWindows.mouseDownLayerX = this.left;
mcWindows.mouseDownLayerY = this.top;
mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
if (elm == this.resizeElement.firstChild)
this.startResize(e);
else
this.startMove(e);
mcWindows.cancelEvent(e);
};
// Global instance
var mcWindows = new MCWindows();

View File

@ -0,0 +1,19 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>blank_page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script language="javascript">
function init() {
document.body.contentEditable = true;
document.designMode = 'on';
parent.initIframe(document);
window.focus();
}
</script>
<link href="css/blank.css" rel="stylesheet" type="text/css" />
<base target="_self" />
</head>
<body onload="init();">
</body>
</html>

View File

@ -0,0 +1,13 @@
body {
background-color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
scrollbar-3dlight-color: #F0F0EE;
scrollbar-arrow-color: #676662;
scrollbar-base-color: #F0F0EE;
scrollbar-darkshadow-color: #DDDDDD;
scrollbar-face-color: #E0E0DD;
scrollbar-highlight-color: #F0F0EE;
scrollbar-shadow-color: #F0F0EE;
scrollbar-track-color: #F5F5F5;
}

View File

@ -0,0 +1,3 @@
.sourceIframe {
border: 1px solid #808080;
}

View File

@ -0,0 +1,388 @@
/**
* $RCSfile: editor_plugin_src.js,v $
* $Revision: 1.36 $
* $Date: 2006/03/20 12:03:44 $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('paste', 'en,tr,sv,cs,zh_cn,fr_ca,da,he,nb,de,hu,ru,ru_KOI8-R,ru_UTF-8,nn,fi,es,cy,is,pl,nl,fr,pt_br');
var TinyMCE_PastePlugin = {
getInfo : function() {
return {
longname : 'Paste text/word',
author : 'Moxiecode Systems',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_paste.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
initInstance : function(inst) {
if (tinyMCE.isMSIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false))
tinyMCE.addEvent(inst.getBody(), "paste", TinyMCE_PastePlugin._handlePasteEvent);
},
getControlHTML : function(cn) {
switch (cn) {
case "pastetext":
return tinyMCE.getButtonHTML(cn, 'lang_paste_text_desc', '{$pluginurl}/images/pastetext.gif', 'mcePasteText', true);
case "pasteword":
return tinyMCE.getButtonHTML(cn, 'lang_paste_word_desc', '{$pluginurl}/images/pasteword.gif', 'mcePasteWord', true);
case "selectall":
return tinyMCE.getButtonHTML(cn, 'lang_selectall_desc', '{$pluginurl}/images/selectall.gif', 'mceSelectAll', true);
}
return '';
},
execCommand : function(editor_id, element, command, user_interface, value) {
switch (command) {
case "mcePasteText":
if (user_interface) {
if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false))
TinyMCE_PastePlugin._insertText(clipboardData.getData("Text"), true);
else {
var template = new Array();
template['file'] = '../../plugins/paste/pastetext.htm'; // Relative to theme
template['width'] = 450;
template['height'] = 400;
var plain_text = "";
tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'});
}
} else
TinyMCE_PastePlugin._insertText(value['html'], value['linebreaks']);
return true;
case "mcePasteWord":
if (user_interface) {
if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false)) {
var html = TinyMCE_PastePlugin._clipboardHTML();
if (html && html.length > 0)
TinyMCE_PastePlugin._insertWordContent(html);
} else {
var template = new Array();
template['file'] = '../../plugins/paste/pasteword.htm'; // Relative to theme
template['width'] = 450;
template['height'] = 400;
var plain_text = "";
tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'});
}
} else
TinyMCE_PastePlugin._insertWordContent(value);
return true;
case "mceSelectAll":
tinyMCE.execInstanceCommand(editor_id, 'selectall');
return true;
}
// Pass to next handler in chain
return false;
},
// Private plugin internal methods
_handlePasteEvent : function(e) {
switch (e.type) {
case "paste":
var html = TinyMCE_PastePlugin._clipboardHTML();
var r, inst = tinyMCE.selectedInstance;
// Removes italic, strong etc, the if was needed due to bug #1437114
if (inst && (r = inst.getRng()) && r.text.length > 0)
tinyMCE.execCommand('delete');
if (html && html.length > 0)
tinyMCE.execCommand('mcePasteWord', false, html);
tinyMCE.cancelEvent(e);
return false;
}
return true;
},
_insertText : function(content, bLinebreaks) {
if (content && content.length > 0) {
if (bLinebreaks) {
// Special paragraph treatment
if (tinyMCE.getParam("paste_create_paragraphs", true)) {
var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
for (var i=0; i<rl.length; i+=2)
content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
content = tinyMCE.regexpReplace(content, "\r\n\r\n", "</p><p>", "gi");
content = tinyMCE.regexpReplace(content, "\r\r", "</p><p>", "gi");
content = tinyMCE.regexpReplace(content, "\n\n", "</p><p>", "gi");
// Has paragraphs
if ((pos = content.indexOf('</p><p>')) != -1) {
tinyMCE.execCommand("Delete");
var node = tinyMCE.selectedInstance.getFocusElement();
// Get list of elements to break
var breakElms = new Array();
do {
if (node.nodeType == 1) {
// Don't break tables and break at body
if (node.nodeName == "TD" || node.nodeName == "BODY")
break;
breakElms[breakElms.length] = node;
}
} while(node = node.parentNode);
var before = "", after = "</p>";
before += content.substring(0, pos);
for (var i=0; i<breakElms.length; i++) {
before += "</" + breakElms[i].nodeName + ">";
after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">";
}
before += "<p>";
content = before + content.substring(pos+7) + after;
}
}
if (tinyMCE.getParam("paste_create_linebreaks", true)) {
content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi");
content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi");
content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi");
}
}
tinyMCE.execCommand("mceInsertRawHTML", false, content);
}
},
_insertWordContent : function(content) {
if (content && content.length > 0) {
// Cleanup Word content
var bull = String.fromCharCode(8226);
var middot = String.fromCharCode(183);
var cb;
if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
content = eval(cb + "('before', content)");
var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
for (var i=0; i<rl.length; i+=2)
content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');
}
content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--");
content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>");
content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list
content = content.replace(/<o:p><\/o:p>/gi, "");
content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks
content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments
if (tinyMCE.getParam("paste_remove_spans", true))
content = content.replace(/<\/?span[^>]*>/gi, "");
if (tinyMCE.getParam("paste_remove_styles", true))
content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");
content = content.replace(/<\/?font[^>]*>/gi, "");
// Strips class attributes.
switch (tinyMCE.getParam("paste_strip_class_attributes", "all")) {
case "all":
content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
break;
case "mso":
content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3");
break;
}
content = content.replace(new RegExp('href="?' + TinyMCE_PastePlugin._reEscape("" + document.location) + '', 'gi'), 'href="' + tinyMCE.settings['document_base_url']);
content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
content = content.replace(/<\\?\?xml[^>]*>/gi, "");
content = content.replace(/<\/?\w+:[^>]*>/gi, "");
content = content.replace(/-- page break --\s*<p>&nbsp;<\/p>/gi, ""); // Remove pagebreaks
content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
// content = content.replace(/\/?&nbsp;*/gi, ""); &nbsp;
// content = content.replace(/<p>&nbsp;<\/p>/gi, '');
if (!tinyMCE.settings['force_p_newlines']) {
content = content.replace('', '' ,'gi');
content = content.replace('</p>', '<br /><br />' ,'gi');
}
if (!tinyMCE.isMSIE && !tinyMCE.settings['force_p_newlines']) {
content = content.replace(/<\/?p[^>]*>/gi, "");
}
content = content.replace(/<\/?div[^>]*>/gi, "");
// Convert all middlot lists to UL lists
if (tinyMCE.getParam("paste_convert_middot_lists", true)) {
var div = document.createElement("div");
div.innerHTML = content;
// Convert all middot paragraphs to li elements
var className = tinyMCE.getParam("paste_unindented_list_class", "unIndentedList");
while (TinyMCE_PastePlugin._convertMiddots(div, "--list--")) ; // bull
while (TinyMCE_PastePlugin._convertMiddots(div, middot, className)) ; // Middot
while (TinyMCE_PastePlugin._convertMiddots(div, bull)) ; // bull
content = div.innerHTML;
}
// Replace all headers with strong and fix some other issues
if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
content = content.replace(/<h[1-6]>&nbsp;<\/h[1-6]>/gi, '<p>&nbsp;&nbsp;</p>');
content = content.replace(/<h[1-6]>/gi, '<p><b>');
content = content.replace(/<\/h[1-6]>/gi, '</b></p>');
content = content.replace(/<b>&nbsp;<\/b>/gi, '<b>&nbsp;&nbsp;</b>');
content = content.replace(/^(&nbsp;)*/gi, '');
}
content = content.replace(/--list--/gi, ""); // Remove --list--
if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
content = eval(cb + "('after', content)");
// Insert cleaned content
tinyMCE.execCommand("mceInsertContent", false, content);
window.setTimeout('tinyMCE.execCommand("mceCleanup");', 1); // Do normal cleanup detached from this thread
}
},
_reEscape : function(s) {
var l = "?.\\*[](){}+^$:";
var o = "";
for (var i=0; i<s.length; i++) {
var c = s.charAt(i);
if (l.indexOf(c) != -1)
o += '\\' + c;
else
o += c;
}
return o;
},
_convertMiddots : function(div, search, class_name) {
var mdot = String.fromCharCode(183);
var bull = String.fromCharCode(8226);
var nodes = div.getElementsByTagName("p");
var prevul;
for (var i=0; i<nodes.length; i++) {
var p = nodes[i];
// Is middot
if (p.innerHTML.indexOf(search) == 0) {
var ul = document.createElement("ul");
if (class_name)
ul.className = class_name;
// Add the first one
var li = document.createElement("li");
li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--|&nbsp;', "gi"), '');
ul.appendChild(li);
// Add the rest
var np = p.nextSibling;
while (np) {
// If the node is whitespace, then
// ignore it and continue on.
if (np.nodeType == 3 && /^\s$/m.test(np.nodeValue)) {
np = np.nextSibling;
continue;
}
if (search == mdot) {
if (np.nodeType == 1 && /^o(\s+|&nbsp;)/.test(np.innerHTML)) {
// Second level of nesting
if (!prevul) {
prevul = ul;
ul = document.createElement("ul");
prevul.appendChild(ul);
}
np.innerHTML = np.innerHTML.replace(/^o/, '');
} else {
// Pop the stack if we're going back up to the first level
if (prevul) {
ul = prevul;
prevul = null;
}
// Not element or middot paragraph
if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
break;
}
} else {
// Not element or middot paragraph
if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
break;
}
var cp = np.nextSibling;
var li = document.createElement("li");
li.innerHTML = np.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--|&nbsp;', "gi"), '');
np.parentNode.removeChild(np);
ul.appendChild(li);
np = cp;
}
p.parentNode.replaceChild(ul, p);
return true;
}
}
return false;
},
_clipboardHTML : function() {
var div = document.getElementById('_TinyMCE_clipboardHTML');
if (!div) {
var div = document.createElement('DIV');
div.id = '_TinyMCE_clipboardHTML';
with (div.style) {
visibility = 'hidden';
overflow = 'hidden';
position = 'absolute';
width = 1;
height = 1;
}
document.body.appendChild(div);
}
div.innerHTML = '';
var rng = document.body.createTextRange();
rng.moveToElementText(div);
rng.execCommand('Paste');
var html = div.innerHTML;
div.innerHTML = '';
return html;
}
};
tinyMCE.addPlugin("paste", TinyMCE_PastePlugin);

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

View File

@ -0,0 +1,34 @@
function saveContent() {
if (document.forms[0].htmlSource.value == '') {
tinyMCEPopup.close();
return false;
}
tinyMCEPopup.execCommand('mcePasteText', false, {
html : document.forms[0].htmlSource.value,
linebreaks : document.forms[0].linebreaks.checked
});
tinyMCEPopup.close();
}
function onLoadInit() {
tinyMCEPopup.resizeToInnerSize();
resizeInputs();
}
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function resizeInputs() {
if (!tinyMCE.isMSIE) {
wHeight = self.innerHeight-80;
wWidth = self.innerWidth-17;
} else {
wHeight = document.body.clientHeight-80;
wWidth = document.body.clientWidth-17;
}
document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
}

View File

@ -0,0 +1,46 @@
function saveContent() {
var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
if (html == ''){
tinyMCEPopup.close();
return false;
}
tinyMCEPopup.execCommand('mcePasteWord', false, html);
tinyMCEPopup.close();
}
function onLoadInit() {
tinyMCEPopup.resizeToInnerSize();
// Fix for endless reloading in FF
window.setTimeout('createIFrame();', 10);
}
function createIFrame() {
document.getElementById('iframecontainer').innerHTML = '<iframe id="frmData" name="frmData" class="sourceIframe" src="blank.htm" height="280" width="400" frameborder="0" style="background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>';
}
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function initIframe(doc) {
var dir = tinyMCE.selectedInstance.settings['directionality'];
doc.body.dir = dir;
resizeInputs();
}
function resizeInputs() {
if (!tinyMCE.isMSIE) {
wHeight = self.innerHeight - 80;
wWidth = self.innerWidth - 18;
} else {
wHeight = document.body.clientHeight - 80;
wWidth = document.body.clientWidth - 18;
}
var elm = document.getElementById('frmData');
if (elm) {
elm.style.height = Math.abs(wHeight) + 'px';
elm.style.width = Math.abs(wWidth) + 'px';
}
}

View File

@ -0,0 +1,10 @@
// UK lang variables
tinyMCE.addToLang('',{
paste_text_desc : 'Paste as Plain Text',
paste_text_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
paste_text_linebreaks : 'Keep linebreaks',
paste_word_desc : 'Paste from Word',
paste_word_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
selectall_desc : 'Select All'
});

View File

@ -0,0 +1,34 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$lang_paste_text_desc}</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/pastetext.js"></script>
<base target="_self" />
</head>
<body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');" onresize="resizeInputs();" style="display: none">
<form name="source" onsubmit="saveContent();">
<div style="float: left" class="title">{$lang_paste_text_desc}</div>
<div style="float: right">
<input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{$lang_paste_text_linebreaks}</label>
</div>
<br style="clear: both" />
<div>{$lang_paste_text_title}</div>
<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft"></textarea>
<div class="mceActionPanel">
<div style="float: left">
<input type="button" name="insert" value="{$lang_insert}" onclick="saveContent();" id="insert" />
</div>
<div style="float: right">
<input type="button" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
</div>
</div>
</form>
</body>
</html>

View File

@ -0,0 +1,29 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>{$lang_paste_word_desc}</title>
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/pasteword.js"></script>
<link href="css/pasteword.css" rel="stylesheet" type="text/css" />
<base target="_self" />
</head>
<body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');" onresize="resizeInputs();" style="display: none">
<form name="source" onsubmit="saveContent();" action="#">
<div class="title">{$lang_paste_word_desc}</div>
<div>{$lang_paste_word_title}</div>
<div id="iframecontainer"></div>
<div class="mceActionPanel">
<div style="float: left">
<input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="saveContent();" />
</div>
<div style="float: right">
<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
</body>
</html>

View File

@ -0,0 +1,339 @@
<?php
/* Version 0.9, 6th April 2003 - Simon Willison ( http://simon.incutio.com/ )
Manual: http://scripts.incutio.com/httpclient/
*/
class HttpClient {
// Request vars
var $host;
var $port;
var $path;
var $method;
var $postdata = '';
var $cookies = array();
var $referer;
var $accept = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif,*/*';
var $accept_encoding = 'gzip';
var $accept_language = 'en-us';
var $user_agent = 'Incutio HttpClient v0.9';
// Options
var $timeout = 20;
var $use_gzip = true;
var $persist_cookies = true; // If true, received cookies are placed in the $this->cookies array ready for the next request
// Note: This currently ignores the cookie path (and time) completely. Time is not important,
// but path could possibly lead to security problems.
var $persist_referers = true; // For each request, sends path of last request as referer
var $debug = false;
var $handle_redirects = true; // Auaomtically redirect if Location or URI header is found
var $max_redirects = 5;
var $headers_only = false; // If true, stops receiving once headers have been read.
// Basic authorization variables
var $username;
var $password;
// Response vars
var $status;
var $headers = array();
var $content = '';
var $errormsg;
// Tracker variables
var $redirect_count = 0;
var $cookie_host = '';
function HttpClient($host, $port=80) {
$this->host = $host;
$this->port = $port;
}
function get($path, $data = false) {
$this->path = $path;
$this->method = 'GET';
if ($data) {
$this->path .= '?'.$this->buildQueryString($data);
}
return $this->doRequest();
}
function post($path, $data) {
$this->path = $path;
$this->method = 'POST';
$this->postdata = $this->buildQueryString($data);
return $this->doRequest();
}
function buildQueryString($data) {
$querystring = '';
if (is_array($data)) {
// Change data in to postable data
foreach ($data as $key => $val) {
if (is_array($val)) {
foreach ($val as $val2) {
$querystring .= urlencode($key).'='.urlencode($val2).'&';
}
} else {
$querystring .= urlencode($key).'='.urlencode($val).'&';
}
}
$querystring = substr($querystring, 0, -1); // Eliminate unnecessary &
} else {
$querystring = $data;
}
return $querystring;
}
function doRequest() {
// Performs the actual HTTP request, returning true or false depending on outcome
if (!$fp = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout)) {
// Set error message
switch($errno) {
case -3:
$this->errormsg = 'Socket creation failed (-3)';
case -4:
$this->errormsg = 'DNS lookup failure (-4)';
case -5:
$this->errormsg = 'Connection refused or timed out (-5)';
default:
$this->errormsg = 'Connection failed ('.$errno.')';
$this->errormsg .= ' '.$errstr;
$this->debug($this->errormsg);
}
return false;
}
socket_set_timeout($fp, $this->timeout);
$request = $this->buildRequest();
$this->debug('Request', $request);
fwrite($fp, $request);
// Reset all the variables that should not persist between requests
$this->headers = array();
$this->content = '';
$this->errormsg = '';
// Set a couple of flags
$inHeaders = true;
$atStart = true;
// Now start reading back the response
while (!feof($fp)) {
$line = fgets($fp, 4096);
if ($atStart) {
// Deal with first line of returned data
$atStart = false;
if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $line, $m)) {
$this->errormsg = "Status code line invalid: ".htmlentities($line);
$this->debug($this->errormsg);
return false;
}
$http_version = $m[1]; // not used
$this->status = $m[2];
$status_string = $m[3]; // not used
$this->debug(trim($line));
continue;
}
if ($inHeaders) {
if (trim($line) == '') {
$inHeaders = false;
$this->debug('Received Headers', $this->headers);
if ($this->headers_only) {
break; // Skip the rest of the input
}
continue;
}
if (!preg_match('/([^:]+):\\s*(.*)/', $line, $m)) {
// Skip to the next header
continue;
}
$key = strtolower(trim($m[1]));
$val = trim($m[2]);
// Deal with the possibility of multiple headers of same name
if (isset($this->headers[$key])) {
if (is_array($this->headers[$key])) {
$this->headers[$key][] = $val;
} else {
$this->headers[$key] = array($this->headers[$key], $val);
}
} else {
$this->headers[$key] = $val;
}
continue;
}
// We're not in the headers, so append the line to the contents
$this->content .= $line;
}
fclose($fp);
// If data is compressed, uncompress it
if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] == 'gzip') {
$this->debug('Content is gzip encoded, unzipping it');
$this->content = substr($this->content, 10); // See http://www.php.net/manual/en/function.gzencode.php
$this->content = gzinflate($this->content);
}
// If $persist_cookies, deal with any cookies
if ($this->persist_cookies && isset($this->headers['set-cookie']) && $this->host == $this->cookie_host) {
$cookies = $this->headers['set-cookie'];
if (!is_array($cookies)) {
$cookies = array($cookies);
}
foreach ($cookies as $cookie) {
if (preg_match('/([^=]+)=([^;]+);/', $cookie, $m)) {
$this->cookies[$m[1]] = $m[2];
}
}
// Record domain of cookies for security reasons
$this->cookie_host = $this->host;
}
// If $persist_referers, set the referer ready for the next request
if ($this->persist_referers) {
$this->debug('Persisting referer: '.$this->getRequestURL());
$this->referer = $this->getRequestURL();
}
// Finally, if handle_redirects and a redirect is sent, do that
if ($this->handle_redirects) {
if (++$this->redirect_count >= $this->max_redirects) {
$this->errormsg = 'Number of redirects exceeded maximum ('.$this->max_redirects.')';
$this->debug($this->errormsg);
$this->redirect_count = 0;
return false;
}
$location = isset($this->headers['location']) ? $this->headers['location'] : '';
$uri = isset($this->headers['uri']) ? $this->headers['uri'] : '';
if ($location || $uri) {
$url = parse_url($location.$uri);
// This will FAIL if redirect is to a different site
return $this->get($url['path']);
}
}
return true;
}
function buildRequest() {
$headers = array();
$headers[] = "{$this->method} {$this->path} HTTP/1.0"; // Using 1.1 leads to all manner of problems, such as "chunked" encoding
$headers[] = "Host: {$this->host}";
$headers[] = "User-Agent: {$this->user_agent}";
$headers[] = "Accept: {$this->accept}";
if ($this->use_gzip) {
$headers[] = "Accept-encoding: {$this->accept_encoding}";
}
$headers[] = "Accept-language: {$this->accept_language}";
if ($this->referer) {
$headers[] = "Referer: {$this->referer}";
}
// Cookies
if ($this->cookies) {
$cookie = 'Cookie: ';
foreach ($this->cookies as $key => $value) {
$cookie .= "$key=$value; ";
}
$headers[] = $cookie;
}
// Basic authentication
if ($this->username && $this->password) {
$headers[] = 'Authorization: BASIC '.base64_encode($this->username.':'.$this->password);
}
// If this is a POST, set the content type and length
if ($this->postdata) {
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$headers[] = 'Content-Length: '.strlen($this->postdata);
}
$request = implode("\r\n", $headers)."\r\n\r\n".$this->postdata;
return $request;
}
function getStatus() {
return $this->status;
}
function getContent() {
return $this->content;
}
function getHeaders() {
return $this->headers;
}
function getHeader($header) {
$header = strtolower($header);
if (isset($this->headers[$header])) {
return $this->headers[$header];
} else {
return false;
}
}
function getError() {
return $this->errormsg;
}
function getCookies() {
return $this->cookies;
}
function getRequestURL() {
$url = 'http://'.$this->host;
if ($this->port != 80) {
$url .= ':'.$this->port;
}
$url .= $this->path;
return $url;
}
// Setter methods
function setUserAgent($string) {
$this->user_agent = $string;
}
function setAuthorization($username, $password) {
$this->username = $username;
$this->password = $password;
}
function setCookies($array) {
$this->cookies = $array;
}
// Option setting methods
function useGzip($boolean) {
$this->use_gzip = $boolean;
}
function setPersistCookies($boolean) {
$this->persist_cookies = $boolean;
}
function setPersistReferers($boolean) {
$this->persist_referers = $boolean;
}
function setHandleRedirects($boolean) {
$this->handle_redirects = $boolean;
}
function setMaxRedirects($num) {
$this->max_redirects = $num;
}
function setHeadersOnly($boolean) {
$this->headers_only = $boolean;
}
function setDebug($boolean) {
$this->debug = $boolean;
}
// "Quick" static methods
function quickGet($url) {
$bits = parse_url($url);
$host = $bits['host'];
$port = isset($bits['port']) ? $bits['port'] : 80;
$path = isset($bits['path']) ? $bits['path'] : '/';
if (isset($bits['query'])) {
$path .= '?'.$bits['query'];
}
$client = new HttpClient($host, $port);
if (!$client->get($path)) {
return false;
} else {
return $client->getContent();
}
}
function quickPost($url, $data) {
$bits = parse_url($url);
$host = $bits['host'];
$port = isset($bits['port']) ? $bits['port'] : 80;
$path = isset($bits['path']) ? $bits['path'] : '/';
$client = new HttpClient($host, $port);
if (!$client->post($path, $data)) {
return false;
} else {
return $client->getContent();
}
}
function debug($msg, $object = false) {
if ($this->debug) {
print '<div style="border: 1px solid red; padding: 0.5em; margin: 0.5em;"><strong>HttpClient Debug:</strong> '.$msg;
if ($object) {
ob_start();
print_r($object);
$content = htmlentities(ob_get_contents());
ob_end_clean();
print '<pre>'.$content.'</pre>';
}
print '</div>';
}
}
}
?>

View File

@ -0,0 +1,73 @@
<?php
/* *
* Tiny Spelling Interface for TinyMCE Spell Checking.
*
* Copyright © 2006 Moxiecode Systems AB
*/
require_once("HttpClient.class.php");
class TinyGoogleSpell {
var $lang;
function TinyGoogleSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
$this->lang = $lang;
}
// Returns array with bad words or false if failed.
function checkWords($word_array) {
$words = array();
$wordstr = implode(' ', $word_array);
$matches = $this->_getMatches($wordstr);
for ($i=0; $i<count($matches); $i++)
$words[] = substr($wordstr, $matches[$i][1], $matches[$i][2]);
return $words;
}
// Returns array with suggestions or false if failed.
function getSuggestion($word) {
$sug = array();
$matches = $this->_getMatches($word);
if (count($matches) > 0)
$sug = explode("\t", $matches[0][4]);
return $sug;
}
function _getMatches($word_list) {
$xml = "";
// Setup HTTP Client
$client = new HttpClient('www.google.com');
$client->setUserAgent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR');
$client->setHandleRedirects(false);
$client->setDebug(false);
// Setup XML request
$xml .= '<?xml version="1.0" encoding="utf-8" ?>';
$xml .= '<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1">';
$xml .= '<text>' . htmlentities($word_list) . '</text></spellrequest>';
// Execute HTTP Post to Google
if (!$client->post('/tbproxy/spell?lang=' . $this->lang, $xml)) {
$this->errorMsg[] = 'An error occurred: ' . $client->getError();
return array();
}
// Grab and parse content
$xml = $client->getContent();
preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
return $matches;
}
}
// Setup classname, should be the same as the name of the spellchecker class
$spellCheckerConfig['class'] = "TinyGoogleSpell";
?>

View File

@ -0,0 +1,64 @@
<?php
/* *
* Tiny Spelling Interface for TinyMCE Spell Checking.
*
* Copyright © 2006 Moxiecode Systems AB
*
*/
class TinyPSpell {
var $lang;
var $mode;
var $string;
var $plink;
var $errorMsg;
var $jargon;
var $spelling;
var $encoding;
function TinyPSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
$this->lang = $lang;
$this->mode = $mode;
$this->plink = false;
$this->errorMsg = array();
if (!function_exists("pspell_new")) {
$this->errorMsg[] = "PSpell not found.";
return;
}
$this->plink = pspell_new($this->lang, $this->spelling, $this->jargon, $this->encoding, $this->mode);
}
// Returns array with bad words or false if failed.
function checkWords($wordArray) {
if (!$this->plink) {
$this->errorMsg[] = "No PSpell link found for checkWords.";
return array();
}
$wordError = array();
foreach($wordArray as $word) {
if(!pspell_check($this->plink, trim($word)))
$wordError[] = $word;
}
return $wordError;
}
// Returns array with suggestions or false if failed.
function getSuggestion($word) {
if (!$this->plink) {
$this->errorMsg[] = "No PSpell link found for getSuggestion.";
return array();
}
return pspell_suggest($this->plink, $word);
}
}
// Setup classname, should be the same as the name of the spellchecker class
$spellCheckerConfig['class'] = "TinyPspell";
?>

View File

@ -0,0 +1,100 @@
<?php
/* *
* Tiny Spelling Interface for TinyMCE Spell Checking.
*
* Copyright © 2006 Moxiecode Systems AB
*
*/
class TinyPspellShell {
var $lang;
var $mode;
var $string;
var $error;
var $errorMsg;
var $cmd;
var $tmpfile;
var $jargon;
var $spelling;
var $encoding;
function TinyPspellShell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
$this->lang = $lang;
$this->mode = $mode;
$this->error = false;
$this->errorMsg = array();
$this->tmpfile = tempnam($config['tinypspellshell.tmp'], "tinyspell");
$this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang;
}
// Returns array with bad words or false if failed.
function checkWords($wordArray) {
if ($fh = fopen($this->tmpfile, "w")) {
fwrite($fh, "!\n");
foreach($wordArray as $key => $value)
fwrite($fh, "^" . $value . "\n");
fclose($fh);
} else {
$this->errorMsg[] = "PSpell not found.";
return array();
}
$data = shell_exec($this->cmd);
$returnData = array();
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
foreach($dataArr as $dstr) {
$matches = array();
// Skip this line.
if (strpos($dstr, "@") === 0)
continue;
preg_match("/\& (.*) .* .*: .*/i", $dstr, $matches);
if (!empty($matches[1]))
$returnData[] = $matches[1];
}
return $returnData;
}
// Returns array with suggestions or false if failed.
function getSuggestion($word) {
if ($fh = fopen($this->tmpfile, "w")) {
fwrite($fh, "!\n");
fwrite($fh, "^$word\n");
fclose($fh);
} else
die("Error opening tmp file.");
$data = shell_exec($this->cmd);
$returnData = array();
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
foreach($dataArr as $dstr) {
$matches = array();
// Skip this line.
if (strpos($dstr, "@") === 0)
continue;
preg_match("/\& .* .* .*: (.*)/i", $dstr, $matches);
if (!empty($matches[1])) {
// For some reason, the exec version seems to add commas?
$returnData[] = str_replace(",", "", $matches[1]);
}
}
return $returnData;
}
}
// Setup classname, should be the same as the name of the spellchecker class
$spellCheckerConfig['class'] = "TinyPspellShell";
?>

View File

@ -0,0 +1,29 @@
<?php
$spellCheckerConfig = array();
// General settings
$spellCheckerConfig['enabled'] = true;
// Pspell shell specific settings
$spellCheckerConfig['tinypspellshell.aspell'] = '/usr/bin/aspell';
$spellCheckerConfig['tinypspellshell.tmp'] = '/tmp';
// Default settings
$spellCheckerConfig['default.language'] = 'en';
$spellCheckerConfig['default.mode'] = PSPELL_FAST;
// Normaly not required to configure
$spellCheckerConfig['default.spelling'] = "";
$spellCheckerConfig['default.jargon'] = "";
$spellCheckerConfig['default.encoding'] = "";
// Spellchecker class use
if ( function_exists('pspell_new') )
require_once("classes/TinyPspell.class.php"); // Internal PHP version
elseif ( file_exists($spellCheckerConfig['tinypspellshell.aspell']) )
require_once("classes/TinyPspellShell.class.php"); // Command line pspell
else
require_once("classes/TinyGoogleSpell.class.php"); // Google web service
?>

View File

@ -0,0 +1,5 @@
.mceItemHiddenSpellWord {
background: url('../images/wline.gif') repeat-x bottom left;
bo2rder-bottom: 1px dashed red;
cursor: default;
}

View File

@ -0,0 +1,34 @@
.mceMsgBox {
border: 1px solid gray;
padding: 8px;
}
.mceMsgBox span {
vertical-align: top;
color: #555555;
}
/* Misc */
.mceBlockBox {
display: none;
position: absolute;
left: 0;
top: 0;
z-index: 100;
filter:progid:DXImageTransform.Microsoft.Alpha(style=0, opacity=60);
-moz-opacity:0.6;
opacity: 0.6;
background-color: white;
}
.mceMsgBox {
display: none;
z-index: 101;
position: absolute;
left: 0;
top: 0;
font-family: Arial, Verdana, Tahoma, Helvetica;
font-weight: bold;
font-size: 11px;
}

View File

@ -0,0 +1,573 @@
/**
* $RCSfile: editor_plugin_src.js,v $
* $Revision: 1.4 $
* $Date: 2006/03/24 17:24:50 $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
tinyMCE.importPluginLanguagePack('spellchecker', 'en,sv,nn,nb');
// Plucin static class
var TinyMCE_SpellCheckerPlugin = {
_contextMenu : new TinyMCE_Menu(),
_menu : new TinyMCE_Menu(),
_counter : 0,
getInfo : function() {
return {
longname : 'Spellchecker',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_spellchecker.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
handleEvent : function(e) {
var elm = tinyMCE.isMSIE ? e.srcElement : e.target;
var inst = tinyMCE.selectedInstance, args = '';
var self = TinyMCE_SpellCheckerPlugin;
var cm = self._contextMenu;
var p, p2, x, y, sx, sy, h, elm;
// Handle click on word
if ((e.type == "click" || e.type == "contextmenu") && elm) {
do {
if (tinyMCE.getAttrib(elm, 'class') == "mceItemHiddenSpellWord") {
inst.spellCheckerElm = elm;
// Setup arguments
args += 'id=' + inst.editorId + "|" + (++self._counter);
args += '&cmd=suggest&check=' + escape(elm.innerHTML);
args += '&lang=' + escape(inst.spellCheckerLang);
elm = inst.spellCheckerElm;
p = tinyMCE.getAbsPosition(inst.iframeElement);
p2 = tinyMCE.getAbsPosition(elm);
h = parseInt(elm.offsetHeight);
sx = inst.getBody().scrollLeft;
sy = inst.getBody().scrollTop;
x = p.absLeft + p2.absLeft - sx;
y = p.absTop + p2.absTop - sy + h;
cm.clear();
cm.addTitle(tinyMCE.getLang('lang_spellchecker_wait', '', true));
cm.show();
cm.moveTo(x, y);
inst.selection.selectNode(elm, false, false);
self._sendAjax(self.baseURL + "/tinyspell.php", self._ajaxResponse, 'post', args);
tinyMCE.cancelEvent(e);
return false;
}
} while ((elm = elm.parentNode));
}
return true;
},
initInstance : function(inst) {
var self = TinyMCE_SpellCheckerPlugin, m = self._menu, cm = self._contextMenu, e;
tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/spellchecker/css/content.css");
if (!tinyMCE.hasMenu('spellcheckercontextmenu')) {
tinyMCE.importCSS(document, tinyMCE.baseURL + "/plugins/spellchecker/css/spellchecker.css");
cm.init({drop_menu : false});
tinyMCE.addMenu('spellcheckercontextmenu', cm);
}
if (!tinyMCE.hasMenu('spellcheckermenu')) {
m.init({});
tinyMCE.addMenu('spellcheckermenu', m);
}
inst.spellCheckerLang = 'en';
self._buildSettingsMenu(inst, null);
e = self._getBlockBoxLayer(inst).create('div', 'mceBlockBox', document.getElementById(inst.editorId + '_parent'));
self._getMsgBoxLayer(inst).create('div', 'mceMsgBox', document.getElementById(inst.editorId + '_parent'));
},
_getMsgBoxLayer : function(inst) {
if (!inst.spellCheckerMsgBoxL)
inst.spellCheckerMsgBoxL = new TinyMCE_Layer(inst.editorId + '_spellcheckerMsgBox', false);
return inst.spellCheckerMsgBoxL;
},
_getBlockBoxLayer : function(inst) {
if (!inst.spellCheckerBoxL)
inst.spellCheckerBoxL = new TinyMCE_Layer(inst.editorId + '_spellcheckerBlockBox', false);
return inst.spellCheckerBoxL;
},
_buildSettingsMenu : function(inst, lang) {
var i, ar = tinyMCE.getParam('spellchecker_languages', '+English=en').split(','), p;
var self = TinyMCE_SpellCheckerPlugin, m = self._menu, c;
m.clear();
m.addTitle(tinyMCE.getLang('lang_spellchecker_langs', '', true));
for (i=0; i<ar.length; i++) {
if (ar[i] != '') {
p = ar[i].split('=');
c = 'mceMenuCheckItem';
if (p[0].charAt(0) == '+') {
p[0] = p[0].substring(1);
if (lang == null) {
c = 'mceMenuSelectedItem';
inst.spellCheckerLang = p[1];
}
}
if (lang == p[1])
c = 'mceMenuSelectedItem';
m.add({text : p[0], js : "tinyMCE.execInstanceCommand('" + inst.editorId + "','mceSpellCheckerSetLang',false,'" + p[1] + "');", class_name : c});
}
}
},
setupContent : function(editor_id, body, doc) {
TinyMCE_SpellCheckerPlugin._removeWords(doc);
},
getControlHTML : function(cn) {
switch (cn) {
case "spellchecker":
return TinyMCE_SpellCheckerPlugin._getMenuButtonHTML(cn, 'lang_spellchecker_desc', '{$pluginurl}/images/spellchecker.gif', 'lang_spellchecker_desc', 'mceSpellCheckerMenu', 'mceSpellCheck');
}
return "";
},
/**
* Returns the HTML code for a normal button control.
*
* @param {string} id Button control id, this will be the suffix for the element id, the prefix is the editor id.
* @param {string} lang Language variable key name to insert as the title/alt of the button image.
* @param {string} img Image URL to insert, {$themeurl} and {$pluginurl} will be replaced.
* @param {string} mlang Language variable key name to insert as the title/alt of the menu button image.
* @param {string} mid Menu by id to display when the menu button is pressed.
* @param {string} cmd Command to execute when the user clicks the button.
* @param {string} ui Optional user interface boolean for command.
* @param {string} val Optional value for command.
* @return HTML code for a normal button based in input information.
* @type string
*/
_getMenuButtonHTML : function(id, lang, img, mlang, mid, cmd, ui, val) {
var h = '', m, x;
cmd = 'tinyMCE.hideMenus();tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
if (typeof(ui) != "undefined" && ui != null)
cmd += ',' + ui;
if (typeof(val) != "undefined" && val != null)
cmd += ",'" + val + "'";
cmd += ');';
// Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled
if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isMSIE || tinyMCE.isOpera) && (m = tinyMCE.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
// Tiled button
x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceTiledButton mceButtonNormal" target="_self">';
h += '<img src="{$themeurl}/images/spacer.gif" style="background-position: ' + x + 'px 0" title="{$' + lang + '}" />';
h += '<img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" onclick="' + mcmd + 'return false;" />';
h += '</a>';
} else {
if (tinyMCE.isMSIE && !tinyMCE.isOpera)
h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE.plugins.spellchecker._menuButtonEvent(\'over\',this);" onmouseout="tinyMCE.plugins.spellchecker._menuButtonEvent(\'out\',this);">';
else
h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">';
h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';
h += '<img src="' + img + '" title="{$' + lang + '}" /></a>';
h += '<a href="#" onclick="tinyMCE.plugins.spellchecker._toggleMenu(\'{$editor_id}\',\'' + mid + '\');return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />';
h += '</a></span>';
}
return h;
},
_menuButtonEvent : function(e, o) {
if (o.className == 'mceMenuButtonFocus')
return;
if (e == 'over')
o.className = o.className + ' mceMenuHover';
else
o.className = o.className.replace(/\s.*$/, '');
},
_toggleMenu : function(editor_id, id) {
var self = TinyMCE_SpellCheckerPlugin;
var e = document.getElementById(editor_id + '_spellchecker');
var inst = tinyMCE.getInstanceById(editor_id);
if (self._menu.isVisible()) {
tinyMCE.hideMenus();
return;
}
tinyMCE.lastMenuBtnClass = e.className.replace(/\s.*$/, '');
tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonFocus');
self._menu.moveRelativeTo(e, 'bl');
self._menu.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? 0 : 1, -1);
if (tinyMCE.isOpera)
self._menu.moveBy(0, -2);
self._onMenuEvent(inst, self._menu, 'show');
self._menu.show();
tinyMCE.lastSelectedMenuBtn = editor_id + '_spellchecker';
},
_onMenuEvent : function(inst, m, n) {
TinyMCE_SpellCheckerPlugin._buildSettingsMenu(inst, inst.spellCheckerLang);
},
execCommand : function(editor_id, element, command, user_interface, value) {
var inst = tinyMCE.getInstanceById(editor_id), self = TinyMCE_SpellCheckerPlugin, args = '', co, bb, mb, nl, i, e;
// Handle commands
switch (command) {
case "mceSpellCheck":
if (!inst.spellcheckerOn) {
inst.spellCheckerBookmark = inst.selection.getBookmark();
// Setup arguments
args += 'id=' + inst.editorId + "|" + (++self._counter);
args += '&cmd=spell&check=' + escape(self._getWordList(inst.getBody())).replace(/%20/g, '+');
args += '&lang=' + escape(inst.spellCheckerLang);
co = document.getElementById(inst.editorId + '_parent').firstChild;
bb = self._getBlockBoxLayer(inst);
bb.moveRelativeTo(co, 'tl');
bb.resizeTo(co.offsetWidth, co.offsetHeight);
bb.show();
// Setup message box
mb = self._getMsgBoxLayer(inst);
e = mb.getElement();
e.innerHTML = '<span>' + tinyMCE.getLang('lang_spellchecker_swait', '', true) + '</span>';
mb.show();
mb.moveRelativeTo(co, 'cc');
if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
nl = co.getElementsByTagName('select');
for (i=0; i<nl.length; i++)
nl[i].disabled = true;
}
inst.spellcheckerOn = true;
tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonSelected');
self._sendAjax(self.baseURL + "/tinyspell.php", self._ajaxResponse, 'post', args);
} else {
self._removeWords(inst.getDoc());
inst.spellcheckerOn = false;
tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButton');
}
return true;
case "mceSpellCheckReplace":
if (inst.spellCheckerElm)
tinyMCE.setOuterHTML(inst.spellCheckerElm, value);
self._checkDone(inst);
self._contextMenu.hide();
self._menu.hide();
return true;
case "mceSpellCheckIgnore":
if (inst.spellCheckerElm)
self._removeWord(inst.spellCheckerElm);
self._checkDone(inst);
self._contextMenu.hide();
self._menu.hide();
return true;
case "mceSpellCheckIgnoreAll":
if (inst.spellCheckerElm)
self._removeWords(inst.getDoc(), inst.spellCheckerElm.innerHTML);
self._checkDone(inst);
self._contextMenu.hide();
self._menu.hide();
return true;
case "mceSpellCheckerSetLang":
tinyMCE.hideMenus();
inst.spellCheckerLang = value;
self._removeWords(inst.getDoc());
inst.spellcheckerOn = false;
tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButton');
return true;
}
// Pass to next handler in chain
return false;
},
cleanup : function(type, content, inst) {
switch (type) {
case "get_from_editor_dom":
TinyMCE_SpellCheckerPlugin._removeWords(content);
inst.spellcheckerOn = false;
break;
}
return content;
},
// Private plugin specific methods
_displayUI : function(inst) {
var self = TinyMCE_SpellCheckerPlugin;
var bb = self._getBlockBoxLayer(inst);
var mb = self._getMsgBoxLayer(inst);
var nl, i;
var co = document.getElementById(inst.editorId + '_parent').firstChild;
if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
nl = co.getElementsByTagName('select');
for (i=0; i<nl.length; i++)
nl[i].disabled = false;
}
bb.hide();
mb.hide();
},
_ajaxResponse : function(xml) {
var el = xml ? xml.documentElement : null;
var inst = tinyMCE.selectedInstance, self = TinyMCE_SpellCheckerPlugin;
var cmd = el ? el.getAttribute("cmd") : null, err, id = el ? el.getAttribute("id") : null;
if (id)
inst = tinyMCE.getInstanceById(id.substring(0, id.indexOf('|')));
self._displayUI(inst);
// Ignore suggestions for other ajax responses
if (cmd == "suggest" && id != inst.editorId + "|" + self._counter)
return;
if (!el) {
inst.spellcheckerOn = false;
tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
alert("Could not execute AJAX call, server didn't return valid a XML.");
return;
}
err = el.getAttribute("error");
if (err == "true") {
inst.spellcheckerOn = false;
tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
alert(el.getAttribute("msg"));
return;
}
switch (cmd) {
case "spell":
if (xml.documentElement.firstChild) {
self._markWords(inst.getDoc(), inst.getBody(), el.firstChild.nodeValue.split(' '));
inst.selection.moveToBookmark(inst.spellCheckerBookmark);
} else
alert(tinyMCE.getLang('lang_spellchecker_no_mpell', '', true));
self._checkDone(inst);
break;
case "suggest":
self._buildMenu(el.firstChild ? el.firstChild.nodeValue.split(' ') : null, 10);
self._contextMenu.show();
break;
}
},
_getWordSeparators : function() {
var i, re = '', ch = tinyMCE.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');
for (i=0; i<ch.length; i++)
re += '\\' + ch.charAt(i);
return re;
},
_getWordList : function(n) {
var i, x, s, nv = '', nl = tinyMCE.getNodeTree(n, new Array(), 3), wl = new Array();
var re = TinyMCE_SpellCheckerPlugin._getWordSeparators();
for (i=0; i<nl.length; i++)
nv += nl[i].nodeValue + " ";
nv = nv.replace(new RegExp('([0-9]|[' + re + '])', 'g'), ' ');
nv = tinyMCE.trim(nv.replace(/(\s+)/g, ' '));
nl = nv.split(/\s+/);
for (i=0; i<nl.length; i++) {
s = false;
for (x=0; x<wl.length; x++) {
if (wl[x] == nl[i]) {
s = true;
break;
}
}
if (!s)
wl[wl.length] = nl[i];
}
return wl.join(' ');
},
_removeWords : function(doc, word) {
var i, c, nl = doc.getElementsByTagName("span");
var self = TinyMCE_SpellCheckerPlugin;
var inst = tinyMCE.selectedInstance, b = inst ? inst.selection.getBookmark() : null;
word = typeof(word) == 'undefined' ? null : word;
for (i=nl.length-1; i>=0; i--) {
c = tinyMCE.getAttrib(nl[i], 'class');
if ((c == 'mceItemHiddenSpellWord' || c == 'mceItemHidden') && (word == null || nl[i].innerHTML == word))
self._removeWord(nl[i]);
}
if (b)
inst.selection.moveToBookmark(b);
},
_checkDone : function(inst) {
var i, w = 0, nl = inst.getDoc().getElementsByTagName("span")
var self = TinyMCE_SpellCheckerPlugin;
for (i=nl.length-1; i>=0; i--) {
c = tinyMCE.getAttrib(nl[i], 'class');
if (c == 'mceItemHiddenSpellWord')
w++;
}
if (w == 0) {
self._removeWords(inst.getDoc());
inst.spellcheckerOn = false;
tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
}
},
_removeWord : function(e) {
tinyMCE.setOuterHTML(e, e.innerHTML);
},
_markWords : function(doc, n, wl) {
var i, nv, nn, nl = tinyMCE.getNodeTree(n, new Array(), 3);
var r1, r2, r3, r4, r5, w = '';
var re = TinyMCE_SpellCheckerPlugin._getWordSeparators();
for (i=0; i<wl.length; i++)
w += wl[i] + ((i == wl.length-1) ? '' : '|');
r1 = new RegExp('([' + re + '])(' + w + ')([' + re + '])', 'g');
r2 = new RegExp('^(' + w + ')', 'g');
r3 = new RegExp('(' + w + ')([' + re + ']?)$', 'g');
r4 = new RegExp('^(' + w + ')([' + re + ']?)$', 'g');
r5 = new RegExp('(' + w + ')([' + re + '])', 'g');
for (i=0; i<nl.length; i++) {
nv = nl[i].nodeValue;
if (r1.test(nv) || r2.test(nv) || r3.test(nv) || r4.test(nv)) {
nv = tinyMCE.xmlEncode(nv);
nv = nv.replace(r5, '<span class="mceItemHiddenSpellWord">$1</span>$2');
nv = nv.replace(r3, '<span class="mceItemHiddenSpellWord">$1</span>$2');
nn = doc.createElement('span');
nn.className = "mceItemHidden";
nn.innerHTML = nv;
// Remove old text node
nl[i].parentNode.replaceChild(nn, nl[i]);
}
}
},
_buildMenu : function(sg, max) {
var i, self = TinyMCE_SpellCheckerPlugin, cm = self._contextMenu;
cm.clear();
if (sg != null) {
cm.addTitle(tinyMCE.getLang('lang_spellchecker_sug', '', true));
for (i=0; i<sg.length && i<max; i++)
cm.addItem(sg[i], 'tinyMCE.execCommand("mceSpellCheckReplace",false,"' + sg[i] + '");');
cm.addSeparator();
cm.addItem(tinyMCE.getLang('lang_spellchecker_ignore_word', '', true), 'tinyMCE.execCommand(\'mceSpellCheckIgnore\');');
cm.addItem(tinyMCE.getLang('lang_spellchecker_ignore_words', '', true), 'tinyMCE.execCommand(\'mceSpellCheckIgnoreAll\');');
} else
cm.addTitle(tinyMCE.getLang('lang_spellchecker_no_sug', '', true));
cm.update();
},
_getAjaxHTTP : function() {
try {
return new ActiveXObject('Msxml2.XMLHTTP')
} catch (e) {
try {
return new ActiveXObject('Microsoft.XMLHTTP')
} catch (e) {
return new XMLHttpRequest();
}
}
},
/**
* Perform AJAX call.
*
* @param {string} u URL of AJAX service.
* @param {function} f Function to call when response arrives.
* @param {string} m Request method post or get.
* @param {Array} a Array with arguments to send.
*/
_sendAjax : function(u, f, m, a) {
var x = TinyMCE_SpellCheckerPlugin._getAjaxHTTP();
x.open(m, u, true);
x.onreadystatechange = function() {
if (x.readyState == 4)
f(x.responseXML);
};
if (m == 'post')
x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
x.send(a);
}
};
// Register plugin
tinyMCE.addPlugin('spellchecker', TinyMCE_SpellCheckerPlugin);

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 B

View File

@ -0,0 +1,14 @@
// UK lang variables
tinyMCE.addToLang('spellchecker',{
desc : 'Toggle spellchecker',
menu : 'Spellchecker settings',
ignore_word : 'Ignore word',
ignore_words : 'Ignore all',
langs : 'Languages',
wait : 'Please wait...',
swait : 'Spellchecking, please wait...',
sug : 'Suggestions',
no_sug : 'No suggestions',
no_mpell : 'No misspellings found.'
});

View File

@ -0,0 +1,133 @@
<?php
/**
* $RCSfile: tinyspell.php,v $
* $Revision: 1.1 $
* $Date: 2006/03/14 17:33:47 $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
require_once("config.php");
$id = sanitize($_POST['id'], "loose");
if (!$spellCheckerConfig['enabled']) {
header('Content-type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8" ?><res id="' . $id . '" error="true" msg="You must enable the spellchecker by modifying the config.php file." />';
die;
}
// Basic config
$defaultLanguage = $spellCheckerConfig['default.language'];
$defaultMode = $spellCheckerConfig['default.mode'];
// Normaly not required to configure
$defaultSpelling = $spellCheckerConfig['default.spelling'];
$defaultJargon = $spellCheckerConfig['default.jargon'];
$defaultEncoding = $spellCheckerConfig['default.encoding'];
$outputType = "xml"; // Do not change
// Get input parameters.
$check = $_POST['check'];
$cmd = sanitize($_POST['cmd']);
$lang = sanitize($_POST['lang'], "strict");
$mode = sanitize($_POST['mode'], "strict");
$spelling = sanitize($_POST['spelling'], "strict");
$jargon = sanitize($_POST['jargon'], "strict");
$encoding = sanitize($_POST['encoding'], "strict");
$sg = sanitize($_POST['sg'], "bool");
$words = array();
$validRequest = true;
if (empty($check))
$validRequest = false;
if (empty($lang))
$lang = $defaultLanguage;
if (empty($mode))
$mode = $defaultMode;
if (empty($spelling))
$spelling = $defaultSpelling;
if (empty($jargon))
$jargon = $defaultJargon;
if (empty($encoding))
$encoding = $defaultEncoding;
function sanitize($str, $type="strict") {
switch ($type) {
case "strict":
$str = preg_replace("/[^a-zA-Z0-9_\-]/i", "", $str);
break;
case "loose":
$str = preg_replace("/</i", "&gt;", $str);
$str = preg_replace("/>/i", "&lt;", $str);
break;
case "bool":
if ($str == "true" || $str == true)
$str = true;
else
$str = false;
break;
}
return $str;
}
$result = array();
$tinyspell = new $spellCheckerConfig['class']($spellCheckerConfig, $lang, $mode, $spelling, $jargon, $encoding);
if (count($tinyspell->errorMsg) == 0) {
switch($cmd) {
case "spell":
// Space for non-exec version and \n for the exec version.
$words = preg_split("/ |\n/", $check, -1, PREG_SPLIT_NO_EMPTY);
$result = $tinyspell->checkWords($words);
break;
case "suggest":
$result = $tinyspell->getSuggestion($check);
break;
default:
// Just use this for now.
$tinyspell->errorMsg[] = "No command.";
$outputType = $outputType . "error";
break;
}
} else
$outputType = $outputType . "error";
if (!$result)
$result = array();
// Output data
switch($outputType) {
case "xml":
header('Content-type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8" ?>';
echo "\n";
if (count($result) == 0)
echo '<res id="' . $id . '" cmd="'. $cmd .'" />';
else
echo '<res id="' . $id . '" cmd="'. $cmd .'">'. utf8_encode(implode(" ", $result)) .'</res>';
break;
case "xmlerror";
header('Content-type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8" ?>';
echo "\n";
echo '<res id="' . $id . '" cmd="'. $cmd .'" error="true" msg="'. implode(" ", $tinyspell->errorMsg) .'" />';
break;
case "html":
var_dump($result);
break;
case "htmlerror":
echo "Error";
break;
}
?>

View File

@ -1,27 +1,321 @@
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('wordpress', '');
tinyMCE.importPluginLanguagePack('wordpress', 'en');
function TinyMCE_wordpress_initInstance(inst) {
if (!tinyMCE.settings['wordpress_skip_plugin_css'])
tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/wordpress/wordpress.css");
}
var TinyMCE_wordpressPlugin = {
getInfo : function() {
return {
longname : 'WordPress Plugin',
author : 'WordPress',
authorurl : 'http://wordpress.org',
infourl : 'http://wordpress.org',
version : '1'
};
},
function TinyMCE_wordpress_getControlHTML(control_name) {
getControlHTML : function(control_name) {
switch (control_name) {
case "wordpress":
var titleMore = tinyMCE.getLang('lang_wordpress_more_button');
var titlePage = tinyMCE.getLang('lang_wordpress_page_button');
var titleHelp = tinyMCE.getLang('lang_wordpress_help_button');
var buttons = '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\');return false;"><img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="'+titleMore+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
// Add this to the buttons var to put the Page button into the toolbar.
// '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\')" target="_self" onclick="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\');return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="'+titlePage+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
return buttons;
case "wp_more":
return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_more_button', '{$pluginurl}/images/more.gif', 'wpMore');
case "wp_page":
return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_page_button', '{$pluginurl}/images/page.gif', 'wpPage');
case "wp_help":
var buttons = tinyMCE.getButtonHTML(control_name, 'lang_help_button_title', '{$pluginurl}/images/help.gif', 'wpHelp');
var hiddenControls = '<div class="zerosize">'
+ '<input type="button" accesskey="n" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSpellCheck\',false);" />'
+ '<input type="button" accesskey="k" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Strikethrough\',false);" />'
+ '<input type="button" accesskey="l" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertUnorderedList\',false);" />'
+ '<input type="button" accesskey="o" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertOrderedList\',false);" />'
+ '<input type="button" accesskey="w" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Outdent\',false);" />'
+ '<input type="button" accesskey="q" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Indent\',false);" />'
+ '<input type="button" accesskey="f" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyLeft\',false);" />'
+ '<input type="button" accesskey="c" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyCenter\',false);" />'
+ '<input type="button" accesskey="r" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyRight\',false);" />'
+ '<input type="button" accesskey="j" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyFull\',false);" />'
+ '<input type="button" accesskey="a" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceLink\',true);" />'
+ '<input type="button" accesskey="s" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'unlink\',false);" />'
+ '<input type="button" accesskey="m" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceImage\',true);" />'
+ '<input type="button" accesskey="t" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpMore\');" />'
+ '<input type="button" accesskey="g" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpPage\');" />'
+ '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />'
+ '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />'
+ '<input type="button" accesskey="e" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceCodeEditor\',false);" />'
+ '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpHelp\',false);" />'
+ '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpAdv\',false);" />'
+ '</div>';
return buttons+hiddenControls;
case "wp_adv":
return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_adv_button', '{$pluginurl}/images/toolbars.gif', 'wpAdv');
case "wp_adv_start":
return '<div id="wpadvbar" style="display:none;"><br />';
case "wp_adv_end":
return '</div>';
}
return '';
},
execCommand : function(editor_id, element, command, user_interface, value) {
var inst = tinyMCE.getInstanceById(editor_id);
var focusElm = inst.getFocusElement();
var doc = inst.getDoc();
function getAttrib(elm, name) {
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
}
return '';
}
// Handle commands
switch (command) {
case "wpMore":
var flag = "";
var template = new Array();
var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
function TinyMCE_wordpress_parseAttributes(attribute_string) {
// Is selection a image
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
flag = getAttrib(focusElm, 'class');
if (flag != 'mce_plugin_wordpress_more') // Not a wordpress
return true;
action = "update";
}
html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" '
+ 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false, html);
tinyMCE.selectedInstance.repaint();
return true;
case "wpPage":
var flag = "";
var template = new Array();
var altPage = tinyMCE.getLang('lang_wordpress_more_alt');
// Is selection a image
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
flag = getAttrib(focusElm, 'name');
if (flag != 'mce_plugin_wordpress_page') // Not a wordpress
return true;
action = "update";
}
html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" '
+ 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
tinyMCE.execCommand("mceInsertContent",true,html);
tinyMCE.selectedInstance.repaint();
return true;
case "wpHelp":
var template = new Array();
template['file'] = tinyMCE.baseURL + '/wp-mce-help.php';
template['width'] = 480;
template['height'] = 380;
args = {
resizable : 'yes',
scrollbars : 'yes'
};
tinyMCE.openWindow(template, args);
return true;
case "wpAdv":
var adv = document.getElementById('wpadvbar');
if ( adv.style.display == 'none' ) {
adv.style.display = 'block';
tinyMCE.switchClass(editor_id + '_wp_adv', 'mceButtonSelected');
} else {
adv.style.display = 'none';
tinyMCE.switchClass(editor_id + '_wp_adv', 'mceButtonNormal');
}
return true;
}
// Pass to next handler in chain
return false;
},
cleanup : function(type, content) {
switch (type) {
case "insert_to_editor":
var startPos = 0;
var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
var altPage = tinyMCE.getLang('lang_wordpress_page_alt');
// Parse all <!--more--> tags and replace them with images
while ((startPos = content.indexOf('<!--more-->', startPos)) != -1) {
// Insert image
var contentAfter = content.substring(startPos + 11);
content = content.substring(0, startPos);
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
content += ' width="100%" height="10px" ';
content += 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
content += contentAfter;
startPos++;
}
var startPos = 0;
// Parse all <!--page--> tags and replace them with images
while ((startPos = content.indexOf('<!--nextpage-->', startPos)) != -1) {
// Insert image
var contentAfter = content.substring(startPos + 15);
content = content.substring(0, startPos);
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
content += ' width="100%" height="10px" ';
content += 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
content += contentAfter;
startPos++;
}
// Look for \n in <pre>, replace with <br>
var startPos = -1;
while ((startPos = content.indexOf('<pre', startPos+1)) != -1) {
var endPos = content.indexOf('</pre>', startPos+1);
var innerPos = content.indexOf('>', startPos+1);
var chunkBefore = content.substring(0, innerPos);
var chunkAfter = content.substring(endPos);
var innards = content.substring(innerPos, endPos);
innards = innards.replace(/\n/g, '<br />');
content = chunkBefore + innards + chunkAfter;
}
break;
case "get_from_editor":
// Parse all img tags and replace them with <!--more-->
var startPos = -1;
while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
var endPos = content.indexOf('/>', startPos);
var attribs = this._parseAttributes(content.substring(startPos + 4, endPos));
if (attribs['class'] == "mce_plugin_wordpress_more" || attribs['name'] == "mce_plugin_wordpress_more") {
endPos += 2;
var embedHTML = '<!--more-->';
// Insert embed/object chunk
chunkBefore = content.substring(0, startPos);
chunkAfter = content.substring(endPos);
content = chunkBefore + embedHTML + chunkAfter;
}
if (attribs['class'] == "mce_plugin_wordpress_page" || attribs['name'] == "mce_plugin_wordpress_page") {
endPos += 2;
var embedHTML = '<!--nextpage-->';
// Insert embed/object chunk
chunkBefore = content.substring(0, startPos);
chunkAfter = content.substring(endPos);
content = chunkBefore + embedHTML + chunkAfter;
}
}
// Remove normal line breaks
content = content.replace(/\n|\r/g, ' ');
// Look for <br> in <pre>, replace with \n
var startPos = -1;
while ((startPos = content.indexOf('<pre', startPos+1)) != -1) {
var endPos = content.indexOf('</pre>', startPos+1);
var innerPos = content.indexOf('>', startPos+1);
var chunkBefore = content.substring(0, innerPos);
var chunkAfter = content.substring(endPos);
var innards = content.substring(innerPos, endPos);
innards = innards.replace(new RegExp('<br\\s?/?>', 'g'), '\n');
innards = innards.replace(new RegExp('\\s$', ''), '');
content = chunkBefore + innards + chunkAfter;
}
// Remove anonymous, empty paragraphs.
content = content.replace(new RegExp('<p>(\\s|&nbsp;)*</p>', 'mg'), '');
// Handle table badness.
content = content.replace(new RegExp('<(table( [^>]*)?)>.*?<((tr|thead)( [^>]*)?)>', 'mg'), '<$1><$3>');
content = content.replace(new RegExp('<(tr|thead|tfoot)>.*?<((td|th)( [^>]*)?)>', 'mg'), '<$1><$2>');
content = content.replace(new RegExp('</(td|th)>.*?<(td( [^>]*)?|th( [^>]*)?|/tr|/thead|/tfoot)>', 'mg'), '</$1><$2>');
content = content.replace(new RegExp('</tr>.*?<(tr|/table)>', 'mg'), '</tr><$1>');
content = content.replace(new RegExp('<(/?(table|tbody|tr|th|td)[^>]*)>(\\s*|(<br ?/?>)*)*', 'g'), '<$1>');
// Pretty it up for the source editor.
var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre|p';
content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)>\\s*', 'mg'), '\n<$1>');
content = content.replace(new RegExp('<((li|/?tr|/?thead|/?tfoot)( [^>]*)?)>', 'g'), '\t<$1>');
content = content.replace(new RegExp('<((td|th)( [^>]*)?)>', 'g'), '\t\t<$1>');
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n');
content = content.replace(new RegExp('^\\s*', ''), '');
content = content.replace(new RegExp('\\s*$', ''), '');
break;
}
// Pass through to next handler in chain
return content;
},
handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
tinyMCE.switchClass(editor_id + '_wp_more', 'mceButtonNormal');
tinyMCE.switchClass(editor_id + '_wp_page', 'mceButtonNormal');
if (node == null)
return;
do {
if (node.nodeName.toLowerCase() == "img" && tinyMCE.getAttrib(node, 'class').indexOf('mce_plugin_wordpress_more') == 0)
tinyMCE.switchClass(editor_id + '_wp_more', 'mceButtonSelected');
if (node.nodeName.toLowerCase() == "img" && tinyMCE.getAttrib(node, 'class').indexOf('mce_plugin_wordpress_page') == 0)
tinyMCE.switchClass(editor_id + '_wp_page', 'mceButtonSelected');
} while ((node = node.parentNode));
return true;
},
saveCallback : function(el, content, body) {
// We have a TON of cleanup to do.
// Mark </p> if it has any attributes.
content = content.replace(new RegExp('(<p[^>]+>.*?)</p>', 'mg'), '$1</p#>');
// Decode the ampersands of time.
// content = content.replace(new RegExp('&amp;', 'g'), '&');
// Get it ready for wpautop.
content = content.replace(new RegExp('[\\s]*<p>[\\s]*', 'mgi'), '');
content = content.replace(new RegExp('[\\s]*</p>[\\s]*', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\n\\s*\\n\\s*\\n*', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
// Fix some block element newline issues
var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre';
content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
content = content.replace(new RegExp('<li>', 'g'), '\t<li>');
// Unmark special paragraph closing tags
content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1');
// Trim any whitespace
content = content.replace(new RegExp('^\\s*', ''), '');
content = content.replace(new RegExp('\\s*$', ''), '');
// Hope.
return content;
},
_parseAttributes : function(attribute_string) {
var attributeName = "";
var attributeValue = "";
var withInName;
@ -66,220 +360,41 @@ function TinyMCE_wordpress_parseAttributes(attribute_string) {
}
return attributes;
}
function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interface, value) {
var inst = tinyMCE.getInstanceById(editor_id);
var focusElm = inst.getFocusElement();
var doc = inst.getDoc();
function getAttrib(elm, name) {
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
}
};
// Handle commands
switch (command) {
case "mcewordpressmore":
var flag = "";
var template = new Array();
var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
tinyMCE.addPlugin("wordpress", TinyMCE_wordpressPlugin);
// Is selection a image
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
flag = getAttrib(focusElm, 'class');
/* This little hack protects our More and Page placeholders from the removeformat command */
tinyMCE.orgExecCommand = tinyMCE.execCommand;
tinyMCE.execCommand = function (command, user_interface, value) {
re = this.orgExecCommand(command, user_interface, value);
if (flag != 'mce_plugin_wordpress_more') // Not a wordpress
return true;
action = "update";
if ( command == 'removeformat' ) {
var inst = tinyMCE.getInstanceById('mce_editor_0');
doc = inst.getDoc();
var imgs = doc.getElementsByTagName('img');
for (i=0;img=imgs[i];i++)
img.className = img.name;
}
return re;
};
html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" '
+ 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
tinyMCE.execCommand("mceInsertContent",true,html);
tinyMCE.selectedInstance.repaint();
return true;
case "mcewordpresspage":
var flag = "";
var template = new Array();
var altPage = tinyMCE.getLang('lang_wordpress_more_alt');
tinyMCE.orgFixGeckoBaseHREFBug = tinyMCE.fixGeckoBaseHREFBug;
tinyMCE.fixGeckoBaseHREFBug = function(m, e, h) {
if ( tinyMCE.isGecko && m == 1 )
h = h.replace(new RegExp('<((a|img|select|area|iframe|base|input|script|embed|object|link)\\s([^>]*\\s)?)(src|href)\\s*=', 'gi'), '<$1 x$4=');
else
h = tinyMCE.orgFixGeckoBaseHREFBug(m, e, h);
// Is selection a image
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
flag = getAttrib(focusElm, 'name');
return h;
};
if (flag != 'mce_plugin_wordpress_page') // Not a wordpress
return true;
tinyMCE.orgStoreAwayURLs = tinyMCE.storeAwayURLs;
tinyMCE.storeAwayURLs = function(s) {
// Remove all mce_src, mce_href and replace them with new ones
s = s.replace(new RegExp('mce_(href|src)\\s*=\\s*\"[^ >\"]*\"', 'gi'), '');
s = s.replace(new RegExp('<((a|img|select|area|iframe|base|input|script|embed|object|link)\\s([^>]*\\s)?)(src|href)\\s*=\\s*"([^"]*)"', 'gi'), '<$1 $4="$5" mce_$4="$5"');
action = "update";
}
html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" '
+ 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
tinyMCE.execCommand("mceInsertContent",true,html);
tinyMCE.selectedInstance.repaint();
return true;
}
// Pass to next handler in chain
return false;
}
function TinyMCE_wordpress_cleanup(type, content) {
switch (type) {
case "insert_to_editor":
var startPos = 0;
var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
var altPage = tinyMCE.getLang('lang_wordpress_page_alt');
// Parse all <!--more--> tags and replace them with images
while ((startPos = content.indexOf('<!--more-->', startPos)) != -1) {
// Insert image
var contentAfter = content.substring(startPos + 11);
content = content.substring(0, startPos);
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
content += ' width="100%" height="10px" ';
content += 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" />';
content += contentAfter;
startPos++;
}
var startPos = 0;
// Parse all <!--page--> tags and replace them with images
while ((startPos = content.indexOf('<!--nextpage-->', startPos)) != -1) {
// Insert image
var contentAfter = content.substring(startPos + 15);
content = content.substring(0, startPos);
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
content += ' width="100%" height="10px" ';
content += 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" />';
content += contentAfter;
startPos++;
}
// It's supposed to be WYSIWYG, right?
content = content.replace(new RegExp('&', 'g'), '&amp;');
break;
case "get_from_editor":
// Parse all img tags and replace them with <!--more-->
var startPos = -1;
while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
var endPos = content.indexOf('/>', startPos);
var attribs = TinyMCE_wordpress_parseAttributes(content.substring(startPos + 4, endPos));
if (attribs['class'] == "mce_plugin_wordpress_more") {
endPos += 2;
var embedHTML = '<!--more-->';
// Insert embed/object chunk
chunkBefore = content.substring(0, startPos);
chunkAfter = content.substring(endPos);
content = chunkBefore + embedHTML + chunkAfter;
}
if (attribs['class'] == "mce_plugin_wordpress_page") {
endPos += 2;
var embedHTML = '<!--nextpage-->';
// Insert embed/object chunk
chunkBefore = content.substring(0, startPos);
chunkAfter = content.substring(endPos);
content = chunkBefore + embedHTML + chunkAfter;
}
}
// If it says & in the WYSIWYG editor, it should say &amp; in the html.
content = content.replace(new RegExp('&', 'g'), '&amp;');
content = content.replace(new RegExp('&amp;nbsp;', 'g'), '&nbsp;');
// Remove anonymous, empty paragraphs.
content = content.replace(new RegExp('<p>(\\s|&nbsp;)*</p>', 'mg'), '');
// Handle table badness.
content = content.replace(new RegExp('<(table( [^>]*)?)>.*?<((tr|thead)( [^>]*)?)>', 'mg'), '<$1><$3>');
content = content.replace(new RegExp('<(tr|thead|tfoot)>.*?<((td|th)( [^>]*)?)>', 'mg'), '<$1><$2>');
content = content.replace(new RegExp('</(td|th)>.*?<(td( [^>]*)?|th( [^>]*)?|/tr|/thead|/tfoot)>', 'mg'), '</$1><$2>');
content = content.replace(new RegExp('</tr>.*?<(tr|/table)>', 'mg'), '</tr><$1>');
content = content.replace(new RegExp('<(/?(table|tbody|tr|th|td)[^>]*)>(\\s*|(<br ?/?>)*)*', 'g'), '<$1>');
// Pretty it up for the source editor.
var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre|p';
content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)>\\s*', 'mg'), '\n<$1>');
content = content.replace(new RegExp('<((li|/?tr|/?thead|/?tfoot)( [^>]*)?)>', 'g'), '\t<$1>');
content = content.replace(new RegExp('<((td|th)( [^>]*)?)>', 'g'), '\t\t<$1>');
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n');
content = content.replace(new RegExp('^\\s*', ''), '');
content = content.replace(new RegExp('\\s*$', ''), '');
break;
}
// Pass through to next handler in chain
return content;
}
function TinyMCE_wordpress_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
function getAttrib(elm, name) {
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
}
tinyMCE.switchClassSticky(editor_id + '_wordpress_more', 'mceButtonNormal');
tinyMCE.switchClassSticky(editor_id + '_wordpress_page', 'mceButtonNormal');
if (node == null)
return;
do {
if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'class').indexOf('mce_plugin_wordpress_more') == 0)
tinyMCE.switchClassSticky(editor_id + '_wordpress_more', 'mceButtonSelected');
if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'class').indexOf('mce_plugin_wordpress_page') == 0)
tinyMCE.switchClassSticky(editor_id + '_wordpress_page', 'mceButtonSelected');
} while ((node = node.parentNode));
return true;
}
function wp_save_callback(el, content, body) {
// We have a TON of cleanup to do.
// Mark </p> if it has any attributes.
content = content.replace(new RegExp('(<p[^>]+>.*?)</p>', 'mg'), '$1</p#>');
// Decode the ampersands of time.
content = content.replace(new RegExp('&amp;', 'g'), '&');
// Get it ready for wpautop.
content = content.replace(new RegExp('[\\s]*<p>[\\s]*', 'mgi'), '');
content = content.replace(new RegExp('[\\s]*</p>[\\s]*', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\n\\s*\\n\\s*\\n*', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
// Fix some block element newline issues
var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre';
content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
content = content.replace(new RegExp('<li>', 'g'), '\t<li>');
// Unmark special paragraph closing tags
content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1');
// Trim any whitespace
content = content.replace(new RegExp('^\\s*', ''), '');
content = content.replace(new RegExp('\\s*$', ''), '');
// Hope.
return content;
}
return s;
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

View File

@ -9,8 +9,25 @@ else {
}
tinyMCE.addToLang('',{
wordpress_more_button : 'Split post with More tag (' + metaKey + '-t)',
wordpress_more_button : 'Split post with More tag (' + metaKey + '+t)',
wordpress_page_button : 'Split post with Page tag',
wordpress_adv_button : 'Show/Hide Advanced Toolbar (' + metaKey + '+b)',
wordpress_more_alt : 'More...',
wordpress_page_alt : '...page...'
wordpress_page_alt : '...page...',
help_button_title : 'Help (' + metaKey + '+h)',
bold_desc : 'Bold (Ctrl+B)',
italic_desc : 'Italic (Ctrl+I)',
underline_desc : 'Underline (Ctrl+U)',
link_desc : 'Insert/edit link (' + metaKey + '+a)',
unlink_desc : 'Unlink (' + metaKey + '+s)',
image_desc : 'Insert/edit image (' + metaKey + '+m)',
striketrough_desc : 'Strikethrough (' + metaKey + '+k)',
justifyleft_desc : 'Align left (' + metaKey + '+f)',
justifycenter_desc : 'Align center (' + metaKey + '+c)',
justifyright_desc : 'Align right (' + metaKey + '+r)',
justifyfull_desc : 'Align full (' + metaKey + '+j)',
bullist_desc : 'Unordered list (' + metaKey + '+l)',
numlist_desc : 'Ordered list (' + metaKey + '+o)',
outdent_desc : 'Outdent (' + metaKey + '+w)',
indent_desc : 'Indent List/Blockquote (' + metaKey + '+q)'
});

View File

@ -0,0 +1,354 @@
/* This file contains the CSS data for all popups in TinyMCE */
body {
background-color: #F0F0EE;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
scrollbar-3dlight-color: #F0F0EE;
scrollbar-arrow-color: #676662;
scrollbar-base-color: #F0F0EE;
scrollbar-darkshadow-color: #DDDDDD;
scrollbar-face-color: #E0E0DD;
scrollbar-highlight-color: #F0F0EE;
scrollbar-shadow-color: #F0F0EE;
scrollbar-track-color: #F5F5F5;
margin: 8px;
}
td {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
}
input {
background: #FFFFFF;
border: 1px solid #cccccc;
}
td, input, select, textarea {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
input, select, textarea {
border: 1px solid #808080;
}
.input_noborder {
border: 0;
}
#insert, .updateButton {
font-weight: bold;
width: 90px;
height: 21px;
border: 0;
background-image: url('../images/insert_button_bg.gif');
cursor: pointer;
}
#cancel {
font-weight: bold;
width: 90px;
height: 21px;
border: 0;
background-image: url('../images/cancel_button_bg.gif');
cursor: pointer;
}
/* Mozilla only style */
html>body #insert, html>body #cancel {
padding-bottom: 2px;
}
.title {
display: block;
padding-top: 5px;
padding-bottom: 5px;
padding-left: 15px;
font-size: 15px;
}
table.charmap {
border-style: solid;
border-width: 1px;
border-color: #AAAAAA;
}
td.charmap, td.charmapOver {
color: #000000;
border-color: #AAAAAA;
border-style: solid;
border-width: 1px;
text-align: center;
font-size: 12px;
}
td.charmapOver {
background-color: #CCCCCC;
cursor: default;
}
a.charmap {
color: #000000;
text-decoration: none
}
.wordWrapCode {
vertical-align: middle;
border: 1px none #000000;
background-color: transparent;
}
input.radio {
border: 1px none #000000;
background-color: transparent;
vertical-align: middle;
}
input.checkbox {
border: 1px none #000000;
background-color: transparent;
vertical-align: middle;
}
.mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceButtonDisabled, .mceButtonSelected {
margin-left: 1px;
}
.mceButtonNormal {
border-top: 1px solid;
border-left: 1px solid;
border-bottom: 1px solid;
border-right: 1px solid;
border-color: #F0F0EE;
cursor: default;
}
.mceButtonOver {
border: 1px solid #0A246A;
cursor: default;
background-color: #B6BDD2;
}
.mceButtonDown {
cursor: default;
border: 1px solid #0A246A;
background-color: #8592B5;
}
.mceButtonDisabled {
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
-moz-opacity:0.3;
opacity: 0.3;
border-top: 1px solid;
border-left: 1px solid;
border-bottom: 1px solid;
border-right: 1px solid;
border-color: #F0F0EE;
cursor: default;
}
.mceActionPanel {
margin-top: 5px;
}
/* Tabs classes */
.tabs {
float: left;
width: 100%;
line-height: normal;
background-image: url("../images/xp/tabs_bg.gif");
}
.tabs ul {
margin: 0;
padding: 0 0 0;
list-style: none;
}
.tabs li {
float: left;
background: url("../images/xp/tab_bg.gif") no-repeat left top;
margin: 0;
margin-left: 0;
margin-right: 2px;
padding: 0 0 0 10px;
line-height: 18px;
}
.tabs li.current {
background: url("../images/xp/tab_sel_bg.gif") no-repeat left top;
margin-right: 2px;
}
.tabs span {
float: left;
display: block;
background: url("../images/xp/tab_end.gif") no-repeat right top;
padding: 0px 10px 0 0;
}
.tabs .current span {
background: url("../images/xp/tab_sel_end.gif") no-repeat right top;
}
.tabs a {
text-decoration: none;
font-family: Verdana, Arial;
font-size: 10px;
}
.tabs a:link, .tabs a:visited, .tabs a:hover {
color: black;
}
.tabs a:hover {
}
.tabs .current {
}
.tabs .current a, .tabs .current a:link, .tabs .current a:visited {
}
.panel_wrapper div.panel {
display: none;
}
.panel_wrapper div.current {
display: block;
width: 100%;
height: 300px;
overflow: visible; /* Should be auto but that breaks Safari */
}
.panel_wrapper {
border: 1px solid #919B9C;
border-top: 0px;
padding: 10px;
padding-top: 5px;
clear: both;
background-color: white;
}
fieldset {
border: 1px solid #919B9C;
font-family: Verdana, Arial;
font-size: 10px;
padding: 0;
margin: 0;
padding: 4px;
}
legend {
color: #2B6FB6;
font-weight: bold;
}
.properties {
width: 100%;
}
.properties .column1 {
}
.properties .column2 {
text-align: left;
}
a:link, a:visited {
color: black;
}
a:hover {
color: #2B6FB6;
}
#plugintable thead {
font-weight: bold;
background-color: #DDDDDD;
}
#plugintable, #about #plugintable td {
border: 1px solid #919B9C;
}
#plugintable {
width: 99%;
margin-top: 10px;
}
#pluginscontainer {
height: 290px;
overflow: auto;
}
/* MSIE Specific styles */
* html .panel_wrapper {
width: 100%;
}
.column {
float: left;
}
h1, h2, h3, h4 {
color: #2B6FB6;
margin: 0;
padding: 0;
padding-top: 5px;
}
h3 {
font-size: 14px;
}
#link .panel_wrapper, #link div.current {
height: 125px;
}
#image .panel_wrapper, #image div.current {
height: 190px;
}
/* Disables the advanced tab in the table plugin. */
/*
#table #advanced_tab {
display: none;
}
*/
/* Disables the border input field and label in the table plugin. */
/*
#table #border, #table #borderlabel {
display: none;
}
*/
#insert, #cancel, .submitbutton {
font: 13px Verdana, Arial, Helvetica, sans-serif;
height: auto;
width: auto;
background-color: transparent;
background-image: url(../../../../../wp-admin/images/fade-butt.png);
background-repeat: repeat;
border: 3px double;
border-right-color: rgb(153, 153, 153);
border-bottom-color: rgb(153, 153, 153);
border-left-color: rgb(204, 204, 204);
border-top-color: rgb(204, 204, 204);
color: rgb(51, 51, 51);
padding: 0.25em 0.75em;
}
#insert:active, #cancel:active, .submitbutton:active {
background: #f4f4f4;
border-left-color: #999;
border-top-color: #999;
}

View File

@ -19,3 +19,66 @@
background-repeat: no-repeat;
background-position: right top;
}
/* This file contains the CSS data for the editable area(iframe) of TinyMCE */
/* You can extend this CSS by adding your own CSS file with the the content_css option */
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 0.9em;
line-height: 1.2em;
padding: .3em;
background-color: #FFFFFF;
}
td {
font-size: 10px;
}
pre {
font-family: "Courier New", fixed;
font-size: 11px;
line-height: 13px;
}
.mceVisualAid {
border: 1px dashed #BBBBBB !important;
}
.mceItemAnchor {
width: 12px;
line-height: 6px;
overflow: hidden;
padding-left: 12px;
background-image: url('../images/anchor_symbol.gif');
background-position: bottom;
background-repeat: no-repeat;
}
/* Important is needed in Gecko browsers inorder to style links */
/*
a {
color: green !important;
}
*/
/* Style selection range colors in Gecko browsers */
/*
::-moz-selection {
background-color: red;
color: green;
}
*/
/* MSIE specific */
* html body {
scrollbar-3dlight-color: #F0F0EE;
scrollbar-arrow-color: #676662;
scrollbar-base-color: #F0F0EE;
scrollbar-darkshadow-color: #DDDDDD;
scrollbar-face-color: #E0E0DD;
scrollbar-highlight-color: #F0F0EE;
scrollbar-shadow-color: #F0F0EE;
scrollbar-track-color: #F5F5F5;
}

View File

@ -4,7 +4,7 @@
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/about.js"></script>
<link href="css/dialog_about.css" rel="stylesheet" type="text/css" />
<base target="_self" />
</head>
<body id="about" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
<div class="tabs">
@ -21,7 +21,7 @@
<p>Version: {$tinymce_version} ({$tinymce_releasedate})</p>
<p>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under <a href="../../license.txt" target="_blank">LGPL</a>
by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</p>
<p>Copyright &copy; 2005, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
<p>Copyright &copy; 2003-2006, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
<p>For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.</p>
<div id="buttoncontainer"></div>

View File

@ -3,6 +3,7 @@
<title>{$lang_insert_anchor_title}</title>
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/anchor.js"></script>
<base target="_self" />
</head>
<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
<form onsubmit="insertAnchor();return false;" action="#">

View File

@ -4,8 +4,9 @@
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/charmap.js"></script>
<base target="_self" />
</head>
<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
<body onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';document.getElementById('insert').focus();" style="display: none">
<table align="center" border="0" cellspacing="0" cellpadding="2">
<tr>
<td colspan="2" class="title">{$lang_theme_charmap_title}</td>

View File

@ -3,8 +3,9 @@
<title>{$lang_theme_colorpicker_title}</title>
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/color_picker.js"></script>
<base target="_self" />
</head>
<body onload="tinyMCEPopup.executeOnLoad('init();');" marginheight="3" topmargin="3" leftmargin="3" marginwidth="3" style="display: none">
<body onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';document.getElementById('insert').focus();" style="margin: 3px; display: none">
<div align="center">
<script language="javascript" type="text/javascript">renderColorMap();</script>
</div>

View File

@ -1,22 +1,13 @@
/* This file contains the CSS data for the editable area(iframe) of TinyMCE */
/* You can extend this CSS by adding your own CSS file with the the content_css option */
body, td, pre {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
body {
background-color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 0.9em;
line-height: 1.2em;
padding: .3em;
}
td {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
pre {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
.mceVisualAid {
@ -47,3 +38,16 @@ a {
color: green;
}
*/
/* MSIE specific */
* html body {
scrollbar-3dlight-color: #F0F0EE;
scrollbar-arrow-color: #676662;
scrollbar-base-color: #F0F0EE;
scrollbar-darkshadow-color: #DDDDDD;
scrollbar-face-color: #E0E0DD;
scrollbar-highlight-color: #F0F0EE;
scrollbar-shadow-color: #F0F0EE;
scrollbar-track-color: #F5F5F5;
}

View File

@ -35,14 +35,14 @@ input, select, textarea {
}
.input_noborder {
border: 0px solid #808080;
border: 0;
}
#insert {
#insert, .updateButton {
font-weight: bold;
width: 90px;
height: 21px;
border: 0px;
border: 0;
background-image: url('../images/insert_button_bg.gif');
cursor: pointer;
}
@ -51,7 +51,7 @@ input, select, textarea {
font-weight: bold;
width: 90px;
height: 21px;
border: 0px;
border: 0;
background-image: url('../images/cancel_button_bg.gif');
cursor: pointer;
}
@ -84,7 +84,7 @@ td.charmap, td.charmapOver {
td.charmapOver {
background-color: #CCCCCC;
cursor: arrow;
cursor: default;
}
a.charmap {
@ -120,17 +120,17 @@ input.checkbox {
border-bottom: 1px solid;
border-right: 1px solid;
border-color: #F0F0EE;
cursor: arrow;
cursor: default;
}
.mceButtonOver {
border: 1px solid #0A246A;
cursor: arrow;
cursor: default;
background-color: #B6BDD2;
}
.mceButtonDown {
cursor: arrow;
cursor: default;
border: 1px solid #0A246A;
background-color: #8592B5;
}
@ -144,7 +144,7 @@ input.checkbox {
border-bottom: 1px solid;
border-right: 1px solid;
border-color: #F0F0EE;
cursor: arrow;
cursor: default;
}
.mceActionPanel {
@ -162,7 +162,7 @@ input.checkbox {
.tabs ul {
margin: 0;
padding: 0px 0px 0;
padding: 0 0 0;
list-style: none;
}
@ -170,7 +170,7 @@ input.checkbox {
float: left;
background: url("../images/xp/tab_bg.gif") no-repeat left top;
margin: 0;
margin-left: 0px;
margin-left: 0;
margin-right: 2px;
padding: 0 0 0 10px;
line-height: 18px;
@ -185,7 +185,7 @@ input.checkbox {
float: left;
display: block;
background: url("../images/xp/tab_end.gif") no-repeat right top;
padding: 0px 10px 0px 0px;
padding: 0px 10px 0 0;
}
.tabs .current span {
@ -235,8 +235,8 @@ fieldset {
border: 1px solid #919B9C;
font-family: Verdana, Arial;
font-size: 10px;
padding: 0px;
margin: 0px;
padding: 0;
margin: 0;
padding: 4px;
}
@ -295,8 +295,8 @@ a:hover {
h1, h2, h3, h4 {
color: #2B6FB6;
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
padding-top: 5px;
}
@ -304,6 +304,14 @@ h3 {
font-size: 14px;
}
#link .panel_wrapper, #link div.current {
height: 125px;
}
#image .panel_wrapper, #image div.current {
height: 190px;
}
/* Disables the advanced tab in the table plugin. */
/*
#table #advanced_tab {
@ -317,3 +325,30 @@ h3 {
display: none;
}
*/
/* Below this line is WordPress customizations */
#insert, #cancel, .submitbutton {
font: 11px Verdana, Arial, Helvetica, sans-serif;
height: auto;
width: auto;
background-color: transparent;
background-image: url(../../../../../../wp-admin/images/fade-butt.png);
background-repeat: repeat;
border: 3px double;
border-right-color: rgb(153, 153, 153);
border-bottom-color: rgb(153, 153, 153);
border-left-color: rgb(204, 204, 204);
border-top-color: rgb(204, 204, 204);
color: rgb(51, 51, 51);
padding: 0.1em 0.5em;
}
#insert:active, #cancel:active, .submitbutton:active {
background: #f4f4f4;
border-left-color: #999;
border-top-color: #999;
}
#styleSelectRow {
display: none;
}

View File

@ -1,84 +1,25 @@
/* This file contains the CSS data for the editor UI of TinyMCE instances */
.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {
border: 0px; margin: 0px; padding: 0px; background: transparent;
}
.mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceSeparatorLine, .mceButtonDisabled, .mceButtonSelected {
border: 0px; margin: 0px; padding: 0px; background: transparent;
margin-top: 1px;
margin-left: 1px;
}
.mceButtonNormal {
border-top: 1px solid;
border-left: 1px solid;
border-bottom: 1px solid;
border-right: 1px solid;
border-color: #F0F0EE;
cursor: arrow;
}
.mceButtonOver {
border: 1px solid #0A246A;
cursor: arrow;
background-color: #B6BDD2;
}
.mceButtonDown {
cursor: arrow;
border: 1px solid #0A246A;
background-color: #8592B5;
}
.mceButtonSelected {
border: 1px solid;
border-color: #C0C0BB;
cursor: arrow;
}
.mceButtonDisabled {
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
-moz-opacity:0.3;
opacity: 0.3;
border-top: 1px solid;
border-left: 1px solid;
border-bottom: 1px solid;
border-right: 1px solid;
border-color: #F0F0EE;
cursor: arrow;
}
.mceSeparator {
border-top: 1px solid buttonhighlight;
border-left: 1px solid buttonhighlight;
border-bottom: 1px solid buttonshadow;
border-right: 1px solid buttonshadow;
margin-right: 2px;
margin-left: 2px;
border: 0; margin: 0; padding: 0; background: transparent;
}
.mceSeparatorLine {
margin:2px;
border: 0;
padding: 0;
margin-left: 4px;
background-color: #F0F0EE;
border-top: 1px solid buttonshadow;
border-left: 1px solid buttonshadow;
border-bottom: 1px solid buttonhighlight;
border-right: 1px solid buttonhighlight;
width: 0px;
height: 15px;
margin-right: 2px;
}
.mceSelectList {
font-family: "MS Sans Serif";
font-size: 7pt;
font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
font-size: 7pt !important;
font-weight: normal;
margin-top: 3px;
padding: 0px;
padding: 0;
display: inline;
vertical-align: top;
background-color: #F0F0EE
background-color: #F0F0EE;
}
.mceLabel, .mceLabelDisabled {
@ -98,15 +39,15 @@
.mceEditor {
background: #F0F0EE;
border: 1px solid #cccccc;
padding: 0px;
margin: 0px;
padding: 0;
margin: 0;
}
.mceEditorArea {
font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
background: #FFFFFF;
padding: 0px;
margin: 0px;
padding: 0;
margin: 0;
}
.mceToolbarTop, .mceToolbarBottom {
@ -117,6 +58,7 @@
.mceToolbarTop {
border-bottom: 1px solid #cccccc;
padding-bottom: 1px;
}
.mceToolbarBottom {
@ -176,6 +118,231 @@
height: 10px;
display: none;
border: 1px dotted gray;
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
}
/* Button CSS rules */
a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img {
width: 20px;
height: 20px;
cursor: default;
margin-top: 1px;
margin-left: 1px;
}
a.mceButtonDisabled img {
border: 0 !important;
}
a.mceButtonNormal img, a.mceButtonSelected img {
border: 1px solid #F0F0EE !important;
}
a.mceButtonSelected img {
border: 1px solid #6779AA !important;
background-color: #D4D5D8;
}
a.mceButtonNormal img:hover, a.mceButtonSelected img:hover {
border: 1px solid #0A246A !important;
cursor: default;
background-color: #B6BDD2;
}
a.mceButtonDisabled img {
-moz-opacity:0.3;
opacity: 0.3;
border: 1px solid #F0F0EE !important;
cursor: default;
}
a.mceTiledButton img {
background-image: url('../images/buttons.gif');
background-repeat: no-repeat;
}
/* MSIE specific rules */
* html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img {
border: 0 !important;
margin-top: 2px;
margin-bottom: 1px;
}
* html a.mceButtonDisabled img {
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
border: 0 !important;
}
* html a.mceButtonDisabled {
border: 1px solid #F0F0EE !important;
}
* html a.mceButtonNormal, * html a.mceButtonSelected {
border: 1px solid #F0F0EE !important;
cursor: default;
}
* html a.mceButtonSelected {
border: 1px solid #6779AA !important;
background-color: #D4D5D8;
}
* html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover {
border: 1px solid #0A246A !important;
cursor: default;
background-color: #B6BDD2;
}
* html .mceSelectList {
margin-top: 2px;
}
/* Menu button CSS rules */
span.mceMenuButton img, span.mceMenuButtonSelected img {
border: 1px solid #F0F0EE;
margin-left: 1px;
}
span.mceMenuButtonSelected img {
border: 1px solid #6779AA;
background-color: #B6BDD2;
}
span.mceMenuButtonSelected img.mceMenuButton {
border: 1px solid #F0F0EE;
background-color: transparent;
}
span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton {
border-left: 0;
margin-left: 0;
}
span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img {
border: 1px solid #0A246A;
background-color: #B6BDD2;
}
span.mceMenuButton:hover img.mceMenuButton, span.mceMenuButtonSelected:hover img.mceMenuButton {
border-left: 0;
}
span.mceMenuButtonFocus img {
border: 1px solid gray;
border-right: 0;
margin-left: 1px;
background-color: #F5F4F2;
}
span.mceMenuButtonFocus img.mceMenuButton {
border: 1px solid gray;
border-left: 1px solid #F5F4F2;
margin-left: 0;
}
/* Menu button MSIE specific rules */
* html span.mceMenuButton, * html span.mceMenuButtonFocus {
position: relative;
left: 0;
top: 0;
}
* html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {
position: relative;
top: 1px;
}
* html span.mceMenuHover img {
border: 1px solid #0A246A;
background-color: #B6BDD2;
}
* html span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {
border: 1px solid #0A246A;
background-color: #B6BDD2;
border-left: 0;
}
/* Menu */
.mceMenu {
position: absolute;
left: 0;
top: 0;
display: none;
z-index: 100;
background-color: white;
border: 1px solid gray;
font-weight: normal;
}
.mceMenu a, .mceMenuTitle, .mceMenuDisabled {
display: block;
width: 100%;
text-decoration: none;
background-color: white;
font-family: Tahoma, Verdana, Arial, Helvetica;
font-size: 11px;
line-height: 20px;
color: black;
}
.mceMenu a:hover {
background-color: #B6BDD2;
color: black;
}
.mceMenu span {
padding-left: 10px;
padding-right: 10px;
display: block;
line-height: 20px;
}
.mceMenuSeparator {
border-bottom: 1px solid gray;
background-color: gray;
height: 1px;
}
.mceMenuTitle span {
padding-left: 5px;
}
.mceMenuTitle {
background-color: #DDDDDD;
font-weight: bold;
}
.mceMenuDisabled {
color: gray;
}
span.mceMenuSelectedItem {
background-image: url('../images/menu_check.gif');
background-repeat: no-repeat;
background-position: 5px 8px;
padding-left: 20px;
}
span.mceMenuCheckItem {
padding-left: 20px;
}
span.mceMenuLine {
display: block;
position: absolute;
left: 0;
top: -1px;
background-color: #F5F4F2;
width: 30px;
height: 1px;
overflow: hidden;
padding-left: 0;
padding-right: 0;
}

File diff suppressed because one or more lines are too long

View File

@ -2,44 +2,27 @@
<head>
<title>{$lang_insert_image_title}</title>
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/image.js"></script>
<style type="text/css">
#insert, #cancel {
font: 13px Verdana, Arial, Helvetica, sans-serif;
height:auto;
width: auto;
background-color: transparent;
background-image: url(../../../../../wp-admin/images/fade-butt.png);
background-repeat: repeat;
border: 3px double;
border-right-color: rgb(153, 153, 153);
border-bottom-color: rgb(153, 153, 153);
border-left-color: rgb(204, 204, 204);
border-top-color: rgb(204, 204, 204);
color: rgb(51, 51, 51);
padding: 0.25em 1em;
}
#insert:active, #cancel:active {
background: #f4f4f4;
border-left-color: #999;
border-top-color: #999;
}
</style>
<base target="_self" />
</head>
<body onload="tinyMCEPopup.executeOnLoad('init();');document.getElementById('src').focus();" style="display: none">
<form onsubmit="insertImage();return false;">
<table border="0" cellpadding="0" cellspacing="0" width="200">
<body id="image" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';document.getElementById('src').focus();" style="display: none">
<form onsubmit="insertImage();return false;" action="#">
<div class="tabs">
<ul>
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_image_title}</a></span></li>
</ul>
</div>
<div class="panel_wrapper">
<div id="general_panel" class="panel current">
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td align="center" valign="middle"><table border="0" cellpadding="4" cellspacing="0">
<tr>
<td colspan="2" class="title" nowrap="nowrap">{$lang_insert_image_title}</td>
</tr>
<tr>
<td nowrap="nowrap">{$lang_insert_image_src}:</td>
<td nowrap="nowrap"><label for="src">{$lang_insert_image_src}</label></td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="src" type="text" id="src" value="" style="width: 200px" onchange="getImageData();"></td>
<td><input id="src" name="src" type="text" value="" style="width: 200px" onchange="getImageData();"></td>
<td id="srcbrowsercontainer">&nbsp;</td>
</tr>
</table></td>
@ -49,8 +32,8 @@
if (typeof(tinyMCEImageList) != "undefined" && tinyMCEImageList.length > 0) {
var html = "";
html += '<tr><td>{$lang_image_list}:</td>';
html += '<td><select name="image_list" style="width: 200px" onchange="this.form.src.value=this.options[this.selectedIndex].value;resetImageData();getImageData();">';
html += '<tr><td><label for="image_list">{$lang_image_list}</label></td>';
html += '<td><select id="image_list" name="image_list" style="width: 200px" onchange="this.form.src.value=this.options[this.selectedIndex].value;resetImageData();getImageData();">';
html += '<option value="">---</option>';
for (var i=0; i<tinyMCEImageList.length; i++)
@ -63,12 +46,12 @@
</script>
<!-- /Image list -->
<tr>
<td nowrap="nowrap">{$lang_insert_image_alt}:</td>
<td><input name="alt" type="text" id="alt" value="" style="width: 200px"></td>
<td nowrap="nowrap"><label for="alt">{$lang_insert_image_alt}</label></td>
<td><input id="alt" name="alt" type="text" value="" style="width: 200px"></td>
</tr>
<tr>
<td nowrap="nowrap">{$lang_insert_image_align}:</td>
<td><select name="align">
<td nowrap="nowrap"><label for="align">{$lang_insert_image_align}</label></td>
<td><select id="align" name="align">
<option value="">{$lang_insert_image_align_default}</option>
<option value="baseline">{$lang_insert_image_align_baseline}</option>
<option value="top">{$lang_insert_image_align_top}</option>
@ -82,31 +65,36 @@
</select></td>
</tr>
<tr>
<td nowrap="nowrap"><!--{$lang_insert_image_dimensions}:</td>
<td><input name="width" type="text" id="width" value="" size="3" maxlength="3">
<td nowrap="nowrap"><label for="width">{$lang_insert_image_dimensions}</label></td>
<td><input id="width" name="width" type="text" value="" size="3" maxlength="3">
x
<input name="height" type="text" id="height" value="" size="3" maxlength="3">--></td>
</tr>
<!-- <tr>
<td nowrap="nowrap">{$lang_insert_image_border}:</td>
<td><input name="border" type="text" id="border" value="" size="3" maxlength="3"></td>
<input id="height" name="height" type="text" value="" size="3" maxlength="3"></td>
</tr>
<tr>
<td nowrap="nowrap">{$lang_insert_image_vspace}:</td>
<td><input name="vspace" type="text" id="vspace" value="" size="3" maxlength="3"></td>
<td nowrap="nowrap"><label for="border">{$lang_insert_image_border}</label></td>
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3"></td>
</tr>
<tr>
<td nowrap="nowrap">{$lang_insert_image_hspace}:</td>
<td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3"></td>
<td nowrap="nowrap"><label for="vspace">{$lang_insert_image_vspace}</label></td>
<td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3"></td>
</tr>
--> <tr>
<td nowrap="nowrap"><input type="submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();">
</td>
<td align="right"><input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();"></td>
</tr>
</table></td>
<tr>
<td nowrap="nowrap"><label for="hspace">{$lang_insert_image_hspace}</label></td>
<td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3"></td>
</tr>
</table>
</div>
</div>
<div class="mceActionPanel">
<div style="float: left">
<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
</div>
<div style="float: right">
<input type="submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();" />
</div>
</div>
</form>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

View File

@ -1,5 +1,8 @@
function init() {
var inst;
tinyMCEPopup.resizeToInnerSize();
inst = tinyMCE.selectedInstance;
// Give FF some time
window.setTimeout('insertHelpIFrame();', 10);
@ -20,8 +23,8 @@ function init() {
html += '</thead>';
html += '<tbody>';
for (var i=0; i<plugins.length; i++) {
var info = getPluginInfo(plugins[i]);
for (var i=0; i<inst.plugins.length; i++) {
var info = getPluginInfo(inst.plugins[i]);
html += '<tr>';
@ -46,10 +49,8 @@ function init() {
}
function getPluginInfo(name) {
var fn = eval('tinyMCEPopup.windowOpener.TinyMCE_' + name + '_getInfo');
if (typeof(fn) != 'undefined')
return fn();
if (tinyMCE.plugins[name].getInfo)
return tinyMCE.plugins[name].getInfo();
return {
longname : name,

View File

@ -26,7 +26,7 @@ function init() {
function insertAnchor() {
var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
var name = document.forms[0].anchorName.value;
var name = document.forms[0].anchorName.value, e;
tinyMCEPopup.execCommand("mceBeginUndoLevel");
@ -44,11 +44,26 @@ function insertAnchor() {
name = name.replace(/&/g, '&amp;');
name = name.replace(/\"/g, '&quot;');
name = name.replace(/</g, '&lt;');
name = name.replace(/>/g, '&gr;');
name = name.replace(/>/g, '&gt;');
// Fix for bug #1447335
if (tinyMCE.isGecko)
html = '<a id="mceNewAnchor" name="' + name + '"></a>';
else
html = '<a name="' + name + '"></a>';
tinyMCEPopup.execCommand("mceInsertContent", false, html);
// Fix for bug #1447335 force cursor after the anchor element
if (tinyMCE.isGecko) {
e = inst.getDoc().getElementById('mceNewAnchor');
if (e) {
inst.selection.selectNode(e, true, false, false);
e.removeAttribute('id');
}
}
tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst);
}

View File

@ -170,7 +170,7 @@ charmap = [
['&yacute;', '&#253;', true, 'y - acute'],
['&thorn;', '&#254;', true, 'thorn'],
['&yuml;', '&#255;', true, 'y - diaeresis'],
// ['&Alpha;', '&#913;', true, 'Alpha'],
['&Alpha;', '&#913;', true, 'Alpha'],
['&Beta;', '&#914;', true, 'Beta'],
['&Gamma;', '&#915;', true, 'Gamma'],
['&Delta;', '&#916;', true, 'Delta'],
@ -279,9 +279,9 @@ function renderCharMapHTML() {
cols++;
html += ''
+ '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap"'
+ ' onmouseover="tinyMCE.switchClass(this,\'charmapOver\');'
+ ' onmouseover="this.className=\'charmapOver\';'
+ 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');"'
+ ' onmouseout="tinyMCE.restoreClass(this,\'charmapOver\');"'
+ ' onmouseout="this.className=\'charmap\';"'
+ ' nowrap="nowrap" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');"><a style="text-decoration: none;" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">'
+ charmap[i][1]
+ '</a></td>';
@ -299,11 +299,13 @@ function renderCharMapHTML() {
}
function insertChar(chr) {
tinyMCEPopup.execCommand('mceInsertContent', false, '\&#' + chr + ';');
tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';');
// Refocus in window
if (tinyMCEPopup.isWindow)
window.focus();
tinyMCEPopup.close();
}
function previewChar(codeA, codeB, codeN) {

View File

@ -99,7 +99,8 @@ function renderColorMap() {
+ '<input id="selectedColorBox" name="selectedColorBox" type="text" size="7" maxlength="7" style="width:65px" value="' + inputColor + '" />'
+ '</td></tr>'
+ '</table>'
+ '<input type="button" id="insert" name="insert" value="{$lang_theme_colorpicker_apply}" style="margin-top:3px" onclick="selectColor();">'
+ '<div style="float: left"><input type="button" id="insert" name="insert" value="{$lang_theme_colorpicker_apply}" style="margin-top:3px" onclick="selectColor();"></div>'
+ '<div style="float: right"><input type="button" name="cancel" value="{$lang_cancel}" style="margin-top:3px" onclick="tinyMCEPopup.close();" id="cancel" /></div>'
+ '</td></tr>'
+ '</table>';

View File

@ -8,19 +8,18 @@ if (url != null) {
}
function insertImage() {
if (window.opener) {
var src = document.forms[0].src.value;
var alt = document.forms[0].alt.value;
var border = '';//document.forms[0].border.value;
var vspace = '';//document.forms[0].vspace.value;
var hspace = '';//document.forms[0].hspace.value;
var width = '';//document.forms[0].width.value;
var height = '';//document.forms[0].height.value;
var border = document.forms[0].border.value;
var vspace = document.forms[0].vspace.value;
var hspace = document.forms[0].hspace.value;
var width = document.forms[0].width.value;
var height = document.forms[0].height.value;
var align = document.forms[0].align.options[document.forms[0].align.selectedIndex].value;
window.opener.tinyMCE.insertImage(src, alt, border, hspace, vspace, width, height, align);
top.close();
}
tinyMCEPopup.restoreSelection();
tinyMCE.themes['advanced']._insertImage(src, alt, border, hspace, vspace, width, height, align);
tinyMCEPopup.close();
}
function init() {
@ -37,11 +36,11 @@ function init() {
formObj.src.value = tinyMCE.getWindowArg('src');
formObj.alt.value = tinyMCE.getWindowArg('alt');
// formObj.border.value = tinyMCE.getWindowArg('border');
// formObj.vspace.value = tinyMCE.getWindowArg('vspace');
// formObj.hspace.value = tinyMCE.getWindowArg('hspace');
// formObj.width.value = tinyMCE.getWindowArg('width');
// formObj.height.value = tinyMCE.getWindowArg('height');
formObj.border.value = tinyMCE.getWindowArg('border');
formObj.vspace.value = tinyMCE.getWindowArg('vspace');
formObj.hspace.value = tinyMCE.getWindowArg('hspace');
formObj.width.value = tinyMCE.getWindowArg('width');
formObj.height.value = tinyMCE.getWindowArg('height');
formObj.insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
// Handle file browser
@ -67,11 +66,11 @@ function resetImageData() {
function updateImageData() {
var formObj = document.forms[0];
// if (formObj.width.value == "")
// formObj.width.value = preloadImg.width;
if (formObj.width.value == "")
formObj.width.value = preloadImg.width;
// if (formObj.height.value == "")
// formObj.height.value = preloadImg.height;
if (formObj.height.value == "")
formObj.height.value = preloadImg.height;
}
function getImageData() {

View File

@ -10,7 +10,11 @@ if (url != null) {
function init() {
tinyMCEPopup.resizeToInnerSize();
// document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','theme_advanced_link');
document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','theme_advanced_link');
// Handle file browser
if (isVisible('hrefbrowser'))
document.getElementById('href').style.width = '180px';
var formObj = document.forms[0];
@ -25,12 +29,15 @@ function init() {
document.forms[0].linktitle.value = tinyMCE.getWindowArg('title');
document.forms[0].insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
// addClassesToList('styleSelect', 'theme_advanced_link_styles');
// selectByValue(formObj, 'styleSelect', tinyMCE.getWindowArg('className'), true);
addClassesToList('styleSelect', 'theme_advanced_link_styles');
selectByValue(formObj, 'styleSelect', tinyMCE.getWindowArg('className'), true);
// Handle file browser
if (isVisible('hrefbrowser'))
document.getElementById('href').style.width = '180px';
// Hide css select row if no CSS classes
if (formObj.styleSelect && formObj.styleSelect.options.length <= 1) {
var sr = document.getElementById('styleSelectRow');
sr.style.display = 'none';
sr.parentNode.removeChild(sr);
}
// Auto select link in list
if (typeof(tinyMCELinkList) != "undefined" && tinyMCELinkList.length > 0) {
@ -44,11 +51,10 @@ function init() {
}
function insertLink() {
if (window.opener) {
var href = document.forms[0].href.value;
var target = document.forms[0].target.options[document.forms[0].target.selectedIndex].value;
var title = document.forms[0].linktitle.value;
var style_class = '';//document.forms[0].styleSelect.value;
var style_class = document.forms[0].styleSelect ? document.forms[0].styleSelect.value : "";
var dummy;
// Make anchors absolute
@ -58,7 +64,7 @@ function insertLink() {
if (target == '_self')
target = '';
window.opener.tinyMCE.insertLink(href, target, title, dummy, style_class);
tinyMCEPopup.restoreSelection();
tinyMCE.themes['advanced']._insertLink(href, target, title, dummy, style_class);
tinyMCEPopup.close();
}
}

View File

@ -5,13 +5,10 @@ function saveContent() {
// Fixes some charcode issues
function fixContent(html) {
// WP
return html;
html = html.replace(new RegExp('<(p|hr|table|tr|td|ol|ul|object|embed|li|blockquote)', 'gi'),'\n<$1');
/* html = html.replace(new RegExp('<(p|hr|table|tr|td|ol|ul|object|embed|li|blockquote)', 'gi'),'\n<$1');
html = html.replace(new RegExp('<\/(p|ol|ul|li|table|tr|td|blockquote|object)>', 'gi'),'</$1>\n');
html = tinyMCE.regexpReplace(html, '<br />','<br />\n','gi');
html = tinyMCE.regexpReplace(html, '\n\n','\n','gi');
html = tinyMCE.regexpReplace(html, '\n\n','\n','gi');*/
return html;
}
@ -20,12 +17,20 @@ function onLoadInit() {
document.forms[0].htmlSource.value = fixContent(tinyMCE.getContent(tinyMCE.getWindowArg('editor_id')));
resizeInputs();
setWrap('off');
}
function setWrap(val) {
// hard soft off
document.forms[0].htmlSource.wrap = val;
var s = document.forms[0].htmlSource;
s.wrap = val;
if (tinyMCE.isGecko) {
var v = s.value;
var n = s.cloneNode(false);
n.setAttribute("wrap", val);
s.parentNode.replaceChild(n, s);
n.value = v;
}
}
function toggleWordWrap(elm) {
@ -51,6 +56,6 @@ function resizeInputs() {
}
function renderWordWrap() {
if (tinyMCE.isMSIE)
if (tinyMCE.isMSIE || tinyMCE.isGecko)
document.write('<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{$lang_theme_code_wordwrap}</label>');
}

View File

@ -2,7 +2,7 @@
tinyMCE.addToLang('',{
theme_style_select : '-- Styles --',
theme_code_desc : 'Edit HTML Source (Alt+e)',
theme_code_desc : 'Edit HTML Source',
theme_code_title : 'HTML Source Editor',
theme_code_wordwrap : 'Word wrap',
theme_sub_desc : 'Subscript',

View File

@ -2,44 +2,28 @@
<head>
<title>{$lang_insert_link_title}</title>
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/link.js"></script>
<style type="text/css">
#insert, #cancel {
font: 13px Verdana, Arial, Helvetica, sans-serif;
height: auto;
width: auto;
background-color: transparent;
background-image: url(../../../../../wp-admin/images/fade-butt.png);
background-repeat: repeat;
border: 3px double;
border-right-color: rgb(153, 153, 153);
border-bottom-color: rgb(153, 153, 153);
border-left-color: rgb(204, 204, 204);
border-top-color: rgb(204, 204, 204);
color: rgb(51, 51, 51);
padding: 0.25em 0.75em;
}
#insert:active, #cancel:active {
background: #f4f4f4;
border-left-color: #999;
border-top-color: #999;
}
</style>
<base target="_self" />
</head>
<body onload="tinyMCEPopup.executeOnLoad('init();');document.getElementById('href').focus();" style="display: none">
<form onsubmit="insertLink();return false;">
<table border="0" cellpadding="0" cellspacing="0" width="100">
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';document.getElementById('href').focus();" style="display: none">
<form onsubmit="insertLink();return false;" action="#">
<div class="tabs">
<ul>
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_link_title}</a></span></li>
</ul>
</div>
<div class="panel_wrapper">
<div id="general_panel" class="panel current">
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td align="center" valign="middle"><table border="0" cellpadding="4" cellspacing="0">
<td nowrap="nowrap"><label for="href">{$lang_insert_link_url}</label></td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" class="title" nowrap="nowrap">{$lang_insert_link_title}</td>
</tr>
<tr>
<td nowrap="nowrap">{$lang_insert_link_url}:</td>
<td> <table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="href" type="text" id="href" value="" style="width: 200px"></td>
<td><input id="href" name="href" type="text" value="" style="width: 200px" /></td>
<td id="hrefbrowsercontainer">&nbsp;</td>
</tr>
</table></td>
@ -49,8 +33,8 @@
if (typeof(tinyMCELinkList) != "undefined" && tinyMCELinkList.length > 0) {
var html = "";
html += '<tr><td>{$lang_link_list}:</td>';
html += '<td><select name="link_list" style="width: 200px" onchange="this.form.href.value=this.options[this.selectedIndex].value;">';
html += '<tr><td><label for="link_list">{$lang_link_list}</label></td>';
html += '<td><select id="link_list" name="link_list" style="width: 200px" onchange="this.form.href.value=this.options[this.selectedIndex].value;">';
html += '<option value="">---</option>';
for (var i=0; i<tinyMCELinkList.length; i++)
@ -63,8 +47,8 @@
</script>
<!-- /Link list -->
<tr>
<td nowrap="nowrap">{$lang_insert_link_target}:</td>
<td><select name="target" style="width: 200px">
<td nowrap="nowrap"><label for="target">{$lang_insert_link_target}</label></td>
<td><select id="target" name="target" style="width: 200px">
<option value="_self">{$lang_insert_link_target_same}</option>
<option value="_blank">{$lang_insert_link_target_blank}</option>
<script language="javascript">
@ -88,26 +72,29 @@
</select></td>
</tr>
<tr>
<td nowrap="nowrap">{$lang_theme_insert_link_titlefield}:</td>
<td><input name="linktitle" type="text" id="linktitle" value="" style="width: 200px"></td>
<td nowrap="nowrap"><label for="linktitle">{$lang_theme_insert_link_titlefield}</label></td>
<td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px"></td>
</tr>
<tr id="styleSelectRow">
<td><!--{$lang_class_name}:</td>
<td><label for="styleSelect">{$lang_class_name}</label></td>
<td>
<select id="styleSelect" name="styleSelect">
<option value="" selected>{$lang_theme_style_select}</option>
</select></td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;--></td>
</tr>
<tr>
<td><input type="submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertLink();">
</td>
<td align="right"><input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();"></td>
</tr>
</table></td>
</tr>
</table>
</div>
</div>
<div class="mceActionPanel">
<div style="float: left">
<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
</div>
<div style="float: right">
<input type="submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertLink();" />
</div>
</div>
</form>
</body>
</html>

View File

@ -4,30 +4,9 @@
<title>{$lang_theme_code_title}</title>
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/source_editor.js"></script>
<style type="text/css">
#insert, #cancel {
font: 13px Verdana, Arial, Helvetica, sans-serif;
height: auto;
width: auto;
background-color: transparent;
background-image: url(../../../../../wp-admin/images/fade-butt.png);
background-repeat: repeat;
border: 3px double;
border-right-color: rgb(153, 153, 153);
border-bottom-color: rgb(153, 153, 153);
border-left-color: rgb(204, 204, 204);
border-top-color: rgb(204, 204, 204);
color: rgb(51, 51, 51);
padding: 0.25em 0.75em;
}
#insert:active, #cancel:active {
background: #f4f4f4;
border-left-color: #999;
border-top-color: #999;
}
</style>
<base target="_self" />
</head>
<body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');document.getElementById('htmlSource').focus();" onresize="resizeInputs();" style="display: none">
<body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');document.body.style.display='';document.getElementById('htmlSource').focus();" onresize="resizeInputs();" style="display: none">
<form name="source" onsubmit="saveContent();" action="#">
<div style="float: left" class="title">{$lang_theme_code_title}</div>
@ -35,15 +14,15 @@
<script language="javascript" type="text/javascript">renderWordWrap();</script>
</div>
<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft"></textarea>
<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px" dir="ltr" wrap="off"></textarea>
<div class="mceActionPanel">
<div style="float: left">
<input type="button" name="insert" value="{$lang_update}" onclick="saveContent();" id="insert" />
<input type="button" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
</div>
<div style="float: right">
<input type="button" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
<input type="submit" name="insert" value="{$lang_update}" onclick="saveContent();" id="insert" />
</div>
</div>
</form>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,85 @@
<?php
@ require('../../../wp-config.php');
function wp_translate_tinymce_lang($text) {
if ( ! function_exists('__') ) {
return $text;
} else {
$search1 = "/^tinyMCELang\\[(['\"])(.*)\\1\]( ?= ?)(['\"])(.*)\\4/Uem";
$replace1 = "'tinyMCELang[\\1\\2\\1]\\3'.stripslashes('\\4').__('\\5').stripslashes('\\4')";
$search2 = "/ : (['\"])(.*)\\1/Uem";
$replace2 = "' : '.stripslashes('\\1').__('\\2').stripslashes('\\1')";
$search = array($search1, $search2);
$replace = array($replace1, $replace2);
$text = preg_replace($search, $replace, $text);
return $text;
}
}
// Set up init variables
$valid_elements = 'p/-div[*],-b[*],-font[*],-ul[*],-ol[*],-li[*],*[*]';
$valid_elements = apply_filters('mce_valid_elements', $valid_elements);
$plugins = array('inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress');
$plugins = apply_filters('mce_plugins', $plugins);
$plugins = implode($plugins, ',');
$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'link', 'unlink', 'image', 'wp_more', 'separator', 'spellchecker', 'separator', 'code', 'wp_help', 'wp_adv_start', 'wp_adv', 'separator', 'formatselect', 'underline', 'justifyfull', 'forecolor', 'separator', 'pastetext', 'pasteword', 'separator', 'removeformat', 'cleanup', 'separator', 'charmap', 'separator', 'undo', 'redo', 'wp_adv_end'));
$mce_buttons = implode($mce_buttons, ',');
$mce_buttons_2 = apply_filters('mce_buttons_2', array());
$mce_buttons_2 = implode($mce_buttons_2, ',');
$mce_buttons_3 = apply_filters('mce_buttons_3', array());
$mce_buttons_3 = implode($mce_buttons_3, ',');
$mce_browsers = apply_filters('mce_browsers', array('msie', 'gecko', 'opera', 'safari'));
$mce_browsers = implode($mce_browsers, ',');
$mce_popups_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/popups.css';
$mce_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/wordpress.css';
$mce_css = apply_filters('mce_css', $mce_css);
?>
initArray = {
mode : "specific_textareas",
editor_selector : "mceEditor",
width : "100%",
theme : "advanced",
theme_advanced_buttons1 : "<?php echo $mce_buttons; ?>",
theme_advanced_buttons2 : "<?php echo $mce_buttons_2; ?>",
theme_advanced_buttons3 : "<?php echo $mce_buttons_3; ?>",
language : "<?php echo strtolower(get_locale()); ?>",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
theme_advanced_resizing : true,
browsers : "<?php echo $mce_browsers; ?>",
dialog_type : "modal",
theme_advanced_resize_horizontal : false,
convert_urls : false,
relative_urls : false,
remove_script_host : false,
force_p_newlines : true,
force_br_newlines : false,
convert_newlines_to_brs : false,
remove_linebreaks : false,
fix_list_elements : true,
content_css : "<?php echo $mce_css; ?>",
valid_elements : "<?php echo $valid_elements; ?>",
save_callback : 'TinyMCE_wordpressPlugin.saveCallback',
<?php do_action('mce_options'); ?>
plugins : "<?php echo $plugins; ?>"
};
<?php
// For people who really REALLY know what they're doing with TinyMCE
// You can modify initArray to add, remove, change elements of the config before tinyMCE.init
do_action('tinymce_before_init');
?>
tinyMCE.init(initArray);

View File

@ -1,33 +1,50 @@
<?php
/**
/**
* $RCSfile: tiny_mce_gzip.php,v $
* $Revision: $
* $Date: $
*
* @version 1.02
* @version 1.07
* @author Moxiecode
* @copyright Copyright © 2005, Moxiecode Systems AB, All rights reserved.
* @copyright Copyright © 20052006, Moxiecode Systems AB, All rights reserved.
*
* This file compresses the TinyMCE JavaScript using GZip and
* enables the browser to do two requests instead of one for each .js file.
* Notice: This script defaults the button_tile_map option to true for extra performance.
*
* Todo:
* - Add local file cache for the GZip:ed version.
*/
/* Heavily edited to add flexibilty in WordPress */
@ require('../../../wp-config.php');
@require_once('../../../wp-config.php');
function wp_translate_tinymce_lang($text) {
if ( ! function_exists('__') ) {
return $text;
} else {
gzip_compression();
function wp_tinymce_lang($path) {
global $language;
$text = '';
// Look for xx_YY.js, xx_yy.js, xx.js
$file = realpath(sprintf($path, $language));
if ( file_exists($file) )
$text = file_get_contents($file);
$file = realpath(sprintf($path, strtolower($language)));
if ( file_exists($file) )
$text = file_get_contents($file);
$file = realpath(sprintf($path, substr($language, 0, 2)));
if ( file_exists($file) )
$text = file_get_contents($file);
// Fall back on en.js
if ( empty($text) )
$text = file_get_contents(realpath(sprintf($path, 'en')));
// Send lang file through gettext
if ( function_exists('__') && strtolower(substr($language, 0, 2)) != 'en' ) {
$search1 = "/^tinyMCELang\\[(['\"])(.*)\\1\]( ?= ?)(['\"])(.*)\\4/Uem";
$replace1 = "'tinyMCELang[\\1\\2\\1]\\3'.stripslashes('\\4').__('\\5').stripslashes('\\4')";
$search2 = "/ : (['\"])(.*)\\1/Uem";
$replace2 = "' : '.stripslashes('\\1').__('\\2').stripslashes('\\1')";
$search2 = "/\\s:\\s(['\"])(.*)\\1(,|\\s*})/Uem";
$replace2 = "' : '.stripslashes('\\1').__('\\2foo').stripslashes('\\1').'\\3'";
$search = array($search1, $search2);
$replace = array($replace1, $replace2);
@ -36,9 +53,11 @@
return $text;
}
}
function wp_compact_tinymce_js($text) {
return $text;
}
function wp_compact_tinymce_js($text) {
// This function was custom-made for TinyMCE 2.0, not expected to work with any other JS.
// Strip comments
@ -50,123 +69,221 @@
$text = str_replace("\r", '', $text);
$text = preg_replace("!(^|{|}|;|:|\))\n!m", '\\1', $text);
return $text;
return "$text\n";
}
// General options
$suffix = ""; // Set to "_src" to use source version
$expiresOffset = 3600 * 24 * 10; // 10 days util client cache expires
$diskCache = false; // If you enable this option gzip files will be cached on disk.
$cacheDir = realpath("."); // Absolute directory path to where cached gz files will be stored
$debug = false; // Enable this option if you need debuging info
// Headers
header("Content-type: text/javascript; charset: UTF-8");
// header("Cache-Control: must-revalidate");
header("Vary: Accept-Encoding"); // Handle proxies
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
// Get data to load
$theme = isset($_GET['theme']) ? TinyMCE_cleanInput($_GET['theme']) : "";
$language = isset($_GET['language']) ? TinyMCE_cleanInput($_GET['language']) : "";
$plugins = isset($_GET['plugins']) ? TinyMCE_cleanInput($_GET['plugins']) : "";
$lang = isset($_GET['lang']) ? TinyMCE_cleanInput($_GET['lang']) : "en";
$index = isset($_GET['index']) ? TinyMCE_cleanInput($_GET['index']) : -1;
$cacheKey = md5($theme . $language . $plugins . $lang . $index . $debug);
$cacheFile = $cacheDir == "" ? "" : $cacheDir . "/" . "tinymce_" . $cacheKey . ".gz";
$cacheData = "";
// Patch older versions of PHP < 4.3.0
if (!function_exists('file_get_contents')) {
function file_get_contents($filename) {
$fd = fopen($filename, 'rb');
$content = fread($fd, filesize($filename));
fclose($fd);
return $content;
}
}
// Security check function, can only contain a-z 0-9 , _ - and whitespace.
function TinyMCE_cleanInput($str) {
return preg_replace("/[^0-9a-z\-_,]+/i", "", $str); // Remove anything but 0-9,a-z,-_
}
function TinyMCE_echo($str) {
global $cacheData, $diskCache;
if ($diskCache)
$cacheData .= $str;
else
echo $str;
}
/* WP
// Only gzip the contents if clients and server support it
$encodings = array();
if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
$encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));
// Check for gzip header or northon internet securities
if ((in_array('gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) {
// Use cached file if it exists but not in debug mode
if (file_exists($cacheFile) && !$debug) {
header("Content-Encoding: gzip");
echo file_get_contents($cacheFile);
die;
}
// General options
$expiresOffset = 3600 * 24 * 30; // 30 days util client cache expires
if (!$diskCache)
ob_start("ob_gzhandler");
} else
$diskCache = false;
WP */
if ($index > -1) {
// Write main script and patch some things
if ($index == 0) {
TinyMCE_echo(wp_compact_tinymce_js(file_get_contents(realpath("tiny_mce" . $suffix . ".js")))); // WP
TinyMCE_echo('TinyMCE.prototype.loadScript = function() {};var realTinyMCE = tinyMCE;');
} else
TinyMCE_echo('tinyMCE = realTinyMCE;');
gzip_compression();
// Output rest of headers
header("Content-type: text/javascript; charset: UTF-8");
header("Vary: Accept-Encoding"); // Handle proxies
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
// Write main script
$tinymce = file_get_contents(realpath("tiny_mce.js"));
echo wp_compact_tinymce_js($tinymce);
echo "\n\n";
// Remove some functions
echo "\n/* WP cancels all TinyMCE language and import handling */\n";
echo "TinyMCE.prototype.importThemeLanguagePack = function() {};\n";
echo "TinyMCE.prototype.importPluginLanguagePack = function() {};\n\n";
echo "TinyMCE.prototype.loadScript = function() {};\n";
// Do init based on index
TinyMCE_echo("tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);");
// Load theme, language pack and theme language packs
$theme = apply_filters('mce_theme', 'advanced');
echo wp_compact_tinymce_js(file_get_contents(realpath("themes/" . $theme . "/editor_template.js")));
// Get the WordPress locale
$locale = get_locale();
$themeLanguageFile = realpath("themes/" . $theme . "/langs/" . $locale . ".js");
if (!file_exists($themeLanguageFile))
$themeLanguageFile = realpath("themes/" . $theme . "/langs/en.js");
echo wp_translate_tinymce_lang(file_get_contents($themeLanguageFile));
$tinymceLanguageFile = realpath("langs/" . $locale . ".js");
if (!file_exists($tinymceLanguageFile))
$tinymceLanguageFile = realpath("langs/en.js");
echo wp_translate_tinymce_lang(file_get_contents($tinymceLanguageFile));
// Load all plugins and their language packs
$plugins = apply_filters('mce_plugins', array('wordpress', 'autosave','wphelp'));
foreach ($plugins as $plugin) {
$pluginFile = realpath("plugins/" . $plugin . "/editor_plugin.js");
$languageFile = realpath("plugins/" . $plugin . "/langs/" . $locale . ".js");
if (!file_exists($languageFile))
$languageFile = realpath("plugins/" . $plugin . "/langs/en.js");
if ($pluginFile)
echo file_get_contents($pluginFile);
if ($languageFile)
echo wp_translate_tinymce_lang(file_get_contents($languageFile));
if ($theme) {
TinyMCE_echo(wp_compact_tinymce_js(file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js"))));
TinyMCE_echo(wp_tinymce_lang("themes/" . $theme . "/langs/%s.js")); // WP
}
// Set up init variables
if ( current_user_can('unfiltered_html') ) // Use the full XHTML set provided in the docs
$valid_elements = 'a[accesskey|charset|class|coords|dir<ltr?rtl|href|hreflang|id|lang|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rel|rev|shape<circle?default?poly?rect|style|tabindex|title|target|type],abbr[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],acronym[class|dir<ltr?rtl|id|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],address[class|align|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],applet[align<bottom?left?middle?right?top|alt|archive|class|code|codebase|height|hspace|id|name|object|style|title|vspace|width],area[accesskey|alt|class|coords|dir<ltr?rtl|href|id|lang|nohref<nohref|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|shape<circle?default?poly?rect|style|tabindex|title|target],base[href|target],basefont[color|face|id|size],bdo[class|dir<ltr?rtl|id|lang|style|title],big[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],blockquote[dir|style|cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],body[alink|background|bgcolor|class|dir<ltr?rtl|id|lang|link|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onunload|style|title|text|vlink],br[class|clear<all?left?none?right|id|style|title],button[accesskey|class|dir<ltr?rtl|disabled<disabled|id|lang|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|tabindex|title|type|value],caption[align<bottom?left?right?top|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],center[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],'
. 'cite[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],code[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],col[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title|valign<baseline?bottom?middle?top|width],colgroup[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title|valign<baseline?bottom?middle?top|width],dd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],del[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],dfn[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],dir[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],div[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],dl[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],dt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],em/i[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],'
. 'fieldset[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],font[class|color|dir<ltr?rtl|face|id|lang|size|style|title],form[accept|accept-charset|action|class|dir<ltr?rtl|enctype|id|lang|method<get?post|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onreset|onsubmit|style|title|target],frame[class|frameborder|id|longdesc|marginheight|marginwidth|name|noresize<noresize|scrolling<auto?no?yes|src|style|title],frameset[class|cols|id|onload|onunload|rows|style|title],h1[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h2[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h3[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h4[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h5[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h6[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],head[dir<ltr?rtl|lang|profile],hr[align<center?left?right|class|dir<ltr?rtl|id|lang|noshade<noshade|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|size|style|title|width],html[dir<ltr?rtl|lang|version],'
. 'iframe[align<bottom?left?middle?right?top|class|frameborder|height|id|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style|title|width],img[align<bottom?left?middle?right?top|alt|border|class|dir<ltr?rtl|height|hspace|id|ismap<ismap|lang|longdesc|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|src|style|title|usemap|vspace|width],input[accept|accesskey|align<bottom?left?middle?right?top|alt|checked<checked|class|dir<ltr?rtl|disabled<disabled|id|ismap<ismap|lang|maxlength|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect|readonly<readonly|size|src|style|tabindex|title|type<button?checkbox?file?hidden?image?password?radio?reset?submit?text|usemap|value],ins[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],isindex[class|dir<ltr?rtl|id|lang|prompt|style|title],kbd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],label[accesskey|class|dir<ltr?rtl|for|id|lang|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],legend[align<bottom?left?right?top|accesskey|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],li[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|type|value],link[charset|class|dir<ltr?rtl|href|hreflang|id|lang|media|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rel|rev|style|title|target|type],map[class|dir<ltr?rtl|id|lang|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],'
. 'menu[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],meta[content|dir<ltr?rtl|http-equiv|lang|name|scheme],noframes[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],noscript[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],object[align<bottom?left?middle?right?top|archive|border|class|classid|codebase|codetype|data|declare|dir<ltr?rtl|height|hspace|id|lang|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|standby|style|tabindex|title|type|usemap|vspace|width],ol[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|start|style|title|type],optgroup[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],option[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|selected<selected|style|title|value],p[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],param[id|name|type|value|valuetype<DATA?OBJECT?REF],pre/listing/plaintext/xmp[align|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|width],q[cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],'
. 's[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],samp[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],script[charset|defer|language|src|type],select[class|dir<ltr?rtl|disabled<disabled|id|lang|multiple<multiple|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|size|style|tabindex|title],small[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],span[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],strike[class|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],strong/b[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],style[dir<ltr?rtl|lang|media|title|type],sub[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],sup[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],table[align<center?left?right|bgcolor|border|cellpadding|cellspacing|class|dir<ltr?rtl|frame|height|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rules|style|summary|title|width],'
. 'tbody[align<center?char?justify?left?right|char|class|charoff|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|valign<baseline?bottom?middle?top],td[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup|style|title|valign<baseline?bottom?middle?top|width],textarea[accesskey|class|cols|dir<ltr?rtl|disabled<disabled|id|lang|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect|readonly<readonly|rows|style|tabindex|title],tfoot[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|valign<baseline?bottom?middle?top],th[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup|style|title|valign<baseline?bottom?middle?top|width],thead[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|valign<baseline?bottom?middle?top],'
. 'title[dir<ltr?rtl|lang],tr[abbr|align<center?char?justify?left?right|bgcolor|char|charoff|class|rowspan|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|valign<baseline?bottom?middle?top],tt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],u[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],ul[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|type],var[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
else // Use a much smaller set
$valid_elements = '-a[id|href|title|rel],-strong/b,-em/i,-strike,-del,-u,p[class|align|dir],-ol,-ul,-li,br,img[class|src|alt|title|width|height|align],-sub,-sup,-blockquote[dir],-table[border|cellspacing|cellpadding|width|height|class|align|dir],thead[class|rowspan|width|height|align|valign|dir],tr[class|rowspan|width|height|align|valign|dir],th[dir|class|colspan|rowspan|width|height|align|valign|scope],td[dir|class|colspan|rowspan|width|height|align|valign],-div[dir|class|align],-span[class|align],-pre[class],-code[class],-address,-h1[class|align|dir],-h2[class|align|dir],-h3[class|align|dir],-h4[class|align|dir],-h5[class|align|dir],-h6[class|align|dir],hr';
$valid_elements = apply_filters('mce_valid_elements', $valid_elements);
$plugins = implode($plugins, ',');
$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright' ,'separator', 'link', 'unlink', 'image', 'wordpress', 'separator', 'undo', 'redo', 'code', 'wphelp'));
$mce_buttons = implode($mce_buttons, ',');
$mce_buttons_2 = apply_filters('mce_buttons_2', array());
$mce_buttons_2 = implode($mce_buttons_2, ',');
$mce_buttons_3 = apply_filters('mce_buttons_3', array());
$mce_buttons_3 = implode($mce_buttons_3, ',');
$mce_browsers = apply_filters('mce_browsers', array('msie', 'gecko', 'opera'));
$mce_browsers = implode($mce_browsers, ',');
/* WP if ($language) WP */
TinyMCE_echo(wp_tinymce_lang("langs/%s.js"));
// Load all plugins and their language packs
$plugins = explode(",", $plugins);
foreach ($plugins as $plugin) {
$pluginFile = realpath("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");
/* WP $languageFile = realpath("plugins/" . $plugin . "/langs/" . $lang . ".js"); WP */
if ($pluginFile)
TinyMCE_echo(file_get_contents($pluginFile));
/* WP if ($languageFile) WP */
TinyMCE_echo(wp_tinymce_lang("plugins/" . $plugin . "/langs/%s.js")); // WP
}
// Reset tinyMCE compressor engine
TinyMCE_echo("tinyMCE = tinyMCECompressed;");
// Write to cache
if ($diskCache) {
// Calculate compression ratio and debug target output path
if ($debug) {
$ratio = round(100 - strlen(gzencode($cacheData, 9, FORCE_GZIP)) / strlen($cacheData) * 100.0);
TinyMCE_echo("alert('TinyMCE was compressed by " . $ratio . "%.\\nOutput cache file: " . $cacheFile . "');");
}
$cacheData = gzencode($cacheData, 9, FORCE_GZIP);
// Write to file if possible
$fp = @fopen($cacheFile, "wb");
if ($fp) {
fwrite($fp, $cacheData);
fclose($fp);
}
// Output
header("Content-Encoding: gzip");
echo $cacheData;
}
die;
}
?>
initArray = {
mode : "specific_textareas",
textarea_trigger : "title",
width : "100%",
theme : "advanced",
theme_advanced_buttons1 : "<?php echo $mce_buttons; ?>",
theme_advanced_buttons2 : "<?php echo $mce_buttons_2; ?>",
theme_advanced_buttons3 : "<?php echo $mce_buttons_3; ?>",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
theme_advanced_resizing : true,
browsers : "<?php echo $mce_browsers; ?>",
dialog_type : "modal",
theme_advanced_resize_horizontal : false,
entity_encoding : "raw",
relative_urls : false,
remove_script_host : false,
force_p_newlines : true,
force_br_newlines : false,
convert_newlines_to_brs : false,
remove_linebreaks : true,
save_callback : "wp_save_callback",
document_base_url : "<?php echo trailingslashit(get_bloginfo('home')); ?>",
valid_elements : "<?php echo $valid_elements; ?>",
<?php do_action('mce_options'); ?>
plugins : "<?php echo $plugins; ?>"
};
function TinyMCECompressed() {
this.configs = new Array();
this.loadedFiles = new Array();
this.loadAdded = false;
this.isLoaded = false;
}
<?php
// For people who really REALLY know what they're doing with TinyMCE
do_action('tinymce_before_init');
?>
TinyMCECompressed.prototype.init = function(settings) {
var elements = document.getElementsByTagName('script');
var scriptURL = "";
tinyMCE.init(initArray);
for (var i=0; i<elements.length; i++) {
if (elements[i].src && elements[i].src.indexOf("tiny_mce_gzip.php") != -1) {
scriptURL = elements[i].src;
break;
}
}
settings["theme"] = typeof(settings["theme"]) != "undefined" ? settings["theme"] : "default";
settings["plugins"] = typeof(settings["plugins"]) != "undefined" ? settings["plugins"] : "";
settings["language"] = typeof(settings["language"]) != "undefined" ? settings["language"] : "en";
settings["button_tile_map"] = typeof(settings["button_tile_map"]) != "undefined" ? settings["button_tile_map"] : true;
this.configs[this.configs.length] = settings;
this.settings = settings;
scriptURL += "?theme=" + escape(this.getOnce(settings["theme"])) + "&language=" + escape(this.getOnce(settings["language"])) + "&plugins=" + escape(this.getOnce(settings["plugins"])) + "&lang=" + settings["language"] + "&index=" + escape(this.configs.length-1);
document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>');
if (!this.loadAdded) {
tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCECompressed.prototype.onLoad);
tinyMCE.addEvent(window, "load", TinyMCECompressed.prototype.onLoad);
this.loadAdded = true;
}
}
TinyMCECompressed.prototype.onLoad = function() {
if (tinyMCE.isLoaded)
return true;
tinyMCE = realTinyMCE;
TinyMCE_Engine.prototype.onLoad();
tinyMCE._addUnloadEvents();
tinyMCE.isLoaded = true;
}
TinyMCECompressed.prototype.addEvent = function(o, n, h) {
if (o.attachEvent)
o.attachEvent("on" + n, h);
else
o.addEventListener(n, h, false);
}
TinyMCECompressed.prototype.getOnce = function(str) {
var ar = str.split(',');
for (var i=0; i<ar.length; i++) {
if (ar[i] == '')
continue;
// Skip load
for (var x=0; x<this.loadedFiles.length; x++) {
if (this.loadedFiles[x] == ar[i])
ar[i] = null;
}
this.loadedFiles[this.loadedFiles.length] = ar[i];
}
// Glue
str = "";
for (var i=0; i<ar.length; i++) {
if (ar[i] == null)
continue;
str += ar[i];
if (i != ar.length-1)
str += ",";
}
return str;
}
var tinyMCE = new TinyMCECompressed();
var tinyMCECompressed = tinyMCE;

View File

@ -1,22 +1,25 @@
/**
* $RCSfile: tiny_mce_popup.js,v $
* $Revision: 1.18 $
* $Date: 2005/10/29 19:13:20 $
*
* @author Moxiecode
* @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
*/
// Some global instances, this will be filled later
var tinyMCE = null, tinyMCELang = null;
function TinyMCEPopup() {
function TinyMCE_Popup() {
};
TinyMCEPopup.prototype.init = function() {
var win = window.opener ? window.opener : window.dialogArguments;
if (!win)
TinyMCE_Popup.prototype.init = function() {
var win = window.opener ? window.opener : window.dialogArguments;
var inst;
if (!win) {
// Try parent
win = parent.parent;
// Try top
if (typeof(win.tinyMCE) == "undefined")
win = top;
}
window.opener = win;
this.windowOpener = win;
@ -31,15 +34,16 @@ TinyMCEPopup.prototype.init = function() {
return;
}
inst = tinyMCE.selectedInstance;
this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
this.storeSelection = tinyMCE.isMSIE && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
this.storeSelection = (tinyMCE.isMSIE && !tinyMCE.isOpera) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
if (this.isWindow)
window.focus();
// Store selection
if (this.storeSelection)
tinyMCE.selectedInstance.execCommand('mceStoreSelection');
inst.selectionBookmark = inst.selection.getBookmark(true);
// Setup dir
if (tinyMCELang['lang_dir'])
@ -63,23 +67,24 @@ TinyMCEPopup.prototype.init = function() {
tinyMCE.addEvent(window, "load", this.onLoad);
};
TinyMCEPopup.prototype.onLoad = function() {
var body = document.body;
TinyMCE_Popup.prototype.onLoad = function() {
var dir, i, elms, body = document.body;
body.onkeydown = function (e) {
e = e ? e : window.event;
if ( e.keyCode == 27 && !e.shiftKey && !e.controlKey && !e.altKey ) {
tinyMCEPopup.close();
tinyMCE.closeWindow(window);
}
}
if (tinyMCE.getWindowArg('mce_replacevariables', true))
body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
var dir = tinyMCE.selectedInstance.settings['directionality'];
if (dir == "rtl") {
var elms = document.forms[0].elements;
for (var i=0; i<elms.length; i++) {
dir = tinyMCE.selectedInstance.settings['directionality'];
if (dir == "rtl" && document.forms && document.forms.length > 0) {
elms = document.forms[0].elements;
for (i=0; i<elms.length; i++) {
if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr")
elms[i].dir = dir;
}
@ -89,19 +94,20 @@ TinyMCEPopup.prototype.onLoad = function() {
body.style.display = 'block';
// Execute real onload (Opera fix)
if (tinyMCEPopup.onLoadEval != "") {
if (tinyMCEPopup.onLoadEval != "")
eval(tinyMCEPopup.onLoadEval);
}
};
TinyMCEPopup.prototype.executeOnLoad = function(str) {
TinyMCE_Popup.prototype.executeOnLoad = function(str) {
if (tinyMCE.isOpera)
this.onLoadEval = str;
else
eval(str);
};
TinyMCEPopup.prototype.resizeToInnerSize = function() {
TinyMCE_Popup.prototype.resizeToInnerSize = function() {
// Netscape 7.1 workaround
if (this.isWindow && tinyMCE.isNS71) {
window.resizeBy(0, 10);
@ -118,13 +124,13 @@ TinyMCEPopup.prototype.resizeToInnerSize = function() {
// Remove margin
oldMargin = body.style.margin;
body.style.margin = '0px';
body.style.margin = '0';
// Create wrapper
wrapper = doc.createElement("div");
wrapper.id = 'mcBodyWrapper';
wrapper.style.display = 'none';
wrapper.style.margin = '0px';
wrapper.style.margin = '0';
// Wrap body elements
nodes = doc.body.childNodes;
@ -146,7 +152,7 @@ TinyMCEPopup.prototype.resizeToInnerSize = function() {
iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings['default_document'];
iframe.width = "100%";
iframe.height = "100%";
iframe.style.margin = '0px';
iframe.style.margin = '0';
// Add iframe
doc.body.appendChild(iframe);
@ -167,7 +173,8 @@ TinyMCEPopup.prototype.resizeToInnerSize = function() {
}
};
TinyMCEPopup.prototype.resizeToContent = function() {
TinyMCE_Popup.prototype.resizeToContent = function() {
var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
@ -197,31 +204,42 @@ TinyMCEPopup.prototype.resizeToContent = function() {
}
};
TinyMCEPopup.prototype.getWindowArg = function(name, default_value) {
TinyMCE_Popup.prototype.getWindowArg = function(name, default_value) {
return tinyMCE.getWindowArg(name, default_value);
};
TinyMCEPopup.prototype.execCommand = function(command, user_interface, value) {
TinyMCE_Popup.prototype.restoreSelection = function() {
if (this.storeSelection) {
var inst = tinyMCE.selectedInstance;
// Restore selection
if (this.storeSelection) {
inst.getWin().focus();
inst.execCommand('mceRestoreSelection');
}
if (inst.selectionBookmark)
inst.selection.moveToBookmark(inst.selectionBookmark);
}
};
TinyMCE_Popup.prototype.execCommand = function(command, user_interface, value) {
var inst = tinyMCE.selectedInstance;
this.restoreSelection();
inst.execCommand(command, user_interface, value);
// Store selection
if (this.storeSelection)
inst.execCommand('mceStoreSelection');
inst.selectionBookmark = inst.selection.getBookmark(true);
};
TinyMCEPopup.prototype.close = function() {
TinyMCE_Popup.prototype.close = function() {
tinyMCE.closeWindow(window);
};
TinyMCEPopup.prototype.pickColor = function(e, element_id) {
TinyMCE_Popup.prototype.pickColor = function(e, element_id) {
tinyMCE.selectedInstance.execCommand('mceColorPicker', true, {
element_id : element_id,
document : document,
@ -230,7 +248,8 @@ TinyMCEPopup.prototype.pickColor = function(e, element_id) {
});
};
TinyMCEPopup.prototype.openBrowser = function(element_id, type, option) {
TinyMCE_Popup.prototype.openBrowser = function(element_id, type, option) {
var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
var url = document.getElementById(element_id).value;
@ -245,6 +264,6 @@ TinyMCEPopup.prototype.openBrowser = function(element_id, type, option) {
};
// Setup global instance
var tinyMCEPopup = new TinyMCEPopup();
var tinyMCEPopup = new TinyMCE_Popup();
tinyMCEPopup.init();

View File

@ -1,22 +1,22 @@
/**
* $RCSfile: form_utils.js,v $
* $Revision: 1.5 $
* $Date: 2005/10/25 16:01:51 $
* $Revision: 1.10 $
* $Date: 2006/03/22 12:21:24 $
*
* Various form utilitiy functions.
*
* @author Moxiecode
* @copyright Copyright © 2005, Moxiecode Systems AB, All rights reserved.
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
function getColorPickerHTML(id, target_form_element) {
var html = "";
html += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
html += '<img id="' + id + '" src="../../themes/advanced/images/color.gif"';
html += ' onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');"';
html += ' onmouseout="tinyMCE.restoreClass(this);"';
html += ' onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');"';
html += '<img id="' + id + '" src="../../themes/' + tinyMCE.getParam("theme") + '/images/color.gif"';
html += ' onmouseover="this.className=\'mceButtonOver\'"';
html += ' onmouseout="this.className=\'mceButtonNormal\'"';
html += ' onmousedown="this.className=\'mceButtonDown\'"';
html += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
@ -57,10 +57,10 @@ function getBrowserHTML(id, target_form_element, type, prefix) {
var html = "";
html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
html += '<img id="' + id + '" src="../../themes/advanced/images/browse.gif"';
html += ' onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');"';
html += ' onmouseout="tinyMCE.restoreClass(this);"';
html += ' onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');"';
html += '<img id="' + id + '" src="../../themes/' + tinyMCE.getParam("theme") + '/images/browse.gif"';
html += ' onmouseover="this.className=\'mceButtonOver\';"';
html += ' onmouseout="this.className=\'mceButtonNormal\';"';
html += ' onmousedown="this.className=\'mceButtonDown\';"';
html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
@ -74,7 +74,7 @@ function openBrower(img_id, target_form_element, type, option) {
tinyMCEPopup.openBrowser(target_form_element, type, option);
}
function selectByValue(form_obj, field_name, value, add_custom) {
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
if (!form_obj || !form_obj.elements[field_name])
return;
@ -84,7 +84,7 @@ function selectByValue(form_obj, field_name, value, add_custom) {
for (var i=0; i<sel.options.length; i++) {
var option = sel.options[i];
if (option.value == value) {
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
option.selected = true;
found = true;
} else
@ -109,8 +109,13 @@ function getSelectValue(form_obj, field_name) {
return elm.options[elm.selectedIndex].value;
}
function addSelectValue(form_obj, field_name, name, value) {
var s = form_obj.elements[field_name];
var o = new Option(name, value);
s.options[s.options.length] = o;
}
function addClassesToList(list_id, specific_option) {
return;
// Setup class droplist
var styleSelectElm = document.getElementById(list_id);
var styles = tinyMCE.getParam('theme_advanced_styles', false);

View File

@ -0,0 +1,212 @@
/**
* $RCSfile: mclayer.js,v $
* $Revision: 1.2 $
* $Date: 2006/02/06 20:11:09 $
*
* Moxiecode floating layer script.
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
function MCLayer(id) {
this.id = id;
this.settings = new Array();
this.blockerElement = null;
this.isMSIE = navigator.appName == "Microsoft Internet Explorer";
this.events = false;
this.autoHideCallback = null;
}
MCLayer.prototype = {
moveRelativeTo : function(re, p, a) {
var rep = this.getAbsPosition(re);
var w = parseInt(re.offsetWidth);
var h = parseInt(re.offsetHeight);
var x, y;
switch (p) {
case "tl":
break;
case "tr":
x = rep.absLeft + w;
y = rep.absTop;
break;
case "bl":
break;
case "br":
break;
}
this.moveTo(x, y);
},
moveBy : function(dx, dy) {
var e = this.getElement();
var x = parseInt(e.style.left);
var y = parseInt(e.style.top);
e.style.left = (x + dx) + "px";
e.style.top = (y + dy) + "px";
this.updateBlocker();
},
moveTo : function(x, y) {
var e = this.getElement();
e.style.left = x + "px";
e.style.top = y + "px";
this.updateBlocker();
},
show : function() {
MCLayer.visibleLayer = this;
this.getElement().style.display = 'block';
this.updateBlocker();
},
hide : function() {
this.getElement().style.display = 'none';
this.updateBlocker();
},
setAutoHide : function(s, cb) {
this.autoHideCallback = cb;
this.registerEventHandlers();
},
getElement : function() {
return document.getElementById(this.id);
},
updateBlocker : function() {
if (!this.isMSIE)
return;
var e = this.getElement();
var b = this.getBlocker();
var x = this.parseInt(e.style.left);
var y = this.parseInt(e.style.top);
var w = this.parseInt(e.offsetWidth);
var h = this.parseInt(e.offsetHeight);
b.style.left = x + 'px';
b.style.top = y + 'px';
b.style.width = w + 'px';
b.style.height = h + 'px';
b.style.display = e.style.display;
},
getBlocker : function() {
if (!this.blockerElement) {
var d = document, b = d.createElement("iframe");
b.style.cssText = 'display: none; left: 0px; position: absolute; top: 0';
b.src = 'javascript:false;';
b.frameBorder = '0';
b.scrolling = 'no';
d.body.appendChild(b);
this.blockerElement = b;
}
return this.blockerElement;
},
getAbsPosition : function(n) {
var p = {absLeft : 0, absTop : 0};
while (n) {
p.absLeft += n.offsetLeft;
p.absTop += n.offsetTop;
n = n.offsetParent;
}
return p;
},
registerEventHandlers : function() {
if (!this.events) {
var d = document;
this.addEvent(d, 'mousedown', MCLayer.prototype.onMouseDown);
this.events = true;
}
},
addEvent : function(o, n, h) {
if (o.attachEvent)
o.attachEvent("on" + n, h);
else
o.addEventListener(n, h, false);
},
onMouseDown : function(e) {
e = typeof(e) == "undefined" ? window.event : e;
var b = document.body;
var l = MCLayer.visibleLayer;
if (l) {
var mx = l.isMSIE ? e.clientX + b.scrollLeft : e.pageX;
var my = l.isMSIE ? e.clientY + b.scrollTop : e.pageY;
var el = l.getElement();
var x = parseInt(el.style.left);
var y = parseInt(el.style.top);
var w = parseInt(el.offsetWidth);
var h = parseInt(el.offsetHeight);
if (!(mx > x && mx < x + w && my > y && my < y + h)) {
MCLayer.visibleLayer = null;
if (l.autoHideCallback && l.autoHideCallback(l, e, mx, my))
return true;
l.hide();
}
}
},
addCSSClass : function(e, c) {
this.removeCSSClass(e, c);
var a = this.explode(' ', e.className);
a[a.length] = c;
e.className = a.join(' ');
},
removeCSSClass : function(e, c) {
var a = this.explode(' ', e.className), i;
for (i=0; i<a.length; i++) {
if (a[i] == c)
a[i] = '';
}
e.className = a.join(' ');
},
explode : function(d, s) {
var ar = s.split(d);
var oar = new Array();
for (var i = 0; i<ar.length; i++) {
if (ar[i] != "")
oar[oar.length] = ar[i];
}
return oar;
},
parseInt : function(s) {
if (s == null || s == '')
return 0;
return parseInt(s);
}
}

View File

@ -1,12 +1,12 @@
/**
* $RCSfile: mctabs.js,v $
* $Revision: 1.1 $
* $Date: 2005/08/01 18:36:35 $
* $Revision: 1.2 $
* $Date: 2006/02/06 20:11:09 $
*
* Moxiecode DHTML Tabs script.
*
* @author Moxiecode
* @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
function MCTabs() {

View File

@ -1,12 +1,12 @@
/**
* $RCSfile: validate.js,v $
* $Revision: 1.2 $
* $Date: 2005/08/13 12:20:37 $
* $Revision: 1.3 $
* $Date: 2006/02/06 20:11:09 $
*
* Various form validation methods.
*
* @author Moxiecode
* @copyright Copyright © 2005, Moxiecode Systems AB, All rights reserved.
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
function testRegExp(form_name, element_name, re) {

View File

@ -118,29 +118,27 @@ require_once('../../../wp-config.php');
<div id="content1">
<h2><?php _e('Rich Editing Basics') ?></h2>
<p><?php _e('<em>Rich editing</em>, also called WYSIWYG for What You See Is What You Get, means your text is formatted as you type. The rich editor creates HTML code behind the scenes while you concentrate on writing. Font styles, links and images all appear just as they will on the internet.') ?></p>
<p><?php _e('WordPress includes TinyMCE, a rich editor that works well in most web browsers used today. It is powerful but it has limitations. Pasting text from other word processors may not give the results you expect. If you do not like the way the rich editor works, you may turn it off in the My Profile form, under Users in the admin menu.') ?></p>
<p><?php _e('Because HTML code depends on the less-than character (&lt;) to render web pages, this character is reserved for HTML code. If you want a "<" to be visible on your site, you must encode it as "&amp;lt;" without the quotes.') ?></p>
<p><?php _e('<em>Rich editing</em>, also called WYSIWYG for What You See Is What You Get, means your text is formatted as you type. The rich editor creates HTML code behind the scenes while you concentrate on writing. Font styles, links and images all appear approximately as they will on the internet.') ?></p>
<p><?php _e('WordPress includes a rich HTML editor that works well in most web browsers used today. It is powerful but it has limitations. Pasting text from other word processors may not give the results you expect. If you do not like the way the rich editor works, you may turn it off in the Your Profile and Personal Options form, under Users in the admin menu.') ?></p>
</div>
<div id="content2" class="hidden">
<h2><?php _e('Advanced Rich Editing') ?></h2>
<h3><?php _e('Images and Attachments') ?></h3>
<p><?php _e('Some (not all) browsers allow you to drag images and other items directly into the editor. Most <a href="http://www.mozilla.org/products/firefox/" title="Mozilla.org, home of the Firefox web browser" target="_blank">Firefox</a> users can drag images from the uploading box (directly below the editor) and see their images instantly, complete with a link. If you cannot do this, use your clipboard Copy and Paste functions to insert the image and link tags. The rich editor will display the images after you have saved the post or used the HTML Editor to refresh the display.') ?></p>
<p><?php _e('There is a button in the editor toolbar for inserting images that are already hosted somewhere on the internet. If you have a URL for an image, click this button and enter the URL in the box which appears.') ?></p>
<p><?php _e('If you need to upload an image or sound file from your computer, you can use the uploading tool below the editor. The tool will attempt to create a thumbnail-sized image when you upload an image. To insert your uploaded image into the post, first click on the thumbnail to reveal a menu of options. Clicking on a "Using.." or "Linked..." option will change that option. For instance, you might want to use the thumbnail in the post and link it to a page showing the original with a caption. When you have selected the options you like, click "Send to Editor" and your image or file will appear in the post you are editing.</p>') ?>
<h3><?php _e('HTML in the Rich Editor') ?></h3>
<p><?php _e('When you want to include HTML elements that are not generated by the toolbar buttons, you must enter it by hand. Examples are &lt;pre> and &lt;code>. Simply type the code into the editor. If the code is valid and allowed by the editor, you should see it rendered the next time you update the display, usually by saving or using the HTML Editor. If you want to display "&lt;" on the web, you must encode it as "&amp;lt;" in the editor.') ?></p>
<h3><?php _e('The HTML Editor') ?></h3>
<p><?php _e('The editor will not always understand your intentions as your editing gets more complex. Use the HTML Editor to sort out any rough spots, such as extra elements or attributes. WordPress will strip all empty &lt;p> tags and &lt;br /> tags in favor of simple newline characters. However, it will preserve any tag such as this: &lt;p class="anyclass">&lt;/p>. When using the HTML editor, all less-thans are double-encoded: &amp;amp;lt;. This ensures they display as &amp;lt; in the rich editor and &lt; on the web.') ?></p>
<p><?php _e('Any HTML entered directly into the rich editor will show up as text when the post is viewed. What you see is what you get. When you want to include HTML elements that cannot be generated with the toolbar buttons, you must enter it by hand in the HTML editor. Examples are tables and &lt;code&gt;. To do this, click the HTML button and edit the code, then click Update. If the code is valid and understood by the editor, you should see it rendered immediately.') ?></p>
</div>
<div id="content3" class="hidden">
<h2><?php _e('Writing at Full Speed') ?></h2>
<p><?php _e('Rather than reaching for your mouse to click on the toolbar, use these access keys. Windows and Linux use Alt+&lt;letter>. Macintosh uses Ctrl+&lt;letter>.') ?></p>
<table id="keys" width="100%" border="0">
<tr class="top"><th class="key center"><?php _e('Key') ?></th><th class="left"><?php _e('Action') ?></th><th class="key center"><?php _e('Key') ?></th><th class="left"><?php _e('Action') ?></th></tr>
<tr><th>b</th><td><strong><?php _e('Bold') ?></strong></td><th>f</th><td class="align left"><?php _e('Align Left') ?></td></tr>
<tr><th>i</th><td><em><?php _e('Italic') ?></em></td><th>c</th><td class="align center"><?php _e('Align Center') ?></td></tr>
<tr><th>d</th><td><strike><?php _e('Strikethrough') ?></strike></td><th>r</th><td class="align right"><?php _e('Align Right') ?></td></tr>
<tr class="top"><th class="key center"><?php _e('Letter') ?></th><th class="left"><?php _e('Action') ?></th><th class="key center"><?php _e('Letter') ?></th><th class="left"><?php _e('Action') ?></th></tr>
<tr><th>n</th><td><?php _e('Check Spelling') ?></td><th>f</th><td class="align left"><?php _e('Align Left') ?></td></tr>
<tr><th>j</th><td><?php _e('Justify Text') ?></td><th>c</th><td class="align center"><?php _e('Align Center') ?></td></tr>
<tr><th>k</th><td><strike><?php _e('Strikethrough') ?></strike></td><th>r</th><td class="align right"><?php _e('Align Right') ?></td></tr>
<tr><th>l</th><td><b>&bull;</b> <?php _e('List') ?></td><th>a</th><td><?php _e('Insert <span class="anchor">Anchor</span>') ?></td></tr>
<tr><th>o</th><td>1. <?php _e('List') ?></td><th>s</th><td><?php _e('Unlink Anchor') ?></td></tr>
<tr><th>q</th><td>&rarr;<?php _e('Quote/Indent') ?></td><th>m</th><td><?php _e('Insert Image') ?></td></tr>