Big tiny fixes from skeltoac. fixes #1897
git-svn-id: http://svn.automattic.com/wordpress/trunk@3136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
20660c0ffb
commit
544842e3dc
|
@ -100,6 +100,11 @@ tinyMCE.init({
|
|||
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",
|
||||
valid_elements : "-a[href|title|rel],-strong/b,-em/i,-strike,-del,-u,p[class|align],-ol,-ul,-li,br,img[class|src|alt|title|width|height|align],-sub,-sup,-blockquote,-table[border=0|cellspacing|cellpadding|width|height|class|align],tr[class|rowspan|width|height|align|valign],td[dir|class|colspan|rowspan|width|height|align|valign],-div[dir|class|align],-span[class|align],-pre[class],address,-h1[class|align],-h2[class|align],-h3[class|align],-h4[class|align],-h5[class|align],-h6[class|align],hr",
|
||||
plugins : "wordpress,autosave"
|
||||
<?php do_action('mce_options'); ?>
|
||||
|
@ -335,7 +340,7 @@ function myPload( str ) {
|
|||
<?php
|
||||
require(ABSPATH . '/wp-admin/menu-header.php');
|
||||
|
||||
if ( $parent_file == 'options-general.php' ) {
|
||||
if ( $parent_file == 'options-personal.php' ) {
|
||||
require(ABSPATH . '/wp-admin/options-head.php');
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -7,11 +7,9 @@ $messages[3] = __('Custom field deleted.');
|
|||
<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $richedit = ( 'true' != get_user_option('rich_editing') ) ? false : true; ?>
|
||||
|
||||
<form name="post" action="post.php" method="post" id="post">
|
||||
<?php if ( (isset($mode) && 'bookmarklet' == $mode) ||
|
||||
isset($_GET['popupurl']) ): ?>
|
||||
<input type="hidden" name="mode" value="bookmarklet" />
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2 id="write-post"><?php _e('Write Post'); ?><?php if ( 0 != $post_ID ) : ?>
|
||||
|
@ -137,7 +135,7 @@ endforeach;
|
|||
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="<?php echo ( 'true' != get_user_option('rich_editing') ) ? 'postdiv' : 'postdivrich'; ?>">
|
||||
<fieldset id="<?php echo $richedit ? 'postdivrich' : 'postdiv'; ?>">
|
||||
<legend><?php _e('Post') ?></legend>
|
||||
|
||||
<?php
|
||||
|
@ -146,11 +144,12 @@ endforeach;
|
|||
$rows = 12;
|
||||
}
|
||||
?>
|
||||
<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo $post->post_content ?></textarea></div>
|
||||
<?php if ( !$richedit ) the_quicktags(); ?>
|
||||
|
||||
<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo $richedit ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div>
|
||||
</fieldset>
|
||||
|
||||
<?php if ( 'true' != get_user_option('rich_editing') ) : ?>
|
||||
<?php the_quicktags(); ?>
|
||||
<?php if ( !$richedit ) : ?>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
edCanvas = document.getElementById('content');
|
||||
|
@ -201,7 +200,7 @@ else
|
|||
|
||||
<p class="submit"><?php echo $saveasdraft; ?> <input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" />
|
||||
<?php
|
||||
if ('publish' != $post->post_status || 0 == $post_ID) {
|
||||
if ('publish' != $post_status || 0 == $post_ID) {
|
||||
?>
|
||||
<?php if ( current_user_can('publish_posts') ) : ?>
|
||||
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
|
||||
|
@ -210,9 +209,7 @@ if ('publish' != $post->post_status || 0 == $post_ID) {
|
|||
}
|
||||
?>
|
||||
<input name="referredby" type="hidden" id="referredby" value="<?php
|
||||
if ( !empty($_REQUEST['popupurl']) )
|
||||
echo wp_specialchars($_REQUEST['popupurl']);
|
||||
else if ( url_to_postid($_SERVER['HTTP_REFERER']) == $post_ID )
|
||||
if ( url_to_postid($_SERVER['HTTP_REFERER']) == $post_ID )
|
||||
echo 'redo';
|
||||
else
|
||||
echo wp_specialchars($_SERVER['HTTP_REFERER']);
|
||||
|
@ -223,8 +220,6 @@ else
|
|||
<?php
|
||||
$uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
|
||||
$uploading_iframe_src = "inline-uploading.php?action=view&post=$uploading_iframe_ID";
|
||||
if ( !$attachments = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent = '$uploading_iframe_ID'") )
|
||||
$uploading_iframe_src = "inline-uploading.php?action=upload&post=$uploading_iframe_ID";
|
||||
$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
|
||||
if ( false != $uploading_iframe_src )
|
||||
echo '<iframe id="uploading" border="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
|
||||
|
|
|
@ -4,6 +4,7 @@ $toprow_title = sprintf(__('Editing Comment # %s'), $comment->comment_ID);
|
|||
$form_action = 'editedcomment';
|
||||
$form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment->comment_ID . "' />\n<input type='hidden' name='comment_post_ID' value='".$comment->comment_post_ID;
|
||||
?>
|
||||
<?php $richedit = ( 'true' != get_user_option('rich_editing') ) ? false : true; ?>
|
||||
|
||||
<form name="post" action="post.php" method="post" id="post">
|
||||
<div class="wrap">
|
||||
|
@ -37,14 +38,8 @@ addLoadEvent(focusit);
|
|||
|
||||
<fieldset style="clear: both;">
|
||||
<legend><?php _e('Comment') ?></legend>
|
||||
<?php if ( 'true' != get_user_option('rich_editing') ) : ?>
|
||||
<?php the_quicktags(); ?>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
edCanvas = document.getElementById('content');
|
||||
//-->
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
<?php if ( !$richedit ) the_quicktags(); ?>
|
||||
|
||||
<?php
|
||||
$rows = get_settings('default_post_edit_rows');
|
||||
if (($rows < 3) || ($rows > 100)) {
|
||||
|
@ -54,6 +49,13 @@ edCanvas = document.getElementById('content');
|
|||
<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content" style="width: 99%"><?php echo $comment->comment_content ?></textarea></div>
|
||||
</fieldset>
|
||||
|
||||
<?php if ( !$richedit ) : ?>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
edCanvas = document.getElementById('content');
|
||||
//-->
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
<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']; ?>" />
|
||||
|
|
|
@ -20,6 +20,8 @@ $sendto = wp_specialchars( $sendto );
|
|||
|
||||
?>
|
||||
|
||||
<?php $richedit = ( 'true' != get_user_option('rich_editing') ) ? false : true; ?>
|
||||
|
||||
<form name="post" action="post.php" method="post" id="post">
|
||||
|
||||
<?php
|
||||
|
@ -117,7 +119,7 @@ endforeach;
|
|||
</fieldset>
|
||||
|
||||
|
||||
<fieldset id="<?php echo ( 'true' != get_user_option('rich_editing') ) ? 'postdiv' : 'postdivrich'; ?>">
|
||||
<fieldset id="<?php echo ( $richedit) ? 'postdivrich' : 'postdiv'; ?>">
|
||||
<legend><?php _e('Page Content') ?></legend>
|
||||
<?php
|
||||
$rows = get_settings('default_post_edit_rows');
|
||||
|
@ -125,11 +127,12 @@ endforeach;
|
|||
$rows = 10;
|
||||
}
|
||||
?>
|
||||
<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo $post->post_content ?></textarea></div>
|
||||
<?php if (! $richedit ) the_quicktags(); ?>
|
||||
|
||||
<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo $richedit ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div>
|
||||
</fieldset>
|
||||
|
||||
<?php if ( 'true' != get_user_option('rich_editing') ) : ?>
|
||||
<?php the_quicktags(); ?>
|
||||
<?php if ( !$richedit ) : ?>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
edCanvas = document.getElementById('content');
|
||||
|
@ -140,7 +143,7 @@ edCanvas = document.getElementById('content');
|
|||
<p class="submit">
|
||||
<?php if ( $post_ID ) : ?>
|
||||
<input name="save" type="submit" id="save" tabindex="5" value=" <?php _e('Save and Continue Editing'); ?> "/>
|
||||
<input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php $post_ID ? _e('Save') : _e('Create New Page') ?> »" style="font-weight: bold;"/>
|
||||
<input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php $post_ID ? _e('Edit Page') : _e('Create New Page') ?> »" />
|
||||
<?php else : ?>
|
||||
<input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php _e('Create New Page') ?> »" />
|
||||
<?php endif; ?>
|
||||
|
@ -150,8 +153,6 @@ edCanvas = document.getElementById('content');
|
|||
<?php
|
||||
$uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
|
||||
$uploading_iframe_src = "inline-uploading.php?action=view&post=$uploading_iframe_ID";
|
||||
if ( !$attachments = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent = '$uploading_iframe_ID'") )
|
||||
$uploading_iframe_src = "inline-uploading.php?action=upload&post=$uploading_iframe_ID";
|
||||
$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
|
||||
if ( false != $uploading_iframe_src )
|
||||
echo '<iframe id="uploading" border="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
|
||||
|
|
|
@ -62,7 +62,7 @@ function wpautop($pee, $br = 1) {
|
|||
$pee = preg_replace('!(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)!', "$1\n", $pee);
|
||||
$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
|
||||
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
|
||||
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "\t<p>$1</p>\n", $pee); // make paragraphs, including one at the end
|
||||
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
|
||||
$pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
|
||||
$pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
|
||||
$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
|
||||
|
@ -993,4 +993,21 @@ function ent2ncr($text) {
|
|||
return $text;
|
||||
}
|
||||
|
||||
function wp_richedit_pre($text) {
|
||||
// Filtering a blank results in an annoying <br />\n
|
||||
if ( empty($text) ) return '';
|
||||
|
||||
$output = $text;
|
||||
$output = html_entity_decode($output); // undoes format_to_edit()
|
||||
$output = wptexturize($output);
|
||||
$output = convert_chars($output);
|
||||
$output = wpautop($output);
|
||||
|
||||
// These must be double-escaped or planets will collide.
|
||||
$output = str_replace('<', '&lt;', $output);
|
||||
$output = str_replace('>', '&gt;', $output);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,465 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>TinyMCE License (LGPL)</title>
|
||||
<link href="css/screen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="header">
|
||||
<h1>TinyMCE License (LGPL)</h1>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<p>
|
||||
Visit the <a href="faq.html">FAQ</a> for general answers surrounding TinyMCE. Or visit <a href="http://www.fsf.org" target="_blank">http://www.fsf.org</a> for more information about Open-Source licenses.
|
||||
</p>
|
||||
<pre>
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if
|
||||
you distribute copies of the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, so that any problems introduced by others will not reflect on
|
||||
the original authors' reputations.
|
||||
.
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
.
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
.
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
.
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
.
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the source code distributed need not include anything that is normally
|
||||
distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
.
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
.
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
.
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<div class="helpindexlink"><a href="index.html">Index</a></div>
|
||||
<div class="copyright">Copyright © 2005 Moxiecode Systems AB</div>
|
||||
<br style="clear: both" />
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,69 +0,0 @@
|
|||
/* Window classes */
|
||||
|
||||
.mceWindow {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
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;
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -1,653 +0,0 @@
|
|||
/**
|
||||
* $RCSfile: editor_plugin_src.js,v $
|
||||
* $Revision: 1.3 $
|
||||
* $Date: 2005/10/18 13:59:43 $
|
||||
*
|
||||
* Moxiecode DHTML Windows script.
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
// Patch openWindow, closeWindow TinyMCE functions
|
||||
|
||||
function TinyMCE_inlinepopups_getInfo() {
|
||||
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.prototype.orgOpenWindow = TinyMCE.prototype.openWindow;
|
||||
|
||||
TinyMCE.prototype.openWindow = function(template, args) {
|
||||
// Does the caller support inline
|
||||
if (args['inline'] != "yes") {
|
||||
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.prototype.orgCloseWindow = TinyMCE.prototype.closeWindow;
|
||||
|
||||
TinyMCE.prototype.closeWindow = function(win) {
|
||||
if (mcWindows.selectedWindow != null)
|
||||
mcWindows.selectedWindow.close();
|
||||
else
|
||||
this.orgCloseWindow(win);
|
||||
};
|
||||
|
||||
TinyMCE.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;
|
||||
}
|
||||
};
|
||||
|
||||
// * * * * * MCWindows classes below
|
||||
|
||||
// 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.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;
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
this.doc = document;
|
||||
};
|
||||
|
||||
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 (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'] = "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;
|
||||
};
|
||||
|
||||
MCWindows.prototype.open = function(url, name, features) {
|
||||
this.lastSelectedWindow = this.selectedWindow;
|
||||
|
||||
var win = new MCWindow();
|
||||
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
|
||||
MCWindows.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 = "0px";
|
||||
elm.style.top = "0px";
|
||||
|
||||
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
|
||||
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;
|
||||
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);
|
||||
};
|
||||
|
||||
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() {
|
||||
if (this != mcWindows.selectedWindow) {
|
||||
this.winElement.style.zIndex = ++mcWindows.zindex;
|
||||
mcWindows.lastSelectedWindow = mcWindows.selectedWindow;
|
||||
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() {
|
||||
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);
|
||||
};
|
||||
|
||||
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 - 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";
|
||||
}
|
||||
|
||||
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 + "_iframe") {
|
||||
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 (this.resizeElement != null && elm == this.resizeElement.firstChild)
|
||||
this.startResize(e);
|
||||
else
|
||||
this.startMove(e);
|
||||
|
||||
mcWindows.cancelEvent(e);
|
||||
};
|
||||
|
||||
// Global instance
|
||||
var mcWindows = new MCWindows();
|
||||
|
||||
// Initialize windows
|
||||
mcWindows.init({
|
||||
images_path : tinyMCE.baseURL + "/plugins/inlinepopups/images",
|
||||
css_file : tinyMCE.baseURL + "/plugins/inlinepopups/css/inlinepopup.css"
|
||||
});
|
|
@ -1,455 +0,0 @@
|
|||
/**
|
||||
* $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();
|
|
@ -11,20 +11,24 @@ function TinyMCE_wordpress_getControlHTML(control_name) {
|
|||
case "wordpress":
|
||||
var titleMore = tinyMCE.getLang('lang_wordpress_more_button');
|
||||
var titlePage = tinyMCE.getLang('lang_wordpress_page_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><!--<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>-->';
|
||||
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>'
|
||||
+ '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresshelp\')" target="_self" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresshelp\');return false;"><img id="{$editor_id}_wordpress_help" src="{$pluginurl}/images/help.gif" title="'+titleHelp+'" 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>';
|
||||
var hiddenControls = '<div class="zerosize">'
|
||||
+ '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Bold\',false);" />'
|
||||
+ '<input type="button" accesskey="i" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Italic\',false);" />'
|
||||
+ '<input type="button" accesskey="d" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Strikethrough\',false);" />'
|
||||
+ '<input type="button" accesskey="n" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertUnorderedList\',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="a" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Outdent\',false);" />'
|
||||
+ '<input type="button" accesskey="s" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Indent\',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="l" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceLink\',true);" />'
|
||||
+ '<input type="button" accesskey="k" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'unlink\',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}\',\'mcewordpressmore\');" />'
|
||||
+ '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />'
|
||||
|
@ -86,6 +90,10 @@ function TinyMCE_wordpress_parseAttributes(attribute_string) {
|
|||
}
|
||||
|
||||
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) : "";
|
||||
}
|
||||
|
@ -95,8 +103,6 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
|
|||
case "mcewordpressmore":
|
||||
var flag = "";
|
||||
var template = new Array();
|
||||
var inst = tinyMCE.getInstanceById(editor_id);
|
||||
var focusElm = inst.getFocusElement();
|
||||
var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
|
||||
|
||||
// Is selection a image
|
||||
|
@ -119,8 +125,6 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
|
|||
case "mcewordpresspage":
|
||||
var flag = "";
|
||||
var template = new Array();
|
||||
var inst = tinyMCE.getInstanceById(editor_id);
|
||||
var focusElm = inst.getFocusElement();
|
||||
var altPage = tinyMCE.getLang('lang_wordpress_more_alt');
|
||||
|
||||
// Is selection a image
|
||||
|
@ -140,6 +144,10 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
|
|||
tinyMCE.execCommand("mceInsertContent",true,html);
|
||||
tinyMCE.selectedInstance.repaint();
|
||||
return true;
|
||||
case "mcewordpresshelp":
|
||||
var helpText = tinyMCE.getLang('lang_wordpress_help_text');
|
||||
alert(helpText);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Pass to next handler in chain
|
||||
|
@ -180,6 +188,10 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
|||
|
||||
startPos++;
|
||||
}
|
||||
|
||||
// It's supposed to be WYSIWYG, right?
|
||||
content = content.replace(new RegExp('&', 'g'), '&');
|
||||
|
||||
break;
|
||||
|
||||
case "get_from_editor":
|
||||
|
@ -211,12 +223,17 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
|||
}
|
||||
}
|
||||
|
||||
// The Curse of the Trailing <br />
|
||||
content = content.replace(new RegExp('<br ?/?>[ \t]*$', ''), '');
|
||||
|
||||
// The Curse of the Trailing <br />
|
||||
content = content.replace(new RegExp('<br ?/?>[ \t]*$', ''), '');
|
||||
// If it says & in the WYSIWYG editor, it should say & in the html.
|
||||
content = content.replace(new RegExp('&', 'g'), '&');
|
||||
|
||||
// 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>', 'g'), '\t<li>');
|
||||
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n');
|
||||
content = content.replace(new RegExp('^\\s*', ''), '');
|
||||
content = content.replace(new RegExp('\\s*$', ''), '');
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -244,3 +261,37 @@ function TinyMCE_wordpress_handleNodeChange(editor_id, node, undo_index, undo_le
|
|||
|
||||
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('&', '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;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,246 +0,0 @@
|
|||
/* Import plugin specific language pack */
|
||||
tinyMCE.importPluginLanguagePack('wordpress', '');
|
||||
|
||||
function TinyMCE_wordpress_initInstance(inst) {
|
||||
if (!tinyMCE.settings['wordpress_skip_plugin_css'])
|
||||
tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/wordpress/wordpress.css");
|
||||
}
|
||||
|
||||
function TinyMCE_wordpress_getControlHTML(control_name) {
|
||||
switch (control_name) {
|
||||
case "wordpress":
|
||||
var titleMore = tinyMCE.getLang('lang_wordpress_more_button');
|
||||
var titlePage = tinyMCE.getLang('lang_wordpress_page_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><!--<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>-->';
|
||||
var hiddenControls = '<div class="zerosize">'
|
||||
+ '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Bold\',false);" />'
|
||||
+ '<input type="button" accesskey="i" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Italic\',false);" />'
|
||||
+ '<input type="button" accesskey="d" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Strikethrough\',false);" />'
|
||||
+ '<input type="button" accesskey="n" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertUnorderedList\',false);" />'
|
||||
+ '<input type="button" accesskey="o" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertOrderedList\',false);" />'
|
||||
+ '<input type="button" accesskey="a" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Outdent\',false);" />'
|
||||
+ '<input type="button" accesskey="s" 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="l" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceLink\',true);" />'
|
||||
+ '<input type="button" accesskey="k" 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}\',\'mcewordpressmore\');" />'
|
||||
+ '<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}\',\'mcewordpresshelp\',false);" />'
|
||||
+ '</div>';
|
||||
return buttons+hiddenControls;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function TinyMCE_wordpress_parseAttributes(attribute_string) {
|
||||
var attributeName = "";
|
||||
var attributeValue = "";
|
||||
var withInName;
|
||||
var withInValue;
|
||||
var attributes = new Array();
|
||||
var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
|
||||
var titleText = tinyMCE.getLang('lang_wordpress_more');
|
||||
var titleTextPage = tinyMCE.getLang('lang_wordpress_page');
|
||||
|
||||
if (attribute_string == null || attribute_string.length < 2)
|
||||
return null;
|
||||
|
||||
withInName = withInValue = false;
|
||||
|
||||
for (var i=0; i<attribute_string.length; i++) {
|
||||
var chr = attribute_string.charAt(i);
|
||||
|
||||
if ((chr == '"' || chr == "'") && !withInValue)
|
||||
withInValue = true;
|
||||
else if ((chr == '"' || chr == "'") && withInValue) {
|
||||
withInValue = false;
|
||||
|
||||
var pos = attributeName.lastIndexOf(' ');
|
||||
if (pos != -1)
|
||||
attributeName = attributeName.substring(pos+1);
|
||||
|
||||
attributes[attributeName.toLowerCase()] = attributeValue.substring(1).toLowerCase();
|
||||
|
||||
attributeName = "";
|
||||
attributeValue = "";
|
||||
} else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
|
||||
withInName = true;
|
||||
|
||||
if (chr == '=' && withInName)
|
||||
withInName = false;
|
||||
|
||||
if (withInName)
|
||||
attributeName += chr;
|
||||
|
||||
if (withInValue)
|
||||
attributeValue += chr;
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interface, value) {
|
||||
function getAttrib(elm, name) {
|
||||
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
|
||||
}
|
||||
|
||||
// Handle commands
|
||||
switch (command) {
|
||||
case "mcewordpressmore":
|
||||
var flag = "";
|
||||
var template = new Array();
|
||||
var inst = tinyMCE.getInstanceById(editor_id);
|
||||
var focusElm = inst.getFocusElement();
|
||||
var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
|
||||
|
||||
// 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.execCommand("mceInsertContent",true,html);
|
||||
tinyMCE.selectedInstance.repaint();
|
||||
return true;
|
||||
case "mcewordpresspage":
|
||||
var flag = "";
|
||||
var template = new Array();
|
||||
var inst = tinyMCE.getInstanceById(editor_id);
|
||||
var focusElm = inst.getFocusElement();
|
||||
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;
|
||||
}
|
||||
|
||||
// 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++;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// The Curse of the Trailing <br />
|
||||
content = content.replace(new RegExp('<br ?/?>[ \t]*$', ''), '');
|
||||
|
||||
// The Curse of the Trailing <br />
|
||||
content = content.replace(new RegExp('<br ?/?>[ \t]*$', ''), '');
|
||||
|
||||
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;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 92 B |
|
@ -3,6 +3,8 @@
|
|||
tinyMCE.addToLang('',{
|
||||
wordpress_more_button : 'Split post with More tag',
|
||||
wordpress_page_button : 'Split post with Page tag',
|
||||
wordpress_help_button : 'Help',
|
||||
wordpress_more_alt : 'More...',
|
||||
wordpress_page_alt : '...page...'
|
||||
wordpress_page_alt : '...page...',
|
||||
wordpress_help_text : 'This is the Rich Editor. It shows you approximately what your entry will look like as you type. Pasting formatted text from other editors is not recommended. One character, less-than (<), is reserved for HTML and must be represented in code: to represent "<" type "<" without the quotes.\n\nThere are several hotkeys you can use instead of clicking on the toolbar. Windows and Linux use Alt+<letter>. Macintosh computers use Ctrl+<letter>.\nb: Bold\ni: Italic\ns: Strikethrough\nl: Unordered list\no: Ordered list\nq: Quote, indent list\nw: Unquote, outdent list\nf: Left align\nc: Center align\nr: Right align\na: Link\ns: Unlink\ni: Image\nt: "More" tag\nu: Undo\ny: Redo\ne: Edit HTML\nh: Help'
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -360,7 +360,7 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId)
|
|||
};
|
||||
|
||||
// Add accessibility control
|
||||
toolbarHTML += '<a href="#" accesskey="q" title="' + tinyMCE.getLang("lang_toolbar_focus") + '"></a>';
|
||||
//toolbarHTML += '<a href="#" accesskey="q" title="' + tinyMCE.getLang("lang_toolbar_focus") + '"></a>';
|
||||
|
||||
// Render rows
|
||||
for (var i=1; i<100; i++) {
|
||||
|
|
|
@ -5,6 +5,9 @@ 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|ol|ul|li|table|tr|td|blockquote|object)>', 'gi'),'</$1>\n');
|
||||
html = tinyMCE.regexpReplace(html, '<br />','<br />\n','gi');
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue