summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wp-inst/wp-admin/admin-functions.php27
-rw-r--r--wp-inst/wp-admin/admin-header.php4
-rw-r--r--wp-inst/wp-admin/edit-form-advanced.php62
-rw-r--r--wp-inst/wp-admin/edit-page-form.php11
-rw-r--r--wp-inst/wp-admin/execute-pings.php2
-rw-r--r--wp-inst/wp-admin/images/box-bg.gifbin0 -> 111 bytes
-rw-r--r--wp-inst/wp-admin/images/box-butt.gifbin0 -> 347 bytes
-rw-r--r--wp-inst/wp-admin/images/box-head.gifbin0 -> 879 bytes
-rw-r--r--wp-inst/wp-admin/images/notice.gifbin0 -> 156 bytes
-rw-r--r--wp-inst/wp-admin/images/toggle.gifbin0 -> 79 bytes
-rw-r--r--wp-inst/wp-admin/images/toggle.pngbin210 -> 0 bytes
-rw-r--r--wp-inst/wp-admin/inline-uploading.php (renamed from wp-inst/wp-admin/image-uploading.php)1089
-rw-r--r--wp-inst/wp-admin/options-general.php2
-rw-r--r--wp-inst/wp-admin/plugin-editor.php2
-rw-r--r--wp-inst/wp-admin/post.php3
-rw-r--r--wp-inst/wp-admin/profile.php14
-rw-r--r--wp-inst/wp-admin/templates.php2
-rw-r--r--wp-inst/wp-admin/theme-editor.php2
-rw-r--r--wp-inst/wp-admin/upgrade-functions.php238
-rw-r--r--wp-inst/wp-admin/upgrade-schema.php2
-rw-r--r--wp-inst/wp-admin/wp-admin.css93
-rw-r--r--wp-inst/wp-comments-post.php9
-rw-r--r--wp-inst/wp-content/themes/default/sidebar.php10
-rw-r--r--wp-inst/wp-includes/classes.php19
-rw-r--r--wp-inst/wp-includes/comment-functions.php4
-rw-r--r--wp-inst/wp-includes/functions-post.php6
-rw-r--r--wp-inst/wp-includes/functions.php6
-rw-r--r--wp-inst/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js2
-rw-r--r--wp-inst/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js4
-rw-r--r--wp-inst/wp-includes/js/tinymce/plugins/autosave/langs/cs.js11
-rw-r--r--wp-inst/wp-includes/js/tinymce/plugins/autosave/langs/sv.js6
-rw-r--r--wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js8
-rw-r--r--wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js22
-rw-r--r--wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js12
-rw-r--r--wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js31
-rw-r--r--wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js31
-rw-r--r--wp-inst/wp-includes/js/tinymce/plugins/wordpress/langs/en.js12
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/about.htm2
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/anchor.htm2
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/charmap.htm2
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/color_picker.htm2
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/css/editor_content.css14
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css17
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/editor_template.js6
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/editor_template_src.js338
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/image.htm6
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/about.js4
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js5
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/image.js4
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/link.js11
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js5
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/langs/en.js3
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/link.htm6
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/source_editor.htm4
-rw-r--r--wp-inst/wp-includes/js/tinymce/tiny_mce.js10
-rw-r--r--wp-inst/wp-includes/js/tinymce/tiny_mce_gzip.php114
-rw-r--r--wp-inst/wp-includes/js/tinymce/tiny_mce_popup.js35
-rw-r--r--wp-inst/wp-includes/js/tinymce/tiny_mce_src.js1197
-rw-r--r--wp-inst/wp-includes/js/tinymce/utils/form_utils.js203
-rw-r--r--wp-inst/wp-includes/js/tinymce/utils/mctabs.js76
-rw-r--r--wp-inst/wp-includes/js/tinymce/utils/validate.js50
-rw-r--r--wp-inst/wp-includes/registration-functions.php12
-rw-r--r--wp-inst/wp-includes/template-functions-post.php1
-rw-r--r--wp-inst/wp-login.php16
-rw-r--r--wp-inst/xmlrpc.php3
65 files changed, 2565 insertions, 1329 deletions
diff --git a/wp-inst/wp-admin/admin-functions.php b/wp-inst/wp-admin/admin-functions.php
index b88ef8f..cc7af04 100644
--- a/wp-inst/wp-admin/admin-functions.php
+++ b/wp-inst/wp-admin/admin-functions.php
@@ -256,6 +256,7 @@ function add_user() {
}
function edit_user($user_id = 0) {
+ global $current_user, $wp_roles;
if ($user_id != 0) {
$update = true;
@@ -276,6 +277,14 @@ function edit_user($user_id = 0) {
if (isset ($_POST['pass2']))
$pass2 = $_POST['pass2'];
+ if (isset ($_POST['role'])) {
+ if($user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap('edit_users'))
+ $user->role = $_POST['role'];
+ }
+
+ if (isset ($_POST['role'])) {
+ $user->role = $_POST['role'];
+ }
if (isset ($_POST['email']))
$user->user_email = wp_specialchars(trim($_POST['email']));
if (isset ($_POST['url'])) {
@@ -430,7 +439,11 @@ function checked($checked, $current) {
function return_categories_list($parent = 0) {
global $wpdb;
- return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY category_count DESC");
+ return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent");
+}
+
+function sort_cats($cat1, $cat2) {
+ return strcasecmp($cat1['cat_name'], $cat2['cat_name']);
}
function get_nested_categories($default = 0, $parent = 0) {
@@ -463,6 +476,8 @@ function get_nested_categories($default = 0, $parent = 0) {
$result[$cat]['cat_name'] = get_the_category_by_ID($cat);
}
}
+
+ usort($result, 'sort_cats');
return $result;
}
@@ -856,11 +871,11 @@ function touch_time($edit = 1, $for_post = 1) {
}
?>
</select>
-<input type="text" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" />
-<input type="text" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" /> @
-<input type="text" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" /> :
-<input type="text" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" />
-<input type="hidden" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />
+<input type="text" id="jj" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" />
+<input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" /> @
+<input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" /> :
+<input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" />
+<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />
<?php _e('Existing timestamp'); ?>:
<?php
diff --git a/wp-inst/wp-admin/admin-header.php b/wp-inst/wp-admin/admin-header.php
index b44003f..3eaa74e 100644
--- a/wp-inst/wp-admin/admin-header.php
+++ b/wp-inst/wp-admin/admin-header.php
@@ -80,7 +80,7 @@ addLoadEvent(blurry);
<script type="text/javascript" src="list-manipulation.js"></script>
<?php if ( isset( $editing ) ) : ?>
<?php if ( 'true' == get_user_option('rich_editing') ) :?>
-<script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php"></script>
+<script language="javascript" type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php?index=0&theme=advanced&plugins=wordpress,autosave"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "specific_textareas",
@@ -101,7 +101,7 @@ tinyMCE.init({
relative_urls : false,
remove_script_host : false,
valid_elements : "a[href|title],strong/b,em/i,strike,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 : "contextmenu,wordpress"
+ plugins : "wordpress,autosave"
<?php do_action('mce_options'); ?>
});
</script>
diff --git a/wp-inst/wp-admin/edit-form-advanced.php b/wp-inst/wp-admin/edit-form-advanced.php
index 492320d..9caae5e 100644
--- a/wp-inst/wp-admin/edit-form-advanced.php
+++ b/wp-inst/wp-admin/edit-form-advanced.php
@@ -10,8 +10,7 @@ $messages[3] = __('Custom field deleted.');
<form name="post" action="post.php" method="post" id="post">
<div class="wrap">
-<a id="write-post"></a>
-<h2><?php _e('Write Post'); ?><?php if ( 0 != $post_ID ) : ?>
+<h2 id="write-post"><?php _e('Write Post'); ?><?php if ( 0 != $post_ID ) : ?>
<small class="quickjump"><a href="#preview-post"><?php _e('preview &darr;'); ?></a></small><?php endif; ?></h2>
<?php
@@ -39,7 +38,7 @@ if ('' != $pinged) {
$pings .= '</ul>';
}
-$saveasdraft = '<input name="save" type="submit" id="save" tabindex="6" value="' . __('Save and Continue Editing') . '" />';
+$saveasdraft = '<input name="save" type="submit" id="save" tabindex="3" value="' . __('Save and Continue Editing') . '" />';
if (empty($post->post_status)) $post->post_status = 'draft';
@@ -154,6 +153,43 @@ endforeach;
edCanvas = document.getElementById('content');
//-->
</script>
+<?php else : ?>
+<script type="text/javascript">
+<!--
+// This code is meant to allow tabbing from Title to Post (TinyMCE).
+if ( tinyMCE.isMSIE )
+ document.getElementById('title').onkeydown = function (e)
+ {
+ e = e ? e : window.event;
+ if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
+ var i = tinyMCE.selectedInstance;
+ if(typeof i == 'undefined')
+ return true;
+ tinyMCE.execCommand("mceStartTyping");
+ this.blur();
+ i.contentWindow.focus();
+ e.returnValue = false;
+ return false;
+ }
+ }
+else
+ document.getElementById('title').onkeypress = function (e)
+ {
+ e = e ? e : window.event;
+ if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
+ var i = tinyMCE.selectedInstance;
+ if(typeof i == 'undefined')
+ return true;
+ tinyMCE.execCommand("mceStartTyping");
+ this.blur();
+ i.contentWindow.focus();
+ e.returnValue = false;
+ return false;
+ }
+ }
+
+//-->
+</script>
<?php endif; ?>
<?php echo $form_pingback ?>
@@ -165,23 +201,33 @@ edCanvas = document.getElementById('content');
if ('publish' != $post_status || 0 == $post_ID) {
?>
<?php if ( current_user_can('publish_posts') ) : ?>
- <input name="publish" type="submit" id="publish" tabindex="6" accesskey="p" value="<?php _e('Publish') ?>" />
+ <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
<?php endif; ?>
<?php
}
?>
- <input name="referredby" type="hidden" id="referredby" value="<?php echo wp_specialchars($_SERVER['HTTP_REFERER']); ?>" />
-</p>
+<input name="referredby" type="hidden" id="referredby" value="<?php
+if ( url_to_postid($_SERVER['HTTP_REFERER']) == $post_ID )
+ echo 'redo';
+else
+ echo wp_specialchars($_SERVER['HTTP_REFERER']);
+?>" /></p>
<?php do_action('edit_form_advanced'); ?>
-<iframe border="0" src="image-uploading.php?action=view&amp;post=<?php echo 0 == $post_ID ? $temp_ID : $post_ID; ?>" id="imageup">This feature requires iframe support.</iframe>
+<?php
+$uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
+$uploading_iframe_src = "inline-uploading.php?action=view&amp;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>';
+?>
<div id="advancedstuff" class="dbx-group" >
<fieldset id="postexcerpt" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Optional Excerpt') ?></h3>
-<div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="7" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div>
+<div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div>
</fieldset>
<fieldset class="dbx-box">
diff --git a/wp-inst/wp-admin/edit-page-form.php b/wp-inst/wp-admin/edit-page-form.php
index 7682c30..6179eb8 100644
--- a/wp-inst/wp-admin/edit-page-form.php
+++ b/wp-inst/wp-admin/edit-page-form.php
@@ -1,6 +1,7 @@
<div class="wrap">
-<h2><?php _e('Write Page'); ?></h2>
+<h2 id="write-post"><?php _e('Write Page'); ?><?php if ( 0 != $post_ID ) : ?>
+<small class="quickjump"><a href="#preview-post"><?php _e('preview &darr;'); ?></a></small><?php endif; ?></h2>
<?php
if (0 == $post_ID) {
$form_action = 'post';
@@ -147,10 +148,12 @@ edCanvas = document.getElementById('content');
</p>
<?php
-$frame_src = 'image-uploading.php?action=view&amp;post=' . ((0 == $post_ID) ? $temp_ID : $post_ID);
-$frame_src = apply_filters('upload_frame_src', $frame_src, ((0 == $post_ID) ? $temp_ID : $post_ID));
+$uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
+$uploading_iframe_src = "inline-uploading.php?action=view&amp;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>';
?>
-<iframe border="0" src="<?php echo $frame_src; ?>" id="imageup"><?php _e('This feature requires iframe support.'); ?></iframe>
<div id="advancedstuff" class="dbx-group">
diff --git a/wp-inst/wp-admin/execute-pings.php b/wp-inst/wp-admin/execute-pings.php
index 5a4288a..6dc575f 100644
--- a/wp-inst/wp-admin/execute-pings.php
+++ b/wp-inst/wp-admin/execute-pings.php
@@ -27,7 +27,7 @@ function execute_all_pings() {
}
}
// Do Trackbacks
- if($trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != ''")) {
+ if($trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != '' AND post_status != 'draft'")) {
foreach($trackbacks as $trackback) {
//echo "trackback : $trackback->ID<br/>";
do_trackbacks($trackback->ID);
diff --git a/wp-inst/wp-admin/images/box-bg.gif b/wp-inst/wp-admin/images/box-bg.gif
new file mode 100644
index 0000000..2eb7f58
--- /dev/null
+++ b/wp-inst/wp-admin/images/box-bg.gif
Binary files differ
diff --git a/wp-inst/wp-admin/images/box-butt.gif b/wp-inst/wp-admin/images/box-butt.gif
new file mode 100644
index 0000000..514a165
--- /dev/null
+++ b/wp-inst/wp-admin/images/box-butt.gif
Binary files differ
diff --git a/wp-inst/wp-admin/images/box-head.gif b/wp-inst/wp-admin/images/box-head.gif
new file mode 100644
index 0000000..5c09a9a
--- /dev/null
+++ b/wp-inst/wp-admin/images/box-head.gif
Binary files differ
diff --git a/wp-inst/wp-admin/images/notice.gif b/wp-inst/wp-admin/images/notice.gif
new file mode 100644
index 0000000..ba6eab0
--- /dev/null
+++ b/wp-inst/wp-admin/images/notice.gif
Binary files differ
diff --git a/wp-inst/wp-admin/images/toggle.gif b/wp-inst/wp-admin/images/toggle.gif
new file mode 100644
index 0000000..795772e
--- /dev/null
+++ b/wp-inst/wp-admin/images/toggle.gif
Binary files differ
diff --git a/wp-inst/wp-admin/images/toggle.png b/wp-inst/wp-admin/images/toggle.png
deleted file mode 100644
index e8e6cae..0000000
--- a/wp-inst/wp-admin/images/toggle.png
+++ /dev/null
Binary files differ
diff --git a/wp-inst/wp-admin/image-uploading.php b/wp-inst/wp-admin/inline-uploading.php
index 9881a7a..752e3fe 100644
--- a/wp-inst/wp-admin/image-uploading.php
+++ b/wp-inst/wp-admin/inline-uploading.php
@@ -1,631 +1,458 @@
-<?php
-
-require_once('admin.php');
-
-if (!current_user_can('edit_posts'))
- die(__('You do not have permission to edit posts.'));
-
-$wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'object', 'flickrtag');
-
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
- $wpvar = $wpvarstoreset[$i];
- if (!isset($$wpvar)) {
- if (empty($_POST["$wpvar"])) {
- if (empty($_GET["$wpvar"])) {
- $$wpvar = '';
- } else {
- $$wpvar = $_GET["$wpvar"];
- }
- } else {
- $$wpvar = $_POST["$wpvar"];
- }
- }
-}
-
-$post = (int) $post;
-$images_width = 1;
-
-function get_udims($width, $height) {
- if ( $height <= 96 && $width <= 128 )
- return array($width, $height);
- elseif ( $width / $height > 4 / 3 )
- return array(128, (int) ($height / $width * 128));
- else
- return array((int) ($width / $height * 96), 96);
-}
-
-switch($action) {
-case 'delete':
-
-wp_delete_object($object);
-
-header("Location: ".basename(__FILE__)."?post=$post&all=$all&action=view&start=$start");
-die;
-
-case 'save':
-
-$overrides = array('action'=>'save');
-
-$file = wp_handle_upload($_FILES['image'], $overrides);
-
-if( isset( $file[ 'error' ] ) == false )
- $file[ 'error' ] = apply_filters( "check_uploaded_file", $file[ 'error' ] );
-
-if ( isset($file['error']) )
- die($file['error'] . '<a href="' . basename(__FILE__) . '?action=upload&post="' . $post . '">Back to Image Uploading</a>');
-
-$url = $file['url'];
-$file = $file['file'];
-$filename = basename($file);
-
-// Construct the object array
-$object = array(
- 'post_title' => $imgtitle ? $imgtitle : $filename,
- 'post_content' => $descr,
- 'post_status' => 'object',
- 'post_parent' => $post,
- 'post_type' => $_FILES['image']['type'],
- 'guid' => $url
- );
-
-// Save the data
-$id = wp_attach_object($object, $post);
-
-// Generate the object's postmeta.
-$imagesize = getimagesize($file);
-$imagedata['width'] = $imagesize['0'];
-$imagedata['height'] = $imagesize['1'];
-list($uwidth, $uheight) = get_udims($imagedata['width'], $imagedata['height']);
-$imagedata['hwstring_small'] = "height='$uheight' width='$uwidth'";
-$imagedata['file'] = $file;
-$imagedata['thumb'] = "thumb-$filename";
-
-add_post_meta($id, 'imagedata', $imagedata);
-
-if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
- if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
- $error = wp_create_thumbnail($file['file'], 128);
- elseif ( $imagedata['height'] > 96 )
- $error = wp_create_thumbnail($file, 96);
-}
-
-header("Location: ".basename(__FILE__)."?post=$post&all=$all&action=view&last=true");
-die;
-
-case 'upload':
-
-$current_1 = ' class="current"';
-$back = $next = false;
-break;
-
-case 'view':
-
-// How many images do we show? How many do we query?
-$num = 5;
-$double = $num * 2;
-
-if ( $post && empty($all) ) {
- $and_post = "AND post_parent = '$post'";
- $current_2 = ' class="current"';
-} else {
- $current_3 = ' class="current"';
-}
-
-if ( $last )
- $start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'object' AND left(post_type, 5) = 'image' $and_post") - $num;
-else
- $start = (int) $start;
-
-if ( $start < 0 )
- $start = 0;
-
-if ( '' == $sort )
- $sort = "ID";
-
-$images = $wpdb->get_results("SELECT ID, post_date, post_title, guid FROM $wpdb->posts WHERE post_status = 'object' AND left(post_type, 5) = 'image' $and_post ORDER BY $sort LIMIT $start, $double", ARRAY_A);
-
-if ( count($images) > $num ) {
- $next = $start + count($images) - $num;
-} else {
- $next = false;
-}
-
-if ( $start > 0 ) {
- $back = $start - $num;
- if ( $back < 1 )
- $back = '0';
-} else {
- $back = false;
-}
-
-$i = 0;
-$uwidth_sum = 0;
-$images_html = '';
-$images_style = '';
-$images_script = '';
-if ( count($images) > 0 ) {
- $images = array_slice( $images, 0, $num );
- $__delete = __('DELETE');
- $__subpost_on = __('SUBPOST <strong>ON</strong>');
- $__subpost_off = __('SUBPOST <strong>OFF</strong>');
- $__thumbnail_on = __('THUMBNAIL <strong>ON</strong>');
- $__thumbnail_off = __('THUMBNAIL <strong>OFF</strong>');
- $__no_thumbnail = __('<del>THUMBNAIL</del>');
- $__close = __('CLOSE');
- $__confirmdelete = __('Delete this photo from the server?');
- $__nothumb = __('There is no thumbnail associated with this photo.');
- $images_script .= "subposton = '$__subpost_on';\nsubpostoff = '$__subpost_off';\n";
- $images_script .= "thumbnailon = '$__thumbnail_on';\nthumbnailoff = '$__thumbnail_off';\n";
- foreach ( $images as $key => $image ) {
- $meta = get_post_meta($image['ID'], 'imagedata', true);
- if (!is_array($meta)) {
- wp_delete_object($image['ID']);
- continue;
- }
- $image = array_merge($image, $meta);
- if ( ($image['width'] > 128 || $image['height'] > 96) && !empty($image['thumb']) && file_exists(dirname($image['file']).'/'.$image['thumb']) ) {
- $src = str_replace(basename($image['guid']), '', $image['guid']) . $image['thumb'];
- $images_script .= "src".$i."a = '$src';\nsrc".$i."b = '".$image['guid']."';\n";
- $thumb = 'true';
- $thumbtext = $__thumbnail_on;
- } else {
- $src = $image['guid'];
- $thumb = 'false';
- $thumbtext = $__no_thumbnail;
- }
- list($image['uwidth'], $image['uheight']) = get_udims($image['width'], $image['height']);
- $height_width = 'height="'.$image['uheight'].'" width="'.$image['uwidth'].'"';
- $uwidth_sum += 128;
- $xpadding = (128 - $image['uwidth']) / 2;
- $ypadding = (96 - $image['uheight']) / 2;
- $object = $image['ID'];
- $images_style .= "#target$i img { padding: {$ypadding}px {$xpadding}px; }\n";
- $href = get_subpost_link($object);
- $images_script .= "href".$i."a = '$href';\nhref".$i."b = '{$image['guid']}';\n";
- $images_html .= <<<HERE
-<div id='target$i' class='imagewrap left'>
- <div id='popup$i' class='popup'>
- <a id="L$i" onclick="toggleLink($i);return false;" href="javascript:void();">$__subpost_on</a>
- <a id="I$i" onclick="if($thumb)toggleImage($i);else alert('$__nothumb');return false;" href="javascript:void();">$thumbtext</a>
- <a onclick="return confirm('$__confirmdelete')" href="image-uploading.php?action=delete&amp;object=$object&amp;all=$all&amp;start=$start&amp;post=$post">$__delete</a>
- <a onclick="popup.style.display='none';return false;" href="javascript:void()">$__close</a>
- </div>
- <a id="link$i" class="imagelink" href="$href" onclick="imagePopup($i);return false;" title="{$image['post_title']}">
- <img id='image$i' src='$src' alt='{$image['post_title']}' $height_width />
- </a>
-</div>
-HERE;
- $i++;
- }
-}
-
-$images_width = $uwidth_sum + ( count($images) * 5 ) + 30;
-
-break;
-
-case 'flickr':
-
-require_once ABSPATH . WPINC . '/class-snoopy.php';
-
-function flickr_api_call($method, $params = '') {
- $api_key = '7cd7b7dea9c9d3069caf99d12471008e'; // An API key reserved for WordPress
- $searchurl = 'http://www.flickr.com/services/rest/?method=' . $method . '&api_key=' . $api_key . '&' . $params;
- $client = new Snoopy();
- $client->agent = 'WordPress/Flickr Browser';
- $client->read_timeout = 2;
- $client->use_gzip = true;
- @$client->fetch($searchurl);
- return $client->results;
-}
-
-// How many images do we show? How many do we query?
-$num = 5;
-$double = $num * 2;
-
-$flickr_user_id = get_user_option('flickr_userid');
-if($flickr_user_id == '') {
- $flickr_username = get_user_option('flickr_username');
- $user_xml = flickr_api_call('flickr.people.findByUsername', "username={$flickr_username}");
- if(preg_match('/nsid="(.*?)">/', $user_xml, $matches)) {
- $flickr_user_id = $matches[1];
- }
- else die("Failed to find Flickr ID for '$flickr_username'"); // Oh, dear - no Flickr user_id!
-
- // Store the found Flickr user_id in usermeta...
- // Don't forget on the options page to update the user_id along with the username!
- update_user_option($current_user->id, 'flickr_userid', $flickr_user_id, true);
-}
-
-// Fetch photo list from Flickr
-$ustart = $start + 1;
-//$photos_xml = flickr_api_call('flickr.photos.search', array('per_page' => $num, 'user_id' => $flickr_user_id));
-if($flickrtag == '') {
- $all = '0';
- $photos_xml = flickr_api_call('flickr.people.getPublicPhotos', "per_page={$num}&user_id={$flickr_user_id}&page={$ustart}");
-}
-else {
- $photos_xml = flickr_api_call('flickr.photos.search', "per_page={$num}&user_id={$flickr_user_id}&page={$ustart}&tags={$flickrtag}");
- $all = '0&flickrtag=' . $flickrtag;
-}
-//echo "<pre>" . htmlentities($photos_xml) . "</pre>"; // Displays the XML returned by Flickr for the photo list
-
-//Get Page Count
-preg_match('/<photos.*pages="([0-9]+)"/', $photos_xml, $page_counta);
-$page_count = $page_counta[1];
-if($page_count == 0) {
- $back = false;
- $next = false;
- break;
-}
-if($start < $page_count) $next = $start + 1; else $next = false;
-if($start > 0) $back = $start - 1; else $back = false;
-if($last != '') {
- $photos_xml = flickr_api_call('flickr.people.getPublicPhotos', "per_page={$num}&user_id={$flickr_user_id}&page={$page_count}");
- $back = $page_count -1;
- $next = false;
-}
-
-//Get Photos
-preg_match_all('/<photo.*?id="([0-9]+)".*?secret="([0-9a-f]+)".*?server="([0-9]+)".*?title="([^"]*)".*?\/>/', $photos_xml, $matches, PREG_SET_ORDER);
-foreach($matches as $match) {
- $img['post_title'] = $match[4];
-
- $sizes_xml = flickr_api_call('flickr.photos.getSizes', "photo_id={$match[1]}");
- preg_match_all('/<size.*?label="([^"]+)".*?width="([0-9]+)".*?height="([0-9]+)".*?source="([^"]+)".*?\/>/', $sizes_xml, $sizes, PREG_SET_ORDER);
-
- $max_size = '';
- foreach($sizes as $size) {
- $img_size[$size[1]]['width'] = $size[2];
- $img_size[$size[1]]['height'] = $size[3];
- $img_size[$size[1]]['url'] = $size[4];
- if($max_size == '' || $img_size[$size[1]]['width'] > $img_size[$max_size]['width']) {
- $max_size = $size[1];
- }
- }
-
- $images[] = array(
- 'post_title' => $match[4],
- 'thumbnail' => $img_size['Thumbnail']['url'],
- 'full' => $img_size[$max_size]['url'],
- 'href' => "http://flickr.com/photos/{$flickr_user_id}/{$match[1]}/",
- 'width' => $img_size['Thumbnail']['width'],
- 'height' => $img_size['Thumbnail']['height'],
- 'size_info' => $img_size,
- );
-}
-
-$current_flickr = ' class="current"';
-
-$__use_size = __('Use %s');
-$__close = __('CLOSE');
-
-$images_script .= "var flickr_src = new Array();\n";
-
-$i=0;
-foreach($images as $image) {
- list($uwidth, $uheight) = get_udims($image['width'], $image['height']);
- $xpadding = (128 - $uwidth) / 2;
- $ypadding = (96 - $uheight) / 2;
- $height_width = 'height="'.$uheight.'" width="'.$uwidth.'"';
- $images_style .= "#target$i img { padding: {$ypadding}px {$xpadding}px; }\n";
- $images_html .= "
- <div id='target$i' class='imagewrap left'>
- <div id='popup$i' class='popup'>
- ";
-
- $images_script .= "flickr_src[$i] = new Array();\n";
- foreach($image['size_info'] as $szkey => $size) {
- $images_script .= "flickr_src[$i]['{$szkey}']= '{$size['url']}';\n";
- $use = sprintf($__use_size, $szkey);
- $prefix = ($szkey == 'Thumbnail') ? '<strong>':'';
- $postfix = ($szkey == 'Thumbnail') ? '</strong>':'';
- $images_html .= "<a id=\"I{$i}_{$szkey}\" onclick=\"toggleSize($i,'$szkey');return false;\" href=\"javascript:void();\">{$prefix}{$use}{$postfix}</a>\n";
- }
- $images_html .= "
- <a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a>
- </div>
- <a id=\"link$i\" class=\"imagelink\" href=\"{$image['href']}\" onclick=\"imagePopup($i);return false;\" title=\"{$image['post_title']}\">
- <img id=\"image$i\" src=\"{$image['thumbnail']}\" alt=\"{$image['post_title']}\" $height_width />
- </a>
- </div>
- ";
- $i++;
-}
-
-$images_width = ( count($images) * 133 ) + 5;
-
-break;
-
-default:
-die('This script was not meant to be called directly.');
-}
-
-?>
-<!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>
-<meta http-equiv="imagetoolbar" content="no" />
-<script type="text/javascript">
-/* Define any variables we'll need, such as alternate URLs. */
-<?php echo $images_script; ?>
-
-function validateImageName() {
-/* This is more for convenience than security. Server-side validation is very thorough.*/
-obj = document.getElementById('upload');
-r = /.jpg$|.gif$|.png$/i;
-if ( obj.value.match(r) )
-return true;
-alert('Please select a JPG, PNG or GIF file.');
-return false;
-}
-function cancelUpload() {
-o = document.getElementById('uploadForm');
-o.method = 'GET';
-o.action.value = 'view';
-o.submit();
-}
-function imagePopup(i) {
-if ( popup )
-popup.style.display = 'none';
-target = document.getElementById('target'+i);
-popup = document.getElementById('popup'+i);
-//popup.style.top = (target.offsetTop + 3) + 'px';
-popup.style.left = (target.offsetLeft) + 'px';
-popup.style.display = 'block';
-}
-function init() {
-popup = false;
-}
-function toggleLink(n) {
- o=document.getElementById('link'+n);
- oi=document.getElementById('L'+n);
- if ( oi.innerHTML == subposton ) {
- o.href = eval('href'+n+'b');
- oi.innerHTML = subpostoff;
- } else {
- o.href = eval('href'+n+'a');
- oi.innerHTML = subposton;
- }
-}
-function toggleImage(n) {
- o = document.getElementById('image'+n);
- oi = document.getElementById('I'+n);
- if ( oi.innerHTML == thumbnailon ) {
- o.src = eval('src'+n+'b');
- oi.innerHTML = thumbnailoff;
- } else {
- o.src = eval('src'+n+'a');
- oi.innerHTML = thumbnailon;
- }
-}
-function toggleSize(n,sz) {
- o = document.getElementById('image'+n);
- oi = document.getElementById('popup'+n);
- o.src = flickr_src[n][sz];
- if (!document.getElementsByTagName) return;
- var anchors = document.getElementsByTagName("a");
- var re_id = 'I'+n+'_'; // /i[0-9]+_.+/i;
- var re_strip = /<.*?>/i;
- for (var i=0; i< anchors.length; i++) {
- var anchor = anchors[i];
- if (anchor.getAttribute("href") && anchor.id.match(re_id))
- anchor.innerHTML = anchor.innerHTML.replace(re_strip, '');
- }
- var anchor = document.getElementById('I'+n+'_'+sz);
- anchor.innerHTML = '<strong>' + anchor.innerHTML + '</strong>';
-}
-</script>
-<style type="text/css">
-body {
-font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana;
-border: none;
-margin: 0px;
-height: 150px;
-background: rgb(223, 232, 241);
-}
-form {
-margin: 6px 2px 0px 6px;
-}
-#wrap {
-clear: both;
-margin: 0px;
-padding: 0px;
-height: 133px;
-width: 100%;
-overflow: auto;
-}
-#images {
-clear: both;
-margin: 0px;
-padding: 5px 15px;
-height: 96px;
-white-space: nowrap;
-width: <?php echo $images_width; ?>px;
-}
-#images img {
-background-color: rgb(209, 226, 239);
-}
-<?php echo $images_style; ?>
-.imagewrap {
-margin-right: 5px;
-height: 96px;
-overflow: hidden;
-}
-.imagewrap * {
-margin: 0px;
-padding: 0px;
-border: 0px;
-}
-.imagewrap a, .imagewrap a img, .imagewrap a:hover img, .imagewrap a:visited img, .imagewrap a:active img {
-text-decoration: none;
-float: left;
-/*display: block;*/
-text-align: center;
-}
-#menu {
-margin: 0px;
-list-style: none;
-background: rgb(109, 166, 209);
-padding: 4px 0px 0px 8px;
-text-align: left;
-border-bottom: 3px solid rgb(68, 138, 189);
-}
-#menu li {
-display: inline;
-margin: 0px;
-}
-#menu a, #menu a:visited, #menu a:active {
-padding: 1px 3px 3px;
-text-decoration: none;
-color: #234;
-background: transparent;
-}
-#menu a:hover {
-background: rgb(203, 214, 228);
-color: #000;
-}
-#menu .current a, #menu .current a:hover, #menu .current a:visited, #menu .current a:active {
-background: rgb(223, 232, 241);
-padding-bottom: 3px;
-color: #000;
-border-right: 2px solid rgb(20, 86, 138);
-}
-.tip {
-color: rgb(68, 138, 189);
-padding: 1px 3px;
-}
-.inactive {
-color: #579;
-padding: 1px 3px;
-}
-.left {
-float: left;
-}
-.right {
-float: right;
-}
-.center {
-text-align: center;
-}
-#menu li.spacer {
-margin-left: 40px;
-}
-label {
-float: left;
-width: 18%;
-}
-#title, #descr {
-width: 80%;
-margin-top: 2px;
-}
-#descr {
-height: 35px;
-v-align: top;
-}
-#buttons {
-width: 98%;
-margin-top: 2px;
-text-align: right;
-}
-.popup {
-margin: 4px 4px;
-padding: 3px;
-position: absolute;
-width: 114px;
-height: 82px;
-display: none;
-background-color: rgb(223, 232, 241);
-opacity: .90;
-filter:alpha(opacity=90);
-text-align: center;
-}
-.popup a, .popup a:visited, .popup a:active {
-background-color: transparent;
-display: block;
-width: 100%;
-text-decoration: none;
-color: #246;
-}
-.popup a:hover {
-background-color: #fff;
-color: #000;
-}
-#flickrtags {
- display: inline;
-}
-#flickrtags input {
- border:0px;
-}
-input#flickrtag {
- background-color: white;
- color: black;
- width:65px;
-}
-input#flickrsubmit {
- background-color: #dfe8f1;
- color: black;
-}
-</style>
-</head>
-<body onload="init()">
-<ul id="menu">
-<li<?php echo $current_1; ?>><a href="image-uploading.php?action=upload&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>">Upload Photo</a></li>
-<li<?php echo $current_flickr; ?>><a href="image-uploading.php?action=flickr&amp;post=<?php echo $post; ?>">Browse Flickr</a></li>
-<li<?php echo $current_2; ?>><a href="image-uploading.php?action=view&amp;post=<?php echo $post; ?>">Browse Attached</a></li>
-<li<?php echo $current_3; ?>><a href="image-uploading.php?action=view&amp;post=<?php echo $post; ?>&amp;all=true">Browse All</a></li>
-<li> </li>
-<?php if ( false !== $back ) : ?>
-<li class="spacer"><a href="image-uploading.php?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=0" title="First">|&lt;</a></li>
-<li><a href="image-uploading.php?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=<?php echo $back; ?>" title="Back">&lt;&lt;</a></li>
-<?php else : ?>
-<li class="inactive spacer">|&lt;</li>
-<li class="inactive">&lt;&lt;</li>
-<?php endif; ?>
-
-<?php if($action == 'flickr') : ?>
-<form id="flickrtags" method="get"><?php echo sprintf(__('Tag: %s'), '<input type="text" id="flickrtag" name="flickrtag" value="' . $flickrtag . '" />'); ?><input id="flickrsubmit" type="submit" value="Filter" /><?php
-parse_str($_SERVER['QUERY_STRING'], $formquery);
-foreach($formquery as $k=>$v) if($k!='flickrtag') echo "<input type=\"hidden\" name=\"$k\" value=\"$v\" />";
-?></form>
-<?php endif; ?>
-
-<?php if ( false !== $next ) : ?>
-<li><a href="image-uploading.php?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=<?php echo $next; ?>" title="Next">&gt;&gt;</a></li>
-<li><a href="image-uploading.php?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;last=true" title="Last">&gt;|</a></li>
-<?php else : ?>
-<li class="inactive">&gt;&gt;</li>
-<li class="inactive">&gt;|</li>
-<?php endif; ?>
-</ul>
-<?php if ( $action == 'view' || $action == 'flickr' ) : ?>
-<span class="left tip"><?php _e('Drag and drop photos to post'); ?></span>
-<span class="right tip"><?php _e('Click photos for more options'); ?></span>
-<div id="wrap">
-<div id="images">
-<?php echo $images_html; ?>
-</div>
-</div>
-<?php elseif ( $action == 'upload' ) : ?>
- <?php if( apply_filters( "pre_upload_error", false ) == true ) {
- ?><div class="center tip">Sorry, you have used your space allocation. Please delete some files to upload more files.</div><?php
- } else { ?>
-<div class="center tip">Duplicated filenames will be numbered (photo.jpg, photo1.jpg, etc.)</div>
-<form enctype="multipart/form-data" id="uploadForm" method="POST" action="image-uploading.php" onsubmit="return validateImageName()">
-<label for="upload">Image:</label><input type="file" id="upload" name="image" onchange="validateImageName()" />
-<label for="title">Title:</label><input type="text" id="title" name="imgtitle" />
-<label for="descr">Description:</label><input type="textarea" name="descr" id="descr" value="" />
-<input type="hidden" name="action" value="save" />
-<input type="hidden" name="post" value="<?php echo $post; ?>" />
-<input type="hidden" name="all" value="<?php echo $all; ?>" />
-<div id="buttons">
-<input type="submit" value="Upload" />
-<input type="button" value="Cancel" onclick="cancelUpload()" />
-</div>
-</form>
-<?php } ?>
-<?php endif; ?>
-</body>
-</html>
-
-
-
+<?php
+
+require_once('admin.php');
+
+if (!current_user_can('edit_posts'))
+ die(__('You do not have permission to edit posts.'));
+
+$wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'object', 'flickrtag');
+
+for ($i=0; $i<count($wpvarstoreset); $i += 1) {
+ $wpvar = $wpvarstoreset[$i];
+ if (!isset($$wpvar)) {
+ if (empty($_POST["$wpvar"])) {
+ if (empty($_GET["$wpvar"])) {
+ $$wpvar = '';
+ } else {
+ $$wpvar = $_GET["$wpvar"];
+ }
+ } else {
+ $$wpvar = $_POST["$wpvar"];
+ }
+ }
+}
+
+$post = (int) $post;
+$images_width = 1;
+
+function get_udims($width, $height) {
+ if ( $height <= 96 && $width <= 128 )
+ return array($width, $height);
+ elseif ( $width / $height > 4 / 3 )
+ return array(128, (int) ($height / $width * 128));
+ else
+ return array((int) ($width / $height * 96), 96);
+}
+
+switch($action) {
+case 'delete':
+
+wp_delete_object($object);
+
+header("Location: ".basename(__FILE__)."?post=$post&all=$all&action=view&start=$start");
+die;
+
+case 'save':
+
+$overrides = array('action'=>'save');
+
+$file = wp_handle_upload($_FILES['image'], $overrides);
+
+if( isset( $file[ 'error' ] ) == false )
+ $file[ 'error' ] = apply_filters( "check_uploaded_file", $file[ 'error' ] );
+
+if ( isset($file['error']) )
+ die($file['error'] . '<a href="' . basename(__FILE__) . '?action=upload&post="' . $post . '">Back to Image Uploading</a>');
+
+$url = $file['url'];
+$file = $file['file'];
+$filename = basename($file);
+
+// Construct the object array
+$object = array(
+ 'post_title' => $imgtitle ? $imgtitle : $filename,
+ 'post_content' => $descr,
+ 'post_status' => 'object',
+ 'post_parent' => $post,
+ 'post_type' => $_FILES['image']['type'],
+ 'guid' => $url
+ );
+
+// Save the data
+$id = wp_attach_object($object, $post);
+
+// Generate the object's postmeta.
+$imagesize = getimagesize($file);
+$imagedata['width'] = $imagesize['0'];
+$imagedata['height'] = $imagesize['1'];
+list($uwidth, $uheight) = get_udims($imagedata['width'], $imagedata['height']);
+$imagedata['hwstring_small'] = "height='$uheight' width='$uwidth'";
+$imagedata['file'] = $file;
+$imagedata['thumb'] = "thumb-$filename";
+
+add_post_meta($id, 'imagedata', $imagedata);
+
+if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
+ if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
+ $error = wp_create_thumbnail($file['file'], 128);
+ elseif ( $imagedata['height'] > 96 )
+ $error = wp_create_thumbnail($file, 96);
+}
+
+header("Location: ".basename(__FILE__)."?post=$post&all=$all&action=view&last=true");
+die;
+
+case 'upload':
+
+$current_1 = ' class="current"';
+$back = $next = false;
+break;
+
+case 'view':
+
+// How many images do we show? How many do we query?
+$num = 5;
+$double = $num * 2;
+
+if ( $post && empty($all) ) {
+ $and_post = "AND post_parent = '$post'";
+ $current_2 = ' class="current"';
+} else {
+ $current_3 = ' class="current"';
+}
+
+if ( $last )
+ $start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'object' AND left(post_type, 5) = 'image' $and_post") - $num;
+else
+ $start = (int) $start;
+
+if ( $start < 0 )
+ $start = 0;
+
+if ( '' == $sort )
+ $sort = "ID";
+
+$images = $wpdb->get_results("SELECT ID, post_date, post_title, guid FROM $wpdb->posts WHERE post_status = 'object' AND left(post_type, 5) = 'image' $and_post ORDER BY $sort LIMIT $start, $double", ARRAY_A);
+
+if ( count($images) > $num ) {
+ $next = $start + count($images) - $num;
+} else {
+ $next = false;
+}
+
+if ( $start > 0 ) {
+ $back = $start - $num;
+ if ( $back < 1 )
+ $back = '0';
+} else {
+ $back = false;
+}
+
+$i = 0;
+$uwidth_sum = 0;
+$images_html = '';
+$images_style = '';
+$images_script = '';
+if ( count($images) > 0 ) {
+ $images = array_slice( $images, 0, $num );
+ $__delete = __('DELETE');
+ $__subpost_on = __('SUBPOST <strong>ON</strong>');
+ $__subpost_off = __('SUBPOST <strong>OFF</strong>');
+ $__thumbnail_on = __('THUMBNAIL <strong>ON</strong>');
+ $__thumbnail_off = __('THUMBNAIL <strong>OFF</strong>');
+ $__no_thumbnail = __('<del>THUMBNAIL</del>');
+ $__close = __('CLOSE');
+ $__confirmdelete = __('Delete this photo from the server?');
+ $__nothumb = __('There is no thumbnail associated with this photo.');
+ $images_script .= "subposton = '$__subpost_on';\nsubpostoff = '$__subpost_off';\n";
+ $images_script .= "thumbnailon = '$__thumbnail_on';\nthumbnailoff = '$__thumbnail_off';\n";
+ foreach ( $images as $key => $image ) {
+ $meta = get_post_meta($image['ID'], 'imagedata', true);
+ if (!is_array($meta)) {
+ wp_delete_object($image['ID']);
+ continue;
+ }
+ $image = array_merge($image, $meta);
+ if ( ($image['width'] > 128 || $image['height'] > 96) && !empty($image['thumb']) && file_exists(dirname($image['file']).'/'.$image['thumb']) ) {
+ $src = str_replace(basename($image['guid']), '', $image['guid']) . $image['thumb'];
+ $images_script .= "src".$i."a = '$src';\nsrc".$i."b = '".$image['guid']."';\n";
+ $thumb = 'true';
+ $thumbtext = $__thumbnail_on;
+ } else {
+ $src = $image['guid'];
+ $thumb = 'false';
+ $thumbtext = $__no_thumbnail;
+ }
+ list($image['uwidth'], $image['uheight']) = get_udims($image['width'], $image['height']);
+ $height_width = 'height="'.$image['uheight'].'" width="'.$image['uwidth'].'"';
+ $uwidth_sum += 128;
+ $xpadding = (128 - $image['uwidth']) / 2;
+ $ypadding = (96 - $image['uheight']) / 2;
+ $object = $image['ID'];
+ $images_style .= "#target$i img { padding: {$ypadding}px {$xpadding}px; }\n";
+ $href = get_subpost_link($object);
+ $images_script .= "href".$i."a = '$href';\nhref".$i."b = '{$image['guid']}';\n";
+ $images_html .= <<<HERE
+<div id='target$i' class='imagewrap left'>
+ <div id='popup$i' class='popup'>
+ <a id="L$i" onclick="toggleLink($i);return false;" href="javascript:void();">$__subpost_on</a>
+ <a id="I$i" onclick="if($thumb)toggleImage($i);else alert('$__nothumb');return false;" href="javascript:void();">$thumbtext</a>
+ <a onclick="return confirm('$__confirmdelete')" href="<?php echo basename(__FILE__); ?>?action=delete&amp;object=$object&amp;all=$all&amp;start=$start&amp;post=$post">$__delete</a>
+ <a onclick="popup.style.display='none';return false;" href="javascript:void()">$__close</a>
+ </div>
+ <a id="link$i" class="imagelink" href="$href" onclick="imagePopup($i);return false;" title="{$image['post_title']}">
+ <img id='image$i' src='$src' alt='{$image['post_title']}' $height_width />
+ </a>
+</div>
+HERE;
+ $i++;
+ }
+}
+
+$images_width = $uwidth_sum + ( count($images) * 5 ) + 30;
+
+break;
+
+default:
+die('This script was not meant to be called directly.');
+}
+
+?>
+<!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>
+<meta http-equiv="imagetoolbar" content="no" />
+<script type="text/javascript">
+/* Define any variables we'll need, such as alternate URLs. */
+<?php echo $images_script; ?>
+
+function validateImageName() {
+/* This is more for convenience than security. Server-side validation is very thorough.*/
+obj = document.getElementById('upload');
+r = /.jpg$|.gif$|.png$/i;
+if ( obj.value.match(r) )
+return true;
+alert('Please select a JPG, PNG or GIF file.');
+return false;
+}
+function cancelUpload() {
+o = document.getElementById('uploadForm');
+o.method = 'GET';
+o.action.value = 'view';
+o.submit();
+}
+function imagePopup(i) {
+if ( popup )
+popup.style.display = 'none';
+target = document.getElementById('target'+i);
+popup = document.getElementById('popup'+i);
+//popup.style.top = (target.offsetTop + 3) + 'px';
+popup.style.left = (target.offsetLeft) + 'px';
+popup.style.display = 'block';
+}
+function init() {
+popup = false;
+}
+function toggleLink(n) {
+ o=document.getElementById('link'+n);
+ oi=document.getElementById('L'+n);
+ if ( oi.innerHTML == subposton ) {
+ o.href = eval('href'+n+'b');
+ oi.innerHTML = subpostoff;
+ } else {
+ o.href = eval('href'+n+'a');
+ oi.innerHTML = subposton;
+ }
+}
+function toggleImage(n) {
+ o = document.getElementById('image'+n);
+ oi = document.getElementById('I'+n);
+ if ( oi.innerHTML == thumbnailon ) {
+ o.src = eval('src'+n+'b');
+ oi.innerHTML = thumbnailoff;
+ } else {
+ o.src = eval('src'+n+'a');
+ oi.innerHTML = thumbnailon;
+ }
+}
+</script>
+<style type="text/css">
+body {
+font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana;
+border: none;
+margin: 0px;
+height: 150px;
+background: rgb(223, 232, 241);
+}
+form {
+margin: 6px 2px 0px 6px;
+}
+#wrap {
+clear: both;
+margin: 0px;
+padding: 0px;
+height: 133px;
+width: 100%;
+overflow: auto;
+}
+#images {
+clear: both;
+margin: 0px;
+padding: 5px 15px;
+height: 96px;
+white-space: nowrap;
+width: <?php echo $images_width; ?>px;
+}
+#images img {
+background-color: rgb(209, 226, 239);
+}
+<?php echo $images_style; ?>
+.imagewrap {
+margin-right: 5px;
+height: 96px;
+overflow: hidden;
+}
+.imagewrap * {
+margin: 0px;
+padding: 0px;
+border: 0px;
+}
+.imagewrap a, .imagewrap a img, .imagewrap a:hover img, .imagewrap a:visited img, .imagewrap a:active img {
+text-decoration: none;
+float: left;
+/*display: block;*/
+text-align: center;
+}
+#menu {
+margin: 0px;
+list-style: none;
+background: rgb(109, 166, 209);
+padding: 4px 0px 0px 8px;
+text-align: left;
+border-bottom: 3px solid rgb(68, 138, 189);
+}
+#menu li {
+display: inline;
+margin: 0px;
+}
+#menu a, #menu a:visited, #menu a:active {
+padding: 1px 3px 3px;
+text-decoration: none;
+color: #234;
+background: transparent;
+}
+#menu a:hover {
+background: rgb(203, 214, 228);
+color: #000;
+}
+#menu .current a, #menu .current a:hover, #menu .current a:visited, #menu .current a:active {
+background: rgb(223, 232, 241);
+padding-bottom: 3px;
+color: #000;
+border-right: 2px solid rgb(20, 86, 138);
+}
+.tip {
+color: rgb(68, 138, 189);
+padding: 1px 3px;
+}
+.inactive {
+color: #579;
+padding: 1px 3px;
+}
+.left {
+float: left;
+}
+.right {
+float: right;
+}
+.center {
+text-align: center;
+}
+#menu li.spacer {
+margin-left: 40px;
+}
+label {
+float: left;
+width: 18%;
+}
+#title, #descr {
+width: 80%;
+margin-top: 2px;
+}
+#descr {
+height: 35px;
+v-align: top;
+}
+#buttons {
+width: 98%;
+margin-top: 2px;
+text-align: right;
+}
+.popup {
+margin: 4px 4px;
+padding: 3px;
+position: absolute;
+width: 114px;
+height: 82px;
+display: none;
+background-color: rgb(223, 232, 241);
+opacity: .90;
+filter:alpha(opacity=90);
+text-align: center;
+}
+.popup a, .popup a:visited, .popup a:active {
+background-color: transparent;
+display: block;
+width: 100%;
+text-decoration: none;
+color: #246;
+}
+.popup a:hover {
+background-color: #fff;
+color: #000;
+}
+</style>
+</head>
+<body onload="init()">
+<ul id="menu">
+<li<?php echo $current_1; ?>><a href="<?php echo basename(__FILE__); ?>?action=upload&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>"><?php _e('Upload File'); ?></a></li>
+<li<?php echo $current_2; ?>><a href="<?php echo basename(__FILE__); ?>?action=view&amp;post=<?php echo $post; ?>"><?php _e('Browse Attached'); ?></a></li>
+<li<?php echo $current_3; ?>><a href="<?php echo basename(__FILE__); ?>?action=view&amp;post=<?php echo $post; ?>&amp;all=true"><?php _e('Browse All'); ?></a></li>
+<li> </li>
+<?php if ( false !== $back ) : ?>
+<li class="spacer"><a href="<?php echo basename(__FILE__); ?>?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=0" title="<?php _e('First'); ?>">|&lt;</a></li>
+<li><a href="<?php echo basename(__FILE__); ?>?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=<?php echo $back; ?>" title="<?php _e('Back'); ?>">&lt;&lt;</a></li>
+<?php else : ?>
+<li class="inactive spacer">|&lt;</li>
+<li class="inactive">&lt;&lt;</li>
+<?php endif; ?>
+<?php if ( false !== $next ) : ?>
+<li><a href="<?php echo basename(__FILE__); ?>?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=<?php echo $next; ?>" title="<?php _e('Next'); ?>">&gt;&gt;</a></li>
+<li><a href="<?php echo basename(__FILE__); ?>?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;last=true" title="<?php _e('Last'); ?>">&gt;|</a></li>
+<?php else : ?>
+<li class="inactive">&gt;&gt;</li>
+<li class="inactive">&gt;|</li>
+<?php endif; ?>
+</ul>
+<?php if ( $action == 'view' ) : ?>
+<span class="left tip"><?php _e('Drag and drop photos to post'); ?></span>
+<span class="right tip"><?php _e('Click photos for more options'); ?></span>
+<div id="wrap">
+<div id="images">
+<?php echo $images_html; ?>
+</div>
+</div>
+<?php elseif ( $action == 'upload' ) : ?>
+ <?php if( apply_filters( "pre_upload_error", false ) == true ) {
+ ?><div class="center tip">Sorry, you have used your space allocation. Please delete some files to upload more files.</div><?php
+ } else { ?>
+<div class="tip"></div>
+<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo basename(__FILE__); ?>" onsubmit="return validateImageName()">
+<label for="upload"><?php _e('Image:'); ?></label><input type="file" id="upload" name="image" onchange="validateImageName()" />
+<label for="title"><?php _e('Title:'); ?></label><input type="text" id="title" name="imgtitle" />
+<label for="descr"><?php _e('Description:'); ?></label><input type="textarea" name="descr" id="descr" value="" />
+<input type="hidden" name="action" value="save" />
+<input type="hidden" name="post" value="<?php echo $post; ?>" />
+<input type="hidden" name="all" value="<?php echo $all; ?>" />
+<div id="buttons">
+<input type="submit" value="<?php _e('Upload'); ?>" />
+<input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" />
+</div>
+</form>
+<?php } ?>
+<?php endif; ?>
+</body>
+</html>
+
+
+
diff --git a/wp-inst/wp-admin/options-general.php b/wp-inst/wp-admin/options-general.php
index cb11959..039592d 100644
--- a/wp-inst/wp-admin/options-general.php
+++ b/wp-inst/wp-admin/options-general.php
@@ -11,7 +11,7 @@ include('admin-header.php');
<h2><?php _e('General Options') ?></h2>
<form name="form1" method="post" action="options.php">
<input type="hidden" name="action" value="update" />
-<input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="'blogname','blogdescription','users_can_register','gmt_offset','date_format','time_format','start_of_week','comment_registration','default_role', 'WPLANG'" />
+<input type="hidden" name="page_options" value="'blogname','blogdescription','siteurl','admin_email','users_can_register','gmt_offset','date_format','time_format','home','start_of_week','comment_registration','default_role'" />
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr valign="top">
<th width="33%" scope="row"><?php _e('Weblog title:') ?></th>
diff --git a/wp-inst/wp-admin/plugin-editor.php b/wp-inst/wp-admin/plugin-editor.php
index 4331fe6..af218c6 100644
--- a/wp-inst/wp-admin/plugin-editor.php
+++ b/wp-inst/wp-admin/plugin-editor.php
@@ -107,7 +107,7 @@ if ($plugin_files) :
?>
</p>
<?php else : ?>
-<p><em><?php _e('If this file was writable you could edit it.'); ?></em></p>
+<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
<?php endif; ?>
</form>
<?php
diff --git a/wp-inst/wp-admin/post.php b/wp-inst/wp-admin/post.php
index 95a386f..a6fa7c9 100644
--- a/wp-inst/wp-admin/post.php
+++ b/wp-inst/wp-admin/post.php
@@ -78,8 +78,7 @@ case 'edit':
?>
<div id='preview' class='wrap'>
- <a id="preview-post"></a>
- <h2><?php _e('Post Preview (updated when post is saved)'); ?> <small class="quickjump"><a href="#write-post"><?php _e('edit &uarr;'); ?></a></small></h2>
+ <h2 id="preview-post"><?php _e('Post Preview (updated when post is saved)'); ?> <small class="quickjump"><a href="#write-post"><?php _e('edit &uarr;'); ?></a></small></h2>
<iframe src="<?php the_permalink(); ?>" width="100%" height="600" />
</div>
<?php
diff --git a/wp-inst/wp-admin/profile.php b/wp-inst/wp-admin/profile.php
index 8621618..2250a24 100644
--- a/wp-inst/wp-admin/profile.php
+++ b/wp-inst/wp-admin/profile.php
@@ -30,12 +30,13 @@ $bookmarklet_height= 440;
<p><label><?php _e('Username: (no editing)'); ?><br />
<input type="text" name="user_login" value="<?php echo $profiledata->user_login; ?>" disabled="disabled" />
</label></p>
+
+<p><label><?php _e('Role: (no editing)') ?><br />
+<input type="text" name="role" value="<?php echo $wp_roles->role_names[$profileuser->roles[0]] ?>" disabled="disabled" /></label></p>
+
<p><label><?php _e('First name:') ?><br />
<input type="text" name="first_name" value="<?php echo $profiledata->first_name ?>" /></label></p>
-<p><label><?php _e('Middle name:') ?><br />
-<input type="text" name="middle_name" value="<?php echo $profiledata->middle_name ?>" /></label></p>
-
<p><label><?php _e('Last name:') ?><br />
<input type="text" name="last_name" value="<?php echo $profiledata->last_name ?>" /></label></p>
@@ -56,9 +57,6 @@ $bookmarklet_height= 440;
<?php if ( !empty( $profiledata->first_name ) && !empty( $profiledata->last_name ) ) : ?>
<option value="<?php echo $profiledata->first_name." ".$profiledata->last_name ?>"><?php echo $profiledata->first_name." ".$profiledata->last_name ?></option>
<option value="<?php echo $profiledata->last_name." ".$profiledata->first_name ?>"><?php echo $profiledata->last_name." ".$profiledata->first_name ?></option>
-<?php if ( !empty( $profiledata->middle_name ) ) : ?>
-<option value="<?php echo $n = $profiledata->first_name." ".$profiledata->middle_name." ".$profiledata->last_name ?>"><?php echo $n ?></option>
-<?php endif; ?>
<?php endif; ?>
</select></label></p>
</fieldset>
@@ -73,10 +71,6 @@ $bookmarklet_height= 440;
<input type="text" name="url" value="<?php echo $profiledata->user_url ?>" />
</label></p>
-<p><label><?php _e('Flickr Username:') ?><br />
-<input type="text" name="flickr_username" value="<?php echo $profiledata->flickr_username ?>" />
-</label></p>
-
<p><label><?php _e('AIM:') ?><br />
<input type="text" name="aim" value="<?php echo $profiledata->aim ?>" />
</label></p>
diff --git a/wp-inst/wp-admin/templates.php b/wp-inst/wp-admin/templates.php
index 11054c2..377c821 100644
--- a/wp-inst/wp-admin/templates.php
+++ b/wp-inst/wp-admin/templates.php
@@ -126,7 +126,7 @@ endif;
?>
</p>
<?php else : ?>
-<p><em><?php _e('If this file was writable you could edit it.'); ?></em></p>
+<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
<?php endif; ?>
</form>
<?php
diff --git a/wp-inst/wp-admin/theme-editor.php b/wp-inst/wp-admin/theme-editor.php
index 076c54c..8a0d4e7 100644
--- a/wp-inst/wp-admin/theme-editor.php
+++ b/wp-inst/wp-admin/theme-editor.php
@@ -140,7 +140,7 @@ if ($allowed_files) :
?>
</p>
<?php else : ?>
-<p><em><?php _e('If this file was writable you could edit it.'); ?></em></p>
+<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
<?php endif; ?>
</form>
<?php
diff --git a/wp-inst/wp-admin/upgrade-functions.php b/wp-inst/wp-admin/upgrade-functions.php
index c7426f3..4c3d18a 100644
--- a/wp-inst/wp-admin/upgrade-functions.php
+++ b/wp-inst/wp-admin/upgrade-functions.php
@@ -2,17 +2,249 @@
require_once(ABSPATH . '/wp-admin/admin-functions.php');
require_once(ABSPATH . '/wp-admin/upgrade-schema.php');
+define( "RESET_CAPS", true );
// Functions to be called in install and upgrade scripts
+function upgrade_all() {
+ global $wp_current_db_version, $wp_db_version;
+ $wp_current_db_version = __get_option('db_version');
-define( "RESET_CAPS", true );
+ // We are up-to-date. Nothing to do.
+ if ( $wp_db_version == $wp_current_db_version )
+ return;
-function upgrade_all() {
+ // If the version is not set in the DB, try to guess the version.
+ if ( empty($wp_current_db_version) ) {
+ $wp_current_db_version = 0;
+
+ // If the template option exists, we have 1.5.
+ $template = __get_option('template');
+ if ( !empty($template) )
+ $wp_current_db_version = 2541;
+ }
+
populate_options();
- upgrade_160();
+
+ if ( $wp_current_db_version < 2541 ) {
+ upgrade_100();
+ upgrade_101();
+ upgrade_110();
+ upgrade_130();
+ }
+
+ if ( $wp_current_db_version < 2966 )
+ upgrade_160();
+
+ save_mod_rewrite_rules();
+
+ update_option('db_version', $wp_db_version);
+}
+
+function upgrade_100() {
+ global $wpdb;
+
+ // Get the title and ID of every post, post_name to check if it already has a value
+ $posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''");
+ if ($posts) {
+ foreach($posts as $post) {
+ if ('' == $post->post_name) {
+ $newtitle = sanitize_title($post->post_title);
+ $wpdb->query("UPDATE $wpdb->posts SET post_name = '$newtitle' WHERE ID = '$post->ID'");
+ }
+ }
+ }
+
+ $categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories");
+ foreach ($categories as $category) {
+ if ('' == $category->category_nicename) {
+ $newtitle = sanitize_title($category->cat_name);
+ $wpdb->query("UPDATE $wpdb->categories SET category_nicename = '$newtitle' WHERE cat_ID = '$category->cat_ID'");
+ }
+ }
+
+
+ $wpdb->query("UPDATE $wpdb->options SET option_value = REPLACE(option_value, 'wp-links/links-images/', 'wp-images/links/')
+ WHERE option_name LIKE 'links_rating_image%'
+ AND option_value LIKE 'wp-links/links-images/%'");
+
+ $done_ids = $wpdb->get_results("SELECT DISTINCT post_id FROM $wpdb->post2cat");
+ if ($done_ids) :
+ foreach ($done_ids as $done_id) :
+ $done_posts[] = $done_id->post_id;
+ endforeach;
+ $catwhere = ' AND ID NOT IN (' . implode(',', $done_posts) . ')';
+ else:
+ $catwhere = '';
+ endif;
+
+ $allposts = $wpdb->get_results("SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere");
+ if ($allposts) :
+ foreach ($allposts as $post) {
+ // Check to see if it's already been imported
+ $cat = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post->ID AND category_id = $post->post_category");
+ if (!$cat && 0 != $post->post_category) { // If there's no result
+ $wpdb->query("
+ INSERT INTO $wpdb->post2cat
+ (post_id, category_id)
+ VALUES
+ ('$post->ID', '$post->post_category')
+ ");
+ }
+ }
+ endif;
+}
+
+function upgrade_101() {
+ global $wpdb;
+
+ // Clean up indices, add a few
+ add_clean_index($wpdb->posts, 'post_name');
+ add_clean_index($wpdb->posts, 'post_status');
+ add_clean_index($wpdb->categories, 'category_nicename');
+ add_clean_index($wpdb->comments, 'comment_approved');
+ add_clean_index($wpdb->comments, 'comment_post_ID');
+ add_clean_index($wpdb->links , 'link_category');
+ add_clean_index($wpdb->links , 'link_visible');
+}
+
+
+function upgrade_110() {
+ global $wpdb;
+
+ // Set user_nicename.
+ $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
+ foreach ($users as $user) {
+ if ('' == $user->user_nicename) {
+ $newname = sanitize_title($user->user_nickname);
+ $wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
+ }
+ }
+
+ $users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users");
+ foreach ($users as $row) {
+ if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) {
+ $wpdb->query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\'');
+ }
+ }
+
+
+ // Get the GMT offset, we'll use that later on
+ $all_options = get_alloptions_110();
+
+ $time_difference = $all_options->time_difference;
+
+ $server_time = time()+date('Z');
+ $weblogger_time = $server_time + $time_difference*3600;
+ $gmt_time = time();
+
+ $diff_gmt_server = ($gmt_time - $server_time) / 3600;
+ $diff_weblogger_server = ($weblogger_time - $server_time) / 3600;
+ $diff_gmt_weblogger = $diff_gmt_server - $diff_weblogger_server;
+ $gmt_offset = -$diff_gmt_weblogger;
+
+ // Add a gmt_offset option, with value $gmt_offset
+ add_option('gmt_offset', $gmt_offset);
+
+ // Check if we already set the GMT fields (if we did, then
+ // MAX(post_date_gmt) can't be '0000-00-00 00:00:00'
+ // <michel_v> I just slapped myself silly for not thinking about it earlier
+ $got_gmt_fields = ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $wpdb->posts") == '0000-00-00 00:00:00') ? false : true;
+
+ if (!$got_gmt_fields) {
+
+ // Add or substract time to all dates, to get GMT dates
+ $add_hours = intval($diff_gmt_weblogger);
+ $add_minutes = intval(60 * ($diff_gmt_weblogger - $add_hours));
+ $wpdb->query("UPDATE $wpdb->posts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
+ $wpdb->query("UPDATE $wpdb->posts SET post_modified = post_date");
+ $wpdb->query("UPDATE $wpdb->posts SET post_modified_gmt = DATE_ADD(post_modified, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE) WHERE post_modified != '0000-00-00 00:00:00'");
+ $wpdb->query("UPDATE $wpdb->comments SET comment_date_gmt = DATE_ADD(comment_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
+ $wpdb->query("UPDATE $wpdb->users SET user_registered = DATE_ADD(user_registered, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
+ }
+
+}
+
+function upgrade_130() {
+ global $wpdb, $table_prefix;
+
+ // Remove extraneous backslashes.
+ $posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
+ if ($posts) {
+ foreach($posts as $post) {
+ $post_content = addslashes(deslash($post->post_content));
+ $post_title = addslashes(deslash($post->post_title));
+ $post_excerpt = addslashes(deslash($post->post_excerpt));
+ if ( empty($post->guid) )
+ $guid = get_permalink($post->ID);
+ else
+ $guid = $post->guid;
+
+ $wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'");
+ }
+ }
+
+ // Remove extraneous backslashes.
+ $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments");
+ if ($comments) {
+ foreach($comments as $comment) {
+ $comment_content = addslashes(deslash($comment->comment_content));
+ $comment_author = addslashes(deslash($comment->comment_author));
+ $wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'");
+ }
+ }
+
+ // Remove extraneous backslashes.
+ $links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
+ if ($links) {
+ foreach($links as $link) {
+ $link_name = addslashes(deslash($link->link_name));
+ $link_description = addslashes(deslash($link->link_description));
+ $wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'");
+ }
+ }
+
+ // The "paged" option for what_to_show is no more.
+ if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') {
+ $wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
+ }
+
+ $active_plugins = __get_option('active_plugins');
+
+ // If plugins are not stored in an array, they're stored in the old
+ // newline separated format. Convert to new format.
+ if ( !is_array( $active_plugins ) ) {
+ $active_plugins = explode("\n", trim($active_plugins));
+ update_option('active_plugins', $active_plugins);
+ }
+
+ // Obsolete tables
+ $wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optionvalues');
+ $wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiontypes');
+ $wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiongroups');
+ $wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiongroup_options');
+
+ // Update comments table to use comment_type
+ $wpdb->query("UPDATE $wpdb->comments SET comment_type='trackback', comment_content = REPLACE(comment_content, '<trackback />', '') WHERE comment_content LIKE '<trackback />%'");
+ $wpdb->query("UPDATE $wpdb->comments SET comment_type='pingback', comment_content = REPLACE(comment_content, '<pingback />', '') WHERE comment_content LIKE '<pingback />%'");
+
+ // Some versions have multiple duplicate option_name rows with the same values
+ $options = $wpdb->get_results("SELECT option_name, COUNT(option_name) AS dupes FROM `$wpdb->options` GROUP BY option_name");
+ foreach ( $options as $option ) {
+ if ( 1 != $option->dupes ) { // Could this be done in the query?
+ $limit = $option->dupes - 1;
+ $dupe_ids = $wpdb->get_col("SELECT option_id FROM $wpdb->options WHERE option_name = '$option->option_name' LIMIT $limit");
+ $dupe_ids = join($dupe_ids, ',');
+ $wpdb->query("DELETE FROM $wpdb->options WHERE option_id IN ($dupe_ids)");
+ }
+ }
+
+ make_site_theme();
}
function upgrade_160_helper( $users ) {
global $wpdb, $table_prefix;
+
+ populate_roles_160();
+
foreach ( $users as $user_details ) :
$user = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE ID = '" . $user_details[ 'user_id' ] . "'");
if ( !empty( $user->user_firstname ) )
diff --git a/wp-inst/wp-admin/upgrade-schema.php b/wp-inst/wp-admin/upgrade-schema.php
index fe548ae..4c20f42 100644
--- a/wp-inst/wp-admin/upgrade-schema.php
+++ b/wp-inst/wp-admin/upgrade-schema.php
@@ -240,7 +240,7 @@ function populate_options() {
add_option('ping_sites', 'http://rpc.pingomatic.com/');
add_option('advanced_edit', 0);
add_option('comment_max_links', 2);
- add_option('gmt_offset', 0);
+ add_option('gmt_offset', date('Z') / 3600);
// 1.5
add_option('default_email_category', 1, __('Posts by email go to this category'));
add_option('recently_edited');
diff --git a/wp-inst/wp-admin/wp-admin.css b/wp-inst/wp-admin/wp-admin.css
index e8c429e..7bf1f85 100644
--- a/wp-inst/wp-admin/wp-admin.css
+++ b/wp-inst/wp-admin/wp-admin.css
@@ -59,7 +59,7 @@ a:hover {
}
body {
- background: #fff;
+ background: #f9fcfe;
color: #000;
margin: 0;
padding: 0;
@@ -75,14 +75,13 @@ fieldset {
}
fieldset label.selectit {
- background: #f0f0f0;
display: block;
font-size: 11px;
padding: 0 2px;
}
fieldset label.selectit:hover {
- background: #dadada;
+ background: #e9e9e9;
}
fieldset legend {
@@ -157,7 +156,7 @@ textarea, input, select {
padding: 3px;
}
-#imageup {
+#uploading {
border-style: none;
padding: 0px;
margin-bottom: 16px;
@@ -226,10 +225,6 @@ textarea, input, select {
padding: .3em 1em;
}
-.ed_button {
- padding: 1px;
-}
-
.hidden {
display: none;
}
@@ -294,10 +289,10 @@ textarea, input, select {
}
.updated {
- background: #f0f8ff;
- border: 1px solid #69c;
+ background: #CFEBF7 url(images/notice.gif) no-repeat 1em ;
+ border: 1px solid #2580B2;
margin: 1em 5% 10px;
- padding: 0 1em 0 1em;
+ padding: 0 1em 0 3em;
}
.error {
@@ -364,7 +359,7 @@ table .vers, table .name {
}
#submenu .current {
- background: #ddeaf4;
+ background: #f9fcfe;
border-top: 1px solid #045290;
border-right: 2px solid #045290;
color: #000;
@@ -667,12 +662,11 @@ table .vers, table .name {
position: absolute;
right: 5%;
width: 14.5em;
- border-left: 1px solid #dfe8f1;
}
#slugdiv input, #passworddiv input, #authordiv select {
margin-top: .5em;
- width: 95%;
+ width: 90%;
}
#moremeta h3, #advancedstuff h3 {
@@ -720,66 +714,67 @@ table .vers, table .name {
}
/* default box styles */
-.dbx-box {
-background: #fff;
-}
-
-/* box when toggle is open */
-.dbx-box-open {
-}
-
-/* box when toggle is closed */
-.dbx-box-closed {
-}
/* toggle state of inner content area */
.dbx-box-open .dbx-content {
- display:block;
+ display: block;
}
.dbx-box-closed .dbx-content {
- display:none;
+ display: none;
+}
+
+#moremeta .dbx-content {
+ background: url(images/box-butt.gif) no-repeat bottom right;
+ padding-bottom: 15px;
+ padding-right: 2px;
}
/* handles */
-.dbx-handle {
- background-color: #dfe8f1;
+
+.dbx-handle {
+ background: #2685af;
+ padding: 6px 1em 2px;
+ font-size: 12px;
margin: 0;
- padding: 0;
+ color: #E3EFF5;
+}
+
+#moremeta .dbx-handle {
+ padding: 6px 1em 2px;
+ font-size: 12px;
+ background: url(images/box-head.gif) no-repeat;
+}
+
+#moremeta .dbx-box {
+ background: url(images/box-bg.gif) repeat-y right;
}
/* handle cursors */
.dbx-handle-cursor {
- cursor:move;
+ cursor: move;
}
/* toggle images */
a.dbx-toggle, a.dbx-toggle:visited {
display:block;
- width: 12px;
- height: 12px;
+ width: 9px;
+ height: 9px;
overflow: hidden;
- background-image: url( images/toggle.png );
+ background-image: url( images/toggle.gif );
position: absolute;
- top: .3em;
- right: .3em;
+ top: 10px;
+ right: 14px;
+ background-repeat: none;
border-bottom: 0;
- background-position: 0 0;
+ background-position: 0 9px;
}
a.dbx-toggle-open, a.dbx-toggle-open:visited {
- background-position: 0;
-}
-
-a.dbx-toggle-closed, a.dbx-toggle-closed:visited {
- background-position: -12px 0;
-}
-
-a.dbx-toggle-hilite-open, a.dbx-toggle-hilite-open:visited {
- background-position: 0;
+ background-position: 0 0;
}
-
-a.dbx-toggle-hilite-closed, a.dbx-toggle-hilite-closed:visited {
- background-position: -12px 0;
+
+#categorychecklist {
+ margin-right: 6px;
}
/* additional clone styles */
diff --git a/wp-inst/wp-comments-post.php b/wp-inst/wp-comments-post.php
index 3440ae8..5b1c0a2 100644
--- a/wp-inst/wp-comments-post.php
+++ b/wp-inst/wp-comments-post.php
@@ -1,6 +1,8 @@
<?php
require( dirname(__FILE__) . '/wp-config.php' );
+nocache_headers();
+
$comment_post_ID = (int) $_POST['comment_post_ID'];
$status = $wpdb->get_row("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'");
@@ -46,7 +48,7 @@ if ( '' == $comment_content )
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID');
-wp_new_comment($commentdata);
+wp_new_comment( $commentdata );
if ( !$user_ID ) :
setcookie('comment_author_' . COOKIEHASH, stripslashes($comment_author), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
@@ -54,9 +56,8 @@ if ( !$user_ID ) :
setcookie('comment_author_url_' . COOKIEHASH, stripslashes($comment_author_url), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
endif;
-nocache_headers();
+$location = ( empty( $_POST['redirect_to'] ) ) ? get_permalink( $comment_post_ID ) : $_POST['redirect_to'];
-$location = (empty($_POST['redirect_to'])) ? $_SERVER["HTTP_REFERER"] : $_POST['redirect_to'];
+wp_redirect( $location );
-wp_redirect($location);
?>
diff --git a/wp-inst/wp-content/themes/default/sidebar.php b/wp-inst/wp-content/themes/default/sidebar.php
index e74ecf7..1368706 100644
--- a/wp-inst/wp-content/themes/default/sidebar.php
+++ b/wp-inst/wp-content/themes/default/sidebar.php
@@ -17,23 +17,23 @@
<p>You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p>
<?php /* If this is a yearly archive */ } elseif (is_day()) { ?>
- <p>You are currently browsing the <a href="<?php echo get_settings('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives
+ <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives
for the day <?php the_time('l, F jS, Y'); ?>.</p>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
- <p>You are currently browsing the <a href="<?php echo get_settings('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives
+ <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives
for <?php the_time('F, Y'); ?>.</p>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
- <p>You are currently browsing the <a href="<?php echo get_settings('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives
+ <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives
for the year <?php the_time('Y'); ?>.</p>
<?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
- <p>You have searched the <a href="<?php echo get_settings('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives
+ <p>You have searched the <a href="<?php echo bloginfo('home'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives
for <strong>'<?php echo wp_specialchars($s); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
<?php /* If this is a monthly archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
- <p>You are currently browsing the <a href="<?php echo get_settings('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives.</p>
+ <p>You are currently browsing the <a href="<?php echo bloginfo('home'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives.</p>
<?php } ?>
</li>
diff --git a/wp-inst/wp-includes/classes.php b/wp-inst/wp-includes/classes.php
index cb52017..2bcef47 100644
--- a/wp-inst/wp-includes/classes.php
+++ b/wp-inst/wp-includes/classes.php
@@ -13,6 +13,7 @@ class WP_Query {
var $post;
var $is_single = false;
+ var $is_preview = false;
var $is_page = false;
var $is_archive = false;
var $is_date = false;
@@ -534,8 +535,10 @@ class WP_Query {
}
$now = gmdate('Y-m-d H:i:59');
-
- if ($pagenow != 'post.php' && $pagenow != 'edit.php') {
+
+ //only select past-dated posts, except if a logged in user is viewing a single: then, if they
+ //can edit the post, we let them through
+ if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single && $user_ID)) {
$where .= " AND post_date_gmt <= '$now'";
$distinct = 'DISTINCT';
}
@@ -609,13 +612,23 @@ class WP_Query {
} else {
if ('draft' == $status) {
// User must have edit permissions on the draft to preview.
- if (! user_can_edit_post($user_ID, $this->posts[0]->ID))
+ if (! user_can_edit_post($user_ID, $this->posts[0]->ID)) {
$this->posts = array();
+ } else {
+ $this->is_preview = true;
+ }
} elseif ('private' == $status) {
if ($this->posts[0]->post_author != $user_ID)
$this->posts = array();
}
}
+ } else {
+ if (mysql2date('U', $this->posts[0]->post_date) > mysql2date('U', $now)) { //it's future dated
+ $this->is_preview = true;
+ if (!current_user_can('edit_post', $this->posts[0]->ID)) {
+ $this->posts = array ( );
+ }
+ }
}
}
diff --git a/wp-inst/wp-includes/comment-functions.php b/wp-inst/wp-includes/comment-functions.php
index 9e0bf2d..1480e44 100644
--- a/wp-inst/wp-includes/comment-functions.php
+++ b/wp-inst/wp-includes/comment-functions.php
@@ -294,7 +294,7 @@ function comment_ID() {
function get_comment_author() {
global $comment;
if ( empty($comment->comment_author) )
- $author = 'Anonymous';
+ $author = __('Anonymous');
else
$author = $comment->comment_author;
return apply_filters('get_comment_author', $author);
@@ -590,7 +590,7 @@ function pingback($content, $post_ID) {
// We don't wanna ping first and second types, even if they have a valid <link/>
foreach($post_links_temp[0] as $link_test) :
- if ( !in_array($link_test, $pung) ) : // If we haven't pung it already
+ if ( !in_array($link_test, $pung) && url_to_postid($link_test) != $post_ID) : // If we haven't pung it already and it isn't a link to itself
$test = parse_url($link_test);
if (isset($test['query']))
$post_links[] = $link_test;
diff --git a/wp-inst/wp-includes/functions-post.php b/wp-inst/wp-includes/functions-post.php
index 6da26fb..e90dded 100644
--- a/wp-inst/wp-includes/functions-post.php
+++ b/wp-inst/wp-includes/functions-post.php
@@ -622,8 +622,10 @@ function do_trackbacks($post_id) {
if ($to_ping) : foreach ($to_ping as $tb_ping) :
$tb_ping = trim($tb_ping);
- if ( !in_array($tb_ping, $pinged) )
- trackback($tb_ping, $post_title, $excerpt, $post_id);
+ if ( !in_array($tb_ping, $pinged) ) {
+ trackback($tb_ping, $post_title, $excerpt, $post_id);
+ $pinged[] = $tb_ping;
+ }
endforeach; endif;
}
diff --git a/wp-inst/wp-includes/functions.php b/wp-inst/wp-includes/functions.php
index 88afb07..df336e3 100644
--- a/wp-inst/wp-includes/functions.php
+++ b/wp-inst/wp-includes/functions.php
@@ -1406,6 +1406,12 @@ function is_subpost () {
return $wp_query->is_subpost;
}
+function is_preview() {
+ global $wp_query;
+
+ return $wp_query->is_preview;
+}
+
function is_archive () {
global $wp_query;
diff --git a/wp-inst/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js b/wp-inst/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js
index 9d0511e..28d7ae7 100644
--- a/wp-inst/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js
+++ b/wp-inst/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js
@@ -1,2 +1,2 @@
/* Import plugin specific language pack */
- tinyMCE.importPluginLanguagePack('autosave','en,sv,cs');function TinyMCE_autosave_getInfo(){return{longname:'Auto save',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};};function TinyMCE_autosave_beforeUnloadHandler(){var msg=tinyMCE.getLang("lang_autosave_unload_msg");var anyDirty=false;for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(inst.isDirty())return msg;}return;}window.onbeforeunload=TinyMCE_autosave_beforeUnloadHandler; \ No newline at end of file
+ tinyMCE.importPluginLanguagePack('autosave','en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');function TinyMCE_autosave_getInfo(){return{longname:'Auto save',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};};function TinyMCE_autosave_beforeUnloadHandler(){var msg=tinyMCE.getLang("lang_autosave_unload_msg");var anyDirty=false;for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(inst.isDirty())return msg;}return;}window.onbeforeunload=TinyMCE_autosave_beforeUnloadHandler; \ No newline at end of file
diff --git a/wp-inst/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js b/wp-inst/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js
index ed9afd1..102d69b 100644
--- a/wp-inst/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js
+++ b/wp-inst/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js
@@ -1,5 +1,5 @@
/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs');
+tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');
function TinyMCE_autosave_getInfo() {
return {
@@ -17,6 +17,8 @@ function TinyMCE_autosave_beforeUnloadHandler() {
var anyDirty = false;
for (var n in tinyMCE.instances) {
var inst = tinyMCE.instances[n];
+ if (!tinyMCE.isInstance(inst))
+ continue;
if (inst.isDirty())
return msg;
diff --git a/wp-inst/wp-includes/js/tinymce/plugins/autosave/langs/cs.js b/wp-inst/wp-includes/js/tinymce/plugins/autosave/langs/cs.js
index b41863d..e69de29 100644
--- a/wp-inst/wp-includes/js/tinymce/plugins/autosave/langs/cs.js
+++ b/wp-inst/wp-includes/js/tinymce/plugins/autosave/langs/cs.js
@@ -1,11 +0,0 @@
-/**
- * Czech lang variables
- * encoding: utf-8
- *
- * $Id$
- */
-
-tinyMCE.addToLang('',{
-autosave_unload_msg : 'Změny, které jste udělal(a) budou ztraceny, jestliže opustíte tuto stránku.'
-});
-
diff --git a/wp-inst/wp-includes/js/tinymce/plugins/autosave/langs/sv.js b/wp-inst/wp-includes/js/tinymce/plugins/autosave/langs/sv.js
index 7c1b66e..e69de29 100644
--- a/wp-inst/wp-includes/js/tinymce/plugins/autosave/langs/sv.js
+++ b/wp-inst/wp-includes/js/tinymce/plugins/autosave/langs/sv.js
@@ -1,6 +0,0 @@
-// SE lang variables
-
-tinyMCE.addToLang('',{
-autosave_unload_msg : 'F&ouml;r&auml;ndringarna du gjorde kommer att g&aring; f&ouml;rlorade om du v&auml;ljer att l&auml;mna denna sida.'
-});
-
diff --git a/wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js b/wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
index 3b478f6..58b51b3 100644
--- a/wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
+++ b/wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
@@ -1,11 +1,11 @@
/**
- * $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.2 $
- * $Date: 2005/08/23 20:28:34 $
+ * $RCSfile: editor_plugin.js,v $
+ * $Revision: 1.42 $
+ * $Date: 2005/10/30 16:06:56 $
*
* Moxiecode DHTML Windows script.
*
* @author Moxiecode
* @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
*/
- 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){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;for(var name in args)url=tinyMCE.replaceVar(url,name,escape(args[name]));var elm=document.getElementById(this.selectedInstance.editorId+'_parent');var pos=tinyMCE.getAbsPosition(elm);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(win_ref.name==win.id+"_iframe")window.frames[win.id+"_iframe"].document.getElementById(win.id+'_title').innerHTML=title;}};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];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;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){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);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;win.id=id;win.url=url;win.name=name;win.features=features;this.windows[name]=win;iframeWidth=width;iframeHeight=height;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();" onmousedown="return false;" class="mceWindowClose"><img border="0" src="'+imgPath+'/window_close.gif" /></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>';this.createFloatingIFrame(id,features['left'],features['top'],features['width'],features['height'],html);};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;}};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];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");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);}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;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;}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("scrolling","no");iframe.style.width=iframeWidth+"px";iframe.style.height=iframeHeight+"px";iframe.style.backgroundColor="white";div.appendChild(iframe);document.body.appendChild(div);div.innerHTML=div.innerHTML;if(this.isSafari){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;};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(win.name!=this.name)mcWindowsNew[n]=win;}mcWindows.windows=mcWindowsNew;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;var scrollY=0;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;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){var winRef=e.currentTarget;for(var n in mcWindows.windows){var win=mcWindows.windows[n];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;var scrollY=0;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);};var mcWindows=new MCWindows();mcWindows.init({images_path:tinyMCE.baseURL+"/plugins/inlinepopups/images",css_file:tinyMCE.baseURL+"/plugins/inlinepopups/css/inlinepopup.css"}); \ No newline at end of file
+ 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){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;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);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;}};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];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;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){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);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;win.id=id;win.url=url;win.name=name;win.features=features;this.windows[name]=win;iframeWidth=width;iframeHeight=height;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+=' </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>';this.createFloatingIFrame(id,features['left'],features['top'],features['width'],features['height'],html);};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;}};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];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");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);}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;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;}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("scrolling","no");iframe.style.width=iframeWidth+"px";iframe.style.height=iframeHeight+"px";iframe.style.backgroundColor="white";div.appendChild(iframe);document.body.appendChild(div);div.innerHTML=div.innerHTML;if(this.isSafari){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;};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;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;var scrollY=0;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;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){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;var scrollY=0;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);};var mcWindows=new MCWindows();mcWindows.init({images_path:tinyMCE.baseURL+"/plugins/inlinepopups/images",css_file:tinyMCE.baseURL+"/plugins/inlinepopups/css/inlinepopup.css"}); \ No newline at end of file
diff --git a/wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js b/wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js
index 41f597a..3bd4993 100644
--- a/wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js
+++ b/wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js
@@ -1,7 +1,7 @@
/**
* $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.2 $
- * $Date: 2005/08/23 20:28:34 $
+ * $Revision: 1.3 $
+ * $Date: 2005/10/18 13:59:43 $
*
* Moxiecode DHTML Windows script.
*
@@ -54,8 +54,12 @@ TinyMCE.prototype.openWindow = function(template, args) {
height += 18;
// Replace all args as variables in URL
- for (var name in args)
+ 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);
@@ -79,6 +83,8 @@ TinyMCE.prototype.closeWindow = function(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;
@@ -279,9 +285,9 @@ MCWindows.prototype.open = function(url, name, features) {
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();" onmousedown="return false;" class="mceWindowClose"><img border="0" src="' + imgPath + '/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 += ' <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>';
@@ -524,6 +530,8 @@ MCWindow.prototype.close = function() {
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;
@@ -604,6 +612,8 @@ MCWindow.prototype.onFocus = function(e) {
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
+ if (typeof(win) == 'function')
+ continue;
if (winRef.name == win.id + "_iframe") {
win.focus();
diff --git a/wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js b/wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js
index 8982342..a88ffd7 100644
--- a/wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js
+++ b/wp-inst/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js
@@ -1,7 +1,7 @@
/**
* $RCSfile: mcwindows.js,v $
- * $Revision: 1.1 $
- * $Date: 2005/08/10 21:21:00 $
+ * $Revision: 1.2 $
+ * $Date: 2005/10/18 13:59:43 $
*
* Moxiecode DHTML Windows script.
*
@@ -64,6 +64,8 @@ MCWindows.prototype.eventDispatcher = function(e) {
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();
@@ -408,10 +410,6 @@ MCWindow.prototype.onMouseMove = function(e) {
}
};
-function debug(msg) {
- document.getElementById('debug').value += msg + "\n";
-}
-
MCWindow.prototype.onMouseUp = function(e) {
mcWindows.action = "none";
};
@@ -422,6 +420,8 @@ MCWindow.prototype.onFocus = function(e) {
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
+ if (typeof(win) == 'function')
+ continue;
if (winRef.name == win.id) {
win.focus();
diff --git a/wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
index a4c9c86..6f7149c 100644
--- a/wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
+++ b/wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
@@ -7,9 +7,11 @@ function TinyMCE_wordpress_initInstance(inst) {
}
function TinyMCE_wordpress_getControlHTML(control_name) {
- switch (control_name) {
- case "wordpress":
- return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="More..." 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" onmousedown="return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="...Page..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>-->';
+ switch (control_name) {
+ case "wordpress":
+ var titleMore = tinyMCE.getLang('lang_wordpress_more_button');
+ var titlePage = tinyMCE.getLang('lang_wordpress_page_button');
+ return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onmousedown="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" onmousedown="return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="'+titlePage+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>-->';
}
return "";
@@ -22,6 +24,8 @@ function TinyMCE_wordpress_parseAttributes(attribute_string) {
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;
@@ -72,7 +76,8 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
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');
@@ -86,7 +91,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" '
- + 'alt="More..." title="More..." class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
+ + 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
tinyMCE.execCommand("mceInsertContent",true,html);
tinyMCE.selectedInstance.repaint();
return true;
@@ -95,6 +100,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
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") {
@@ -109,7 +115,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" '
- + 'alt="More..." title="More..." class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
+ + 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
tinyMCE.execCommand("mceInsertContent",true,html);
tinyMCE.selectedInstance.repaint();
return true;
@@ -124,6 +130,8 @@ function TinyMCE_wordpress_cleanup(type, content) {
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) {
@@ -132,7 +140,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
content = content.substring(0, startPos);
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
content += ' width="100%" height="10px" ';
- content += 'alt="More..." title="More..." class="mce_plugin_wordpress_more" />';
+ content += 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" />';
content += contentAfter;
startPos++;
@@ -146,7 +154,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
content = content.substring(0, startPos);
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
content += ' width="100%" height="10px" ';
- content += 'alt="...Next Page..." title="...Next Page..." class="mce_plugin_wordpress_page" />';
+ content += 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" />';
content += contentAfter;
startPos++;
@@ -182,13 +190,6 @@ function TinyMCE_wordpress_cleanup(type, content) {
}
}
- // Handle TinyMCE weirdness without messing up the core
- //alert("Content before TinyMCE_wordpress_cleanup\n\n'"+content+"'");
-
- // Strip any trailing <br /> and whitespace.
- content = content.replace(new RegExp('<br ?/?>[ \t]*$', ''), '');
-
- //alert("Content after TinyMCE_wordpress_cleanup\n\n'"+content+"'");
break;
}
diff --git a/wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js b/wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js
index a4c9c86..6f7149c 100644
--- a/wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js
+++ b/wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js
@@ -7,9 +7,11 @@ function TinyMCE_wordpress_initInstance(inst) {
}
function TinyMCE_wordpress_getControlHTML(control_name) {
- switch (control_name) {
- case "wordpress":
- return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="More..." 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" onmousedown="return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="...Page..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>-->';
+ switch (control_name) {
+ case "wordpress":
+ var titleMore = tinyMCE.getLang('lang_wordpress_more_button');
+ var titlePage = tinyMCE.getLang('lang_wordpress_page_button');
+ return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onmousedown="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" onmousedown="return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="'+titlePage+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>-->';
}
return "";
@@ -22,6 +24,8 @@ function TinyMCE_wordpress_parseAttributes(attribute_string) {
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;
@@ -72,7 +76,8 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
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');
@@ -86,7 +91,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" '
- + 'alt="More..." title="More..." class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
+ + 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
tinyMCE.execCommand("mceInsertContent",true,html);
tinyMCE.selectedInstance.repaint();
return true;
@@ -95,6 +100,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
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") {
@@ -109,7 +115,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" '
- + 'alt="More..." title="More..." class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
+ + 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
tinyMCE.execCommand("mceInsertContent",true,html);
tinyMCE.selectedInstance.repaint();
return true;
@@ -124,6 +130,8 @@ function TinyMCE_wordpress_cleanup(type, content) {
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) {
@@ -132,7 +140,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
content = content.substring(0, startPos);
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
content += ' width="100%" height="10px" ';
- content += 'alt="More..." title="More..." class="mce_plugin_wordpress_more" />';
+ content += 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" />';
content += contentAfter;
startPos++;
@@ -146,7 +154,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
content = content.substring(0, startPos);
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
content += ' width="100%" height="10px" ';
- content += 'alt="...Next Page..." title="...Next Page..." class="mce_plugin_wordpress_page" />';
+ content += 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" />';
content += contentAfter;
startPos++;
@@ -182,13 +190,6 @@ function TinyMCE_wordpress_cleanup(type, content) {
}
}
- // Handle TinyMCE weirdness without messing up the core
- //alert("Content before TinyMCE_wordpress_cleanup\n\n'"+content+"'");
-
- // Strip any trailing <br /> and whitespace.
- content = content.replace(new RegExp('<br ?/?>[ \t]*$', ''), '');
-
- //alert("Content after TinyMCE_wordpress_cleanup\n\n'"+content+"'");
break;
}
diff --git a/wp-inst/wp-includes/js/tinymce/plugins/wordpress/langs/en.js b/wp-inst/wp-includes/js/tinymce/plugins/wordpress/langs/en.js
index 2d3358d..fe59a2f 100644
--- a/wp-inst/wp-includes/js/tinymce/plugins/wordpress/langs/en.js
+++ b/wp-inst/wp-includes/js/tinymce/plugins/wordpress/langs/en.js
@@ -1,6 +1,8 @@
-// UK lang variables
+// EN lang variables
-/* Remember to namespace the language parameters lang_<your plugin>_<some name> */
-
-tinyMCELang['lang_template_title'] = 'This is just a template popup';
-tinyMCELang['lang_template_desc'] = 'This is just a template button';
+tinyMCE.addToLang('',{
+wordpress_more_button : 'Split post with More tag',
+wordpress_page_button : 'Split post with Page tag',
+wordpress_more_alt : 'More...',
+wordpress_page_alt : '...page...'
+});
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/about.htm b/wp-inst/wp-includes/js/tinymce/themes/advanced/about.htm
index ec5c8cf..f4130fd 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/about.htm
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/about.htm
@@ -6,7 +6,7 @@
<script language="javascript" type="text/javascript" src="jscripts/about.js"></script>
<link href="css/dialog_about.css" rel="stylesheet" type="text/css" />
</head>
-<body id="about" onload="init();" style="display: none">
+<body id="about" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
<div class="tabs">
<ul>
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_about}</a></span></li>
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/anchor.htm b/wp-inst/wp-includes/js/tinymce/themes/advanced/anchor.htm
index 1b90fe9..6fbe53f 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/anchor.htm
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/anchor.htm
@@ -4,7 +4,7 @@
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/anchor.js"></script>
</head>
-<body onload="init();" style="display: none">
+<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
<form onsubmit="insertAnchor();return false;" action="#">
<table border="0" cellpadding="4" cellspacing="0">
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/charmap.htm b/wp-inst/wp-includes/js/tinymce/themes/advanced/charmap.htm
index da947ee..59d893d 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/charmap.htm
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/charmap.htm
@@ -5,7 +5,7 @@
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/charmap.js"></script>
</head>
-<body onload="init();" style="display: none">
+<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
<table align="center" border="0" cellspacing="0" cellpadding="2">
<tr>
<td colspan="2" class="title">{$lang_theme_charmap_title}</td>
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/color_picker.htm b/wp-inst/wp-includes/js/tinymce/themes/advanced/color_picker.htm
index 24e73df..374d846 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/color_picker.htm
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/color_picker.htm
@@ -4,7 +4,7 @@
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/color_picker.js"></script>
</head>
-<body onload="init();" marginheight="3" topmargin="3" leftmargin="3" marginwidth="3" style="display: none">
+<body onload="tinyMCEPopup.executeOnLoad('init();');" marginheight="3" topmargin="3" leftmargin="3" marginwidth="3" style="display: none">
<div align="center">
<script language="javascript" type="text/javascript">renderColorMap();</script>
</div>
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/css/editor_content.css b/wp-inst/wp-includes/js/tinymce/themes/advanced/css/editor_content.css
index b1e8c5e..1b41edb 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/css/editor_content.css
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/css/editor_content.css
@@ -2,11 +2,17 @@
/* You can extend this CSS by adding your own CSS file with the the content_css option */
body {
- background-color: #fff;
+ background-color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 13px;
- line-height: 130%;
- padding: 1em;
+ font-size: 10px;
+ scrollbar-3dlight-color: #F0F0EE;
+ scrollbar-arrow-color: #676662;
+ scrollbar-base-color: #F0F0EE;
+ scrollbar-darkshadow-color: #DDDDDD;
+ scrollbar-face-color: #E0E0DD;
+ scrollbar-highlight-color: #F0F0EE;
+ scrollbar-shadow-color: #F0F0EE;
+ scrollbar-track-color: #F5F5F5;
}
td {
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css b/wp-inst/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css
index a943499..f2f5eff 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css
@@ -1,6 +1,11 @@
/* This file contains the CSS data for the editor UI of TinyMCE instances */
-.mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceButtonDisabled, .mceButtonSelected {
+.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {
+ border: 0px; margin: 0px; padding: 0px; background: transparent;
+}
+
+.mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceSeparatorLine, .mceButtonDisabled, .mceButtonSelected {
+ border: 0px; margin: 0px; padding: 0px; background: transparent;
margin-top: 1px;
margin-left: 1px;
}
@@ -77,7 +82,7 @@
}
.mceLabel, .mceLabelDisabled {
- font-family: "MS Sans Serif";
+ font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
font-size: 9pt;
}
@@ -98,7 +103,7 @@
}
.mceEditorArea {
- font-family: "MS Sans Serif";
+ font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
background: #FFFFFF;
padding: 0px;
margin: 0px;
@@ -106,6 +111,8 @@
.mceToolbarTop, .mceToolbarBottom {
background: #F0F0EE;
+ line-height: 1px;
+ font-size: 1px;
}
.mceToolbarTop {
@@ -121,7 +128,7 @@
}
.mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText {
- font-family: "MS Sans Serif";
+ font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
font-size: 9pt;
padding: 2px;
line-height: 16px;
@@ -142,7 +149,7 @@
.mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {
text-decoration: none;
- font-family: "MS Sans Serif";
+ font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
font-size: 9pt;
color: #000000;
}
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/editor_template.js b/wp-inst/wp-includes/js/tinymce/themes/advanced/editor_template.js
index 7861793..0248e25 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/editor_template.js
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/editor_template.js
@@ -1,5 +1,5 @@
/* Import theme specific language pack */
- tinyMCE.importThemeLanguagePack('advanced');var TinyMCE_advanced_autoImportCSSClasses=true;var TinyMCE_advanced_resizer=new Object();var TinyMCE_advanced_buttons=[['bold','{$lang_bold_img}','{$lang_bold_desc}','Bold'],['italic','{$lang_italic_img}','{$lang_italic_desc}','Italic'],['underline','{$lang_underline_img}','{$lang_underline_desc}','Underline'],['strikethrough','strikethrough.gif','{$lang_striketrough_desc}','Strikethrough'],['justifyleft','left.gif','{$lang_justifyleft_desc}','JustifyLeft'],['justifycenter','center.gif','{$lang_justifycenter_desc}','JustifyCenter'],['justifyright','right.gif','{$lang_justifyright_desc}','JustifyRight'],['justifyfull','full.gif','{$lang_justifyfull_desc}','JustifyFull'],['bullist','bullist.gif','{$lang_bullist_desc}','InsertUnorderedList'],['numlist','numlist.gif','{$lang_numlist_desc}','InsertOrderedList'],['outdent','outdent.gif','{$lang_outdent_desc}','Outdent'],['indent','indent.gif','{$lang_indent_desc}','Indent'],['cut','cut.gif','{$lang_cut_desc}','Cut'],['copy','copy.gif','{$lang_copy_desc}','Copy'],['paste','paste.gif','{$lang_paste_desc}','Paste'],['undo','undo.gif','{$lang_undo_desc}','Undo'],['redo','redo.gif','{$lang_redo_desc}','Redo'],['link','link.gif','{$lang_link_desc}','mceLink',true],['unlink','unlink.gif','{$lang_unlink_desc}','unlink'],['image','image.gif','{$lang_image_desc}','mceImage',true],['cleanup','cleanup.gif','{$lang_cleanup_desc}','mceCleanup'],['help','help.gif','{$lang_help_desc}','mceHelp'],['code','code.gif','{$lang_theme_code_desc}','mceCodeEditor'],['hr','hr.gif','{$lang_theme_hr_desc}','inserthorizontalrule'],['removeformat','removeformat.gif','{$lang_theme_removeformat_desc}','removeformat'],['sub','sub.gif','{$lang_theme_sub_desc}','subscript'],['sup','sup.gif','{$lang_theme_sup_desc}','superscript'],['forecolor','forecolor.gif','{$lang_theme_forecolor_desc}','mceForeColor',true],['backcolor','backcolor.gif','{$lang_theme_backcolor_desc}','mceBackColor',true],['charmap','charmap.gif','{$lang_theme_charmap_desc}','mceCharMap'],['visualaid','visualaid.gif','{$lang_theme_visualaid_desc}','mceToggleVisualAid'],['anchor','anchor.gif','{$lang_theme_anchor_desc}','mceInsertAnchor'],['newdocument','newdocument.gif','{$lang_newdocument_desc}','mceNewDocument']];function TinyMCE_advanced_getControlHTML(button_name){var buttonTileMap=new Array('anchor.gif','backcolor.gif','bullist.gif','center.gif','charmap.gif','cleanup.gif','code.gif','copy.gif','custom_1.gif','cut.gif','forecolor.gif','full.gif','help.gif','hr.gif','image.gif','indent.gif','left.gif','link.gif','numlist.gif','outdent.gif','paste.gif','redo.gif','removeformat.gif','right.gif','strikethrough.gif','sub.gif','sup.gif','undo.gif','unlink.gif','visualaid.gif');for(var i=0;i<TinyMCE_advanced_buttons.length;i++){var but=TinyMCE_advanced_buttons[i];if(but[0]==button_name){if(tinyMCE.settings['button_tile_map']){for(var x=0;!tinyMCE.isMSIE&&x<buttonTileMap.length;x++){if(buttonTileMap[x]==but[1]){return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\', '+(but.length>4?but[4]:false)+(but.length>5?', \''+but[5]+'\'':'')+')" onmousedown="return false;"><img id="{$editor_id}_'+but[0]+'" src="{$themeurl}/images/spacer.gif" style="background-image:url({$themeurl}/images/buttons.gif); background-position: '+(0-(x*20))+'px 0px" title="'+but[2]+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';}}}return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\', '+(but.length>4?but[4]:false)+(but.length>5?', \''+but[5]+'\'':'')+')" onmousedown="return false;"><img id="{$editor_id}_'+but[0]+'" src="{$themeurl}/images/'+but[1]+'" title="'+but[2]+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';}}switch(button_name){case "formatselect":var html='<select id="{$editor_id}_formatSelect" name="{$editor_id}_formatSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FormatBlock\',false,this.options[this.selectedIndex].value);" class="mceSelectList">';var formats=tinyMCE.getParam("theme_advanced_blockformats","p,address,pre,h1,h2,h3,h4,h5,h6",true).split(',');var lookup=[['p','{$lang_theme_paragraph}'],['address','{$lang_theme_address}'],['pre','{$lang_theme_pre}'],['h1','{$lang_theme_h1}'],['h2','{$lang_theme_h2}'],['h3','{$lang_theme_h3}'],['h4','{$lang_theme_h4}'],['h5','{$lang_theme_h5}'],['h6','{$lang_theme_h6}']];html+='<option value="">{$lang_theme_block}</option>';for(var i=0;i<formats.length;i++){for(var x=0;x<lookup.length;x++){if(formats[i]==lookup[x][0]){html+='<option value="<'+lookup[x][0]+'>">'+lookup[x][1]+'</option>';}}}html+='</select>';return html;case "styleselect":return '<select id="{$editor_id}_styleSelect" onmousedown="TinyMCE_advanced_setupCSSClasses(\'{$editor_id}\');" name="{$editor_id}_styleSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSetCSSClass\',false,this.options[this.selectedIndex].value);" class="mceSelectList">{$style_select_options}</select>';case "fontselect":var fontHTML='<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';var iFonts='Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';var nFonts='Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sand;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';var fonts=tinyMCE.getParam("theme_advanced_fonts",nFonts).split(';');for(var i=0;i<fonts.length;i++){if(fonts[i]!=''){var parts=fonts[i].split('=');fontHTML+='<option value="'+parts[1]+'">'+parts[0]+'</option>';}}fontHTML+='</select>';return fontHTML;case "fontsizeselect":return '<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">\
+ tinyMCE.importThemeLanguagePack('advanced');var TinyMCE_advanced_autoImportCSSClasses=true;var TinyMCE_advanced_resizer=new Object();var TinyMCE_advanced_buttons=[['bold','{$lang_bold_img}','{$lang_bold_desc}','Bold'],['italic','{$lang_italic_img}','{$lang_italic_desc}','Italic'],['underline','{$lang_underline_img}','{$lang_underline_desc}','Underline'],['strikethrough','strikethrough.gif','{$lang_striketrough_desc}','Strikethrough'],['justifyleft','left.gif','{$lang_justifyleft_desc}','JustifyLeft'],['justifycenter','center.gif','{$lang_justifycenter_desc}','JustifyCenter'],['justifyright','right.gif','{$lang_justifyright_desc}','JustifyRight'],['justifyfull','full.gif','{$lang_justifyfull_desc}','JustifyFull'],['bullist','bullist.gif','{$lang_bullist_desc}','InsertUnorderedList'],['numlist','numlist.gif','{$lang_numlist_desc}','InsertOrderedList'],['outdent','outdent.gif','{$lang_outdent_desc}','Outdent'],['indent','indent.gif','{$lang_indent_desc}','Indent'],['cut','cut.gif','{$lang_cut_desc}','Cut'],['copy','copy.gif','{$lang_copy_desc}','Copy'],['paste','paste.gif','{$lang_paste_desc}','Paste'],['undo','undo.gif','{$lang_undo_desc}','Undo'],['redo','redo.gif','{$lang_redo_desc}','Redo'],['link','link.gif','{$lang_link_desc}','mceLink',true],['unlink','unlink.gif','{$lang_unlink_desc}','unlink'],['image','image.gif','{$lang_image_desc}','mceImage',true],['cleanup','cleanup.gif','{$lang_cleanup_desc}','mceCleanup'],['help','help.gif','{$lang_help_desc}','mceHelp'],['code','code.gif','{$lang_theme_code_desc}','mceCodeEditor'],['hr','hr.gif','{$lang_theme_hr_desc}','inserthorizontalrule'],['removeformat','removeformat.gif','{$lang_theme_removeformat_desc}','removeformat'],['sub','sub.gif','{$lang_theme_sub_desc}','subscript'],['sup','sup.gif','{$lang_theme_sup_desc}','superscript'],['forecolor','forecolor.gif','{$lang_theme_forecolor_desc}','mceForeColor',true],['backcolor','backcolor.gif','{$lang_theme_backcolor_desc}','mceBackColor',true],['charmap','charmap.gif','{$lang_theme_charmap_desc}','mceCharMap'],['visualaid','visualaid.gif','{$lang_theme_visualaid_desc}','mceToggleVisualAid'],['anchor','anchor.gif','{$lang_theme_anchor_desc}','mceInsertAnchor'],['newdocument','newdocument.gif','{$lang_newdocument_desc}','mceNewDocument']];function TinyMCE_advanced_getControlHTML(button_name){var buttonTileMap=new Array('anchor.gif','backcolor.gif','bullist.gif','center.gif','charmap.gif','cleanup.gif','code.gif','copy.gif','custom_1.gif','cut.gif','forecolor.gif','full.gif','help.gif','hr.gif','image.gif','indent.gif','left.gif','link.gif','numlist.gif','outdent.gif','paste.gif','redo.gif','removeformat.gif','right.gif','strikethrough.gif','sub.gif','sup.gif','undo.gif','unlink.gif','visualaid.gif');for(var i=0;i<TinyMCE_advanced_buttons.length;i++){var but=TinyMCE_advanced_buttons[i];if(but[0]==button_name){if(tinyMCE.settings['button_tile_map']){for(var x=0;!tinyMCE.isMSIE&&x<buttonTileMap.length;x++){if(buttonTileMap[x]==but[1]){var cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\','+(but.length>4?but[4]:false)+(but.length>5?',\''+but[5]+'\'':'')+')';return '<a href="javascript:'+cmd+'" onclick="'+cmd+';return false;" onmousedown="return false;" target="_self"><img id="{$editor_id}_'+but[0]+'" src="{$themeurl}/images/spacer.gif" style="background-image:url({$themeurl}/images/buttons.gif); background-position: '+(0-(x*20))+'px 0px" title="'+but[2]+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';}}}var cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\','+(but.length>4?but[4]:false)+(but.length>5?',\''+but[5]+'\'':'')+')';return '<a href="javascript:'+cmd+'" onclick="'+cmd+';return false;" onmousedown="return false;" target="_self"><img id="{$editor_id}_'+but[0]+'" src="{$themeurl}/images/'+but[1]+'" title="'+but[2]+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';}}switch(button_name){case "formatselect":var html='<select id="{$editor_id}_formatSelect" name="{$editor_id}_formatSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FormatBlock\',false,this.options[this.selectedIndex].value);" class="mceSelectList">';var formats=tinyMCE.getParam("theme_advanced_blockformats","p,address,pre,h1,h2,h3,h4,h5,h6",true).split(',');var lookup=[['p','{$lang_theme_paragraph}'],['address','{$lang_theme_address}'],['pre','{$lang_theme_pre}'],['h1','{$lang_theme_h1}'],['h2','{$lang_theme_h2}'],['h3','{$lang_theme_h3}'],['h4','{$lang_theme_h4}'],['h5','{$lang_theme_h5}'],['h6','{$lang_theme_h6}']];html+='<option value="">{$lang_theme_block}</option>';for(var i=0;i<formats.length;i++){for(var x=0;x<lookup.length;x++){if(formats[i]==lookup[x][0]){html+='<option value="<'+lookup[x][0]+'>">'+lookup[x][1]+'</option>';}}}html+='</select>';return html;case "styleselect":return '<select id="{$editor_id}_styleSelect" onmousedown="TinyMCE_advanced_setupCSSClasses(\'{$editor_id}\');" name="{$editor_id}_styleSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSetCSSClass\',false,this.options[this.selectedIndex].value);" class="mceSelectList">{$style_select_options}</select>';case "fontselect":var fontHTML='<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';var iFonts='Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';var nFonts='Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sand;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';var fonts=tinyMCE.getParam("theme_advanced_fonts",nFonts).split(';');for(var i=0;i<fonts.length;i++){if(fonts[i]!=''){var parts=fonts[i].split('=');fontHTML+='<option value="'+parts[1]+'">'+parts[0]+'</option>';}}fontHTML+='</select>';return fontHTML;case "fontsizeselect":return '<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">\
<option value="0">{$lang_theme_font_size}</option>\
<option value="1">1 (8 pt)</option>\
<option value="2">2 (10 pt)</option>\
@@ -8,6 +8,6 @@
<option value="5">5 (18 pt)</option>\
<option value="6">6 (24 pt)</option>\
<option value="7">7 (36 pt)</option>\
- </select>';case "|":case "separator":return '<img src="{$themeurl}/images/spacer.gif" width="1" height="15" class="mceSeparatorLine">';case "spacer":return '<img src="{$themeurl}/images/spacer.gif" width="1" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" />';case "rowseparator":return '<br />';}return "";}function TinyMCE_advanced_execCommand(editor_id,element,command,user_interface,value){switch(command){case "mceForeColor":var template=new Array();var elm=tinyMCE.selectedInstance.getFocusElement();var inputColor=tinyMCE.getAttrib(elm,"color");if(inputColor=='')inputColor=elm.style.color;if(!inputColor)inputColor="#000000";template['file']='color_picker.htm';template['width']=220;template['height']=190;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"forecolor",input_color:inputColor});return true;case "mceBackColor":var template=new Array();var elm=tinyMCE.selectedInstance.getFocusElement();var inputColor=elm.style.backgroundColor;if(!inputColor)inputColor="#000000";template['file']='color_picker.htm';template['width']=220;template['height']=190;template['width']+=tinyMCE.getLang('lang_theme_advanced_backcolor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_backcolor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"HiliteColor",input_color:inputColor});return true;case "mceColorPicker":if(user_interface){var template=new Array();var inputColor=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=220;template['height']=190;template['width']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height',0);if(typeof(value['store_selection'])=="undefined")value['store_selection']=true;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,mce_store_selection:value['store_selection'],inline:"yes",command:"mceColorPicker",input_color:inputColor});}else{var savedVal=tinyMCE.lastColorPickerValue;var elm=savedVal['document'].getElementById(savedVal['element_id']);elm.value=value;eval('elm.onchange();');}return true;case "mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_width",500));template['height']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_height",400));tinyMCE.openWindow(template,{editor_id:editor_id,resizable:"yes",scrollbars:"no",inline:"yes"});return true;case "mceCharMap":var template=new Array();template['file']='charmap.htm';template['width']=550;template['height']=250;template['width']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case "mceInsertAnchor":var template=new Array();template['file']='anchor.htm';template['width']=320;template['height']=90;template['width']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case "mceNewDocument":if(confirm(tinyMCE.getLang('lang_newdocument')))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,'');return true;}return false;}function TinyMCE_advanced_getEditorTemplate(settings,editorId){function removeFromArray(in_array,remove_array){var outArray=new Array();for(var i=0;i<in_array.length;i++){skip=false;for(var j=0;j<remove_array.length;j++){if(in_array[i]==remove_array[j]){skip=true;}}if(!skip){outArray[outArray.length]=in_array[i];}}return outArray;}function addToArray(in_array,add_array){for(var i=0;i<add_array.length;i++){in_array[in_array.length]=add_array[i];}return in_array;}var template=new Array();var deltaHeight=0;var resizing=tinyMCE.getParam("theme_advanced_resizing",false);var path=tinyMCE.getParam("theme_advanced_path",true);var statusbarHTML='<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: '+(path?"block":"none")+'">&nbsp;</div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: '+(resizing?"block":"none")+'" onmousedown="TinyMCE_advanced_setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />';var layoutManager=tinyMCE.getParam("theme_advanced_layout_manager","SimpleLayout");var styleSelectHTML='<option value="">{$lang_theme_style_select}</option>';if(settings['theme_advanced_styles']){var stylesAr=settings['theme_advanced_styles'].split(';');for(var i=0;i<stylesAr.length;i++){var key,value;key=stylesAr[i].split('=')[0];value=stylesAr[i].split('=')[1];styleSelectHTML+='<option value="'+value+'">'+key+'</option>';}TinyMCE_advanced_autoImportCSSClasses=false;}switch(layoutManager){case "SimpleLayout":var toolbarHTML="";var toolbarLocation=tinyMCE.getParam("theme_advanced_toolbar_location","bottom");var toolbarAlign=tinyMCE.getParam("theme_advanced_toolbar_align","center");var pathLocation=tinyMCE.getParam("theme_advanced_path_location","none");var statusbarLocation=tinyMCE.getParam("theme_advanced_statusbar_location",pathLocation);var defVals={theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,separator,sub,sup,separator,charmap"};for(var i=1;i<100;i++){var def=defVals["theme_advanced_buttons"+i];buttons=tinyMCE.getParam("theme_advanced_buttons"+i,def==null?'':def,true,',');if(buttons.length==0)break;buttons=removeFromArray(buttons,tinyMCE.getParam("theme_advanced_disable","",true,','));buttons=addToArray(buttons,tinyMCE.getParam("theme_advanced_buttons"+i+"_add","",true,','));buttons=addToArray(tinyMCE.getParam("theme_advanced_buttons"+i+"_add_before","",true,','),buttons);for(var b=0;b<buttons.length;b++)toolbarHTML+=tinyMCE.getControlHTML(buttons[b]);if(buttons.length>0){toolbarHTML+="<br />";deltaHeight-=23;}}template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';if(toolbarLocation=="top"){template['html']+='<tr><td class="mceToolbarTop" align="'+toolbarAlign+'" height="1" nowrap="nowrap">'+toolbarHTML+'</td></tr>';}if(statusbarLocation=="top"){template['html']+='<tr><td class="mceStatusbarTop" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23;}template['html']+='<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';if(toolbarLocation=="bottom"){template['html']+='<tr><td class="mceToolbarBottom" align="'+toolbarAlign+'" height="1">'+toolbarHTML+'</td></tr>';}if(toolbarLocation=="external"){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVars(toolbarHTML,tinyMCE.settings);toolbarHTML=tinyMCE.replaceVars(toolbarHTML,tinyMCELang);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,"editor_id",editorId);toolbarHTML=tinyMCE.applyTemplate(toolbarHTML);elm.className="mceToolbarExternal";elm.id=editorId+"_toolbar";elm.innerHTML='<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>';bod.appendChild(elm);deltaHeight=0;tinyMCE.getInstanceById(editorId).toolbarElement=elm;}else{tinyMCE.getInstanceById(editorId).toolbarElement=null;}if(statusbarLocation=="bottom"){template['html']+='<tr><td class="mceStatusbarBottom" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23;}template['html']+='</table>';break;case "RowLayout":template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';var containers=tinyMCE.getParam("theme_advanced_containers","",true,",");var defaultContainerCSS=tinyMCE.getParam("theme_advanced_containers_default_class","container");var defaultContainerAlign=tinyMCE.getParam("theme_advanced_containers_default_align","center");for(var i=0;i<containers.length;i++){if(containers[i]=="mceEditor"){template['html']+='<tr><td align="center" class="mceEditor_border">\
+ </select>';case "|":case "separator":return '<img src="{$themeurl}/images/spacer.gif" width="1" height="15" class="mceSeparatorLine">';case "spacer":return '<img src="{$themeurl}/images/spacer.gif" width="1" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" />';case "rowseparator":return '<br />';}return "";}function TinyMCE_advanced_execCommand(editor_id,element,command,user_interface,value){switch(command){case "mceForeColor":var template=new Array();var elm=tinyMCE.selectedInstance.getFocusElement();var inputColor=tinyMCE.getAttrib(elm,"color");if(inputColor=='')inputColor=elm.style.color;if(!inputColor)inputColor="#000000";template['file']='color_picker.htm';template['width']=220;template['height']=190;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"forecolor",input_color:inputColor});return true;case "mceBackColor":var template=new Array();var elm=tinyMCE.selectedInstance.getFocusElement();var inputColor=elm.style.backgroundColor;if(!inputColor)inputColor="#000000";template['file']='color_picker.htm';template['width']=220;template['height']=190;template['width']+=tinyMCE.getLang('lang_theme_advanced_backcolor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_backcolor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"HiliteColor",input_color:inputColor});return true;case "mceColorPicker":if(user_interface){var template=new Array();var inputColor=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=220;template['height']=190;template['close_previous']="no";template['width']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height',0);if(typeof(value['store_selection'])=="undefined")value['store_selection']=true;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,mce_store_selection:value['store_selection'],inline:"yes",command:"mceColorPicker",input_color:inputColor});}else{var savedVal=tinyMCE.lastColorPickerValue;var elm=savedVal['document'].getElementById(savedVal['element_id']);elm.value=value;eval('elm.onchange();');}return true;case "mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_width",500));template['height']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_height",400));tinyMCE.openWindow(template,{editor_id:editor_id,resizable:"yes",scrollbars:"no",inline:"yes"});return true;case "mceCharMap":var template=new Array();template['file']='charmap.htm';template['width']=550+(tinyMCE.isOpera?40:0);template['height']=250;template['width']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case "mceInsertAnchor":var template=new Array();template['file']='anchor.htm';template['width']=320;template['height']=90+(tinyMCE.isNS7?30:0);template['width']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case "mceNewDocument":if(confirm(tinyMCE.getLang('lang_newdocument')))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,'');return true;}return false;}function TinyMCE_advanced_getEditorTemplate(settings,editorId){function removeFromArray(in_array,remove_array){var outArray=new Array();for(var i=0;i<in_array.length;i++){skip=false;for(var j=0;j<remove_array.length;j++){if(in_array[i]==remove_array[j]){skip=true;}}if(!skip){outArray[outArray.length]=in_array[i];}}return outArray;}function addToArray(in_array,add_array){for(var i=0;i<add_array.length;i++){in_array[in_array.length]=add_array[i];}return in_array;}var template=new Array();var deltaHeight=0;var resizing=tinyMCE.getParam("theme_advanced_resizing",false);var path=tinyMCE.getParam("theme_advanced_path",true);var statusbarHTML='<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: '+(path?"block":"none")+'">&nbsp;</div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: '+(resizing?"block":"none")+'" onmousedown="TinyMCE_advanced_setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />';var layoutManager=tinyMCE.getParam("theme_advanced_layout_manager","SimpleLayout");var styleSelectHTML='<option value="">{$lang_theme_style_select}</option>';if(settings['theme_advanced_styles']){var stylesAr=settings['theme_advanced_styles'].split(';');for(var i=0;i<stylesAr.length;i++){var key,value;key=stylesAr[i].split('=')[0];value=stylesAr[i].split('=')[1];styleSelectHTML+='<option value="'+value+'">'+key+'</option>';}TinyMCE_advanced_autoImportCSSClasses=false;}switch(layoutManager){case "SimpleLayout":var toolbarHTML="";var toolbarLocation=tinyMCE.getParam("theme_advanced_toolbar_location","bottom");var toolbarAlign=tinyMCE.getParam("theme_advanced_toolbar_align","center");var pathLocation=tinyMCE.getParam("theme_advanced_path_location","none");var statusbarLocation=tinyMCE.getParam("theme_advanced_statusbar_location",pathLocation);var defVals={theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,separator,sub,sup,separator,charmap"};toolbarHTML+='<a href="#" accesskey="q" title="'+tinyMCE.getLang("lang_toolbar_focus")+'"></a>';for(var i=1;i<100;i++){var def=defVals["theme_advanced_buttons"+i];var buttons=tinyMCE.getParam("theme_advanced_buttons"+i,def==null?'':def,true,',');if(buttons.length==0)break;buttons=removeFromArray(buttons,tinyMCE.getParam("theme_advanced_disable","",true,','));buttons=addToArray(buttons,tinyMCE.getParam("theme_advanced_buttons"+i+"_add","",true,','));buttons=addToArray(tinyMCE.getParam("theme_advanced_buttons"+i+"_add_before","",true,','),buttons);for(var b=0;b<buttons.length;b++)toolbarHTML+=tinyMCE.getControlHTML(buttons[b]);if(buttons.length>0){toolbarHTML+="<br />";deltaHeight-=23;}}toolbarHTML+='<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\''+editorId+'\').getWin().focus();"></a>';template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';if(toolbarLocation=="top"){template['html']+='<tr><td class="mceToolbarTop" align="'+toolbarAlign+'" height="1" nowrap="nowrap">'+toolbarHTML+'</td></tr>';}if(statusbarLocation=="top"){template['html']+='<tr><td class="mceStatusbarTop" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23;}template['html']+='<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';if(toolbarLocation=="bottom"){template['html']+='<tr><td class="mceToolbarBottom" align="'+toolbarAlign+'" height="1">'+toolbarHTML+'</td></tr>';}if(toolbarLocation=="external"){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVars(toolbarHTML,tinyMCE.settings);toolbarHTML=tinyMCE.replaceVars(toolbarHTML,tinyMCELang);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,"editor_id",editorId);toolbarHTML=tinyMCE.applyTemplate(toolbarHTML);elm.className="mceToolbarExternal";elm.id=editorId+"_toolbar";elm.innerHTML='<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>';bod.appendChild(elm);deltaHeight=0;tinyMCE.getInstanceById(editorId).toolbarElement=elm;}else{tinyMCE.getInstanceById(editorId).toolbarElement=null;}if(statusbarLocation=="bottom"){template['html']+='<tr><td class="mceStatusbarBottom" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23;}template['html']+='</tbody></table>';break;case "RowLayout":template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';var containers=tinyMCE.getParam("theme_advanced_containers","",true,",");var defaultContainerCSS=tinyMCE.getParam("theme_advanced_containers_default_class","container");var defaultContainerAlign=tinyMCE.getParam("theme_advanced_containers_default_align","center");for(var i=0;i<containers.length;i++){if(containers[i]=="mceEditor"){template['html']+='<tr><td align="center" class="mceEditor_border">\
<span id="{$editor_id}"></span>\
- </td></tr>';}else if(containers[i]=="mceElementpath"||containers[i]=="mceStatusbar"){var pathClass="mceStatusbar";if(i==containers.length-1){pathClass="mceStatusbarBottom";}else if(i==0){pathClass="mceStatusbar";}else{deltaHeight-=2;}template['html']+='<tr><td class="'+pathClass+'" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=22;}else{var curContainer=tinyMCE.getParam("theme_advanced_container_"+containers[i],"",true,',');var curContainerHTML="";var curAlign=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align",defaultContainerAlign);var curCSS=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class",defaultContainerCSS);for(var j=0;j<curContainer.length;j++){curContainerHTML+=tinyMCE.getControlHTML(curContainer[j]);}if(curContainer.length>0){curContainerHTML+="<br />";deltaHeight-=23;}template['html']+='<tr><td class="'+curCSS+'" align="'+curAlign+'" height="1">'+curContainerHTML+'</td></tr>';}}template['html']+='</tbody></table>';break;case "BorderLayout":break;case "CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);");}break;default:alert('UNDEFINED LAYOUT MANAGER! PLEASE CHECK YOUR TINYMCE CONFIG!');break;}template['html']+='<div id="{$editor_id}_resize_box" class="mceResizeBox"></div>';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);template['delta_width']=0;template['delta_height']=deltaHeight;return template;}function TinyMCE_advanced_setResizing(e,editor_id,state){e=typeof(e)=="undefined"?window.event:e;var resizer=TinyMCE_advanced_resizer;var editorContainer=document.getElementById(editor_id+'_parent');var editorArea=document.getElementById(editor_id+'_parent').firstChild;var resizeBox=document.getElementById(editor_id+'_resize_box');var inst=tinyMCE.getInstanceById(editor_id);if(state){var width=editorArea.clientWidth;var height=editorArea.clientHeight;resizeBox.style.width=width+"px";resizeBox.style.height=height+"px";resizer.iframeWidth=inst.iframeElement.clientWidth;resizer.iframeHeight=inst.iframeElement.clientHeight;editorArea.style.display="none";resizeBox.style.display="block";if(!resizer.eventHandlers){if(tinyMCE.isMSIE)tinyMCE.addEvent(document,"mousemove",TinyMCE_advanced_resizeEventHandler);else tinyMCE.addEvent(window,"mousemove",TinyMCE_advanced_resizeEventHandler);tinyMCE.addEvent(document,"mouseup",TinyMCE_advanced_resizeEventHandler);resizer.eventHandlers=true;}resizer.resizing=true;resizer.downX=e.screenX;resizer.downY=e.screenY;resizer.width=parseInt(resizeBox.style.width);resizer.height=parseInt(resizeBox.style.height);resizer.editorId=editor_id;resizer.resizeBox=resizeBox;resizer.horizontal=tinyMCE.getParam("theme_advanced_resize_horizontal",true);}else{resizer.resizing=false;resizeBox.style.display="none";editorArea.style.display=tinyMCE.isMSIE?"block":"table";tinyMCE.execCommand('mceResetDesignMode');}}function TinyMCE_advanced_initInstance(inst){if(tinyMCE.getParam("theme_advanced_resizing",false)){var w=TinyMCE_advanced_getCookie("TinyMCE_"+inst.editorId+"_width");var h=TinyMCE_advanced_getCookie("TinyMCE_"+inst.editorId+"_height");TinyMCE_advanced_resizeTo(inst,w,h,tinyMCE.getParam("theme_advanced_resize_horizontal",true));}}function TinyMCE_advanced_setCookie(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+escape(path):"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");document.cookie=curCookie;}function TinyMCE_advanced_getCookie(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null;}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end));}function TinyMCE_advanced_resizeTo(inst,w,h,set_w){var editorContainer=document.getElementById(inst.editorId+'_parent');var tableElm=editorContainer.firstChild;var iframe=inst.iframeElement;if(w==null||w=="null"){set_w=false;w=0;}if(h==null||h=="null")return;w=parseInt(w);h=parseInt(h);if(tinyMCE.isGecko){w+=2;h+=2;}var dx=w-tableElm.clientWidth;var dy=h-tableElm.clientHeight;if(set_w)tableElm.style.width=w+"px";tableElm.style.height=h+"px";iw=iframe.clientWidth+dx;ih=iframe.clientHeight+dy;if(tinyMCE.isGecko){iw-=2;ih-=2;}if(set_w)iframe.style.width=iw+"px";iframe.style.height=ih+"px";if(set_w){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth<minIframeWidth){dx=minIframeWidth-inst.iframeElement.clientWidth;inst.iframeElement.style.width=(iw+dx)+"px";}}}function TinyMCE_advanced_resizeEventHandler(e){var resizer=TinyMCE_advanced_resizer;if(!resizer.resizing)return;e=typeof(e)=="undefined"?window.event:e;var dx=e.screenX-resizer.downX;var dy=e.screenY-resizer.downY;var resizeBox=resizer.resizeBox;var editorId=resizer.editorId;switch(e.type){case "mousemove":if(resizer.horizontal)resizeBox.style.width=(resizer.width+dx)+"px";resizeBox.style.height=(resizer.height+dy)+"px";break;case "mouseup":TinyMCE_advanced_setResizing(e,editorId,false);TinyMCE_advanced_resizeTo(tinyMCE.getInstanceById(editorId),resizer.width+dx,resizer.height+dy,resizer.horizontal);var expires=new Date();expires.setTime(expires.getTime()+3600000*24*30);TinyMCE_advanced_setCookie("TinyMCE_"+editorId+"_width",""+(resizer.horizontal?resizer.width+dx:""),expires);TinyMCE_advanced_setCookie("TinyMCE_"+editorId+"_height",""+(resizer.height+dy),expires);break;}}function TinyMCE_advanced_getInsertLinkTemplate(){var template=new Array();template['file']='link.htm';template['width']=330;template['height']=170;template['width']+=tinyMCE.getLang('lang_insert_link_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_link_delta_height',0);return template;};function TinyMCE_advanced_getInsertImageTemplate(){var template=new Array();template['file']='image.htm?src={$src}';template['width']=340;template['height']=245;template['width']+=tinyMCE.getLang('lang_insert_image_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_image_delta_height',0);return template;};function TinyMCE_advanced_handleNodeChange(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){function selectByValue(select_elm,value){if(select_elm){for(var i=0;i<select_elm.options.length;i++){if(select_elm.options[i].value==value){select_elm.selectedIndex=i;return true;}}}return false;};function getAttrib(elm,name){return elm.getAttribute(name)?elm.getAttribute(name):"";};if(node==null){return;}var pathElm=document.getElementById(editor_id+"_path");if(pathElm){var parentNode=node;var path=new Array();while(parentNode){if(parentNode.nodeName.toLowerCase()=="body"){break;}if(parentNode.nodeType==1){path[path.length]=parentNode;}parentNode=parentNode.parentNode;}var html="";for(var i=path.length-1;i>=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName=="b"){nodeName="strong";}if(nodeName=="i"){nodeName="em";}if(getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" ";}var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeData+="class: "+className+" ";if(getAttrib(path[i],'src')!=""){nodeData+="src: "+path[i].getAttribute('src')+" ";}if(getAttrib(path[i],'href')!=""){nodeData+="href: "+path[i].getAttribute('href')+" ";}if(nodeName=="img"&&tinyMCE.getAttrib(path[i],"class").indexOf('mceItemFlash')!=-1){nodeName="flash";nodeData="";}if(nodeName=="a"&&(anchor=tinyMCE.getAttrib(path[i],"name"))!=""){nodeName="a";nodeName+="#"+anchor;nodeData="";}if(getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeName+="."+className;}if(tinyMCE.isMSIE){html+='<a title="'+nodeData+'" href="javascript:void(0);" onmousedown="tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');return false;" class="mcePathItem">'+nodeName+'</a>';}else{html+='<a title="'+nodeData+'" href="javascript:tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');" class="mcePathItem">'+nodeName+'</a>';}if(i>0){html+=" &raquo; ";}}pathElm.innerHTML=tinyMCE.getLang('lang_theme_path')+": "+html+'&nbsp;';}tinyMCE.switchClassSticky(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifyfull','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_link','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_unlink','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_outdent','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_image','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_hr','mceButtonNormal');if(node.nodeName=="A"&&tinyMCE.getAttrib(node,"class").indexOf('mceItemAnchor')!=-1)tinyMCE.switchClassSticky(editor_id+'_anchor','mceButtonSelected');var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClassSticky(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal',false);tinyMCE.switchClassSticky(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal',false);}tinyMCE.switchClassSticky(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal',false);if(undo_levels!=-1){tinyMCE.switchClassSticky(editor_id+'_undo','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_redo','mceButtonDisabled',true);}if(tinyMCE.getParentElement(node,"li,blockquote")){tinyMCE.switchClassSticky(editor_id+'_outdent','mceButtonNormal',false);}if(undo_index!=-1&&(undo_index<undo_levels-1&&undo_levels>0)){tinyMCE.switchClassSticky(editor_id+'_redo','mceButtonNormal',false);}if(undo_index!=-1&&(undo_index>0&&undo_levels>0)){tinyMCE.switchClassSticky(editor_id+'_undo','mceButtonNormal',false);}var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_advanced_setupCSSClasses(editor_id);classNode=node;breakOut=false;var index=0;do{if(classNode&&classNode.className){for(var i=0;i<selectElm.options.length;i++){if(selectElm.options[i].value==classNode.className){index=i;breakOut=true;break;}}}}while(!breakOut&&classNode!=null&&(classNode=classNode.parentNode));selectElm.selectedIndex=index;}var selectElm=document.getElementById(editor_id+"_formatSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm){selectByValue(selectElm,"<"+elm.nodeName.toLowerCase()+">");}else{selectByValue(selectElm,"");}}var selectElm=document.getElementById(editor_id+"_fontNameSelect");if(selectElm){var elm=tinyMCE.getParentElement(node);if(elm){var family=tinyMCE.getAttrib(elm,"face");if(family=='')family=''+elm.style.fontFamily;if(!selectByValue(selectElm,family))selectByValue(selectElm,"");}else selectByValue(selectElm,"");}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){var elm=tinyMCE.getParentElement(node);if(elm){var size=tinyMCE.getAttrib(elm,"size");if(size==''){var sizes=new Array('','8px','10px','12px','14px','18px','24px','36px');size=''+elm.style.fontSize;for(var i=0;i<sizes.length;i++){if((''+sizes[i])==size){size=i;break;}}}if(!selectByValue(selectElm,size))selectByValue(selectElm,"");}else selectByValue(selectElm,"0");}alignNode=node;breakOut=false;do{if(!alignNode.getAttribute||!alignNode.getAttribute('align')){continue;}switch(alignNode.getAttribute('align').toLowerCase()){case "left":tinyMCE.switchClassSticky(editor_id+'_justifyleft','mceButtonSelected');breakOut=true;break;case "right":tinyMCE.switchClassSticky(editor_id+'_justifyright','mceButtonSelected');breakOut=true;break;case "middle":case "center":tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonSelected');breakOut=true;break;case "justify":tinyMCE.switchClassSticky(editor_id+'_justifyfull','mceButtonSelected');breakOut=true;break;}}while(!breakOut&&(alignNode=alignNode.parentNode));var div=tinyMCE.getParentElement(node,"div");if(div&&div.style.textAlign=="center")tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonSelected');if(tinyMCE.isGecko&&node.nodeType==3){var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();if(doc.queryCommandState("Bold")){tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonSelected');}if(doc.queryCommandState("Italic")){tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonSelected');}if(doc.queryCommandState("Underline")&&(node.parentNode==null||node.parentNode.nodeName!="A")){tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonSelected');}if(doc.queryCommandState("Strikethrough")){tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonSelected');}}do{switch(node.nodeName.toLowerCase()){case "b":case "strong":tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonSelected');break;case "i":case "em":tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonSelected');break;case "u":tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonSelected');break;case "strike":tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonSelected');break;case "ul":tinyMCE.switchClassSticky(editor_id+'_bullist','mceButtonSelected');break;case "ol":tinyMCE.switchClassSticky(editor_id+'_numlist','mceButtonSelected');break;case "sub":tinyMCE.switchClassSticky(editor_id+'_sub','mceButtonSelected');break;case "sup":tinyMCE.switchClassSticky(editor_id+'_sup','mceButtonSelected');break;case "hr":tinyMCE.switchClassSticky(editor_id+'_hr','mceButtonSelected');break;case "img":if(getAttrib(node,'name').indexOf('mce_')!=0){tinyMCE.switchClassSticky(editor_id+'_image','mceButtonSelected');}break;}}while((node=node.parentNode));};function TinyMCE_advanced_setupCSSClasses(editor_id){if(!TinyMCE_advanced_autoImportCSSClasses){return;}var selectElm=document.getElementById(editor_id+'_styleSelect');if(selectElm&&selectElm.getAttribute('cssImported')!='true'){var csses=tinyMCE.getCSSClasses(editor_id);if(csses&&selectElm){for(var i=0;i<csses.length;i++){selectElm.options[selectElm.length]=new Option(csses[i],csses[i]);}}if(csses!=null&&csses.length>0){selectElm.setAttribute('cssImported','true');}}}; \ No newline at end of file
+ </td></tr>';}else if(containers[i]=="mceElementpath"||containers[i]=="mceStatusbar"){var pathClass="mceStatusbar";if(i==containers.length-1){pathClass="mceStatusbarBottom";}else if(i==0){pathClass="mceStatusbar";}else{deltaHeight-=2;}template['html']+='<tr><td class="'+pathClass+'" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=22;}else{var curContainer=tinyMCE.getParam("theme_advanced_container_"+containers[i],"",true,',');var curContainerHTML="";var curAlign=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align",defaultContainerAlign);var curCSS=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class",defaultContainerCSS);for(var j=0;j<curContainer.length;j++){curContainerHTML+=tinyMCE.getControlHTML(curContainer[j]);}if(curContainer.length>0){curContainerHTML+="<br />";deltaHeight-=23;}template['html']+='<tr><td class="'+curCSS+'" align="'+curAlign+'" height="1">'+curContainerHTML+'</td></tr>';}}template['html']+='</tbody></table>';break;case "BorderLayout":break;case "CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);");}break;default:alert('UNDEFINED LAYOUT MANAGER! PLEASE CHECK YOUR TINYMCE CONFIG!');break;}template['html']+='<div id="{$editor_id}_resize_box" class="mceResizeBox"></div>';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);template['delta_width']=0;template['delta_height']=deltaHeight;return template;}function TinyMCE_advanced_setResizing(e,editor_id,state){e=typeof(e)=="undefined"?window.event:e;var resizer=TinyMCE_advanced_resizer;var editorContainer=document.getElementById(editor_id+'_parent');var editorArea=document.getElementById(editor_id+'_parent').firstChild;var resizeBox=document.getElementById(editor_id+'_resize_box');var inst=tinyMCE.getInstanceById(editor_id);if(state){var width=editorArea.clientWidth;var height=editorArea.clientHeight;resizeBox.style.width=width+"px";resizeBox.style.height=height+"px";resizer.iframeWidth=inst.iframeElement.clientWidth;resizer.iframeHeight=inst.iframeElement.clientHeight;editorArea.style.display="none";resizeBox.style.display="block";if(!resizer.eventHandlers){if(tinyMCE.isMSIE)tinyMCE.addEvent(document,"mousemove",TinyMCE_advanced_resizeEventHandler);else tinyMCE.addEvent(window,"mousemove",TinyMCE_advanced_resizeEventHandler);tinyMCE.addEvent(document,"mouseup",TinyMCE_advanced_resizeEventHandler);resizer.eventHandlers=true;}resizer.resizing=true;resizer.downX=e.screenX;resizer.downY=e.screenY;resizer.width=parseInt(resizeBox.style.width);resizer.height=parseInt(resizeBox.style.height);resizer.editorId=editor_id;resizer.resizeBox=resizeBox;resizer.horizontal=tinyMCE.getParam("theme_advanced_resize_horizontal",true);}else{resizer.resizing=false;resizeBox.style.display="none";editorArea.style.display=tinyMCE.isMSIE?"block":"table";tinyMCE.execCommand('mceResetDesignMode');}}function TinyMCE_advanced_initInstance(inst){if(tinyMCE.getParam("theme_advanced_resizing",false)){if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var w=TinyMCE_advanced_getCookie("TinyMCE_"+inst.editorId+"_width");var h=TinyMCE_advanced_getCookie("TinyMCE_"+inst.editorId+"_height");TinyMCE_advanced_resizeTo(inst,w,h,tinyMCE.getParam("theme_advanced_resize_horizontal",true));}}}function TinyMCE_advanced_setCookie(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+escape(path):"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");document.cookie=curCookie;}function TinyMCE_advanced_getCookie(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null;}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end));}function TinyMCE_advanced_resizeTo(inst,w,h,set_w){var editorContainer=document.getElementById(inst.editorId+'_parent');var tableElm=editorContainer.firstChild;var iframe=inst.iframeElement;if(w==null||w=="null"){set_w=false;w=0;}if(h==null||h=="null")return;w=parseInt(w);h=parseInt(h);if(tinyMCE.isGecko){w+=2;h+=2;}var dx=w-tableElm.clientWidth;var dy=h-tableElm.clientHeight;if(set_w)tableElm.style.width=w+"px";tableElm.style.height=h+"px";iw=iframe.clientWidth+dx;ih=iframe.clientHeight+dy;if(tinyMCE.isGecko){iw-=2;ih-=2;}if(set_w)iframe.style.width=iw+"px";iframe.style.height=ih+"px";if(set_w){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth<minIframeWidth){dx=minIframeWidth-inst.iframeElement.clientWidth;inst.iframeElement.style.width=(iw+dx)+"px";}}}function TinyMCE_advanced_resizeEventHandler(e){var resizer=TinyMCE_advanced_resizer;if(!resizer.resizing)return;e=typeof(e)=="undefined"?window.event:e;var dx=e.screenX-resizer.downX;var dy=e.screenY-resizer.downY;var resizeBox=resizer.resizeBox;var editorId=resizer.editorId;switch(e.type){case "mousemove":if(resizer.horizontal)resizeBox.style.width=(resizer.width+dx)+"px";resizeBox.style.height=(resizer.height+dy)+"px";break;case "mouseup":TinyMCE_advanced_setResizing(e,editorId,false);TinyMCE_advanced_resizeTo(tinyMCE.getInstanceById(editorId),resizer.width+dx,resizer.height+dy,resizer.horizontal);if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var expires=new Date();expires.setTime(expires.getTime()+3600000*24*30);TinyMCE_advanced_setCookie("TinyMCE_"+editorId+"_width",""+(resizer.horizontal?resizer.width+dx:""),expires);TinyMCE_advanced_setCookie("TinyMCE_"+editorId+"_height",""+(resizer.height+dy),expires);}break;}}function TinyMCE_advanced_getInsertLinkTemplate(){var template=new Array();template['file']='link.htm';template['width']=330;template['height']=170;template['width']+=tinyMCE.getLang('lang_insert_link_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_link_delta_height',0);return template;};function TinyMCE_advanced_getInsertImageTemplate(){var template=new Array();template['file']='image.htm?src={$src}';template['width']=340;template['height']=245;template['width']+=tinyMCE.getLang('lang_insert_image_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_image_delta_height',0);return template;};function TinyMCE_advanced_handleNodeChange(editor_id,node,undo_index,undo_levels,visual_aid,any_selection,setup_content){function selectByValue(select_elm,value,first_index){first_index=typeof(first_index)=="undefined"?false:true;if(select_elm){for(var i=0;i<select_elm.options.length;i++){var ov=""+select_elm.options[i].value;if(first_index&&ov.toLowerCase().indexOf(value.toLowerCase())==0){select_elm.selectedIndex=i;return true;}if(ov==value){select_elm.selectedIndex=i;return true;}}}return false;};function getAttrib(elm,name){return elm.getAttribute(name)?elm.getAttribute(name):"";};if(node==null){return;}var pathElm=document.getElementById(editor_id+"_path");var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();if(pathElm){var parentNode=node;var path=new Array();while(parentNode!=null){if(parentNode.nodeName.toUpperCase()=="BODY"){break;}if(parentNode.nodeType==1){path[path.length]=parentNode;}parentNode=parentNode.parentNode;}var html="";for(var i=path.length-1;i>=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName=="b"){nodeName="strong";}if(nodeName=="i"){nodeName="em";}if(nodeName=="span"){var cn=tinyMCE.getAttrib(path[i],"class");if(cn!=""&&cn.indexOf('mceItem')==-1)nodeData+="class: "+cn+" ";var st=tinyMCE.getAttrib(path[i],"style");if(st!=""){st=tinyMCE.serializeStyle(tinyMCE.parseStyle(st));nodeData+="style: "+st+" ";}}if(nodeName=="font"){if(tinyMCE.getParam("convert_fonts_to_spans"))nodeName="span";var face=tinyMCE.getAttrib(path[i],"face");if(face!="")nodeData+="font: "+face+" ";var size=tinyMCE.getAttrib(path[i],"size");if(size!="")nodeData+="size: "+size+" ";var color=tinyMCE.getAttrib(path[i],"color");if(color!="")nodeData+="color: "+color+" ";}if(getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" ";}var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeData+="class: "+className+" ";if(getAttrib(path[i],'src')!=""){nodeData+="src: "+path[i].getAttribute('src')+" ";}if(getAttrib(path[i],'href')!=""){nodeData+="href: "+path[i].getAttribute('href')+" ";}if(nodeName=="img"&&tinyMCE.getAttrib(path[i],"class").indexOf('mceItemFlash')!=-1){nodeName="flash";nodeData="src: "+path[i].getAttribute('title');}if(nodeName=="a"&&(anchor=tinyMCE.getAttrib(path[i],"name"))!=""){nodeName="a";nodeName+="#"+anchor;nodeData="";}if(getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1){nodeName+="."+className;}}var cmd='tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');';html+='<a title="'+nodeData+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" target="_self" class="mcePathItem">'+nodeName+'</a>';if(i>0){html+=" &raquo; ";}}pathElm.innerHTML='<a href="#" accesskey="x"></a>'+tinyMCE.getLang('lang_theme_path')+": "+html+'&nbsp;';}tinyMCE.switchClassSticky(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifyfull','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_link','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_unlink','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_outdent','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_image','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_hr','mceButtonNormal');if(node.nodeName=="A"&&tinyMCE.getAttrib(node,"class").indexOf('mceItemAnchor')!=-1)tinyMCE.switchClassSticky(editor_id+'_anchor','mceButtonSelected');var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClassSticky(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal',false);tinyMCE.switchClassSticky(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal',false);}tinyMCE.switchClassSticky(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal',false);if(undo_levels!=-1){tinyMCE.switchClassSticky(editor_id+'_undo','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_redo','mceButtonDisabled',true);}if(tinyMCE.getParentElement(node,"li,blockquote")){tinyMCE.switchClassSticky(editor_id+'_outdent','mceButtonNormal',false);}if(undo_index!=-1&&(undo_index<undo_levels-1&&undo_levels>0)){tinyMCE.switchClassSticky(editor_id+'_redo','mceButtonNormal',false);}if(undo_index!=-1&&(undo_index>0&&undo_levels>0)){tinyMCE.switchClassSticky(editor_id+'_undo','mceButtonNormal',false);}var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_advanced_setupCSSClasses(editor_id);classNode=node;breakOut=false;var index=0;do{if(classNode&&classNode.className){for(var i=0;i<selectElm.options.length;i++){if(selectElm.options[i].value==classNode.className){index=i;breakOut=true;break;}}}}while(!breakOut&&classNode!=null&&(classNode=classNode.parentNode)!=null);selectElm.selectedIndex=index;}var selectElm=document.getElementById(editor_id+"_formatSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm){selectByValue(selectElm,"<"+elm.nodeName.toLowerCase()+">");}else{selectByValue(selectElm,"");}}var selectElm=document.getElementById(editor_id+"_fontNameSelect");if(selectElm){if(!tinyMCE.isSafari&&!(tinyMCE.isMSIE&&!tinyMCE.isOpera)){var face=doc.queryCommandValue('FontName');face=face==null||face==""?"":face;selectByValue(selectElm,face,face!="");}else{var elm=tinyMCE.getParentElement(node,"font","face");if(elm){var family=tinyMCE.getAttrib(elm,"face");if(family=='')family=''+elm.style.fontFamily;if(!selectByValue(selectElm,family,family!=""))selectByValue(selectElm,"");}else selectByValue(selectElm,"");}}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){if(!tinyMCE.isSafari&&!tinyMCE.isOpera){var size=doc.queryCommandValue('FontSize');selectByValue(selectElm,size==null||size==""?"0":size);}else{var elm=tinyMCE.getParentElement(node,"font","size");if(elm){var size=tinyMCE.getAttrib(elm,"size");if(size==''){var sizes=new Array('','8px','10px','12px','14px','18px','24px','36px');size=''+elm.style.fontSize;for(var i=0;i<sizes.length;i++){if((''+sizes[i])==size){size=i;break;}}}if(!selectByValue(selectElm,size))selectByValue(selectElm,"");}else selectByValue(selectElm,"0");}}alignNode=node;breakOut=false;do{if(!alignNode.getAttribute||!alignNode.getAttribute('align')){continue;}switch(alignNode.getAttribute('align').toLowerCase()){case "left":tinyMCE.switchClassSticky(editor_id+'_justifyleft','mceButtonSelected');breakOut=true;break;case "right":tinyMCE.switchClassSticky(editor_id+'_justifyright','mceButtonSelected');breakOut=true;break;case "middle":case "center":tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonSelected');breakOut=true;break;case "justify":tinyMCE.switchClassSticky(editor_id+'_justifyfull','mceButtonSelected');breakOut=true;break;}}while(!breakOut&&(alignNode=alignNode.parentNode)!=null);var div=tinyMCE.getParentElement(node,"div");if(div&&div.style.textAlign=="center")tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonSelected');if(!setup_content){var ar=new Array("Bold","_bold","Italic","_italic","Strikethrough","_strikethrough","superscript","_sup","subscript","_sub");for(var i=0;i<ar.length;i+=2){if(doc.queryCommandState(ar[i]))tinyMCE.switchClassSticky(editor_id+ar[i+1],'mceButtonSelected');}if(doc.queryCommandState("Underline")&&(node.parentNode==null||node.parentNode.nodeName!="A")){tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonSelected');}}do{switch(node.nodeName){case "UL":tinyMCE.switchClassSticky(editor_id+'_bullist','mceButtonSelected');break;case "OL":tinyMCE.switchClassSticky(editor_id+'_numlist','mceButtonSelected');break;case "HR":tinyMCE.switchClassSticky(editor_id+'_hr','mceButtonSelected');break;case "IMG":if(getAttrib(node,'name').indexOf('mce_')!=0){tinyMCE.switchClassSticky(editor_id+'_image','mceButtonSelected');}break;}}while((node=node.parentNode)!=null);};function TinyMCE_advanced_setupCSSClasses(editor_id){if(!TinyMCE_advanced_autoImportCSSClasses){return;}var selectElm=document.getElementById(editor_id+'_styleSelect');if(selectElm&&selectElm.getAttribute('cssImported')!='true'){var csses=tinyMCE.getCSSClasses(editor_id);if(csses&&selectElm){for(var i=0;i<csses.length;i++){selectElm.options[selectElm.length]=new Option(csses[i],csses[i]);}}if(csses!=null&&csses.length>0){selectElm.setAttribute('cssImported','true');}}}; \ No newline at end of file
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/editor_template_src.js b/wp-inst/wp-includes/js/tinymce/themes/advanced/editor_template_src.js
index 0f1d321..1af0f30 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/editor_template_src.js
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/editor_template_src.js
@@ -68,13 +68,15 @@ function TinyMCE_advanced_getControlHTML(button_name)
{
if (buttonTileMap[x] == but[1])
{
- return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\', ' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ', \'' + but[5] + '\'' : '') + ')" onmousedown="return false;"><img id="{$editor_id}_' + but[0] +'" src="{$themeurl}/images/spacer.gif" style="background-image:url({$themeurl}/images/buttons.gif); background-position: ' + (0-(x*20)) + 'px 0px" title="' + but[2] + '" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
+ var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\',' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ',\'' + but[5] + '\'' : '') + ')';
+ return '<a href="javascript:' + cmd + '" onclick="' + cmd + ';return false;" onmousedown="return false;" target="_self"><img id="{$editor_id}_' + but[0] +'" src="{$themeurl}/images/spacer.gif" style="background-image:url({$themeurl}/images/buttons.gif); background-position: ' + (0-(x*20)) + 'px 0px" title="' + but[2] + '" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
}
}
}
// Old style
- return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\', ' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ', \'' + but[5] + '\'' : '') + ')" onmousedown="return false;"><img id="{$editor_id}_' + but[0] + '" src="{$themeurl}/images/' + but[1] + '" title="' + but[2] + '" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
+ var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\',' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ',\'' + but[5] + '\'' : '') + ')';
+ return '<a href="javascript:' + cmd + '" onclick="' + cmd + ';return false;" onmousedown="return false;" target="_self"><img id="{$editor_id}_' + but[0] + '" src="{$themeurl}/images/' + but[1] + '" title="' + but[2] + '" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
}
}
@@ -212,6 +214,7 @@ function TinyMCE_advanced_execCommand(editor_id, element, command, user_interfac
template['file'] = 'color_picker.htm';
template['width'] = 220;
template['height'] = 190;
+ template['close_previous'] = "no";
template['width'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width', 0);
template['height'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height', 0);
@@ -244,9 +247,9 @@ function TinyMCE_advanced_execCommand(editor_id, element, command, user_interfac
var template = new Array();
template['file'] = 'charmap.htm';
- template['width'] = 550;
+ template['width'] = 550 + (tinyMCE.isOpera ? 40 : 0);
template['height'] = 250;
-
+
template['width'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_width', 0);
template['height'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_height', 0);
@@ -259,7 +262,7 @@ function TinyMCE_advanced_execCommand(editor_id, element, command, user_interfac
template['file'] = 'anchor.htm';
template['width'] = 320;
- template['height'] = 90;
+ template['height'] = 90 + (tinyMCE.isNS7 ? 30 : 0);
template['width'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_width', 0);
template['height'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_height', 0);
@@ -328,12 +331,10 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId)
// Setup style select options -- MOVED UP FOR EXTERNAL TOOLBAR COMPATABILITY!
var styleSelectHTML = '<option value="">{$lang_theme_style_select}</option>';
- if (settings['theme_advanced_styles'])
- {
+ if (settings['theme_advanced_styles']) {
var stylesAr = settings['theme_advanced_styles'].split(';');
- for (var i=0; i<stylesAr.length; i++)
- {
+ for (var i=0; i<stylesAr.length; i++) {
var key, value;
key = stylesAr[i].split('=')[0];
@@ -345,8 +346,7 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId)
TinyMCE_advanced_autoImportCSSClasses = false;
}
- switch(layoutManager)
- {
+ switch(layoutManager) {
case "SimpleLayout" : //the default TinyMCE Layout (for backwards compatibility)...
var toolbarHTML = "";
var toolbarLocation = tinyMCE.getParam("theme_advanced_toolbar_location", "bottom");
@@ -359,11 +359,14 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId)
theme_advanced_buttons3 : "hr,removeformat,visualaid,separator,sub,sup,separator,charmap"
};
+ // Add accessibility control
+ toolbarHTML += '<a href="#" accesskey="q" title="' + tinyMCE.getLang("lang_toolbar_focus") + '"></a>';
+
// Render rows
for (var i=1; i<100; i++) {
var def = defVals["theme_advanced_buttons" + i];
- buttons = tinyMCE.getParam("theme_advanced_buttons" + i, def == null ? '' : def, true, ',');
+ var buttons = tinyMCE.getParam("theme_advanced_buttons" + i, def == null ? '' : def, true, ',');
if (buttons.length == 0)
break;
@@ -380,6 +383,9 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId)
}
}
+ // Add accessibility control
+ toolbarHTML += '<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"></a>';
+
// Setup template html
template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';
@@ -435,7 +441,7 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId)
deltaHeight -= 23;
}
- template['html'] += '</table>';
+ template['html'] += '</tbody></table>';
//"SimpleLayout"
break;
@@ -585,10 +591,12 @@ function TinyMCE_advanced_setResizing(e, editor_id, state) {
function TinyMCE_advanced_initInstance(inst) {
if (tinyMCE.getParam("theme_advanced_resizing", false)) {
- var w = TinyMCE_advanced_getCookie("TinyMCE_" + inst.editorId + "_width");
- var h = TinyMCE_advanced_getCookie("TinyMCE_" + inst.editorId + "_height");
+ if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) {
+ var w = TinyMCE_advanced_getCookie("TinyMCE_" + inst.editorId + "_width");
+ var h = TinyMCE_advanced_getCookie("TinyMCE_" + inst.editorId + "_height");
- TinyMCE_advanced_resizeTo(inst, w, h, tinyMCE.getParam("theme_advanced_resize_horizontal", true));
+ TinyMCE_advanced_resizeTo(inst, w, h, tinyMCE.getParam("theme_advanced_resize_horizontal", true));
+ }
}
}
@@ -707,12 +715,14 @@ function TinyMCE_advanced_resizeEventHandler(e) {
TinyMCE_advanced_resizeTo(tinyMCE.getInstanceById(editorId), resizer.width + dx, resizer.height + dy, resizer.horizontal);
// Expire in a month
- var expires = new Date();
- expires.setTime(expires.getTime() + 3600000 * 24 * 30);
+ if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) {
+ var expires = new Date();
+ expires.setTime(expires.getTime() + 3600000 * 24 * 30);
- // Set the cookies
- TinyMCE_advanced_setCookie("TinyMCE_" + editorId + "_width", "" + (resizer.horizontal ? resizer.width + dx : ""), expires);
- TinyMCE_advanced_setCookie("TinyMCE_" + editorId + "_height", "" + (resizer.height + dy), expires);
+ // Set the cookies
+ TinyMCE_advanced_setCookie("TinyMCE_" + editorId + "_width", "" + (resizer.horizontal ? resizer.width + dx : ""), expires);
+ TinyMCE_advanced_setCookie("TinyMCE_" + editorId + "_height", "" + (resizer.height + dy), expires);
+ }
break;
}
}
@@ -756,17 +766,20 @@ function TinyMCE_advanced_getInsertImageTemplate()
/**
* Node change handler.
*/
-function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
- undo_levels, visual_aid, any_selection)
-{
- function selectByValue(select_elm, value)
- {
- if (select_elm)
- {
- for (var i=0; i<select_elm.options.length; i++)
- {
- if (select_elm.options[i].value == value)
- {
+function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index, undo_levels, visual_aid, any_selection, setup_content) {
+ function selectByValue(select_elm, value, first_index) {
+ first_index = typeof(first_index) == "undefined" ? false : true;
+
+ if (select_elm) {
+ for (var i=0; i<select_elm.options.length; i++) {
+ var ov = "" + select_elm.options[i].value;
+
+ if (first_index && ov.toLowerCase().indexOf(value.toLowerCase()) == 0) {
+ select_elm.selectedIndex = i;
+ return true;
+ }
+
+ if (ov == value) {
select_elm.selectedIndex = i;
return true;
}
@@ -776,8 +789,7 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
return false;
};
- function getAttrib(elm, name)
- {
+ function getAttrib(elm, name) {
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
};
@@ -789,23 +801,21 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
// Update path
var pathElm = document.getElementById(editor_id + "_path");
-
- if (pathElm)
- {
+ var inst = tinyMCE.getInstanceById(editor_id);
+ var doc = inst.getDoc();
+
+ if (pathElm) {
// Get node path
var parentNode = node;
var path = new Array();
- while (parentNode)
- {
- if (parentNode.nodeName.toLowerCase() == "body")
- {
+ while (parentNode != null) {
+ if (parentNode.nodeName.toUpperCase() == "BODY") {
break;
}
// Only append element nodes to path
- if (parentNode.nodeType == 1)
- {
+ if (parentNode.nodeType == 1) {
path[path.length] = parentNode;
}
@@ -814,23 +824,48 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
// Setup HTML
var html = "";
- for (var i=path.length-1; i>=0; i--)
- {
+ for (var i=path.length-1; i>=0; i--) {
var nodeName = path[i].nodeName.toLowerCase();
var nodeData = "";
- if (nodeName == "b")
- {
+ if (nodeName == "b") {
nodeName = "strong";
}
- if (nodeName == "i")
- {
+ if (nodeName == "i") {
nodeName = "em";
}
- if (getAttrib(path[i], 'id') != "")
- {
+ if (nodeName == "span") {
+ var cn = tinyMCE.getAttrib(path[i], "class");
+ if (cn != "" && cn.indexOf('mceItem') == -1)
+ nodeData += "class: " + cn + " ";
+
+ var st = tinyMCE.getAttrib(path[i], "style");
+ if (st != "") {
+ st = tinyMCE.serializeStyle(tinyMCE.parseStyle(st));
+ nodeData += "style: " + st + " ";
+ }
+ }
+
+ if (nodeName == "font") {
+ if (tinyMCE.getParam("convert_fonts_to_spans"))
+ nodeName = "span";
+
+ var face = tinyMCE.getAttrib(path[i], "face");
+ if (face != "")
+ nodeData += "font: " + face + " ";
+
+ var size = tinyMCE.getAttrib(path[i], "size");
+ if (size != "")
+ nodeData += "size: " + size + " ";
+
+ var color = tinyMCE.getAttrib(path[i], "color");
+ if (color != "")
+ nodeData += "color: " + color + " ";
+ }
+
+ if (getAttrib(path[i], 'id') != "") {
nodeData += "id: " + path[i].getAttribute('id') + " ";
}
@@ -838,52 +873,41 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
if (className != "" && className.indexOf('mceItem') == -1)
nodeData += "class: " + className + " ";
- if (getAttrib(path[i], 'src') != "")
- {
+ if (getAttrib(path[i], 'src') != "") {
nodeData += "src: " + path[i].getAttribute('src') + " ";
}
- if (getAttrib(path[i], 'href') != "")
- {
+ if (getAttrib(path[i], 'href') != "") {
nodeData += "href: " + path[i].getAttribute('href') + " ";
}
- if (nodeName == "img" && tinyMCE.getAttrib(path[i], "class").indexOf('mceItemFlash') != -1)
- {
+ if (nodeName == "img" && tinyMCE.getAttrib(path[i], "class").indexOf('mceItemFlash') != -1) {
nodeName = "flash";
- nodeData = "";
+ nodeData = "src: " + path[i].getAttribute('title');
}
- if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "")
- {
+ if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "") {
nodeName = "a";
nodeName += "#" + anchor;
nodeData = "";
}
- if (getAttrib(path[i], 'name').indexOf("mce_") != 0)
- {
+ if (getAttrib(path[i], 'name').indexOf("mce_") != 0) {
var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false);
- if (className != "" && className.indexOf('mceItem') == -1)
+ if (className != "" && className.indexOf('mceItem') == -1) {
nodeName += "." + className;
+ }
}
- if (tinyMCE.isMSIE)
- {
- html += '<a title="' + nodeData + '" href="javascript:void(0);" onmousedown="tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');return false;" class="mcePathItem">' + nodeName + '</a>';
- }
- else
- {
- html += '<a title="' + nodeData + '" href="javascript:tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');" class="mcePathItem">' + nodeName + '</a>';
- }
+ var cmd = 'tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');';
+ html += '<a title="' + nodeData + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" target="_self" class="mcePathItem">' + nodeName + '</a>';
- if (i > 0)
- {
+ if (i > 0) {
html += " &raquo; ";
}
}
- pathElm.innerHTML = tinyMCE.getLang('lang_theme_path') + ": " + html + '&nbsp;';
+ pathElm.innerHTML = '<a href="#" accesskey="x"></a>' + tinyMCE.getLang('lang_theme_path') + ": " + html + '&nbsp;';
}
// Reset old states
@@ -970,7 +994,7 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
}
}
}
- } while (!breakOut && classNode != null && (classNode = classNode.parentNode));
+ } while (!breakOut && classNode != null && (classNode = classNode.parentNode) != null);
selectElm.selectedIndex = index;
}
@@ -995,57 +1019,68 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
// Select fontselect
var selectElm = document.getElementById(editor_id + "_fontNameSelect");
if (selectElm) {
- var elm = tinyMCE.getParentElement(node);
+ if (!tinyMCE.isSafari && !(tinyMCE.isMSIE && !tinyMCE.isOpera)) {
+ var face = doc.queryCommandValue('FontName');
+
+ face = face == null || face == "" ? "" : face;
- if (elm) {
- var family = tinyMCE.getAttrib(elm, "face");
- if (family == '')
- family = '' + elm.style.fontFamily;
+ selectByValue(selectElm, face, face != "");
+ } else {
+ var elm = tinyMCE.getParentElement(node, "font", "face");
- if (!selectByValue(selectElm, family))
+ if (elm) {
+ var family = tinyMCE.getAttrib(elm, "face");
+
+ if (family == '')
+ family = '' + elm.style.fontFamily;
+
+ if (!selectByValue(selectElm, family, family != ""))
+ selectByValue(selectElm, "");
+ } else
selectByValue(selectElm, "");
- } else
- selectByValue(selectElm, "");
+ }
}
// Select fontsize
var selectElm = document.getElementById(editor_id + "_fontSizeSelect");
if (selectElm) {
- var elm = tinyMCE.getParentElement(node);
-
- if (elm) {
- var size = tinyMCE.getAttrib(elm, "size");
- if (size == '') {
- var sizes = new Array('', '8px', '10px', '12px', '14px', '18px', '24px', '36px');
-
- size = '' + elm.style.fontSize;
-
- for (var i=0; i<sizes.length; i++) {
- if (('' + sizes[i]) == size) {
- size = i;
- break;
+ if (!tinyMCE.isSafari && !tinyMCE.isOpera) {
+ var size = doc.queryCommandValue('FontSize');
+ selectByValue(selectElm, size == null || size == "" ? "0" : size);
+ } else {
+ var elm = tinyMCE.getParentElement(node, "font", "size");
+ if (elm) {
+ var size = tinyMCE.getAttrib(elm, "size");
+
+ if (size == '') {
+ var sizes = new Array('', '8px', '10px', '12px', '14px', '18px', '24px', '36px');
+
+ size = '' + elm.style.fontSize;
+
+ for (var i=0; i<sizes.length; i++) {
+ if (('' + sizes[i]) == size) {
+ size = i;
+ break;
+ }
}
}
- }
- if (!selectByValue(selectElm, size))
- selectByValue(selectElm, "");
- } else
- selectByValue(selectElm, "0");
+ if (!selectByValue(selectElm, size))
+ selectByValue(selectElm, "");
+ } else
+ selectByValue(selectElm, "0");
+ }
}
// Handle align attributes
alignNode = node;
breakOut = false;
- do
- {
- if (!alignNode.getAttribute || !alignNode.getAttribute('align'))
- {
+ do {
+ if (!alignNode.getAttribute || !alignNode.getAttribute('align')) {
continue;
}
- switch (alignNode.getAttribute('align').toLowerCase())
- {
+ switch (alignNode.getAttribute('align').toLowerCase()) {
case "left":
tinyMCE.switchClassSticky(editor_id + '_justifyleft', 'mceButtonSelected');
breakOut = true;
@@ -1067,7 +1102,7 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
breakOut = true;
break;
}
- } while (!breakOut && (alignNode = alignNode.parentNode));
+ } while (!breakOut && (alignNode = alignNode.parentNode) != null);
// Div justification
var div = tinyMCE.getParentElement(node, "div");
@@ -1075,110 +1110,79 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
tinyMCE.switchClassSticky(editor_id + '_justifycenter', 'mceButtonSelected');
// Do special text
- if (tinyMCE.isGecko && node.nodeType == 3)
- {
- var inst = tinyMCE.getInstanceById(editor_id);
- var doc = inst.getDoc();
-
- if (doc.queryCommandState("Bold"))
- {
- tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonSelected');
- }
-
- if (doc.queryCommandState("Italic"))
- {
- tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonSelected');
+ if (!setup_content) {
+ // , "JustifyLeft", "_justifyleft", "JustifyCenter", "justifycenter", "JustifyRight", "justifyright", "JustifyFull", "justifyfull", "InsertUnorderedList", "bullist", "InsertOrderedList", "numlist", "InsertUnorderedList", "bullist", "Outdent", "outdent", "Indent", "indent", "subscript", "sub"
+ var ar = new Array("Bold", "_bold", "Italic", "_italic", "Strikethrough", "_strikethrough", "superscript", "_sup", "subscript", "_sub");
+ for (var i=0; i<ar.length; i+=2) {
+ if (doc.queryCommandState(ar[i]))
+ tinyMCE.switchClassSticky(editor_id + ar[i+1], 'mceButtonSelected');
}
- if (doc.queryCommandState("Underline") &&
- (node.parentNode == null || node.parentNode.nodeName != "A"))
- {
+ if (doc.queryCommandState("Underline") && (node.parentNode == null || node.parentNode.nodeName != "A")) {
tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonSelected');
}
-
- if (doc.queryCommandState("Strikethrough"))
- {
- tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonSelected');
- }
}
// Handle elements
- do
- {
- switch (node.nodeName.toLowerCase())
- {
- case "b":
- case "strong":
+ do {
+ switch (node.nodeName) {
+/* case "B":
+ case "STRONG":
tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonSelected');
break;
- case "i":
- case "em":
+ case "I":
+ case "EM":
tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonSelected');
break;
- case "u":
+ case "U":
tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonSelected');
break;
- case "strike":
+ case "STRIKE":
tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonSelected');
- break;
+ break;*/
- case "ul":
+ case "UL":
tinyMCE.switchClassSticky(editor_id + '_bullist', 'mceButtonSelected');
break;
- case "ol":
+ case "OL":
tinyMCE.switchClassSticky(editor_id + '_numlist', 'mceButtonSelected');
break;
- case "sub":
- tinyMCE.switchClassSticky(editor_id + '_sub', 'mceButtonSelected');
- break;
-
- case "sup":
- tinyMCE.switchClassSticky(editor_id + '_sup', 'mceButtonSelected');
- break;
-
- case "hr":
+ case "HR":
tinyMCE.switchClassSticky(editor_id + '_hr', 'mceButtonSelected');
break;
- case "img":
- if (getAttrib(node, 'name').indexOf('mce_') != 0)
- {
+ case "IMG":
+ if (getAttrib(node, 'name').indexOf('mce_') != 0) {
tinyMCE.switchClassSticky(editor_id + '_image', 'mceButtonSelected');
}
break;
}
- } while ((node = node.parentNode));
+ } while ((node = node.parentNode) != null);
};
// This function auto imports CSS classes into the class selection droplist
-function TinyMCE_advanced_setupCSSClasses(editor_id)
-{
- if (!TinyMCE_advanced_autoImportCSSClasses)
- {
+function TinyMCE_advanced_setupCSSClasses(editor_id) {
+ if (!TinyMCE_advanced_autoImportCSSClasses) {
return;
}
var selectElm = document.getElementById(editor_id + '_styleSelect');
- if (selectElm && selectElm.getAttribute('cssImported') != 'true')
- {
+ if (selectElm && selectElm.getAttribute('cssImported') != 'true') {
var csses = tinyMCE.getCSSClasses(editor_id);
- if (csses && selectElm)
- {
- for (var i=0; i<csses.length; i++)
- {
+ if (csses && selectElm) {
+ for (var i=0; i<csses.length; i++) {
selectElm.options[selectElm.length] = new Option(csses[i], csses[i]);
}
}
// Only do this once
- if (csses != null && csses.length > 0)
- {
+ if (csses != null && csses.length > 0) {
selectElm.setAttribute('cssImported', 'true');
}
}
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/image.htm b/wp-inst/wp-includes/js/tinymce/themes/advanced/image.htm
index 7e7d533..b6b7755 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/image.htm
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/image.htm
@@ -5,7 +5,7 @@
<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/image.js"></script>
</head>
-<body onload="init();" style="display: none">
+<body onload="tinyMCEPopup.executeOnLoad('init();');document.getElementById('src').focus();" style="display: none">
<form onsubmit="insertImage();return false;">
<table border="0" cellpadding="0" cellspacing="0" width="200">
<tr>
@@ -18,7 +18,7 @@
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="src" type="text" id="src" value="" style="width: 200px" onchange="getImageData();"></td>
- <td><script language="javascript" type="text/javascript">renderBrowser('srcbrowser','src','image','theme_advanced_image');</script></td>
+ <td id="srcbrowsercontainer">&nbsp;</td>
</tr>
</table></td>
</tr>
@@ -78,7 +78,7 @@
<td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3"></td>
</tr>
<tr>
- <td nowrap="nowrap"><input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();">
+ <td nowrap="nowrap"><input type="submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();">
</td>
<td align="right"><input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();"></td>
</tr>
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/about.js b/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/about.js
index 99162e2..fc33f85 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/about.js
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/about.js
@@ -26,12 +26,12 @@ function init() {
html += '<tr>';
if (info.infourl != null && info.infourl != '')
- html += '<td width="50%" title="' + plugins[i] + '"><a href="' + info.infourl + '" target="_blank">' + info.longname + '</a></td>';
+ html += '<td width="50%" title="' + plugins[i] + '"><a href="' + info.infourl + '" target="mceplugin">' + info.longname + '</a></td>';
else
html += '<td width="50%" title="' + plugins[i] + '">' + info.longname + '</td>';
if (info.authorurl != null && info.authorurl != '')
- html += '<td width="35%"><a href="' + info.authorurl + '" target="_blank">' + info.author + '</a></td>';
+ html += '<td width="35%"><a href="' + info.authorurl + '" target="mceplugin">' + info.author + '</a></td>';
else
html += '<td width="35%">' + info.author + '</td>';
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js b/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js
index c26fb27..bc9df27 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js
@@ -282,10 +282,9 @@ function renderCharMapHTML() {
+ ' onmouseover="tinyMCE.switchClass(this,\'charmapOver\');'
+ 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');"'
+ ' onmouseout="tinyMCE.restoreClass(this,\'charmapOver\');"'
- + ' onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');return false;"'
- + ' title="' + charmap[i][3] + '" nowrap="nowrap">'
+ + ' nowrap="nowrap" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');"><a style="text-decoration: none;" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">'
+ charmap[i][1]
- + '</td>';
+ + '</a></td>';
if ((cols+1) % charsPerRow == 0)
html += '</tr><tr height="' + tdHeight + '">';
}
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/image.js b/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/image.js
index ea9c348..894a0ff 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/image.js
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/image.js
@@ -1,7 +1,7 @@
var url = tinyMCE.getParam("external_image_list_url");
if (url != null) {
// Fix relative
- if (url.charAt(0) != '/')
+ if (url.charAt(0) != '/' && url.indexOf('://') == -1)
url = tinyMCE.documentBasePath + "/" + url;
document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
@@ -26,6 +26,8 @@ function insertImage() {
function init() {
tinyMCEPopup.resizeToInnerSize();
+ document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
+
var formObj = document.forms[0];
for (var i=0; i<document.forms[0].align.options.length; i++) {
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/link.js b/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/link.js
index 369e489..e23d392 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/link.js
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/link.js
@@ -1,7 +1,7 @@
var url = tinyMCE.getParam("external_link_list_url");
if (url != null) {
// Fix relative
- if (url.charAt(0) != '/')
+ if (url.charAt(0) != '/' && url.indexOf('://') == -1)
url = tinyMCE.documentBasePath + "/" + url;
document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
@@ -10,6 +10,8 @@ if (url != null) {
function init() {
tinyMCEPopup.resizeToInnerSize();
+ document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','theme_advanced_link');
+
var formObj = document.forms[0];
for (var i=0; i<document.forms[0].target.options.length; i++) {
@@ -49,6 +51,13 @@ function insertLink() {
var style_class = document.forms[0].styleSelect.value;
var dummy;
+ // Make anchors absolute
+ if (href.charAt(0) == '#')
+ href = tinyMCE.settings['document_base_url'] + href;
+
+ if (target == '_self')
+ target = '';
+
window.opener.tinyMCE.insertLink(href, target, title, dummy, style_class);
tinyMCEPopup.close();
}
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js b/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js
index 5a374ae..bfbee3f 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js
@@ -39,13 +39,12 @@ function resizeInputs() {
wHeight = self.innerHeight-80;
wWidth = self.innerWidth-16;
} else {
- wHeight = document.body.clientHeight-80;
- wWidth = document.body.clientWidth-16;
+ wHeight = document.body.clientHeight - 80;
+ wWidth = document.body.clientWidth - 16;
}
document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
-
}
function renderWordWrap() {
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/langs/en.js b/wp-inst/wp-includes/js/tinymce/themes/advanced/langs/en.js
index 893dba9..ca72676 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/langs/en.js
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/langs/en.js
@@ -71,5 +71,6 @@ version : 'Version',
loaded_plugins : 'Loaded plugins',
help : 'Help',
not_set : '-- Not set --',
-close : 'Close'
+close : 'Close',
+toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X'
});
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/link.htm b/wp-inst/wp-includes/js/tinymce/themes/advanced/link.htm
index 53d686e..dc24a42 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/link.htm
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/link.htm
@@ -5,7 +5,7 @@
<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/link.js"></script>
</head>
-<body onload="init();" style="display: none">
+<body onload="tinyMCEPopup.executeOnLoad('init();');document.getElementById('href').focus();" style="display: none">
<form onsubmit="insertLink();return false;">
<table border="0" cellpadding="0" cellspacing="0" width="100">
<tr>
@@ -18,7 +18,7 @@
<td> <table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="href" type="text" id="href" value="" style="width: 200px"></td>
- <td><script language="javascript" type="text/javascript">renderBrowser('hrefbrowser','href','file','theme_advanced_link');</script></td>
+ <td id="hrefbrowsercontainer">&nbsp;</td>
</tr>
</table></td>
</tr>
@@ -79,7 +79,7 @@
<td align="right">&nbsp;</td>
</tr>
<tr>
- <td><input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertLink();">
+ <td><input type="submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertLink();">
</td>
<td align="right"><input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();"></td>
</tr>
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/source_editor.htm b/wp-inst/wp-includes/js/tinymce/themes/advanced/source_editor.htm
index 2c24522..3142fae 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/source_editor.htm
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/source_editor.htm
@@ -1,11 +1,11 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>{$lang_theme_code_title}</title>
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/source_editor.js"></script>
</head>
-<body onload="onLoadInit();" onresize="resizeInputs();" style="display: none">
+<body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');document.getElementById('htmlSource').focus();" onresize="resizeInputs();" style="display: none">
<form name="source" onsubmit="saveContent();" action="#">
<div style="float: left" class="title">{$lang_theme_code_title}</div>
diff --git a/wp-inst/wp-includes/js/tinymce/tiny_mce.js b/wp-inst/wp-includes/js/tinymce/tiny_mce.js
index 301e129..85955fc 100644
--- a/wp-inst/wp-includes/js/tinymce/tiny_mce.js
+++ b/wp-inst/wp-includes/js/tinymce/tiny_mce.js
@@ -1,11 +1,11 @@
/**
- * $RCSfile: tiny_mce_src.js,v $
- * $Revision: 1.233 $
- * $Date: 2005/08/26 15:20:32 $
+ * $RCSfile: tiny_mce.js,v $
+ * $Revision: 1.301 $
+ * $Date: 2005/10/30 16:06:56 $
*
* @author Moxiecode
* @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
*/
- function TinyMCE(){this.majorVersion="2";this.minorVersion="0RC2";this.releaseDate="2005-09-12";this.instances=new Array();this.stickyClassesLookup=new Array();this.windowArgs=new Array();this.loadedFiles=new Array();this.configs=new Array();this.currentConfig=0;this.eventHandlers=new Array();this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5.0')!=-1);this.isGecko=navigator.userAgent.indexOf('Gecko')!=-1;this.isSafari=navigator.userAgent.indexOf('Safari')!=-1;this.isMac=navigator.userAgent.indexOf('Mac')!=-1;this.dialogCounter=0;this.idCounter=0;};TinyMCE.prototype.defParam=function(key,def_val){this.settings[key]=tinyMCE.getParam(key,def_val);};TinyMCE.prototype.init=function(settings){var theme;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){var elements=document.getElementsByTagName('script');for(var i=0;i<elements.length;i++){if(elements[i].src&&(elements[i].src.indexOf("tiny_mce.js")!=-1||elements[i].src.indexOf("tiny_mce_src.js")!=-1||elements[i].src.indexOf("tiny_mce_gzip.php")!=-1)){var src=elements[i].src;tinyMCE.srcMode=(src.indexOf('_src')!=-1)?'_src':'';src=src.substring(0,src.lastIndexOf('/'));tinyMCE.baseURL=src;break;}}}this.documentBasePath=document.location.href;if(this.documentBasePath.indexOf('?')!=-1)this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.indexOf('?'));this.documentURL=this.documentBasePath;this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.lastIndexOf('/'));if(tinyMCE.baseURL.indexOf('://')==-1&&tinyMCE.baseURL.charAt(0)!='/'){tinyMCE.baseURL=this.documentBasePath+"/"+tinyMCE.baseURL;}this.defParam("mode","none");this.defParam("theme","advanced");this.defParam("plugins","",true);this.defParam("language","en");this.defParam("docs_language",this.settings['language']);this.defParam("elements","");this.defParam("textarea_trigger","mce_editable");this.defParam("editor_selector","");this.defParam("editor_deselector","mceNoEditor");this.defParam("valid_elements","+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/b[class|style],-em/i[class|style],-strike[class|style],-u[class|style],+p[style|dir|class|align],-ol[class],-ul[class],-li[class],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border=0|alt|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],-td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align],address[class|align],-h1[style|dir|class|align],-h2[style|dir|class|align],-h3[style|dir|class|align],-h4[style|dir|class|align],-h5[style|dir|class|align],-h6[style|dir|class|align],hr[class]");this.defParam("extended_valid_elements","");this.defParam("invalid_elements","");this.defParam("encoding","");this.defParam("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE.prototype.convertURL"));this.defParam("save_callback","");this.defParam("debug",false);this.defParam("force_br_newlines",false);this.defParam("force_p_newlines",true);this.defParam("add_form_submit_trigger",true);this.defParam("relative_urls",true);this.defParam("remove_script_host",true);this.defParam("focus_alert",true);this.defParam("document_base_url",this.documentURL);this.defParam("visual",true);this.defParam("visual_table_class","mceVisualAid");this.defParam("setupcontent_callback","");this.defParam("fix_content_duplication",true);this.defParam("custom_undo_redo",true);this.defParam("custom_undo_redo_levels",-1);this.defParam("custom_undo_redo_keyboard_shortcuts",true);this.defParam("verify_css_classes",false);this.defParam("verify_html",true);this.defParam("apply_source_formatting",false);this.defParam("directionality","ltr");this.defParam("cleanup_on_startup",false);this.defParam("inline_styles",false);this.defParam("convert_newlines_to_brs",false);this.defParam("auto_reset_designmode",true);this.defParam("entities","160,nbsp,38,amp,34,quot,162,cent,8364,euro,163,pound,165,yen,169,copy,174,reg,8482,trade,8240,permil,181,micro,183,middot,8226,bull,8230,hellip,8242,prime,8243,Prime,167,sect,182,para,223,szlig,8249,lsaquo,8250,rsaquo,171,laquo,187,raquo,8216,lsquo,8217,rsquo,8220,ldquo,8221,rdquo,8218,sbquo,8222,bdquo,60,lt,62,gt,8804,le,8805,ge,8211,ndash,8212,mdash,175,macr,8254,oline,164,curren,166,brvbar,168,uml,161,iexcl,191,iquest,710,circ,732,tilde,176,deg,8722,minus,177,plusmn,247,divide,8260,frasl,215,times,185,sup1,178,sup2,179,sup3,188,frac14,189,frac12,190,frac34,402,fnof,8747,int,8721,sum,8734,infin,8730,radic,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8712,isin,8713,notin,8715,ni,8719,prod,8743,and,8744,or,172,not,8745,cap,8746,cup,8706,part,8704,forall,8707,exist,8709,empty,8711,nabla,8727,lowast,8733,prop,8736,ang,180,acute,184,cedil,170,ordf,186,ordm,8224,dagger,8225,Dagger,192,Agrave,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,202,Ecirc,203,Euml,204,Igrave,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,212,Ocirc,213,Otilde,214,Ouml,216,Oslash,338,OElig,217,Ugrave,219,Ucirc,220,Uuml,376,Yuml,222,THORN,224,agrave,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,234,ecirc,235,euml,236,igrave,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,244,ocirc,245,otilde,246,ouml,248,oslash,339,oelig,249,ugrave,251,ucirc,252,uuml,254,thorn,255,yuml,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,8501,alefsym,982,piv,8476,real,977,thetasym,978,upsih,8472,weierp,8465,image,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8756,there4,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,173,shy,233,eacute,237,iacute,243,oacute,250,uacute,193,Aacute,225,aacute,201,Eacute,205,Iacute,211,Oacute,218,Uacute,221,Yacute,253,yacute");this.defParam("entity_encoding","named");this.defParam("cleanup_callback","");this.defParam("add_unload_trigger",true);this.defParam("ask",false);this.defParam("nowrap",false);this.defParam("auto_resize",false);this.defParam("auto_focus",false);this.defParam("cleanup",true);this.defParam("remove_linebreaks",true);this.defParam("button_tile_map",false);this.defParam("submit_patch",true);this.defParam("browsers","msie,safari,gecko");this.defParam("dialog_type","window");this.defParam("convert_fonts_to_styles",true);if(this.isMSIE&&this.settings['browsers'].indexOf('msie')==-1)return;if(this.isGecko&&this.settings['browsers'].indexOf('gecko')==-1)return;if(this.isSafari&&this.settings['browsers'].indexOf('safari')==-1)return;var baseHREF=tinyMCE.settings['document_base_url'];if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings['base_href']=baseHREF.substring(0,baseHREF.lastIndexOf('/'))+"/";theme=this.settings['theme'];this.blockRegExp=new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td)$","i");this.posKeyCodes=new Array(13,45,36,35,33,34,37,38,39,40);this.settings['theme_href']=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isMSIE)this.settings['force_br_newlines']=false;if(tinyMCE.getParam("content_css",false)){var cssPath=tinyMCE.getParam("content_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['content_css']=this.documentBasePath+"/"+cssPath;else this.settings['content_css']=cssPath;}else this.settings['content_css']='';if(tinyMCE.getParam("popups_css",false)){var cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['popups_css']=this.documentBasePath+"/"+cssPath;else this.settings['popups_css']=cssPath;}else this.settings['popups_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){var cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['editor_css']=this.documentBasePath+"/"+cssPath;else this.settings['editor_css']=cssPath;}else this.settings['editor_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_ui.css";if(tinyMCE.settings['debug']){var msg="Debug: \n";msg+="baseURL: "+this.baseURL+"\n";msg+="documentBasePath: "+this.documentBasePath+"\n";msg+="content_css: "+this.settings['content_css']+"\n";msg+="popups_css: "+this.settings['popups_css']+"\n";msg+="editor_css: "+this.settings['editor_css']+"\n";alert(msg);}this._initCleanup();if(this.configs.length==0){if(this.isSafari&&this.getParam('safari_warning',true))alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.");tinyMCE.addEvent(window,"load",TinyMCE.prototype.onLoad);if(tinyMCE.isMSIE){if(tinyMCE.settings['add_unload_trigger']){tinyMCE.addEvent(window,"unload",TinyMCE.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE.prototype.unloadHandler);}}else{if(tinyMCE.settings['add_unload_trigger'])tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true);});}}this.loadScript(tinyMCE.baseURL+'/themes/'+this.settings['theme']+'/editor_template'+tinyMCE.srcMode+'.js');this.loadScript(tinyMCE.baseURL+'/langs/'+this.settings['language']+'.js');this.loadCSS(this.settings['editor_css']);var themePlugins=tinyMCE.getParam('plugins','',true,',');if(this.settings['plugins']!=''){for(var i=0;i<themePlugins.length;i++)this.loadScript(tinyMCE.baseURL+'/plugins/'+themePlugins[i]+'/editor_plugin'+tinyMCE.srcMode+'.js');}settings['index']=this.configs.length;this.configs[this.configs.length]=settings;};TinyMCE.prototype.loadScript=function(url){for(var i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return;}document.write('<sc'+'ript language="javascript" type="text/javascript" src="'+url+'"></script>');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.loadCSS=function(url){for(var i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return;}document.write('<link href="'+url+'" rel="stylesheet" type="text/css" />');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.importCSS=function(doc,css_file){if(css_file=='')return;if(tinyMCE.isMSIE)var styleSheet=doc.createStyleSheet(css_file);else{var elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if(headArr=doc.getElementsByTagName("head"))headArr[0].appendChild(elm);}};TinyMCE.prototype.confirmAdd=function(e,settings){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang['lang_edit_confirm']))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true');};TinyMCE.prototype.updateContent=function(form_element_name){var formElement=document.getElementById(form_element_name);for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();if(inst.formElement==formElement){var doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isMSIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid);}}};TinyMCE.prototype.addMCEControl=function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCEControl(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst.onAdd(replace_element,form_element_name,target_document);};TinyMCE.prototype.triggerSave=function(skip_cleanup,skip_callback){for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();tinyMCE.settings['preformatted']=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tinyMCE._setHTML(inst.getDoc(),inst.getBody().innerHTML);if(inst.settings['cleanup']==false){tinyMCE.handleVisualAid(inst.getBody(),true,false,inst);tinyMCE._setEventsEnabled(inst.getBody(),false);}tinyMCE._customCleanup(inst,"submit_content_dom",inst.contentWindow.document.body);var htm=skip_cleanup?inst.getBody().innerHTML:tinyMCE._cleanupHTML(inst,inst.getDoc(),this.settings,inst.getBody(),this.visualAid,true);htm=tinyMCE._customCleanup(inst,"submit_content",htm);if(tinyMCE.settings["encoding"]=="xml"||tinyMCE.settings["encoding"]=="html")htm=tinyMCE.convertStringToXML(htm);if(!skip_callback&&tinyMCE.settings['save_callback']!="")var content=eval(tinyMCE.settings['save_callback']+"(inst.formTargetElementId,htm,inst.getBody());");if((typeof(content)!="undefined")&&content!=null)htm=content;htm=tinyMCE.regexpReplace(htm,"&#40;","(","gi");htm=tinyMCE.regexpReplace(htm,"&#41;",")","gi");htm=tinyMCE.regexpReplace(htm,"&#59;",";","gi");htm=tinyMCE.regexpReplace(htm,"&#34;","&quot;","gi");htm=tinyMCE.regexpReplace(htm,"&#94;","^","gi");if(inst.formElement)inst.formElement.value=htm;}};TinyMCE.prototype._setEventsEnabled=function(node,state){var events=new Array('onfocus','onblur','onclick','ondblclick','onmousedown','onmouseup','onmouseover','onmousemove','onmouseout','onkeypress','onkeydown','onkeydown','onkeyup');var elms=node.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var event="";for(var x=0;x<events.length;x++){if((event=tinyMCE.getAttrib(elms[i],events[x]))!=''){event=tinyMCE.cleanupEventStr(""+event);if(state)event="return true;"+event;else event=event.replace(/^return true;/gi,'');elms[i].removeAttribute(events[x]);elms[i].setAttribute(events[x],event);}}}};TinyMCE.prototype.resetForm=function(form_index){var formObj=document.forms[form_index];for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();for(var i=0;i<formObj.elements.length;i++){if(inst.formTargetElementId==formObj.elements[i].name){inst.getBody().innerHTML=formObj.elements[i].value;return;}}}};TinyMCE.prototype.execInstanceCommand=function(editor_id,command,user_interface,value,focus){var inst=tinyMCE.getInstanceById(editor_id);if(inst){if(typeof(focus)=="undefined")focus=true;if(focus)inst.contentWindow.focus();inst.autoResetDesignMode();this.selectedElement=inst.getFocusElement();this.selectedInstance=inst;tinyMCE.execCommand(command,user_interface,value);}};TinyMCE.prototype.execCommand=function(command,user_interface,value){user_interface=user_interface?user_interface:false;value=value?value:null;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();switch(command){case 'mceHelp':var template=new Array();template['file']='about.htm';template['width']=480;template['height']=380;tinyMCE.openWindow(template,{tinymce_version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion,tinymce_releasedate:tinyMCE.releaseDate,inline:"yes"});return;case 'mceFocus':var inst=tinyMCE.getInstanceById(value);if(inst)inst.contentWindow.focus();return;case "mceAddControl":case "mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case "mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value['element'],value['document']);return;case "mceRemoveControl":case "mceRemoveEditor":tinyMCE.removeMCEControl(value);return;case "mceResetDesignMode":if(!tinyMCE.isMSIE){for(var n in tinyMCE.instances){try{tinyMCE.instances[n].getDoc().designMode="on";}catch(e){}}}return;}if(this.selectedInstance)this.selectedInstance.execCommand(command,user_interface,value);else if(tinyMCE.settings['focus_alert'])alert(tinyMCELang['lang_focus_alert']);};TinyMCE.prototype.eventPatch=function(editor_id){if(typeof(tinyMCE)=="undefined")return true;for(var i=0;i<document.frames.length;i++){if(document.frames[i].event){var event=document.frames[i].event;event.target=event.srcElement;TinyMCE.prototype.handleEvent(event);return;}}};TinyMCE.prototype.unloadHandler=function(){tinyMCE.triggerSave(true,true);};TinyMCE.prototype.addEventHandlers=function(editor_id){if(tinyMCE.isMSIE){var doc=document.frames[editor_id].document;tinyMCE.addEvent(doc,"keypress",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"keyup",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"keydown",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"mouseup",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"click",TinyMCE.prototype.eventPatch);}else{var inst=tinyMCE.instances[editor_id];var doc=inst.getDoc();inst.switchSettings();tinyMCE.addEvent(doc,"keypress",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keydown",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keyup",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"click",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"mouseup",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"mousedown",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"focus",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"blur",tinyMCE.handleEvent);eval('try { doc.designMode = "On"; } catch(e) {}');}};TinyMCE.prototype._createIFrame=function(replace_element){var iframe=document.createElement("iframe");var id=replace_element.getAttribute("id");iframe.setAttribute("id",id);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",tinyMCE.settings['area_width']);iframe.setAttribute("height",tinyMCE.settings['area_height']);iframe.setAttribute("allowtransparency","true");if(tinyMCE.settings["auto_resize"])iframe.setAttribute("scrolling","no");if(tinyMCE.isMSIE)iframe.setAttribute("src",this.settings['default_document']);iframe.style.width=tinyMCE.settings['area_width'];iframe.style.height=tinyMCE.settings['area_height'];if(tinyMCE.isMSIE)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isMSIE)return window.frames[id];else return iframe;};TinyMCE.prototype.setupContent=function(editor_id){var inst=tinyMCE.instances[editor_id];var doc=inst.getDoc();var head=doc.getElementsByTagName('head').item(0);var content=inst.startContent;inst.switchSettings();if(!tinyMCE.isMSIE&&doc.title!="blank_page"){doc.location.href=tinyMCE.baseURL+"/blank.htm";window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",1000);return;}if(!head){window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",10);return;}tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/themes/"+inst.settings['theme']+"/css/editor_content.css");tinyMCE.importCSS(inst.getDoc(),inst.settings['content_css']);tinyMCE.executeCallback('init_instance_callback','_initInstance',0,inst);if(tinyMCE.settings['nowrap'])doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings['directionality'];doc.editorId=editor_id;if(!tinyMCE.isMSIE)doc.documentElement.editorId=editor_id;base=doc.createElement("base");base.setAttribute('href',tinyMCE.settings['base_href']);head.appendChild(base);if(tinyMCE.settings['convert_newlines_to_brs']){content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");content=tinyMCE.regexpReplace(content,"\r","<br />","gi");content=tinyMCE.regexpReplace(content,"\n","<br />","gi");}content=tinyMCE._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isMSIE){window.setInterval('try{tinyMCE.getCSSClasses(document.frames["'+editor_id+'"].document, "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings["force_br_newlines"])document.frames[editor_id].document.styleSheets[0].addRule("p","margin: 0px;");var body=document.frames[editor_id].document.body;tinyMCE.addEvent(body,"beforepaste",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(body,"beforecut",TinyMCE.prototype.eventPatch);body.editorId=editor_id;}if(!tinyMCE.isMSIE){var contentElement=inst.getDoc().createElement("body");var doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.settings['force_p_newlines'])content=content.replace(new RegExp('&lt;&gt;','g'),"");if(tinyMCE.settings['cleanup_on_startup'])inst.getBody().innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement);else{content=tinyMCE.regexpReplace(content,"<strong","<b","gi");content=tinyMCE.regexpReplace(content,"<em(/?)>","<i$1>","gi");content=tinyMCE.regexpReplace(content,"<em ","<i ","gi");content=tinyMCE.regexpReplace(content,"</strong>","</b>","gi");content=tinyMCE.regexpReplace(content,"</em>","</i>","gi");inst.getBody().innerHTML=content;}inst.convertAllRelativeURLs();}else{if(tinyMCE.settings['cleanup_on_startup']){tinyMCE._setHTML(inst.getDoc(),content);eval('try {inst.getBody().innerHTML = tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody());} catch(e) {}');}else tinyMCE._setHTML(inst.getDoc(),content);}var parentElm=document.getElementById(inst.editorId+'_parent');if(parentElm.lastChild.nodeName.toLowerCase()=="input")inst.formElement=parentElm.lastChild;else inst.formElement=parentElm.nextSibling;tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings['visual'],inst);tinyMCE.executeCallback('setupcontent_callback','_setupContent',0,editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isMSIE)TinyMCE.prototype.addEventHandlers(editor_id);if(tinyMCE.isMSIE)tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE.prototype.eventPatch);tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE.triggerNodeChange(false,true);tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());tinyMCE._setEventsEnabled(inst.getBody(),true);inst.startContent=tinyMCE.trim(inst.getBody().innerHTML);inst.undoLevels[inst.undoLevels.length]=inst.startContent;};TinyMCE.prototype.cancelEvent=function(e){if(tinyMCE.isMSIE){e.returnValue=false;e.cancelBubble=true;}else e.preventDefault();};TinyMCE.prototype.removeTinyMCEFormElements=function(form_obj){for(var i=0;i<form_obj.elements.length;i++){var elementId=form_obj.elements[i].name?form_obj.elements[i].name:form_obj.elements[i].id;if(elementId.indexOf('mce_editor_')==0)form_obj.elements[i].disabled=true;}};TinyMCE.prototype.accessibleEventHandler=function(e){var win=this._win;e=tinyMCE.isMSIE?win.event:e;var elm=tinyMCE.isMSIE?e.srcElement:e.target;if(elm.nodeName=="SELECT"&&!elm.oldonchange){elm.oldonchange=elm.onchange;elm.onchange=null;}if(e.keyCode==13){elm.onchange=elm.oldonchange;elm.onchange();elm.oldonchange=null;tinyMCE.cancelEvent(e);}};TinyMCE.prototype.addSelectAccessibility=function(e,select,win){if(!select._isAccessible){select.onkeydown=tinyMCE.accessibleEventHandler;select._isAccessible=true;select._win=win;}};TinyMCE.prototype.handleEvent=function(e){if(typeof(tinyMCE)=="undefined")return true;switch(e.type){case "blur":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.execCommand('mceEndTyping');return;case "submit":tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE?window.event.srcElement:e.target);tinyMCE.triggerSave();tinyMCE.isNotDirty=true;return;case "reset":var formObj=tinyMCE.isMSIE?window.event.srcElement:e.target;for(var i=0;i<document.forms.length;i++){if(document.forms[i]==formObj)window.setTimeout('tinyMCE.resetForm('+i+');',10);}return;case "keypress":if(e.target.editorId){tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];}else{if(e.target.ownerDocument.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.ownerDocument.editorId];}if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&e.keyCode==13&&!e.shiftKey){if(tinyMCE.selectedInstance._insertPara(e)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false;}}if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false;}}if(tinyMCE.isGecko&&e.ctrlKey&&tinyMCE.settings['custom_undo_redo']){if(tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']){if(e.charCode==122){tinyMCE.selectedInstance.execCommand("Undo");e.preventDefault();return false;}if(e.charCode==121){tinyMCE.selectedInstance.execCommand("Redo");e.preventDefault();return false;}}if(e.charCode==98){tinyMCE.selectedInstance.execCommand("Bold");e.preventDefault();return false;}if(e.charCode==105){tinyMCE.selectedInstance.execCommand("Italic");e.preventDefault();return false;}if(e.charCode==117){tinyMCE.selectedInstance.execCommand("Underline");e.preventDefault();return false;}}if(tinyMCE.isMSIE&&tinyMCE.settings['force_br_newlines']&&e.keyCode==13){if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];if(tinyMCE.selectedInstance){var sel=tinyMCE.selectedInstance.getDoc().selection;var rng=sel.createRange();if(tinyMCE.getParentElement(rng.parentElement(),"li")!=null)return false;e.returnValue=false;e.cancelBubble=true;rng.pasteHTML("<br />");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return false;}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false);}return false;break;case "keyup":case "keydown":if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];else return;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false;}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;var elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);if(tinyMCE.isGecko&&tinyMCE.settings['document_base_url']!=""+document.location.href&&e.type=="keyup"&&e.ctrlKey&&e.keyCode==86)tinyMCE.selectedInstance.fixBrokenURLs();if(tinyMCE.isMSIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isMSIE&&e.type=="keyup"&&e.keyCode==13){var elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML="&nbsp;&nbsp;";else elm.innerHTML="&nbsp;";}}}var keys=tinyMCE.posKeyCodes;var posKey=false;for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){posKey=true;break;}}if(tinyMCE.isMSIE&&tinyMCE.settings['custom_undo_redo']){var keys=new Array(8,46);for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){if(e.type=="keyup")tinyMCE.triggerNodeChange(false);}}if(tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']){if(e.keyCode==90&&e.ctrlKey&&e.type=="keydown"){tinyMCE.selectedInstance.execCommand("Undo");tinyMCE.triggerNodeChange(false);}if(e.keyCode==89&&e.ctrlKey&&e.type=="keydown"){tinyMCE.selectedInstance.execCommand("Redo");tinyMCE.triggerNodeChange(false);}if((e.keyCode==90||e.keyCode==89)&&e.ctrlKey){e.returnValue=false;e.cancelBubble=true;return false;}}}if(!posKey&&e.type=="keyup")tinyMCE.execCommand("mceStartTyping");if(e.type=="keyup"&&(posKey||e.ctrlKey))tinyMCE.execCommand("mceEndTyping");if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);break;case "mousedown":case "mouseup":case "click":case "focus":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var targetBody=tinyMCE.getParentElement(e.target,"body");for(var instanceName in tinyMCE.instances){var inst=tinyMCE.instances[instanceName];inst.autoResetDesignMode();if(inst.getBody()==targetBody){tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"img");break;}}if(tinyMCE.isSafari){tinyMCE.selectedInstance.lastSafariSelection=tinyMCE.selectedInstance.getBookmark();tinyMCE.selectedInstance.lastSafariSelectedElement=tinyMCE.selectedElement;var lnk=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");if(lnk&&e.type=="mousedown"){lnk.setAttribute("mce_real_href",lnk.getAttribute("href"));lnk.setAttribute("href","javascript:void(0);");}if(lnk&&e.type=="click"){window.setTimeout(function(){lnk.setAttribute("href",lnk.getAttribute("mce_real_href"));lnk.removeAttribute("mce_real_href");},10);}}if(e.type!="focus")tinyMCE.selectedNode=null;tinyMCE.triggerNodeChange(false);tinyMCE.execCommand("mceEndTyping");if(e.type=="mouseup")tinyMCE.execCommand("mceAddUndoLevel");if(!tinyMCE.selectedInstance&&e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];if(tinyMCE.isGecko&&tinyMCE.settings['document_base_url']!=""+document.location.href)window.setTimeout('tinyMCE.getInstanceById("'+inst.editorId+'").fixBrokenURLs();',10);return false;break;}};TinyMCE.prototype.switchClass=function(element,class_name,lock_state){var lockChanged=false;if(typeof(lock_state)!="undefined"&&element!=null){element.classLock=lock_state;lockChanged=true;}if(element!=null&&(lockChanged||!element.classLock)){element.oldClassName=element.className;element.className=class_name;}};TinyMCE.prototype.restoreAndSwitchClass=function(element,class_name){if(element!=null&&!element.classLock){this.restoreClass(element);this.switchClass(element,class_name);}};TinyMCE.prototype.switchClassSticky=function(element_name,class_name,lock_state){var element,lockChanged=false;if(!this.stickyClassesLookup[element_name])this.stickyClassesLookup[element_name]=document.getElementById(element_name);element=this.stickyClassesLookup[element_name];if(typeof(lock_state)!="undefined"&&element!=null){element.classLock=lock_state;lockChanged=true;}if(element!=null&&(lockChanged||!element.classLock)){element.className=class_name;element.oldClassName=class_name;}};TinyMCE.prototype.restoreClass=function(element){if(element!=null&&element.oldClassName&&!element.classLock){element.className=element.oldClassName;element.oldClassName=null;}};TinyMCE.prototype.setClassLock=function(element,lock_state){if(element!=null)element.classLock=lock_state;};TinyMCE.prototype.addEvent=function(obj,name,handler){if(tinyMCE.isMSIE){obj.attachEvent("on"+name,handler);}else obj.addEventListener(name,handler,false);};TinyMCE.prototype.submitPatch=function(){tinyMCE.removeTinyMCEFormElements(this);tinyMCE.triggerSave();this.oldSubmit();tinyMCE.isNotDirty=true;};TinyMCE.prototype.onLoad=function(){for(var c=0;c<tinyMCE.configs.length;c++){tinyMCE.settings=tinyMCE.configs[c];var selector=tinyMCE.getParam("editor_selector");var deselector=tinyMCE.getParam("editor_deselector");var elementRefAr=new Array();if(document.forms&&tinyMCE.settings['add_form_submit_trigger']&&!tinyMCE.submitTriggers){for(var i=0;i<document.forms.length;i++){var form=document.forms[i];tinyMCE.addEvent(form,"submit",TinyMCE.prototype.handleEvent);tinyMCE.addEvent(form,"reset",TinyMCE.prototype.handleEvent);tinyMCE.submitTriggers=true;if(tinyMCE.settings['submit_patch']){try{form.oldSubmit=form.submit;form.submit=TinyMCE.prototype.submitPatch;}catch(e){}}}}var mode=tinyMCE.settings['mode'];switch(mode){case "exact":var elements=tinyMCE.getParam('elements','',true,',');for(var i=0;i<elements.length;i++){var element=tinyMCE._getElementById(elements[i]);var trigger=element?element.getAttribute(tinyMCE.settings['textarea_trigger']):"";if(tinyMCE.getAttrib(element,"class").indexOf(deselector)!=-1)continue;if(trigger=="false")continue;if(tinyMCE.settings['ask']&&element){elementRefAr[elementRefAr.length]=element;continue;}if(element)tinyMCE.addMCEControl(element,elements[i]);else if(tinyMCE.settings['debug'])alert("Error: Could not find element by id or name: "+elements[i]);}break;case "specific_textareas":case "textareas":var nodeList=document.getElementsByTagName("textarea");for(var i=0;i<nodeList.length;i++){var elm=nodeList.item(i);var trigger=elm.getAttribute(tinyMCE.settings['textarea_trigger']);if(selector!=''&&tinyMCE.getAttrib(elm,"class").indexOf(selector)==-1)continue;if(tinyMCE.getAttrib(elm,"class").indexOf(deselector)!=-1)continue;if((mode=="specific_textareas"&&trigger=="true")||(mode=="textareas"&&trigger!="false"))elementRefAr[elementRefAr.length]=elm;}break;}for(var i=0;i<elementRefAr.length;i++){var element=elementRefAr[i];var elementId=element.name?element.name:element.id;if(tinyMCE.settings['ask']){if(tinyMCE.isGecko){var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(e){window.setTimeout(function(){TinyMCE.prototype.confirmAdd(e,settings);},10);});}else{var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(){TinyMCE.prototype.confirmAdd(null,settings);});}}else tinyMCE.addMCEControl(element,elementId);}if(tinyMCE.settings['auto_focus']){window.setTimeout(function(){var inst=tinyMCE.getInstanceById(tinyMCE.settings['auto_focus']);inst.selectNode(inst.getBody(),true,true);inst.contentWindow.focus();},10);}tinyMCE.executeCallback('oninit','_oninit',0);}};TinyMCE.prototype.removeMCEControl=function(editor_id){var inst=tinyMCE.getInstanceById(editor_id);if(inst){inst.switchSettings();editor_id=inst.editorId;var html=tinyMCE.getContent(editor_id);var tmpInstances=new Array();for(var instanceName in tinyMCE.instances){var instance=tinyMCE.instances[instanceName];if(instanceName!=editor_id)tmpInstances[instanceName]=instance;}tinyMCE.instances=tmpInstances;tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;var replaceElement=document.getElementById(editor_id+"_parent");var oldTargetElement=inst.oldTargetElement;var targetName=oldTargetElement.nodeName.toLowerCase();if(targetName=="textarea"||targetName=="input"){replaceElement.parentNode.removeChild(replaceElement);oldTargetElement.style.display="inline";oldTargetElement.value=html;}else{oldTargetElement.innerHTML=html;replaceElement.parentNode.insertBefore(oldTargetElement,replaceElement);replaceElement.parentNode.removeChild(replaceElement);}}};TinyMCE.prototype._cleanupElementName=function(element_name,element){var name="";element_name=element_name.toLowerCase();if(element_name=="body")return null;if(tinyMCE.cleanup_verify_html){for(var i=0;i<tinyMCE.cleanup_invalidElements.length;i++){if(tinyMCE.cleanup_invalidElements[i]==element_name)return null;}var validElement=false;var elementAttribs=null;for(var i=0;i<tinyMCE.cleanup_validElements.length&&!elementAttribs;i++){for(var x=0,n=tinyMCE.cleanup_validElements[i][0].length;x<n;x++){var elmMatch=tinyMCE.cleanup_validElements[i][0][x];if(elmMatch.charAt(0)=='+'||elmMatch.charAt(0)=='-')elmMatch=elmMatch.substring(1);if(elmMatch.match(new RegExp('\\*|\\?|\\+','g'))!=null){elmMatch=elmMatch.replace(new RegExp('\\?','g'),'(\\S?)');elmMatch=elmMatch.replace(new RegExp('\\+','g'),'(\\S+)');elmMatch=elmMatch.replace(new RegExp('\\*','g'),'(\\S*)');elmMatch="^"+elmMatch+"$";if(element_name.match(new RegExp(elmMatch,'g'))){elementAttribs=tinyMCE.cleanup_validElements[i];validElement=true;break;}}if(element_name==elmMatch){elementAttribs=tinyMCE.cleanup_validElements[i];validElement=true;element_name=elementAttribs[0][0];break;}}}if(!validElement)return null;}if(element_name.charAt(0)=='+'||element_name.charAt(0)=='-')name=element_name.substring(1);if(!tinyMCE.isMSIE){if(name=="strong"&&!tinyMCE.cleanup_on_save)element_name="b";else if(name=="em"&&!tinyMCE.cleanup_on_save)element_name="i";}var elmData=new Object();elmData.element_name=element_name;elmData.valid_attribs=elementAttribs;return elmData;};TinyMCE.prototype._moveStyle=function(elm,style,attrib){if(tinyMCE.cleanup_inline_styles){var val=tinyMCE.getAttrib(elm,attrib);if(val!=''){val=''+val;switch(attrib){case "background":val="url('"+val+"');";break;case "bordercolor":if(elm.style.borderStyle==''||elm.style.borderStyle=='none')elm.style.borderStyle='solid';break;case "border":case "width":case "height":if(attrib=="border"&&elm.style.borderWidth>0)return;if(val.indexOf('%')==-1)val+='px';break;case "vspace":case "hspace":elm.style.marginTop=val+"px";elm.style.marginBottom=val+"px";elm.removeAttribute(attrib);return;case "align":if(elm.nodeName=="IMG"){if(tinyMCE.isMSIE)elm.style.styleFloat=val;else elm.style.cssFloat=val;}else elm.style.textAlign=val;elm.removeAttribute(attrib);return;}if(val!=''){eval('elm.style.'+style+' = val;');elm.removeAttribute(attrib);}}}else{if(style=='')return;var val=eval('elm.style.'+style)==''?tinyMCE.getAttrib(elm,attrib):eval('elm.style.'+style);val=val==null?'':''+val;switch(attrib){case "background":if(val.indexOf('url')==-1&&val!='')val="url('"+val+"');";if(val!=''){elm.style.backgroundImage=val;elm.removeAttribute(attrib);}return;case "border":case "width":case "height":val=val.replace('px','');break;case "align":if(tinyMCE.getAttrib(elm,'align')==''){if(elm.nodeName=="IMG"){if(tinyMCE.isMSIE&&elm.style.styleFloat!=''){val=elm.style.styleFloat;style='styleFloat';}else if(tinyMCE.isGecko&&elm.style.cssFloat!=''){val=elm.style.cssFloat;style='cssFloat';}}}break;}if(val!=''){elm.removeAttribute(attrib);elm.setAttribute(attrib,val);eval('elm.style.'+style+' = "";');}}};TinyMCE.prototype._cleanupAttribute=function(valid_attributes,element_name,attribute_node,element_node){var attribName=attribute_node.nodeName.toLowerCase();var attribValue=attribute_node.nodeValue;var attribMustBeValue=null;var verified=false;if(attribName.indexOf('moz_')!=-1)return null;if(!tinyMCE.isMSIE&&(attribName=="mce_real_href"||attribName=="mce_real_src")){if(!tinyMCE.cleanup_on_save){var attrib=new Object();attrib.name=attribName;attrib.value=attribValue;return attrib;}else return null;}if(attribName=="mce_onclick")verified=true;if(tinyMCE.cleanup_verify_html&&!verified){for(var i=1;i<valid_attributes.length;i++){var attribMatch=valid_attributes[i][0];var re=null;if(attribMatch.match(new RegExp('\\*|\\?|\\+','g'))!=null){attribMatch=attribMatch.replace(new RegExp('\\?','g'),'(\\S?)');attribMatch=attribMatch.replace(new RegExp('\\+','g'),'(\\S+)');attribMatch=attribMatch.replace(new RegExp('\\*','g'),'(\\S*)');attribMatch="^"+attribMatch+"$";re=new RegExp(attribMatch,'g');}if((re&&attribName.match(re)!=null)||attribName==attribMatch){verified=true;attribMustBeValue=valid_attributes[i][3];break;}}if(!verified)return false;}else verified=true;switch(attribName){case "size":if(tinyMCE.isMSIE5&&element_name=="font")attribValue=element_node.size;break;case "width":case "height":case "border":if(tinyMCE.isMSIE5)attribValue=eval("element_node."+attribName);break;case "color":if(tinyMCE.isMSIE5&&element_name=="font")attribValue=element_node.color;break;case "class":if(element_name=="table"||element_name=="td"){if(tinyMCE.cleanup_visual_table_class!="")attribValue=tinyMCE.getVisualAidClass(attribValue,!tinyMCE.cleanup_on_save);}if(!tinyMCE._verifyClass(element_node)||attribValue=="")return null;break;case "onfocus":case "onblur":case "onclick":case "ondblclick":case "onmousedown":case "onmouseup":case "onmouseover":case "onmousemove":case "onmouseout":case "onkeypress":case "onkeydown":case "onkeydown":case "onkeyup":attribValue=tinyMCE.cleanupEventStr(""+attribValue);if(attribValue.indexOf('return false;')==0)attribValue=attribValue.substring(14);break;case "style":attribValue=tinyMCE.serializeStyle(tinyMCE.parseStyle(element_node.style.cssText));break;case "href":case "src":if(!tinyMCE.isMSIE&&attribName=="href"&&element_node.getAttribute("mce_real_href"))attribValue=element_node.getAttribute("mce_real_href");if(!tinyMCE.isMSIE&&attribName=="src"&&element_node.getAttribute("mce_real_src"))attribValue=element_node.getAttribute("mce_real_src");if(tinyMCE.isGecko&&!tinyMCE.settings['relative_urls'])attribValue=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],attribValue);attribValue=eval(tinyMCE.cleanup_urlconverter_callback+"(attribValue, element_node, tinyMCE.cleanup_on_save);");break;case "colspan":case "rowspan":if(attribValue=="1")return null;break;case "_moz-userdefined":case "editorid":case "mce_real_href":case "mce_real_src":return null;}if(attribMustBeValue!=null){var isCorrect=false;for(var i=0;i<attribMustBeValue.length;i++){if(attribValue==attribMustBeValue[i]){isCorrect=true;break;}}if(!isCorrect)return null;}var attrib=new Object();attrib.name=attribName;attrib.value=attribValue;return attrib;};TinyMCE.prototype.parseStyle=function(str){var ar=new Array();var st=str.split(';');for(var i=0;i<st.length;i++){if(st[i]=='')continue;var re=new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');var pa=st[i].replace(re,'$1||$2').split('||');if(pa.length==2)ar[pa[0].toLowerCase()]=pa[1];}return ar;};TinyMCE.prototype.compressStyle=function(ar,pr,sf,res){var box=new Array();box[0]=ar[pr+'-top'+sf];box[1]=ar[pr+'-left'+sf];box[2]=ar[pr+'-right'+sf];box[3]=ar[pr+'-bottom'+sf];for(var i=0;i<box.length;i++){if(box[i]==null)return;for(var a=0;a<box.length;a++){if(box[a]!=box[i])return;}}ar[res]=box[0];ar[pr+'-top'+sf]=null;ar[pr+'-left'+sf]=null;ar[pr+'-right'+sf]=null;ar[pr+'-bottom'+sf]=null;};TinyMCE.prototype.serializeStyle=function(ar){var str="";tinyMCE.compressStyle(ar,"border","","border");tinyMCE.compressStyle(ar,"border","-width","border-width");tinyMCE.compressStyle(ar,"border","-color","border-color");for(var key in ar){var val=ar[key];if(val!=null&&val!=''){val=''+val;val=val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)",'gi'),"url('$1')");if(val!="url('')")str+=key.toLowerCase()+": "+val+"; ";}}if(new RegExp('; $').test(str))str=str.substring(0,str.length-2);return str;};TinyMCE.prototype._verifyClass=function(node){if(tinyMCE.isGecko){var className=node.getAttribute('class');if(!className)return false;}if(tinyMCE.isMSIE)var className=node.getAttribute('className');if(tinyMCE.cleanup_verify_css_classes&&tinyMCE.cleanup_on_save){var csses=tinyMCE.getCSSClasses();nonDefinedCSS=true;for(var c=0;c<csses.length;c++){if(csses[c]==className){nonDefinedCSS=false;break;}}if(nonDefinedCSS&&className.indexOf('mce_')!=0){node.removeAttribute('className');node.removeAttribute('class');return false;}}return true;};TinyMCE.prototype.cleanupNode=function(node){var output="";switch(node.nodeType){case 1:var elementData=tinyMCE._cleanupElementName(node.nodeName,node);var elementName=elementData?elementData.element_name:null;var elementValidAttribs=elementData?elementData.valid_attribs:null;var elementAttribs="";var openTag=false,nonEmptyTag=false;if(elementName!=null&&elementName.charAt(0)=='+'){elementName=elementName.substring(1);openTag=true;}if(elementName!=null&&elementName.charAt(0)=='-'){elementName=elementName.substring(1);nonEmptyTag=true;}if(tinyMCE.isMSIE&&tinyMCE.settings['fix_content_duplication']){var lookup=tinyMCE.cleanup_elementLookupTable;for(var i=0;i<lookup.length;i++){if(lookup[i]==node)return output;}lookup[lookup.length]=node;}if(!elementName){if(node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++)output+=this.cleanupNode(node.childNodes[i]);}return output;}if(tinyMCE.cleanup_on_save){if(node.nodeName=="A"&&node.className=="mceItemAnchor")return '<a name="'+this.convertStringToXML(node.getAttribute("name"))+'"></a>';}if(tinyMCE.cleanup_inline_styles){var re=new RegExp("^(TABLE|TD|TR|IMG|HR)$");if(re.test(node.nodeName)){tinyMCE._moveStyle(node,'width','width');tinyMCE._moveStyle(node,'height','height');tinyMCE._moveStyle(node,'borderWidth','border');tinyMCE._moveStyle(node,'','vspace');tinyMCE._moveStyle(node,'','hspace');tinyMCE._moveStyle(node,'textAlign','align');tinyMCE._moveStyle(node,'backgroundColor','bgColor');tinyMCE._moveStyle(node,'borderColor','borderColor');tinyMCE._moveStyle(node,'backgroundImage','background');if(tinyMCE.isMSIE5)node.outerHTML=node.outerHTML;}else if(tinyMCE.isBlockElement(node))tinyMCE._moveStyle(node,'textAlign','align');if(node.nodeName=="FONT")tinyMCE._moveStyle(node,'color','color');}if(elementValidAttribs){for(var a=1;a<elementValidAttribs.length;a++){var attribName,attribDefaultValue,attribForceValue,attribValue;attribName=elementValidAttribs[a][0];attribDefaultValue=elementValidAttribs[a][1];attribForceValue=elementValidAttribs[a][2];if(attribDefaultValue!=null||attribForceValue!=null){var attribValue=node.getAttribute(attribName);if(node.getAttribute(attribName)==null||node.getAttribute(attribName)=="")attribValue=attribDefaultValue;attribValue=attribForceValue?attribForceValue:attribValue;if(attribValue=="{$uid}")attribValue="uid_"+(tinyMCE.cleanup_idCount++);if(attribName=="class")attribValue=tinyMCE.getVisualAidClass(attribValue,tinyMCE.cleanup_on_save);node.setAttribute(attribName,attribValue);}}}if(elementName=="table"&&!node.hasChildNodes())return "";if(node.attributes.length>0){for(var i=0;i<node.attributes.length;i++){if(node.attributes[i].specified){var attrib=tinyMCE._cleanupAttribute(elementValidAttribs,elementName,node.attributes[i],node);if(attrib&&attrib.value!="")elementAttribs+=" "+attrib.name+"="+'"'+this.convertStringToXML(""+attrib.value)+'"';}}}if(tinyMCE.isMSIE&&elementName=="table"&&node.getAttribute("summary")!=null&&elementAttribs.indexOf('summary')==-1){elementAttribs+=" summary="+'"'+this.convertStringToXML(""+node.getAttribute("summary"))+'"';}if(tinyMCE.isMSIE&&elementName=="input"){if(node.type){if(!elementAttribs.match(/type=/g))elementAttribs+=" type="+'"'+node.type+'"';}if(node.value){if(!elementAttribs.match(/value=/g))elementAttribs+=" value="+'"'+node.value+'"';}}if((elementName=="p"||elementName=="td")&&(node.innerHTML==""||node.innerHTML=="&nbsp;"))return "<"+elementName+elementAttribs+">"+this.convertStringToXML(String.fromCharCode(160))+"</"+elementName+">";if(tinyMCE.isMSIE&&elementName=="script")return "<"+elementName+elementAttribs+">"+node.text+"</"+elementName+">";if(node.hasChildNodes()){if(elementName=="p"&&tinyMCE.cleanup_force_br_newlines)output+="<div"+elementAttribs+">";else output+="<"+elementName+elementAttribs+">";for(var i=0;i<node.childNodes.length;i++)output+=this.cleanupNode(node.childNodes[i]);if(elementName=="p"&&tinyMCE.cleanup_force_br_newlines)output+="</div><br />";else output+="</"+elementName+">";}else{if(!nonEmptyTag){if(openTag)output+="<"+elementName+elementAttribs+"></"+elementName+">";else output+="<"+elementName+elementAttribs+" />";}}return output;case 3:if(node.parentNode.nodeName.toLowerCase()=="script")return node.nodeValue;return this.convertStringToXML(node.nodeValue);case 8:return "<!--"+node.nodeValue+"-->";default:return "[UNKNOWN NODETYPE "+node.nodeType+"]";}};TinyMCE.prototype.convertStringToXML=function(html_data){var output="";for(var i=0;i<html_data.length;i++){var chr=html_data.charCodeAt(i);if(tinyMCE.settings['entity_encoding']=="numeric"){if(chr>127)output+='&#'+chr+";";else output+=String.fromCharCode(chr);continue;}if(tinyMCE.settings['entity_encoding']=="raw"){output+=String.fromCharCode(chr);continue;}if(typeof(tinyMCE.cleanup_entities["c"+chr])!='undefined'&&tinyMCE.cleanup_entities["c"+chr]!='')output+='&'+tinyMCE.cleanup_entities["c"+chr]+';';else output+=''+String.fromCharCode(chr);}return output;};TinyMCE.prototype._getCleanupElementName=function(chunk){var pos;if(chunk.charAt(0)=='+')chunk=chunk.substring(1);if(chunk.charAt(0)=='-')chunk=chunk.substring(1);if((pos=chunk.indexOf('/'))!=-1)chunk=chunk.substring(0,pos);if((pos=chunk.indexOf('['))!=-1)chunk=chunk.substring(0,pos);return chunk;};TinyMCE.prototype._initCleanup=function(){var validElements=tinyMCE.settings["valid_elements"];validElements=validElements.split(',');var extendedValidElements=tinyMCE.settings["extended_valid_elements"];extendedValidElements=extendedValidElements.split(',');for(var i=0;i<extendedValidElements.length;i++){var elementName=this._getCleanupElementName(extendedValidElements[i]);var skipAdd=false;for(var x=0;x<validElements.length;x++){if(this._getCleanupElementName(validElements[x])==elementName){validElements[x]=extendedValidElements[i];skipAdd=true;break;}}if(!skipAdd)validElements[validElements.length]=extendedValidElements[i];}for(var i=0;i<validElements.length;i++){var item=validElements[i];item=item.replace('[','|');item=item.replace(']','');var attribs=item.split('|');for(var x=0;x<attribs.length;x++)attribs[x]=attribs[x].toLowerCase();attribs[0]=attribs[0].split('/');for(var x=1;x<attribs.length;x++){var attribName=attribs[x];var attribDefault=null;var attribForce=null;var attribMustBe=null;if((pos=attribName.indexOf('='))!=-1){attribDefault=attribName.substring(pos+1);attribName=attribName.substring(0,pos);}if((pos=attribName.indexOf(':'))!=-1){attribForce=attribName.substring(pos+1);attribName=attribName.substring(0,pos);}if((pos=attribName.indexOf('<'))!=-1){attribMustBe=attribName.substring(pos+1).split('?');attribName=attribName.substring(0,pos);}attribs[x]=new Array(attribName,attribDefault,attribForce,attribMustBe);}validElements[i]=attribs;}var invalidElements=tinyMCE.settings['invalid_elements'].split(',');for(var i=0;i<invalidElements.length;i++)invalidElements[i]=invalidElements[i].toLowerCase();tinyMCE.settings['cleanup_validElements']=validElements;tinyMCE.settings['cleanup_invalidElements']=invalidElements;tinyMCE.settings['cleanup_entities']=new Array();var entities=tinyMCE.getParam('entities','',true,',');for(var i=0;i<entities.length;i+=2)tinyMCE.settings['cleanup_entities']['c'+entities[i]]=entities[i+1];};TinyMCE.prototype._cleanupHTML=function(inst,doc,config,element,visual,on_save){if(!tinyMCE.settings['cleanup'])return element.innerHTML;tinyMCE._customCleanup(inst,on_save?"get_from_editor_dom":"insert_to_editor_dom",doc.body);tinyMCE.cleanup_validElements=tinyMCE.settings['cleanup_validElements'];tinyMCE.cleanup_entities=tinyMCE.settings['cleanup_entities'];tinyMCE.cleanup_invalidElements=tinyMCE.settings['cleanup_invalidElements'];tinyMCE.cleanup_verify_html=tinyMCE.settings['verify_html'];tinyMCE.cleanup_force_br_newlines=tinyMCE.settings['force_br_newlines'];tinyMCE.cleanup_urlconverter_callback=tinyMCE.settings['urlconverter_callback'];tinyMCE.cleanup_verify_css_classes=tinyMCE.settings['verify_css_classes'];tinyMCE.cleanup_visual_table_class=tinyMCE.settings['visual_table_class'];tinyMCE.cleanup_apply_source_formatting=tinyMCE.settings['apply_source_formatting'];tinyMCE.cleanup_inline_styles=tinyMCE.settings['inline_styles'];tinyMCE.cleanup_visual_aid=visual;tinyMCE.cleanup_on_save=on_save;tinyMCE.cleanup_idCount=0;tinyMCE.cleanup_elementLookupTable=new Array();var startTime=new Date().getTime();if(tinyMCE.isMSIE){var nodes=element.getElementsByTagName("hr");for(var i=0;i<nodes.length;i++){if(nodes[i].id=="null")nodes[i].removeAttribute("id");}element.innerHTML=tinyMCE.regexpReplace(element.innerHTML,'<p>[ \n\r]*<hr.*>[ \n\r]*</p>','<hr />','gi');element.innerHTML=tinyMCE.regexpReplace(element.innerHTML,'<!([^-(DOCTYPE)]* )|<!/[^-]*>','','gi');}var html=this.cleanupNode(element);if(tinyMCE.settings['debug'])tinyMCE.debug("Cleanup process executed in: "+(new Date().getTime()-startTime)+" ms.");html=tinyMCE.regexpReplace(html,'<p><hr /></p>','<hr />');html=tinyMCE.regexpReplace(html,'<p>&nbsp;</p><hr /><p>&nbsp;</p>','<hr />');html=tinyMCE.regexpReplace(html,'<td>\\s*<br />\\s*</td>','<td>&nbsp;</td>');html=html.replace(new RegExp('<a>(.*?)</a>','gi'),'$1');if(!tinyMCE.isMSIE)html=html.replace(new RegExp('<o:p _moz-userdefined="" />','g'),"");if(tinyMCE.settings['apply_source_formatting']){html=html.replace(new RegExp('<(p|div)([^>]*)>','g'),"\n<$1$2>\n");html=html.replace(new RegExp('<\/(p|div)([^>]*)>','g'),"\n</$1$2>\n");html=html.replace(new RegExp('<br />','g'),"<br />\n");}if(tinyMCE.settings['force_br_newlines']){var re=new RegExp('<p>&nbsp;</p>','g');html=html.replace(re,"<br />");}if(tinyMCE.settings['force_p_newlines']){var re=new RegExp('&lt;&gt;','g');html=html.replace(re,"");}if(tinyMCE.settings['remove_linebreaks'])html=html.replace(new RegExp('\r|\n','g'),' ');html=tinyMCE._customCleanup(inst,on_save?"get_from_editor":"insert_to_editor",html);var chk=tinyMCE.regexpReplace(html,"[ \t\r\n]","").toLowerCase();if(chk=="<br/>"||chk=="<br>"||chk=="<p>&nbsp;</p>"||chk=="<p>&#160;</p>"||chk=="<p></p>")html="";if(tinyMCE.settings["preformatted"])return "<pre>"+html+"</pre>";return html;};TinyMCE.prototype.insertLink=function(href,target,title,onclick,style_class){tinyMCE.execCommand('mceBeginUndoLevel');if(this.selectedInstance&&this.selectedElement&&this.selectedElement.nodeName.toLowerCase()=="img"){var doc=this.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(this.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true;}href=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");tinyMCE.setAttrib(linkElement,'href',href);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',title);tinyMCE.setAttrib(linkElement,'onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(this.selectedElement.cloneNode(true));this.selectedElement.parentNode.replaceChild(linkElement,this.selectedElement);}return;}if(!this.linkElement&&this.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,'<a href="#mce_temp_url#">'+this.selectedInstance.getSelectedHTML()+'</a>');}else this.selectedInstance.contentDocument.execCommand("createlink",false,"#mce_temp_url#");tinyMCE.linkElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"a","href","#mce_temp_url#");var elementArray=this.getElementsByAttributeValue(this.selectedInstance.contentDocument.body,"a","href","#mce_temp_url#");for(var i=0;i<elementArray.length;i++){href=eval(tinyMCE.settings['urlconverter_callback']+"(href, elementArray[i]);");tinyMCE.setAttrib(elementArray[i],'href',href);tinyMCE.setAttrib(elementArray[i],'mce_real_href',href);tinyMCE.setAttrib(elementArray[i],'target',target);tinyMCE.setAttrib(elementArray[i],'title',title);tinyMCE.setAttrib(elementArray[i],'onclick',onclick);tinyMCE.setAttrib(elementArray[i],'class',style_class);}tinyMCE.linkElement=elementArray[0];}if(this.linkElement){href=eval(tinyMCE.settings['urlconverter_callback']+"(href, this.linkElement);");tinyMCE.setAttrib(this.linkElement,'href',href);tinyMCE.setAttrib(this.linkElement,'mce_real_href',href);tinyMCE.setAttrib(this.linkElement,'target',target);tinyMCE.setAttrib(this.linkElement,'title',title);tinyMCE.setAttrib(this.linkElement,'onclick',onclick);tinyMCE.setAttrib(this.linkElement,'class',style_class);}tinyMCE.execCommand('mceEndUndoLevel');};TinyMCE.prototype.insertImage=function(src,alt,border,hspace,vspace,width,height,align,title,onmouseover,onmouseout){tinyMCE.execCommand('mceBeginUndoLevel');if(src=="")return;if(!this.imgElement&&tinyMCE.isSafari){var html="";html+='<img src="'+src+'" alt="'+alt+'"';html+=' border="'+border+'" hspace="'+hspace+'"';html+=' vspace="'+vspace+'" width="'+width+'"';html+=' height="'+height+'" align="'+align+'" title="'+title+'" onmouseover="'+onmouseover+'" onmouseout="'+onmouseout+'" />';tinyMCE.execCommand("mceInsertContent",false,html);}else{if(!this.imgElement&&this.selectedInstance){if(tinyMCE.isSafari)tinyMCE.execCommand("mceInsertContent",false,'<img src="#mce_temp_url#" />');else this.selectedInstance.contentDocument.execCommand("insertimage",false,"#mce_temp_url#");tinyMCE.imgElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"img","src","#mce_temp_url#");}}if(this.imgElement){var needsRepaint=false;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, tinyMCE.imgElement);");if(onmouseover&&onmouseover!="")onmouseover="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, tinyMCE.imgElement);")+"';";if(onmouseout&&onmouseout!="")onmouseout="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, tinyMCE.imgElement);")+"';";if(typeof(title)=="undefined")title=alt;if(width!=this.imgElement.getAttribute("width")||height!=this.imgElement.getAttribute("height")||align!=this.imgElement.getAttribute("align"))needsRepaint=true;tinyMCE.setAttrib(this.imgElement,'src',src);tinyMCE.setAttrib(this.imgElement,'mce_real_src',src);tinyMCE.setAttrib(this.imgElement,'alt',alt);tinyMCE.setAttrib(this.imgElement,'title',title);tinyMCE.setAttrib(this.imgElement,'align',align);tinyMCE.setAttrib(this.imgElement,'border',border,true);tinyMCE.setAttrib(this.imgElement,'hspace',hspace,true);tinyMCE.setAttrib(this.imgElement,'vspace',vspace,true);tinyMCE.setAttrib(this.imgElement,'width',width,true);tinyMCE.setAttrib(this.imgElement,'height',height,true);tinyMCE.setAttrib(this.imgElement,'onmouseover',onmouseover);tinyMCE.setAttrib(this.imgElement,'onmouseout',onmouseout);if(width&&width!="")this.imgElement.style.pixelWidth=width;if(height&&height!="")this.imgElement.style.pixelHeight=height;if(needsRepaint)tinyMCE.selectedInstance.repaint();}tinyMCE.execCommand('mceEndUndoLevel');};TinyMCE.prototype.getElementByAttributeValue=function(node,element_name,attrib,value){var elements=this.getElementsByAttributeValue(node,element_name,attrib,value);if(elements.length==0)return null;return elements[0];};TinyMCE.prototype.getElementsByAttributeValue=function(node,element_name,attrib,value){var elements=new Array();if(node&&node.nodeName.toLowerCase()==element_name){if(node.getAttribute(attrib)&&node.getAttribute(attrib).indexOf(value)!=-1)elements[elements.length]=node;}if(node.hasChildNodes){for(var x=0,n=node.childNodes.length;x<n;x++){var childElements=this.getElementsByAttributeValue(node.childNodes[x],element_name,attrib,value);for(var i=0,m=childElements.length;i<m;i++)elements[elements.length]=childElements[i];}}return elements;};TinyMCE.prototype.isBlockElement=function(node){return node!=null&&node.nodeType==1&&this.blockRegExp.test(node.nodeName);};TinyMCE.prototype.getParentBlockElement=function(node){while(node){if(this.blockRegExp.test(node.nodeName))return node;node=node.parentNode;}return null;};TinyMCE.prototype.getNodeTree=function(node,node_array,type,node_name){if(typeof(type)=="undefined"||node.nodeType==type&&(typeof(node_name)=="undefined"||node.nodeName==node_name))node_array[node_array.length]=node;if(node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++)tinyMCE.getNodeTree(node.childNodes[i],node_array,type,node_name);}return node_array;};TinyMCE.prototype.getParentElement=function(node,names,attrib_name,attrib_value){if(typeof(names)=="undefined"){if(node.nodeType==1)return node;while((node=node.parentNode)!=null&&node.nodeType!=1);return node;}var namesAr=names.split(',');if(node==null)return null;do{for(var i=0;i<namesAr.length;i++){if(node.nodeName.toLowerCase()==namesAr[i].toLowerCase()||names=="*"){if(typeof(attrib_name)=="undefined")return node;else if(node.getAttribute(attrib_name)){if(typeof(attrib_value)=="undefined"){if(node.getAttribute(attrib_name)!="")return node;}else if(node.getAttribute(attrib_name)==attrib_value)return node;}}}}while(node=node.parentNode);return null;};TinyMCE.prototype.convertURL=function(url,node,on_save){var prot=document.location.protocol;var host=document.location.hostname;var port=document.location.port;var fileProto=(prot=="file:");url=tinyMCE.regexpReplace(url,'(http|https):///','/');if(url.indexOf('mailto:')!=-1||url.indexOf('javascript:')!=-1||tinyMCE.regexpReplace(url,'[ \t\r\n\+]|%20','').charAt(0)=="#")return url;if(!tinyMCE.isMSIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings['base_href']+url;if(!tinyMCE.settings['relative_urls']){var urlParts=tinyMCE.parseURL(url);var baseUrlParts=tinyMCE.parseURL(tinyMCE.settings['base_href']);if(urlParts['anchor']&&urlParts['path']==baseUrlParts['path'])return "#"+urlParts['anchor'];}if(on_save&&tinyMCE.settings['relative_urls']){var urlParts=tinyMCE.parseURL(url);var tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings['document_base_url']);if(urlParts['host']==tmpUrlParts['host']&&(!urlParts['port']||urlParts['port']==tmpUrlParts['port']))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings['document_base_url'],url);}if(!fileProto&&tinyMCE.settings['remove_script_host']){var start="",portPart="";if(port!="")portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1);if(!tinyMCE.settings['relative_urls']&&url.indexOf('://')==-1&&url.charAt(0)!='/')url='/'+url;}return url;};TinyMCE.prototype.parseURL=function(url_str){var urlParts=new Array();if(url_str){var pos,lastPos;pos=url_str.indexOf('://');if(pos!=-1){urlParts['protocol']=url_str.substring(0,pos);lastPos=pos+3;}for(var i=lastPos;i<url_str.length;i++){var chr=url_str.charAt(i);if(chr==':')break;if(chr=='/')break;}pos=i;urlParts['host']=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)==':'){pos=url_str.indexOf('/',lastPos);urlParts['port']=url_str.substring(lastPos+1,pos);}lastPos=pos;pos=url_str.indexOf('?',lastPos);if(pos==-1)pos=url_str.indexOf('#',lastPos);if(pos==-1)pos=url_str.length;urlParts['path']=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)=='?'){pos=url_str.indexOf('#');pos=(pos==-1)?url_str.length:pos;urlParts['query']=url_str.substring(lastPos+1,pos);}lastPos=pos;if(url_str.charAt(pos)=='#'){pos=url_str.length;urlParts['anchor']=url_str.substring(lastPos+1,pos);}}return urlParts;};TinyMCE.prototype.convertAbsoluteURLToRelativeURL=function(base_url,url_to_relative){var strTok1;var strTok2;var breakPoint=0;var outputString="";base_url=base_url.substring(0,base_url.lastIndexOf('/'));strTok1=base_url.split('/');strTok2=url_to_relative.split('/');if(strTok1.length>=strTok2.length){for(var i=0;i<strTok1.length;i++){if(i>=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(strTok1.length<strTok2.length){for(var i=0;i<strTok2.length;i++){if(i>=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(breakPoint==1)return url_to_relative;for(var i=0;i<(strTok1.length-(breakPoint-1));i++)outputString+="../";for(var i=breakPoint-1;i<strTok2.length;i++){if(i!=(breakPoint-1))outputString+="/"+strTok2[i];else outputString+=strTok2[i];}return outputString;};TinyMCE.prototype.convertRelativeToAbsoluteURL=function(base_url,relative_url){var baseURL=TinyMCE.prototype.parseURL(base_url);var relURL=TinyMCE.prototype.parseURL(relative_url);if(relative_url==""||relative_url.charAt(0)=='/'||relative_url.indexOf('://')!=-1||relative_url.indexOf('mailto:')!=-1||relative_url.indexOf('javascript:')!=-1||tinyMCE.regexpReplace(relative_url,'[ \t\r\n\+]|%20','').charAt(0)=="#")return relative_url;baseURLParts=baseURL['path'].split('/');relURLParts=relURL['path'].split('/');var newBaseURLParts=new Array();for(var i=baseURLParts.length-1;i>=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i];}baseURLParts=newBaseURLParts.reverse();var newRelURLParts=new Array();var numBack=0;for(var i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue;}if(numBack>0){numBack--;continue;}newRelURLParts[newRelURLParts.length]=relURLParts[i];}relURLParts=newRelURLParts.reverse();var len=baseURLParts.length-numBack;var absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');var start="",end="";if(baseURL['protocol'])start+=baseURL['protocol']+"://";if(baseURL['host'])start+=baseURL['host'];if(baseURL['port'])start+=":"+baseURL['port'];if(relURL['query'])end+="?"+relURL['query'];if(relURL['anchor'])end+="#"+relURL['anchor'];if(relative_url.charAt(relative_url.length-1)=="/")end+="/";return start+absPath+end;};TinyMCE.prototype.getParam=function(name,default_value,strip_whitespace,split_chr){var value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);var outArray=new Array();for(var i=0;i<value.length;i++){if(value[i]&&value[i]!="")outArray[outArray.length]=value[i];}value=outArray;}return value;};TinyMCE.prototype.getLang=function(name,default_value,parse_entities){var value=(typeof(tinyMCELang[name])=="undefined")?default_value:tinyMCELang[name];if(parse_entities){var el=document.createElement("div");el.innerHTML=value;value=el.innerHTML;}return value;};TinyMCE.prototype.addToLang=function(prefix,ar){for(var key in ar)tinyMCELang[(key.indexOf('lang_')==-1?'lang_':'')+(prefix!=''?(prefix+"_"):'')+key]=ar[key];};TinyMCE.prototype.replaceVar=function(replace_haystack,replace_var,replace_str){var re=new RegExp('{\\\$'+replace_var+'}','g');return replace_haystack.replace(re,replace_str);};TinyMCE.prototype.replaceVars=function(replace_haystack,replace_vars){for(var key in replace_vars){var value=replace_vars[key];replace_haystack=tinyMCE.replaceVar(replace_haystack,key,value);}return replace_haystack;};TinyMCE.prototype.triggerNodeChange=function(focus,setup_content){if(tinyMCE.settings['handleNodeChangeCallback']){if(tinyMCE.selectedInstance){var inst=tinyMCE.selectedInstance;var editorId=inst.editorId;var elm=(typeof(setup_content)!="undefined"&&setup_content)?tinyMCE.selectedElement:inst.getFocusElement();var undoIndex=-1;var undoLevels=-1;var anySelection=false;var selectedText=inst.getSelectedText();if(tinyMCE.settings["auto_resize"]){var doc=inst.getDoc();inst.iframeElement.style.width=doc.body.offsetWidth+"px";inst.iframeElement.style.height=doc.body.offsetHeight+"px";}if(tinyMCE.selectedElement)anySelection=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(selectedText&&selectedText.length>0);if(tinyMCE.settings['custom_undo_redo']){undoIndex=inst.undoIndex;undoLevels=inst.undoLevels.length;}tinyMCE.executeCallback('handleNodeChangeCallback','_handleNodeChange',0,editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection);}}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus();};TinyMCE.prototype._customCleanup=function(inst,type,content){var customCleanup=tinyMCE.settings['cleanup_callback'];if(customCleanup!=""&&eval("typeof("+customCleanup+")")!="undefined")content=eval(customCleanup+"(type, content, inst);");var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){if(eval("typeof(TinyMCE_"+plugins[i]+"_cleanup)")!="undefined")content=eval("TinyMCE_"+plugins[i]+"_cleanup(type, content, inst);");}return content;};TinyMCE.prototype.getContent=function(editor_id){if(typeof(editor_id)!="undefined")tinyMCE.selectedInstance=tinyMCE.getInstanceById(editor_id);if(tinyMCE.selectedInstance)return tinyMCE._cleanupHTML(this.selectedInstance,this.selectedInstance.getDoc(),tinyMCE.settings,this.selectedInstance.getBody(),false,true);return null;};TinyMCE.prototype.setContent=function(html_content){if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.execCommand('mceSetContent',false,html_content);tinyMCE.selectedInstance.repaint();}};TinyMCE.prototype.importThemeLanguagePack=function(name){if(typeof(name)=="undefined")name=tinyMCE.settings['theme'];tinyMCE.loadScript(tinyMCE.baseURL+'/themes/'+name+'/langs/'+tinyMCE.settings['language']+'.js');};TinyMCE.prototype.importPluginLanguagePack=function(name,valid_languages){var lang="en";valid_languages=valid_languages.split(',');for(var i=0;i<valid_languages.length;i++){if(tinyMCE.settings['language']==valid_languages[i])lang=tinyMCE.settings['language'];}tinyMCE.loadScript(tinyMCE.baseURL+'/plugins/'+name+'/langs/'+lang+'.js');};TinyMCE.prototype.applyTemplate=function(html,args){html=tinyMCE.replaceVar(html,"themeurl",tinyMCE.themeURL);if(typeof(args)!="undefined")html=tinyMCE.replaceVars(html,args);html=tinyMCE.replaceVars(html,tinyMCE.settings);html=tinyMCE.replaceVars(html,tinyMCELang);return html;};TinyMCE.prototype.openWindow=function(template,args){var html,width,height,x,y,resizable,scrollbars,url;args['mce_template_file']=template['file'];args['mce_width']=template['width'];args['mce_height']=template['height'];tinyMCE.windowArgs=args;html=template['html'];if(!(width=parseInt(template['width'])))width=320;if(!(height=parseInt(template['height'])))height=200;if(tinyMCE.isMSIE)height+=40;else height+=20;x=parseInt(screen.width/2.0)-(width/2.0);y=parseInt(screen.height/2.0)-(height/2.0);resizable=(args&&args['resizable'])?args['resizable']:"no";scrollbars=(args&&args['scrollbars'])?args['scrollbars']:"no";if(template['file'].charAt(0)!='/'&&template['file'].indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template['file'];else url=template['file'];for(var name in args)url=tinyMCE.replaceVar(url,name,escape(args[name]));if(html){html=tinyMCE.replaceVar(html,"css",this.settings['popups_css']);html=tinyMCE.applyTemplate(html,args);var win=window.open("","mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog=yes,minimizable="+resizable+",modal=yes,width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang['lang_popup_blocked']);return;}win.document.write(html);win.document.close();win.resizeTo(width,height);win.focus();}else{if(tinyMCE.isMSIE&&resizable!='yes'&&tinyMCE.settings["dialog_type"]=="modal"){var features="resizable:"+resizable+";scroll:"+scrollbars+";status:yes;center:yes;help:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px;";window.showModalDialog(url,window,features);}else{var modal=(resizable=="yes")?"no":"yes";if(tinyMCE.isGecko&&tinyMCE.isMac)modal="no";var win=window.open(url,"mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog="+modal+",minimizable="+resizable+",modal="+modal+",width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang['lang_popup_blocked']);return;}eval('try { win.resizeTo(width, height); } catch(e) { }');if(tinyMCE.isGecko){if(win.document.defaultView.statusbar.visible)win.resizeBy(0,tinyMCE.isMac?10:24);}win.focus();}}};TinyMCE.prototype.closeWindow=function(win){win.close();};TinyMCE.prototype.getVisualAidClass=function(class_name,state){var aidClass=tinyMCE.settings['visual_table_class'];if(typeof(state)=="undefined")state=tinyMCE.settings['visual'];var classNames=new Array();var ar=class_name.split(' ');for(var i=0;i<ar.length;i++){if(ar[i]==aidClass)ar[i]="";if(ar[i]!="")classNames[classNames.length]=ar[i];}if(state)classNames[classNames.length]=aidClass;var className="";for(var i=0;i<classNames.length;i++){if(i>0)className+=" ";className+=classNames[i];}return className;};TinyMCE.prototype.handleVisualAid=function(element,deep,state,inst){if(!element)return;var tableElement=null;switch(element.nodeName){case "TABLE":var oldW=element.style.width;var oldH=element.style.height;element.className=tinyMCE.getVisualAidClass(element.className,state&&element.getAttribute("border")==0);element.style.width=oldW;element.style.height=oldH;for(var y=0;y<element.rows.length;y++){for(var x=0;x<element.rows[y].cells.length;x++){var className=tinyMCE.getVisualAidClass(element.rows[y].cells[x].className,state&&element.getAttribute("border")==0);element.rows[y].cells[x].className=className;}}break;case "A":var anchorName=tinyMCE.getAttrib(element,"name");if(anchorName!=''&&state){element.title=anchorName;element.className='mceItemAnchor';}else if(anchorName!=''&&!state)element.className='';break;}if(deep&&element.hasChildNodes()){for(var i=0;i<element.childNodes.length;i++)tinyMCE.handleVisualAid(element.childNodes[i],deep,state,inst);}};TinyMCE.prototype.getAttrib=function(elm,name,default_value){if(typeof(default_value)=="undefined")default_value="";if(!elm||elm.nodeType!=1)return default_value;var v=elm.getAttribute(name);if(name=="class"&&!v)v=elm.className;if(name=="style")v=elm.style.cssText;return(v&&v!="")?v:default_value;};TinyMCE.prototype.setAttrib=function(element,name,value,fix_value){if(typeof(value)=="number"&&value!=null)value=""+value;if(fix_value){if(value==null)value="";var re=new RegExp('[^0-9%]','g');value=value.replace(re,'');}if(name=="style")element.style.cssText=value;if(name=="class")element.className=value;if(value!=null&&value!=""&&value!=-1)element.setAttribute(name,value);else element.removeAttribute(name);};TinyMCE.prototype._setHTML=function(doc,html_content){if(tinyMCE.isMSIE){var re=new RegExp('<p><hr /></p>','g');html_content=html_content.replace(re,"<hr>");}try{doc.body.innerHTML=html_content;}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content);}if(tinyMCE.isMSIE&&tinyMCE.settings['fix_content_duplication']){var paras=doc.getElementsByTagName("P");for(var i=0;i<paras.length;i++){var node=paras[i];while((node=node.parentNode)!=null){if(node.nodeName.toLowerCase()=="p")node.outerHTML=node.innerHTML;}}var html=doc.body.innerHTML;if(html.indexOf('="mso')!=-1){for(var i=0;i<doc.body.all.length;i++){var el=doc.body.all[i];el.removeAttribute("className","",0);el.removeAttribute("style","",0);}html=doc.body.innerHTML;html=tinyMCE.regexpReplace(html,"<o:p><\/o:p>","<br />");html=tinyMCE.regexpReplace(html,"<o:p>&nbsp;<\/o:p>","");html=tinyMCE.regexpReplace(html,"<st1:.*?>","");html=tinyMCE.regexpReplace(html,"<p><\/p>","");html=tinyMCE.regexpReplace(html,"<p><\/p>\r\n<p><\/p>","");html=tinyMCE.regexpReplace(html,"<p>&nbsp;<\/p>","<br />");html=tinyMCE.regexpReplace(html,"<p>\s*(<p>\s*)?","<p>");html=tinyMCE.regexpReplace(html,"<\/p>\s*(<\/p>\s*)?","</p>");}doc.body.innerHTML=html;}};TinyMCE.prototype.getImageSrc=function(str){var pos=-1;if(!str)return "";if((pos=str.indexOf('this.src='))!=-1){var src=str.substring(pos+10);src=src.substring(0,src.indexOf('\''));return src;}return "";};TinyMCE.prototype._getElementById=function(element_id){var elm=document.getElementById(element_id);if(!elm){for(var j=0;j<document.forms.length;j++){for(var k=0;k<document.forms[j].elements.length;k++){if(document.forms[j].elements[k].name==element_id){elm=document.forms[j].elements[k];break;}}}}return elm;};TinyMCE.prototype.getEditorId=function(form_element){var inst=this.getInstanceById(form_element);if(!inst)return null;return inst.editorId;};TinyMCE.prototype.getInstanceById=function(editor_id){var inst=this.instances[editor_id];if(!inst){for(var instanceName in tinyMCE.instances){var instance=tinyMCE.instances[instanceName];if(instance.formTargetElementId==editor_id){inst=instance;break;}}}return inst;};TinyMCE.prototype.queryInstanceCommandValue=function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandValue(command);return false;};TinyMCE.prototype.queryInstanceCommandState=function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandState(command);return null;};TinyMCE.prototype.setWindowArg=function(name,value){this.windowArgs[name]=value;};TinyMCE.prototype.getWindowArg=function(name,default_value){return(typeof(this.windowArgs[name])=="undefined")?default_value:this.windowArgs[name];};TinyMCE.prototype.getCSSClasses=function(editor_id,doc){var output=new Array();if(typeof(tinyMCE.cssClasses)!="undefined")return tinyMCE.cssClasses;if(typeof(editor_id)=="undefined"&&typeof(doc)=="undefined"){var instance;for(var instanceName in tinyMCE.instances){instance=tinyMCE.instances[instanceName];break;}doc=instance.getDoc();}if(typeof(doc)=="undefined"){var instance=tinyMCE.getInstanceById(editor_id);doc=instance.getDoc();}if(doc){var styles=tinyMCE.isMSIE?doc.styleSheets:doc.styleSheets;if(styles&&styles.length>0){for(var x=0;x<styles.length;x++){var csses=null;eval("try {var csses = tinyMCE.isMSIE ? doc.styleSheets("+x+").rules : doc.styleSheets["+x+"].cssRules;} catch(e) {}");if(!csses)return new Array();for(var i=0;i<csses.length;i++){var selectorText=csses[i].selectorText;if(selectorText){var rules=selectorText.split(',');for(var c=0;c<rules.length;c++){if(rules[c].indexOf(' ')!=-1||rules[c].indexOf(':')!=-1||rules[c].indexOf('mceItem')!=-1)continue;if(rules[c]=="."+tinyMCE.settings['visual_table_class'])continue;if(rules[c].indexOf('.')!=-1){output[output.length]=rules[c].substring(rules[c].indexOf('.')+1);}}}}}}}if(output.length>0)tinyMCE.cssClasses=output;return output;};TinyMCE.prototype.regexpReplace=function(in_str,reg_exp,replace_str,opts){if(typeof(opts)=="undefined")opts='g';var re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str);};TinyMCE.prototype.trim=function(str){return str.replace(/^\s*|\s*$/g,"");};TinyMCE.prototype.cleanupEventStr=function(str){str=""+str;str=str.replace('function anonymous()\n{\n','');str=str.replace('\n}','');str=str.replace(/^return true;/gi,'');return str;};TinyMCE.prototype.getAbsPosition=function(node){var pos=new Object();pos.absLeft=pos.absTop=0;var parentNode=node;while(parentNode){pos.absLeft+=parentNode.offsetLeft;pos.absTop+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}return pos;};TinyMCE.prototype.getControlHTML=function(control_name){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_getControlHTML";if(eval("typeof("+templateFunction+")")!='undefined'){var html=eval(templateFunction+"('"+control_name+"');");if(html!="")return tinyMCE.replaceVar(html,"pluginurl",tinyMCE.baseURL+"/plugins/"+themePlugins[i]);}}return eval('TinyMCE_'+tinyMCE.settings['theme']+"_getControlHTML"+"('"+control_name+"');");};TinyMCE.prototype._themeExecCommand=function(editor_id,element,command,user_interface,value){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined'){if(eval(templateFunction+"(editor_id, element, command, user_interface, value);"))return true;}}templateFunction='TinyMCE_'+tinyMCE.settings['theme']+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined')return eval(templateFunction+"(editor_id, element, command, user_interface, value);");return false;};TinyMCE.prototype._getThemeFunction=function(suffix,skip_plugins){if(skip_plugins)return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+suffix;if(eval("typeof("+templateFunction+")")!='undefined')return templateFunction;}return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;};TinyMCE.prototype.isFunc=function(func_name){if(func_name==null||func_name=="")return false;return eval("typeof("+func_name+")")!="undefined";};TinyMCE.prototype.exec=function(func_name,args){var str=func_name+'(';for(var i=3;i<args.length;i++){str+='args['+i+']';if(i<args.length-1)str+=',';}str+=');';return eval(str);};TinyMCE.prototype.executeCallback=function(param,suffix,mode){switch(mode){case 0:var state=false;var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){var func="TinyMCE_"+plugins[i]+suffix;if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}}var func='TinyMCE_'+tinyMCE.settings['theme']+suffix;if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}var func=tinyMCE.getParam(param,'');if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}return state;case 1:var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){var func="TinyMCE_"+plugins[i]+suffix;if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}}var func='TinyMCE_'+tinyMCE.settings['theme']+suffix;if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}var func=tinyMCE.getParam(param,'');if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}return false;}};TinyMCE.prototype.debug=function(){var msg="";var elm=document.getElementById("tinymce_debug");if(!elm){var debugDiv=document.createElement("div");debugDiv.setAttribute("className","debugger");debugDiv.className="debugger";debugDiv.innerHTML='\
+ function TinyMCE(){this.majorVersion="2";this.minorVersion="0RC4";this.releaseDate="2005-10-30";this.instances=new Array();this.stickyClassesLookup=new Array();this.windowArgs=new Array();this.loadedFiles=new Array();this.configs=new Array();this.currentConfig=0;this.eventHandlers=new Array();var ua=navigator.userAgent;this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(ua.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(ua.indexOf('MSIE 5.0')!=-1);this.isGecko=ua.indexOf('Gecko')!=-1;this.isGecko18=ua.indexOf('Gecko')!=-1&&ua.indexOf('rv:1.8')!=-1;this.isSafari=ua.indexOf('Safari')!=-1;this.isOpera=ua.indexOf('Opera')!=-1;this.isMac=ua.indexOf('Mac')!=-1;this.isNS7=ua.indexOf('Netscape/7')!=-1;this.isNS71=ua.indexOf('Netscape/7.1')!=-1;this.dialogCounter=0;if(this.isOpera){this.isMSIE=true;this.isGecko=false;this.isSafari=false;}this.idCounter=0;};TinyMCE.prototype.defParam=function(key,def_val){this.settings[key]=tinyMCE.getParam(key,def_val);};TinyMCE.prototype.init=function(settings){var theme;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){var elements=document.getElementsByTagName('script');for(var i=0;i<elements.length;i++){if(elements[i].src&&(elements[i].src.indexOf("tiny_mce.js")!=-1||elements[i].src.indexOf("tiny_mce_src.js")!=-1||elements[i].src.indexOf("tiny_mce_gzip.php")!=-1)){var src=elements[i].src;tinyMCE.srcMode=(src.indexOf('_src')!=-1)?'_src':'';src=src.substring(0,src.lastIndexOf('/'));tinyMCE.baseURL=src;break;}}}this.documentBasePath=document.location.href;if(this.documentBasePath.indexOf('?')!=-1)this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.indexOf('?'));this.documentURL=this.documentBasePath;this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.lastIndexOf('/'));if(tinyMCE.baseURL.indexOf('://')==-1&&tinyMCE.baseURL.charAt(0)!='/'){tinyMCE.baseURL=this.documentBasePath+"/"+tinyMCE.baseURL;}this.defParam("mode","none");this.defParam("theme","advanced");this.defParam("plugins","",true);this.defParam("language","en");this.defParam("docs_language",this.settings['language']);this.defParam("elements","");this.defParam("textarea_trigger","mce_editable");this.defParam("editor_selector","");this.defParam("editor_deselector","mceNoEditor");this.defParam("valid_elements","+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/b[class|style],-em/i[class|style],-strike[class|style],-u[class|style],+p[style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border=0|alt|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],-td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[style|dir|class|align],-h2[style|dir|class|align],-h3[style|dir|class|align],-h4[style|dir|class|align],-h5[style|dir|class|align],-h6[style|dir|class|align],hr[class|style],font[face|size|style|id|class|dir|color]");this.defParam("extended_valid_elements","");this.defParam("invalid_elements","");this.defParam("encoding","");this.defParam("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE.prototype.convertURL"));this.defParam("save_callback","");this.defParam("debug",false);this.defParam("force_br_newlines",false);this.defParam("force_p_newlines",true);this.defParam("add_form_submit_trigger",true);this.defParam("relative_urls",true);this.defParam("remove_script_host",true);this.defParam("focus_alert",true);this.defParam("document_base_url",this.documentURL);this.defParam("visual",true);this.defParam("visual_table_class","mceVisualAid");this.defParam("setupcontent_callback","");this.defParam("fix_content_duplication",true);this.defParam("custom_undo_redo",true);this.defParam("custom_undo_redo_levels",-1);this.defParam("custom_undo_redo_keyboard_shortcuts",true);this.defParam("verify_css_classes",false);this.defParam("verify_html",true);this.defParam("apply_source_formatting",false);this.defParam("directionality","ltr");this.defParam("cleanup_on_startup",false);this.defParam("inline_styles",false);this.defParam("convert_newlines_to_brs",false);this.defParam("auto_reset_designmode",true);this.defParam("entities","160,nbsp,38,amp,34,quot,162,cent,8364,euro,163,pound,165,yen,169,copy,174,reg,8482,trade,8240,permil,181,micro,183,middot,8226,bull,8230,hellip,8242,prime,8243,Prime,167,sect,182,para,223,szlig,8249,lsaquo,8250,rsaquo,171,laquo,187,raquo,8216,lsquo,8217,rsquo,8220,ldquo,8221,rdquo,8218,sbquo,8222,bdquo,60,lt,62,gt,8804,le,8805,ge,8211,ndash,8212,mdash,175,macr,8254,oline,164,curren,166,brvbar,168,uml,161,iexcl,191,iquest,710,circ,732,tilde,176,deg,8722,minus,177,plusmn,247,divide,8260,frasl,215,times,185,sup1,178,sup2,179,sup3,188,frac14,189,frac12,190,frac34,402,fnof,8747,int,8721,sum,8734,infin,8730,radic,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8712,isin,8713,notin,8715,ni,8719,prod,8743,and,8744,or,172,not,8745,cap,8746,cup,8706,part,8704,forall,8707,exist,8709,empty,8711,nabla,8727,lowast,8733,prop,8736,ang,180,acute,184,cedil,170,ordf,186,ordm,8224,dagger,8225,Dagger,192,Agrave,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,202,Ecirc,203,Euml,204,Igrave,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,212,Ocirc,213,Otilde,214,Ouml,216,Oslash,338,OElig,217,Ugrave,219,Ucirc,220,Uuml,376,Yuml,222,THORN,224,agrave,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,234,ecirc,235,euml,236,igrave,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,244,ocirc,245,otilde,246,ouml,248,oslash,339,oelig,249,ugrave,251,ucirc,252,uuml,254,thorn,255,yuml,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,8501,alefsym,982,piv,8476,real,977,thetasym,978,upsih,8472,weierp,8465,image,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8756,there4,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,173,shy,233,eacute,237,iacute,243,oacute,250,uacute,193,Aacute,225,aacute,201,Eacute,205,Iacute,211,Oacute,218,Uacute,221,Yacute,253,yacute");this.defParam("entity_encoding","named");this.defParam("cleanup_callback","");this.defParam("add_unload_trigger",true);this.defParam("ask",false);this.defParam("nowrap",false);this.defParam("auto_resize",false);this.defParam("auto_focus",false);this.defParam("cleanup",true);this.defParam("remove_linebreaks",true);this.defParam("button_tile_map",false);this.defParam("submit_patch",true);this.defParam("browsers","msie,safari,gecko,opera");this.defParam("dialog_type","window");this.defParam("accessibility_warnings",true);this.defParam("merge_styles_invalid_parents","");this.defParam("force_hex_style_colors",true);this.defParam("trim_span_elements",true);this.defParam("convert_fonts_to_spans",false);this.defParam("doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');this.defParam("font_size_classes",'');this.defParam("font_size_style_values",'xx-small,x-small,small,medium,large,x-large,xx-large');this.defParam("event_elements",'a,img');if(this.isMSIE&&this.settings['browsers'].indexOf('msie')==-1)return;if(this.isGecko&&this.settings['browsers'].indexOf('gecko')==-1)return;if(this.isSafari&&this.settings['browsers'].indexOf('safari')==-1)return;if(this.isOpera&&this.settings['browsers'].indexOf('opera')==-1)return;var baseHREF=tinyMCE.settings['document_base_url'];if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings['base_href']=baseHREF.substring(0,baseHREF.lastIndexOf('/'))+"/";theme=this.settings['theme'];this.blockRegExp=new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|blockquote|center|dl|dir|fieldset|form|noscript|noframes|menu|isindex)$","i");this.posKeyCodes=new Array(13,45,36,35,33,34,37,38,39,40);this.uniqueURL='http://tinymce.moxiecode.cp/mce_temp_url';this.settings['theme_href']=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isMSIE)this.settings['force_br_newlines']=false;if(tinyMCE.getParam("content_css",false)){var cssPath=tinyMCE.getParam("content_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['content_css']=this.documentBasePath+"/"+cssPath;else this.settings['content_css']=cssPath;}else this.settings['content_css']='';if(tinyMCE.getParam("popups_css",false)){var cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['popups_css']=this.documentBasePath+"/"+cssPath;else this.settings['popups_css']=cssPath;}else this.settings['popups_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){var cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['editor_css']=this.documentBasePath+"/"+cssPath;else this.settings['editor_css']=cssPath;}else this.settings['editor_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_ui.css";if(tinyMCE.settings['debug']){var msg="Debug: \n";msg+="baseURL: "+this.baseURL+"\n";msg+="documentBasePath: "+this.documentBasePath+"\n";msg+="content_css: "+this.settings['content_css']+"\n";msg+="popups_css: "+this.settings['popups_css']+"\n";msg+="editor_css: "+this.settings['editor_css']+"\n";alert(msg);}this._initCleanup();if(this.configs.length==0){if(this.isSafari&&this.getParam('safari_warning',true))alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.\nYou can disable this message by setting: safari_warning option to false");tinyMCE.addEvent(window,"load",TinyMCE.prototype.onLoad);if(tinyMCE.isMSIE){if(tinyMCE.settings['add_unload_trigger']){tinyMCE.addEvent(window,"unload",TinyMCE.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE.prototype.unloadHandler);}}else{if(tinyMCE.settings['add_unload_trigger'])tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true);});}}this.loadScript(tinyMCE.baseURL+'/themes/'+this.settings['theme']+'/editor_template'+tinyMCE.srcMode+'.js');this.loadScript(tinyMCE.baseURL+'/langs/'+this.settings['language']+'.js');this.loadCSS(this.settings['editor_css']);var themePlugins=tinyMCE.getParam('plugins','',true,',');if(this.settings['plugins']!=''){for(var i=0;i<themePlugins.length;i++)this.loadScript(tinyMCE.baseURL+'/plugins/'+themePlugins[i]+'/editor_plugin'+tinyMCE.srcMode+'.js');}settings['index']=this.configs.length;this.configs[this.configs.length]=settings;};TinyMCE.prototype.loadScript=function(url){for(var i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return;}document.write('<sc'+'ript language="javascript" type="text/javascript" src="'+url+'"></script>');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.loadCSS=function(url){for(var i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return;}document.write('<link href="'+url+'" rel="stylesheet" type="text/css" />');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.importCSS=function(doc,css_file){if(css_file=='')return;if(typeof(doc.createStyleSheet)=="undefined"){var elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if((headArr=doc.getElementsByTagName("head"))!=null&&headArr.length>0)headArr[0].appendChild(elm);}else var styleSheet=doc.createStyleSheet(css_file);};TinyMCE.prototype.confirmAdd=function(e,settings){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang['lang_edit_confirm']))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true');};TinyMCE.prototype.updateContent=function(form_element_name){var formElement=document.getElementById(form_element_name);for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();if(inst.formElement==formElement){var doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isMSIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid);}}};TinyMCE.prototype.addMCEControl=function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCEControl(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst.onAdd(replace_element,form_element_name,target_document);};TinyMCE.prototype.triggerSave=function(skip_cleanup,skip_callback){for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();tinyMCE.settings['preformatted']=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tinyMCE._setHTML(inst.getDoc(),inst.getBody().innerHTML);if(inst.settings['cleanup']==false){tinyMCE.handleVisualAid(inst.getBody(),true,false,inst);tinyMCE._setEventsEnabled(inst.getBody(),true);}tinyMCE._customCleanup(inst,"submit_content_dom",inst.contentWindow.document.body);var htm=skip_cleanup?inst.getBody().innerHTML:tinyMCE._cleanupHTML(inst,inst.getDoc(),this.settings,inst.getBody(),this.visualAid,true);htm=tinyMCE._customCleanup(inst,"submit_content",htm);if(tinyMCE.settings["encoding"]=="xml"||tinyMCE.settings["encoding"]=="html")htm=tinyMCE.convertStringToXML(htm);if(!skip_callback&&tinyMCE.settings['save_callback']!="")var content=eval(tinyMCE.settings['save_callback']+"(inst.formTargetElementId,htm,inst.getBody());");if((typeof(content)!="undefined")&&content!=null)htm=content;htm=tinyMCE.regexpReplace(htm,"&#40;","(","gi");htm=tinyMCE.regexpReplace(htm,"&#41;",")","gi");htm=tinyMCE.regexpReplace(htm,"&#59;",";","gi");htm=tinyMCE.regexpReplace(htm,"&#34;","&quot;","gi");htm=tinyMCE.regexpReplace(htm,"&#94;","^","gi");if(inst.formElement)inst.formElement.value=htm;}};TinyMCE.prototype._setEventsEnabled=function(node,state){var events=new Array('onfocus','onblur','onclick','ondblclick','onmousedown','onmouseup','onmouseover','onmousemove','onmouseout','onkeypress','onkeydown','onkeydown','onkeyup');var evs=tinyMCE.settings['event_elements'].split(',');for(var y=0;y<evs.length;y++){var elms=node.getElementsByTagName(evs[y]);for(var i=0;i<elms.length;i++){var event="";for(var x=0;x<events.length;x++){if((event=tinyMCE.getAttrib(elms[i],events[x]))!=''){event=tinyMCE.cleanupEventStr(""+event);if(!state)event="return true;"+event;else event=event.replace(/^return true;/gi,'');elms[i].removeAttribute(events[x]);elms[i].setAttribute(events[x],event);}}}}};TinyMCE.prototype.resetForm=function(form_index){var formObj=document.forms[form_index];for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();for(var i=0;i<formObj.elements.length;i++){if(inst.formTargetElementId==formObj.elements[i].name){inst.getBody().innerHTML=formObj.elements[i].value;return;}}}};TinyMCE.prototype.execInstanceCommand=function(editor_id,command,user_interface,value,focus){var inst=tinyMCE.getInstanceById(editor_id);if(inst){if(typeof(focus)=="undefined")focus=true;if(focus)inst.contentWindow.focus();inst.autoResetDesignMode();this.selectedElement=inst.getFocusElement();this.selectedInstance=inst;tinyMCE.execCommand(command,user_interface,value);if(tinyMCE.isMSIE&&window.event!=null)tinyMCE.cancelEvent(window.event);}};TinyMCE.prototype.execCommand=function(command,user_interface,value){user_interface=user_interface?user_interface:false;value=value?value:null;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();switch(command){case 'mceHelp':var template=new Array();template['file']='about.htm';template['width']=480;template['height']=380;tinyMCE.openWindow(template,{tinymce_version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion,tinymce_releasedate:tinyMCE.releaseDate,inline:"yes"});return;case 'mceFocus':var inst=tinyMCE.getInstanceById(value);if(inst)inst.contentWindow.focus();return;case "mceAddControl":case "mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case "mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value['element'],value['document']);return;case "mceRemoveControl":case "mceRemoveEditor":tinyMCE.removeMCEControl(value);return;case "mceResetDesignMode":if(!tinyMCE.isMSIE){for(var n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;try{tinyMCE.instances[n].getDoc().designMode="on";}catch(e){}}}return;}if(this.selectedInstance){this.selectedInstance.execCommand(command,user_interface,value);}else if(tinyMCE.settings['focus_alert'])alert(tinyMCELang['lang_focus_alert']);};TinyMCE.prototype.eventPatch=function(editor_id){if(typeof(tinyMCE)=="undefined")return true;for(var i=0;i<document.frames.length;i++){try{if(document.frames[i].event){var event=document.frames[i].event;if(!event.target)event.target=event.srcElement;TinyMCE.prototype.handleEvent(event);return;}}catch(ex){}}};TinyMCE.prototype.unloadHandler=function(){tinyMCE.triggerSave(true,true);};TinyMCE.prototype.addEventHandlers=function(editor_id){if(tinyMCE.isMSIE){var doc=document.frames[editor_id].document;tinyMCE.addEvent(doc,"keypress",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"keyup",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"keydown",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"mouseup",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"click",TinyMCE.prototype.eventPatch);}else{var inst=tinyMCE.instances[editor_id];var doc=inst.getDoc();inst.switchSettings();tinyMCE.addEvent(doc,"keypress",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keydown",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keyup",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"click",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"mouseup",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"mousedown",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"focus",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"blur",tinyMCE.handleEvent);eval('try { doc.designMode = "On"; } catch(e) {}');}};TinyMCE.prototype._createIFrame=function(replace_element){var iframe=document.createElement("iframe");var id=replace_element.getAttribute("id");var aw,ah;aw=""+tinyMCE.settings['area_width'];ah=""+tinyMCE.settings['area_height'];if(aw.indexOf('%')==-1){aw=parseInt(aw);aw=aw<0?300:aw;aw=aw+"px";}if(ah.indexOf('%')==-1){ah=parseInt(ah);ah=ah<0?240:ah;ah=ah+"px";}iframe.setAttribute("id",id);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",aw);iframe.setAttribute("height",ah);iframe.setAttribute("allowtransparency","true");if(tinyMCE.settings["auto_resize"])iframe.setAttribute("scrolling","no");if(tinyMCE.isMSIE&&!tinyMCE.isOpera)iframe.setAttribute("src",this.settings['default_document']);iframe.style.width=aw;iframe.style.height=ah;if(tinyMCE.isMSIE&&!tinyMCE.isOpera)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isMSIE)return window.frames[id];else return iframe;};TinyMCE.prototype.setupContent=function(editor_id){var inst=tinyMCE.instances[editor_id];var doc=inst.getDoc();var head=doc.getElementsByTagName('head').item(0);var content=inst.startContent;tinyMCE.operaOpacityCounter=100*tinyMCE.idCounter;inst.switchSettings();if(!tinyMCE.isMSIE&&doc.title!="blank_page"){try{doc.location.href=tinyMCE.baseURL+"/blank.htm";}catch(ex){}window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",1000);return;}if(!head){window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",10);return;}tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/themes/"+inst.settings['theme']+"/css/editor_content.css");tinyMCE.importCSS(inst.getDoc(),inst.settings['content_css']);tinyMCE.executeCallback('init_instance_callback','_initInstance',0,inst);if(tinyMCE.getParam("convert_fonts_to_spans"))inst.getDoc().body.setAttribute('id','mceSpanFonts');if(tinyMCE.settings['nowrap'])doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings['directionality'];doc.editorId=editor_id;if(!tinyMCE.isMSIE)doc.documentElement.editorId=editor_id;var base=doc.createElement("base");base.setAttribute('href',tinyMCE.settings['base_href']);head.appendChild(base);if(tinyMCE.settings['convert_newlines_to_brs']){content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");content=tinyMCE.regexpReplace(content,"\r","<br />","gi");content=tinyMCE.regexpReplace(content,"\n","<br />","gi");}content=tinyMCE._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isMSIE){window.setInterval('try{tinyMCE.getCSSClasses(document.frames["'+editor_id+'"].document, "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings["force_br_newlines"])document.frames[editor_id].document.styleSheets[0].addRule("p","margin: 0px;");var body=document.frames[editor_id].document.body;tinyMCE.addEvent(body,"beforepaste",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(body,"beforecut",TinyMCE.prototype.eventPatch);body.editorId=editor_id;}content=tinyMCE.cleanupHTMLCode(content);if(!tinyMCE.isMSIE){var contentElement=inst.getDoc().createElement("body");var doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.isGecko&&tinyMCE.settings['remove_lt_gt'])content=content.replace(new RegExp('&lt;&gt;','g'),"");if(tinyMCE.settings['cleanup_on_startup'])tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement));else{content=tinyMCE.regexpReplace(content,"<strong","<b","gi");content=tinyMCE.regexpReplace(content,"<em(/?)>","<i$1>","gi");content=tinyMCE.regexpReplace(content,"<em ","<i ","gi");content=tinyMCE.regexpReplace(content,"</strong>","</b>","gi");content=tinyMCE.regexpReplace(content,"</em>","</i>","gi");tinyMCE.setInnerHTML(inst.getBody(),content);}inst.convertAllRelativeURLs();}else{if(tinyMCE.settings['cleanup_on_startup']){tinyMCE._setHTML(inst.getDoc(),content);eval('try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody());} catch(e) {}');}else tinyMCE._setHTML(inst.getDoc(),content);}var parentElm=document.getElementById(inst.editorId+'_parent');if(parentElm.lastChild.nodeName.toLowerCase()=="input")inst.formElement=parentElm.lastChild;else inst.formElement=parentElm.nextSibling;tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings['visual'],inst);tinyMCE.executeCallback('setupcontent_callback','_setupContent',0,editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isMSIE)TinyMCE.prototype.addEventHandlers(editor_id);if(tinyMCE.isMSIE)tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE.prototype.eventPatch);tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE.triggerNodeChange(false,true);tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());tinyMCE._setEventsEnabled(inst.getBody(),false);tinyMCE.cleanupAnchors(inst.getDoc());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(inst.getDoc());inst.startContent=tinyMCE.trim(inst.getBody().innerHTML);inst.undoLevels[inst.undoLevels.length]=inst.startContent;tinyMCE.operaOpacityCounter=-1;};TinyMCE.prototype.cleanupHTMLCode=function(s){s=s.replace(/<p\/>/gi,'<p>&nbsp;</p>');s=s.replace(/<p>\s*<\/p>/gi,'<p>&nbsp;</p>');s=s.replace(/<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([^\\|>]*?)\/>/gi,'<$1$2></$1>');s=s.replace(new RegExp('\\s+></','gi'),'></');if(tinyMCE.isMSIE)s=s.replace(/<p><hr\/><\/p>/gi,"<hr>");s=s.replace(new RegExp('(href=\"?)(\\s*?#)','gi'),'$1'+tinyMCE.settings['document_base_url']+"#");return s;};TinyMCE.prototype.cancelEvent=function(e){if(tinyMCE.isMSIE){e.returnValue=false;e.cancelBubble=true;}else e.preventDefault();};TinyMCE.prototype.removeTinyMCEFormElements=function(form_obj){for(var i=0;i<form_obj.elements.length;i++){var elementId=form_obj.elements[i].name?form_obj.elements[i].name:form_obj.elements[i].id;if(elementId.indexOf('mce_editor_')==0)form_obj.elements[i].disabled=true;}};TinyMCE.prototype.accessibleEventHandler=function(e){var win=this._win;e=tinyMCE.isMSIE?win.event:e;var elm=tinyMCE.isMSIE?e.srcElement:e.target;if(elm.nodeName=="SELECT"&&!elm.oldonchange){elm.oldonchange=elm.onchange;elm.onchange=null;}if(e.keyCode==13||e.keyCode==32){elm.onchange=elm.oldonchange;elm.onchange();elm.oldonchange=null;tinyMCE.cancelEvent(e);}};TinyMCE.prototype.addSelectAccessibility=function(e,select,win){if(!select._isAccessible){select.onkeydown=tinyMCE.accessibleEventHandler;select._isAccessible=true;select._win=win;}};TinyMCE.prototype.handleEvent=function(e){if(typeof(tinyMCE)=="undefined")return true;switch(e.type){case "blur":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.execCommand('mceEndTyping');return;case "submit":tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE?window.event.srcElement:e.target);tinyMCE.triggerSave();tinyMCE.isNotDirty=true;return;case "reset":var formObj=tinyMCE.isMSIE?window.event.srcElement:e.target;for(var i=0;i<document.forms.length;i++){if(document.forms[i]==formObj)window.setTimeout('tinyMCE.resetForm('+i+');',10);}return;case "keypress":if(e.target.editorId){tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];}else{if(e.target.ownerDocument.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.ownerDocument.editorId];}if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&e.keyCode==13&&!e.shiftKey){if(tinyMCE.selectedInstance._insertPara(e)){tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.cancelEvent(e);return false;}}if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false;}}if(tinyMCE.isGecko&&(e.ctrlKey&&!e.altKey)&&tinyMCE.settings['custom_undo_redo']){if(tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']){if(e.charCode==122){tinyMCE.selectedInstance.execCommand("Undo");e.preventDefault();return false;}if(e.charCode==121){tinyMCE.selectedInstance.execCommand("Redo");e.preventDefault();return false;}}if(e.charCode==98){tinyMCE.selectedInstance.execCommand("Bold");e.preventDefault();return false;}if(e.charCode==105){tinyMCE.selectedInstance.execCommand("Italic");e.preventDefault();return false;}if(e.charCode==117){tinyMCE.selectedInstance.execCommand("Underline");e.preventDefault();return false;}}if(tinyMCE.isMSIE&&tinyMCE.settings['force_br_newlines']&&e.keyCode==13){if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];if(tinyMCE.selectedInstance){var sel=tinyMCE.selectedInstance.getDoc().selection;var rng=sel.createRange();if(tinyMCE.getParentElement(rng.parentElement(),"li")!=null)return false;e.returnValue=false;e.cancelBubble=true;rng.pasteHTML("<br />");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return false;}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false);}return false;break;case "keyup":case "keydown":if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];else return;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false;}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;var elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);if(tinyMCE.isGecko&&tinyMCE.settings['document_base_url']!=""+document.location.href&&e.type=="keyup"&&e.ctrlKey&&e.keyCode==86)tinyMCE.selectedInstance.fixBrokenURLs();if(tinyMCE.isMSIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isMSIE&&e.type=="keyup"&&e.keyCode==13){var elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML="&nbsp;&nbsp;";else elm.innerHTML="&nbsp;";}}}var keys=tinyMCE.posKeyCodes;var posKey=false;for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){posKey=true;break;}}if(tinyMCE.isMSIE&&tinyMCE.settings['custom_undo_redo']){var keys=new Array(8,46);for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){if(e.type=="keyup")tinyMCE.triggerNodeChange(false);}}if(tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']){if(e.keyCode==90&&(e.ctrlKey&&!e.altKey)&&e.type=="keydown"){tinyMCE.selectedInstance.execCommand("Undo");tinyMCE.triggerNodeChange(false);}if(e.keyCode==89&&(e.ctrlKey&&!e.altKey)&&e.type=="keydown"){tinyMCE.selectedInstance.execCommand("Redo");tinyMCE.triggerNodeChange(false);}if((e.keyCode==90||e.keyCode==89)&&(e.ctrlKey&&!e.altKey)){e.returnValue=false;e.cancelBubble=true;return false;}}}if(!posKey&&e.type=="keyup")tinyMCE.execCommand("mceStartTyping");if(e.type=="keyup"&&(posKey||e.ctrlKey))tinyMCE.execCommand("mceEndTyping");if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);if(tinyMCE.isMSIE&&e.ctrlKey)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);break;case "mousedown":case "mouseup":case "click":case "focus":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var targetBody=tinyMCE.getParentElement(e.target,"body");for(var instanceName in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[instanceName]))continue;var inst=tinyMCE.instances[instanceName];inst.autoResetDesignMode();if(inst.getBody()==targetBody){tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"img");break;}}if(tinyMCE.isSafari){tinyMCE.selectedInstance.lastSafariSelection=tinyMCE.selectedInstance.getBookmark();tinyMCE.selectedInstance.lastSafariSelectedElement=tinyMCE.selectedElement;var lnk=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");if(lnk&&e.type=="mousedown"){lnk.setAttribute("mce_real_href",lnk.getAttribute("href"));lnk.setAttribute("href","javascript:void(0);");}if(lnk&&e.type=="click"){window.setTimeout(function(){lnk.setAttribute("href",lnk.getAttribute("mce_real_href"));lnk.removeAttribute("mce_real_href");},10);}}if(e.type!="focus")tinyMCE.selectedNode=null;tinyMCE.triggerNodeChange(false);tinyMCE.execCommand("mceEndTyping");if(e.type=="mouseup")tinyMCE.execCommand("mceAddUndoLevel");if(!tinyMCE.selectedInstance&&e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];if(tinyMCE.isGecko&&tinyMCE.settings['document_base_url']!=""+document.location.href)window.setTimeout('tinyMCE.getInstanceById("'+inst.editorId+'").fixBrokenURLs();',10);return false;break;}};TinyMCE.prototype.switchClass=function(element,class_name,lock_state){var lockChanged=false;if(typeof(lock_state)!="undefined"&&element!=null){element.classLock=lock_state;lockChanged=true;}if(element!=null&&(lockChanged||!element.classLock)){element.oldClassName=element.className;element.className=class_name;}};TinyMCE.prototype.restoreAndSwitchClass=function(element,class_name){if(element!=null&&!element.classLock){this.restoreClass(element);this.switchClass(element,class_name);}};TinyMCE.prototype.switchClassSticky=function(element_name,class_name,lock_state){var element,lockChanged=false;if(!this.stickyClassesLookup[element_name])this.stickyClassesLookup[element_name]=document.getElementById(element_name);element=this.stickyClassesLookup[element_name];if(typeof(lock_state)!="undefined"&&element!=null){element.classLock=lock_state;lockChanged=true;}if(element!=null&&(lockChanged||!element.classLock)){element.className=class_name;element.oldClassName=class_name;if(tinyMCE.isOpera){if(class_name=="mceButtonDisabled"){var suffix="";if(!element.mceOldSrc)element.mceOldSrc=element.src;if(this.operaOpacityCounter>-1)suffix='?rnd='+this.operaOpacityCounter++;element.src=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/images/opacity.png"+suffix;element.style.backgroundImage="url('"+element.mceOldSrc+"')";}else{if(element.mceOldSrc){element.src=element.mceOldSrc;element.parentNode.style.backgroundImage="";element.mceOldSrc=null;}}}}};TinyMCE.prototype.restoreClass=function(element){if(element!=null&&element.oldClassName&&!element.classLock){element.className=element.oldClassName;element.oldClassName=null;}};TinyMCE.prototype.setClassLock=function(element,lock_state){if(element!=null)element.classLock=lock_state;};TinyMCE.prototype.addEvent=function(obj,name,handler){if(tinyMCE.isMSIE){obj.attachEvent("on"+name,handler);}else obj.addEventListener(name,handler,false);};TinyMCE.prototype.submitPatch=function(){tinyMCE.removeTinyMCEFormElements(this);tinyMCE.triggerSave();this.mceOldSubmit();tinyMCE.isNotDirty=true;};TinyMCE.prototype.onLoad=function(){for(var c=0;c<tinyMCE.configs.length;c++){tinyMCE.settings=tinyMCE.configs[c];var selector=tinyMCE.getParam("editor_selector");var deselector=tinyMCE.getParam("editor_deselector");var elementRefAr=new Array();if(document.forms&&tinyMCE.settings['add_form_submit_trigger']&&!tinyMCE.submitTriggers){for(var i=0;i<document.forms.length;i++){var form=document.forms[i];tinyMCE.addEvent(form,"submit",TinyMCE.prototype.handleEvent);tinyMCE.addEvent(form,"reset",TinyMCE.prototype.handleEvent);tinyMCE.submitTriggers=true;if(tinyMCE.settings['submit_patch']){try{form.mceOldSubmit=form.submit;form.submit=TinyMCE.prototype.submitPatch;}catch(e){}}}}var mode=tinyMCE.settings['mode'];switch(mode){case "exact":var elements=tinyMCE.getParam('elements','',true,',');for(var i=0;i<elements.length;i++){var element=tinyMCE._getElementById(elements[i]);var trigger=element?element.getAttribute(tinyMCE.settings['textarea_trigger']):"";if(tinyMCE.getAttrib(element,"class").indexOf(deselector)!=-1)continue;if(trigger=="false")continue;if(tinyMCE.settings['ask']&&element){elementRefAr[elementRefAr.length]=element;continue;}if(element)tinyMCE.addMCEControl(element,elements[i]);else if(tinyMCE.settings['debug'])alert("Error: Could not find element by id or name: "+elements[i]);}break;case "specific_textareas":case "textareas":var nodeList=document.getElementsByTagName("textarea");for(var i=0;i<nodeList.length;i++){var elm=nodeList.item(i);var trigger=elm.getAttribute(tinyMCE.settings['textarea_trigger']);if(selector!=''&&tinyMCE.getAttrib(elm,"class").indexOf(selector)==-1)continue;if(tinyMCE.getAttrib(elm,"class").indexOf(deselector)!=-1)continue;if((mode=="specific_textareas"&&trigger=="true")||(mode=="textareas"&&trigger!="false"))elementRefAr[elementRefAr.length]=elm;}break;}for(var i=0;i<elementRefAr.length;i++){var element=elementRefAr[i];var elementId=element.name?element.name:element.id;if(tinyMCE.settings['ask']){if(tinyMCE.isGecko){var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(e){window.setTimeout(function(){TinyMCE.prototype.confirmAdd(e,settings);},10);});}else{var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(){TinyMCE.prototype.confirmAdd(null,settings);});}}else tinyMCE.addMCEControl(element,elementId);}if(tinyMCE.settings['auto_focus']){window.setTimeout(function(){var inst=tinyMCE.getInstanceById(tinyMCE.settings['auto_focus']);inst.selectNode(inst.getBody(),true,true);inst.contentWindow.focus();},10);}tinyMCE.executeCallback('oninit','_oninit',0);}};TinyMCE.prototype.removeMCEControl=function(editor_id){var inst=tinyMCE.getInstanceById(editor_id);if(inst){inst.switchSettings();editor_id=inst.editorId;var html=tinyMCE.getContent(editor_id);var tmpInstances=new Array();for(var instanceName in tinyMCE.instances){var instance=tinyMCE.instances[instanceName];if(!tinyMCE.isInstance(instance))continue;if(instanceName!=editor_id)tmpInstances[instanceName]=instance;}tinyMCE.instances=tmpInstances;tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;var replaceElement=document.getElementById(editor_id+"_parent");var oldTargetElement=inst.oldTargetElement;var targetName=oldTargetElement.nodeName.toLowerCase();if(targetName=="textarea"||targetName=="input"){replaceElement.parentNode.removeChild(replaceElement);oldTargetElement.style.display="inline";oldTargetElement.value=html;}else{oldTargetElement.innerHTML=html;replaceElement.parentNode.insertBefore(oldTargetElement,replaceElement);replaceElement.parentNode.removeChild(replaceElement);}}};TinyMCE.prototype._cleanupElementName=function(element_name,element){var name="";element_name=element_name.toLowerCase();if(element_name=="body")return null;if(tinyMCE.cleanup_verify_html){for(var i=0;i<tinyMCE.cleanup_invalidElements.length;i++){if(tinyMCE.cleanup_invalidElements[i]==element_name)return null;}var validElement=false;var elementAttribs=null;for(var i=0;i<tinyMCE.cleanup_validElements.length&&!elementAttribs;i++){for(var x=0,n=tinyMCE.cleanup_validElements[i][0].length;x<n;x++){var elmMatch=tinyMCE.cleanup_validElements[i][0][x];if(elmMatch.charAt(0)=='+'||elmMatch.charAt(0)=='-')elmMatch=elmMatch.substring(1);if(elmMatch.match(new RegExp('\\*|\\?|\\+','g'))!=null){elmMatch=elmMatch.replace(new RegExp('\\?','g'),'(\\S?)');elmMatch=elmMatch.replace(new RegExp('\\+','g'),'(\\S+)');elmMatch=elmMatch.replace(new RegExp('\\*','g'),'(\\S*)');elmMatch="^"+elmMatch+"$";if(element_name.match(new RegExp(elmMatch,'g'))){elementAttribs=tinyMCE.cleanup_validElements[i];validElement=true;break;}}if(element_name==elmMatch){elementAttribs=tinyMCE.cleanup_validElements[i];validElement=true;element_name=elementAttribs[0][0];break;}}}if(!validElement)return null;}if(element_name.charAt(0)=='+'||element_name.charAt(0)=='-')name=element_name.substring(1);if(!tinyMCE.isMSIE){if(name=="strong"&&!tinyMCE.cleanup_on_save)element_name="b";else if(name=="em"&&!tinyMCE.cleanup_on_save)element_name="i";}var elmData=new Object();elmData.element_name=element_name;elmData.valid_attribs=elementAttribs;return elmData;};TinyMCE.prototype._moveStyle=function(elm,style,attrib){if(tinyMCE.cleanup_inline_styles){var val=tinyMCE.getAttrib(elm,attrib);if(val!=''){val=''+val;switch(attrib){case "background":val="url('"+val+"');";break;case "bordercolor":if(elm.style.borderStyle==''||elm.style.borderStyle=='none')elm.style.borderStyle='solid';break;case "border":case "width":case "height":if(attrib=="border"&&elm.style.borderWidth>0)return;if(val.indexOf('%')==-1)val+='px';break;case "vspace":case "hspace":elm.style.marginTop=val+"px";elm.style.marginBottom=val+"px";elm.removeAttribute(attrib);return;case "align":if(elm.nodeName=="IMG"){if(tinyMCE.isMSIE)elm.style.styleFloat=val;else elm.style.cssFloat=val;}else elm.style.textAlign=val;elm.removeAttribute(attrib);return;}if(val!=''){eval('elm.style.'+style+' = val;');elm.removeAttribute(attrib);}}}else{if(style=='')return;var val=eval('elm.style.'+style)==''?tinyMCE.getAttrib(elm,attrib):eval('elm.style.'+style);val=val==null?'':''+val;switch(attrib){case "background":if(val.indexOf('url')==-1&&val!='')val="url('"+val+"');";if(val!=''){elm.style.backgroundImage=val;elm.removeAttribute(attrib);}return;case "border":case "width":case "height":val=val.replace('px','');break;case "align":if(tinyMCE.getAttrib(elm,'align')==''){if(elm.nodeName=="IMG"){if(tinyMCE.isMSIE&&elm.style.styleFloat!=''){val=elm.style.styleFloat;style='styleFloat';}else if(tinyMCE.isGecko&&elm.style.cssFloat!=''){val=elm.style.cssFloat;style='cssFloat';}}}break;}if(val!=''){elm.removeAttribute(attrib);elm.setAttribute(attrib,val);eval('elm.style.'+style+' = "";');}}};TinyMCE.prototype._cleanupAttribute=function(valid_attributes,element_name,attribute_node,element_node){var attribName=attribute_node.nodeName.toLowerCase();var attribValue=attribute_node.nodeValue;var attribMustBeValue=null;var verified=false;if(attribName.indexOf('moz_')!=-1)return null;if(!tinyMCE.isMSIE&&(attribName=="mce_real_href"||attribName=="mce_real_src")){if(!tinyMCE.cleanup_on_save){var attrib=new Object();attrib.name=attribName;attrib.value=attribValue;return attrib;}else return null;}if(tinyMCE.cleanup_verify_html&&!verified){for(var i=1;i<valid_attributes.length;i++){var attribMatch=valid_attributes[i][0];var re=null;if(attribMatch.match(new RegExp('\\*|\\?|\\+','g'))!=null){attribMatch=attribMatch.replace(new RegExp('\\?','g'),'(\\S?)');attribMatch=attribMatch.replace(new RegExp('\\+','g'),'(\\S+)');attribMatch=attribMatch.replace(new RegExp('\\*','g'),'(\\S*)');attribMatch="^"+attribMatch+"$";re=new RegExp(attribMatch,'g');}if((re&&attribName.match(re)!=null)||attribName==attribMatch){verified=true;attribMustBeValue=valid_attributes[i][3];break;}}if(!verified)return false;}else verified=true;switch(attribName){case "size":if(tinyMCE.isMSIE5&&element_name=="font")attribValue=element_node.size;break;case "width":case "height":case "border":if(tinyMCE.isMSIE5)attribValue=eval("element_node."+attribName);break;case "shape":attribValue=attribValue.toLowerCase();break;case "cellspacing":if(tinyMCE.isMSIE5)attribValue=element_node.cellSpacing;break;case "cellpadding":if(tinyMCE.isMSIE5)attribValue=element_node.cellPadding;break;case "color":if(tinyMCE.isMSIE5&&element_name=="font")attribValue=element_node.color;break;case "class":if(tinyMCE.cleanup_on_save&&attribValue.indexOf('mceItemAnchor')!=-1)attribValue=attribValue.replace(/mceItem[a-z0-9]+/gi,'');if(element_name=="table"||element_name=="td"){if(tinyMCE.cleanup_visual_table_class!="")attribValue=tinyMCE.getVisualAidClass(attribValue,!tinyMCE.cleanup_on_save);}if(!tinyMCE._verifyClass(element_node)||attribValue=="")return null;break;case "onfocus":case "onblur":case "onclick":case "ondblclick":case "onmousedown":case "onmouseup":case "onmouseover":case "onmousemove":case "onmouseout":case "onkeypress":case "onkeydown":case "onkeydown":case "onkeyup":attribValue=tinyMCE.cleanupEventStr(""+attribValue);if(attribValue.indexOf('return false;')==0)attribValue=attribValue.substring(14);break;case "style":attribValue=tinyMCE.serializeStyle(tinyMCE.parseStyle(tinyMCE.getAttrib(element_node,"style")));break;case "href":case "src":if(tinyMCE.isGecko18&&attribName=="src")attribValue=element_node.src;if(!tinyMCE.isMSIE&&attribName=="href"&&element_node.getAttribute("mce_real_href"))attribValue=element_node.getAttribute("mce_real_href");if(!tinyMCE.isMSIE&&attribName=="src"&&element_node.getAttribute("mce_real_src"))attribValue=element_node.getAttribute("mce_real_src");if(tinyMCE.isGecko&&!tinyMCE.getParam('relative_urls'))attribValue=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],attribValue);attribValue=eval(tinyMCE.cleanup_urlconverter_callback+"(attribValue, element_node, tinyMCE.cleanup_on_save);");break;case "colspan":case "rowspan":if(attribValue=="1")return null;break;case "_moz-userdefined":case "editorid":case "mce_real_href":case "mce_real_src":return null;}if(attribMustBeValue!=null){var isCorrect=false;for(var i=0;i<attribMustBeValue.length;i++){if(attribValue==attribMustBeValue[i]){isCorrect=true;break;}}if(!isCorrect)return null;}var attrib=new Object();attrib.name=attribName;attrib.value=attribValue;return attrib;};TinyMCE.prototype.clearArray=function(ar){for(var key in ar)ar[key]=null;};TinyMCE.prototype.isInstance=function(inst){return inst!=null&&typeof(inst)=="object"&&inst.isTinyMCEControl;};TinyMCE.prototype.parseStyle=function(str){var ar=new Array();if(str==null)return ar;var st=str.split(';');tinyMCE.clearArray(ar);for(var i=0;i<st.length;i++){if(st[i]=='')continue;var re=new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');var pa=st[i].replace(re,'$1||$2').split('||');if(pa.length==2)ar[pa[0].toLowerCase()]=pa[1];}return ar;};TinyMCE.prototype.compressStyle=function(ar,pr,sf,res){var box=new Array();box[0]=ar[pr+'-top'+sf];box[1]=ar[pr+'-left'+sf];box[2]=ar[pr+'-right'+sf];box[3]=ar[pr+'-bottom'+sf];for(var i=0;i<box.length;i++){if(box[i]==null)return;for(var a=0;a<box.length;a++){if(box[a]!=box[i])return;}}ar[res]=box[0];ar[pr+'-top'+sf]=null;ar[pr+'-left'+sf]=null;ar[pr+'-right'+sf]=null;ar[pr+'-bottom'+sf]=null;};TinyMCE.prototype.serializeStyle=function(ar){var str="";tinyMCE.compressStyle(ar,"border","","border");tinyMCE.compressStyle(ar,"border","-width","border-width");tinyMCE.compressStyle(ar,"border","-color","border-color");for(var key in ar){var val=ar[key];if(typeof(val)=='function')continue;if(val!=null&&val!=''){val=''+val;val=val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)",'gi'),"url('$1')");if(tinyMCE.getParam("force_hex_style_colors"))val=tinyMCE.convertRGBToHex(val);if(val!="url('')")str+=key.toLowerCase()+": "+val+"; ";}}if(new RegExp('; $').test(str))str=str.substring(0,str.length-2);return str;};TinyMCE.prototype.convertRGBToHex=function(s){if(s.toLowerCase().indexOf('rgb')!=-1){var re=new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)","gi");var rgb=s.replace(re,"$1,$2,$3").split(',');if(rgb.length==3){r=parseInt(rgb[0]).toString(16);g=parseInt(rgb[1]).toString(16);b=parseInt(rgb[2]).toString(16);r=r.length==1?'0'+r:r;g=g.length==1?'0'+g:g;b=b.length==1?'0'+b:b;s="#"+r+g+b;}}return s;};TinyMCE.prototype._verifyClass=function(node){if(tinyMCE.isGecko){var className=node.getAttribute('class');if(!className)return false;}if(tinyMCE.isMSIE)var className=node.getAttribute('className');if(tinyMCE.cleanup_verify_css_classes&&tinyMCE.cleanup_on_save){var csses=tinyMCE.getCSSClasses();nonDefinedCSS=true;for(var c=0;c<csses.length;c++){if(csses[c]==className){nonDefinedCSS=false;break;}}if(nonDefinedCSS&&className.indexOf('mce_')!=0){node.removeAttribute('className');node.removeAttribute('class');return false;}}return true;};TinyMCE.prototype.cleanupNode=function(node){var output="";switch(node.nodeType){case 1:var elementData=tinyMCE._cleanupElementName(node.nodeName,node);var elementName=elementData?elementData.element_name:null;var elementValidAttribs=elementData?elementData.valid_attribs:null;var elementAttribs="";var openTag=false,nonEmptyTag=false;if(elementName!=null&&elementName.charAt(0)=='+'){elementName=elementName.substring(1);openTag=true;}if(elementName!=null&&elementName.charAt(0)=='-'){elementName=elementName.substring(1);nonEmptyTag=true;}if(tinyMCE.isMSIE&&tinyMCE.settings['fix_content_duplication']){var lookup=tinyMCE.cleanup_elementLookupTable;for(var i=0;i<lookup.length;i++){if(lookup[i]==node)return output;}lookup[lookup.length]=node;}if(!elementName){if(node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++)output+=this.cleanupNode(node.childNodes[i]);}return output;}if(tinyMCE.cleanup_on_save){if(node.nodeName=="A"&&node.className=="mceItemAnchor"){if(node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++)output+=this.cleanupNode(node.childNodes[i]);}return '<a name="'+this.convertStringToXML(node.getAttribute("name"))+'"></a>'+output;}}var re=new RegExp("^(TABLE|TD|TR)$");if(re.test(node.nodeName)){if((node.nodeName!="TABLE"||tinyMCE.cleanup_inline_styles)&&(width=tinyMCE.getAttrib(node,"width"))!=''){node.style.width=width.indexOf('%')!=-1?width:width.replace(/[^0-9]/gi,'')+"px";node.removeAttribute("width");}if((node.nodeName=="TABLE"&&!tinyMCE.cleanup_inline_styles)&&node.style.width!=''){tinyMCE.setAttrib(node,"width",node.style.width.replace('px',''));node.style.width='';}if((height=tinyMCE.getAttrib(node,"height"))!=''){node.style.height=height.indexOf('%')!=-1?height:height.replace(/[^0-9]/gi,'')+"px";node.removeAttribute("height");}}if(tinyMCE.cleanup_inline_styles){var re=new RegExp("^(TABLE|TD|TR|IMG|HR)$");if(re.test(node.nodeName)){tinyMCE._moveStyle(node,'width','width');tinyMCE._moveStyle(node,'height','height');tinyMCE._moveStyle(node,'borderWidth','border');tinyMCE._moveStyle(node,'','vspace');tinyMCE._moveStyle(node,'','hspace');tinyMCE._moveStyle(node,'textAlign','align');tinyMCE._moveStyle(node,'backgroundColor','bgColor');tinyMCE._moveStyle(node,'borderColor','borderColor');tinyMCE._moveStyle(node,'backgroundImage','background');if(tinyMCE.isMSIE5)node.outerHTML=node.outerHTML;}else if(tinyMCE.isBlockElement(node))tinyMCE._moveStyle(node,'textAlign','align');if(node.nodeName=="FONT")tinyMCE._moveStyle(node,'color','color');}if(elementValidAttribs){for(var a=1;a<elementValidAttribs.length;a++){var attribName,attribDefaultValue,attribForceValue,attribValue;attribName=elementValidAttribs[a][0];attribDefaultValue=elementValidAttribs[a][1];attribForceValue=elementValidAttribs[a][2];if(attribDefaultValue!=null||attribForceValue!=null){var attribValue=node.getAttribute(attribName);if(node.getAttribute(attribName)==null||node.getAttribute(attribName)=="")attribValue=attribDefaultValue;attribValue=attribForceValue?attribForceValue:attribValue;if(attribValue=="{$uid}")attribValue="uid_"+(tinyMCE.cleanup_idCount++);if(attribName=="class")attribValue=tinyMCE.getVisualAidClass(attribValue,tinyMCE.cleanup_on_save);node.setAttribute(attribName,attribValue);}}}if((tinyMCE.isMSIE&&!tinyMCE.isOpera)&&elementName=="style")return "<style>"+node.innerHTML+"</style>";if(elementName=="table"&&!node.hasChildNodes())return "";if(node.attributes.length>0){var lastAttrib="";for(var i=0;i<node.attributes.length;i++){if(node.attributes[i].specified){if(tinyMCE.isOpera){if(node.attributes[i].nodeName==lastAttrib)continue;lastAttrib=node.attributes[i].nodeName;}var attrib=tinyMCE._cleanupAttribute(elementValidAttribs,elementName,node.attributes[i],node);if(attrib&&attrib.value!="")elementAttribs+=" "+attrib.name+"="+'"'+this.convertStringToXML(""+attrib.value)+'"';}}}if(tinyMCE.isMSIE&&elementName=="table"&&node.getAttribute("summary")!=null&&elementAttribs.indexOf('summary')==-1){var summary=tinyMCE.getAttrib(node,'summary');if(summary!='')elementAttribs+=" summary="+'"'+this.convertStringToXML(summary)+'"';}if(tinyMCE.isMSIE5&&/^(td|img|a)$/.test(elementName)){var ma=new Array("scope","longdesc","hreflang","charset","type");for(var u=0;u<ma.length;u++){if(node.getAttribute(ma[u])!=null){var s=tinyMCE.getAttrib(node,ma[u]);if(s!='')elementAttribs+=" "+ma[u]+"="+'"'+this.convertStringToXML(s)+'"';}}}if(tinyMCE.isMSIE&&elementName=="input"){if(node.type){if(!elementAttribs.match(/type=/g))elementAttribs+=" type="+'"'+node.type+'"';}if(node.value){if(!elementAttribs.match(/value=/g))elementAttribs+=" value="+'"'+node.value+'"';}}if((elementName=="p"||elementName=="td")&&(node.innerHTML==""||node.innerHTML=="&nbsp;"))return "<"+elementName+elementAttribs+">"+this.convertStringToXML(String.fromCharCode(160))+"</"+elementName+">";if(tinyMCE.isMSIE&&elementName=="script")return "<"+elementName+elementAttribs+">"+node.text+"</"+elementName+">";if(node.hasChildNodes()){if(!(elementName=="span"&&elementAttribs==""&&tinyMCE.getParam("trim_span_elements"))){if(elementName=="p"&&tinyMCE.cleanup_force_br_newlines)output+="<div"+elementAttribs+">";else output+="<"+elementName+elementAttribs+">";}for(var i=0;i<node.childNodes.length;i++)output+=this.cleanupNode(node.childNodes[i]);if(!(elementName=="span"&&elementAttribs==""&&tinyMCE.getParam("trim_span_elements"))){if(elementName=="p"&&tinyMCE.cleanup_force_br_newlines)output+="</div><br />";else output+="</"+elementName+">";}}else{if(!nonEmptyTag){if(openTag)output+="<"+elementName+elementAttribs+"></"+elementName+">";else output+="<"+elementName+elementAttribs+" />";}}return output;case 3:if(node.parentNode.nodeName=="SCRIPT"||node.parentNode.nodeName=="STYLE")return node.nodeValue;return this.convertStringToXML(node.nodeValue);case 8:return "<!--"+node.nodeValue+"-->";default:return "[UNKNOWN NODETYPE "+node.nodeType+"]";}};TinyMCE.prototype.convertStringToXML=function(html_data){var output="";for(var i=0;i<html_data.length;i++){var chr=html_data.charCodeAt(i);if(tinyMCE.settings['entity_encoding']=="numeric"){if(chr>127)output+='&#'+chr+";";else output+=String.fromCharCode(chr);continue;}if(tinyMCE.settings['entity_encoding']=="raw"){output+=String.fromCharCode(chr);continue;}if(typeof(tinyMCE.cleanup_entities["c"+chr])!='undefined'&&tinyMCE.cleanup_entities["c"+chr]!='')output+='&'+tinyMCE.cleanup_entities["c"+chr]+';';else output+=''+String.fromCharCode(chr);}return output;};TinyMCE.prototype._getCleanupElementName=function(chunk){var pos;if(chunk.charAt(0)=='+')chunk=chunk.substring(1);if(chunk.charAt(0)=='-')chunk=chunk.substring(1);if((pos=chunk.indexOf('/'))!=-1)chunk=chunk.substring(0,pos);if((pos=chunk.indexOf('['))!=-1)chunk=chunk.substring(0,pos);return chunk;};TinyMCE.prototype._initCleanup=function(){var validElements=tinyMCE.settings["valid_elements"];validElements=validElements.split(',');var extendedValidElements=tinyMCE.settings["extended_valid_elements"];extendedValidElements=extendedValidElements.split(',');for(var i=0;i<extendedValidElements.length;i++){var elementName=this._getCleanupElementName(extendedValidElements[i]);var skipAdd=false;for(var x=0;x<validElements.length;x++){if(this._getCleanupElementName(validElements[x])==elementName){validElements[x]=extendedValidElements[i];skipAdd=true;break;}}if(!skipAdd)validElements[validElements.length]=extendedValidElements[i];}for(var i=0;i<validElements.length;i++){var item=validElements[i];item=item.replace('[','|');item=item.replace(']','');var attribs=item.split('|');for(var x=0;x<attribs.length;x++)attribs[x]=attribs[x].toLowerCase();attribs[0]=attribs[0].split('/');for(var x=1;x<attribs.length;x++){var attribName=attribs[x];var attribDefault=null;var attribForce=null;var attribMustBe=null;if((pos=attribName.indexOf('='))!=-1){attribDefault=attribName.substring(pos+1);attribName=attribName.substring(0,pos);}if((pos=attribName.indexOf(':'))!=-1){attribForce=attribName.substring(pos+1);attribName=attribName.substring(0,pos);}if((pos=attribName.indexOf('<'))!=-1){attribMustBe=attribName.substring(pos+1).split('?');attribName=attribName.substring(0,pos);}attribs[x]=new Array(attribName,attribDefault,attribForce,attribMustBe);}validElements[i]=attribs;}var invalidElements=tinyMCE.settings['invalid_elements'].split(',');for(var i=0;i<invalidElements.length;i++)invalidElements[i]=invalidElements[i].toLowerCase();tinyMCE.settings['cleanup_validElements']=validElements;tinyMCE.settings['cleanup_invalidElements']=invalidElements;tinyMCE.settings['cleanup_entities']=new Array();var entities=tinyMCE.getParam('entities','',true,',');for(var i=0;i<entities.length;i+=2)tinyMCE.settings['cleanup_entities']['c'+entities[i]]=entities[i+1];};TinyMCE.prototype._cleanupHTML=function(inst,doc,config,element,visual,on_save){if(!tinyMCE.settings['cleanup'])return element.innerHTML;if(on_save&&tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertFontsToSpans(doc);tinyMCE._customCleanup(inst,on_save?"get_from_editor_dom":"insert_to_editor_dom",doc.body);tinyMCE.cleanup_validElements=tinyMCE.settings['cleanup_validElements'];tinyMCE.cleanup_entities=tinyMCE.settings['cleanup_entities'];tinyMCE.cleanup_invalidElements=tinyMCE.settings['cleanup_invalidElements'];tinyMCE.cleanup_verify_html=tinyMCE.settings['verify_html'];tinyMCE.cleanup_force_br_newlines=tinyMCE.settings['force_br_newlines'];tinyMCE.cleanup_urlconverter_callback=tinyMCE.settings['urlconverter_callback'];tinyMCE.cleanup_verify_css_classes=tinyMCE.settings['verify_css_classes'];tinyMCE.cleanup_visual_table_class=tinyMCE.settings['visual_table_class'];tinyMCE.cleanup_apply_source_formatting=tinyMCE.settings['apply_source_formatting'];tinyMCE.cleanup_inline_styles=tinyMCE.settings['inline_styles'];tinyMCE.cleanup_visual_aid=visual;tinyMCE.cleanup_on_save=on_save;tinyMCE.cleanup_idCount=0;tinyMCE.cleanup_elementLookupTable=new Array();var startTime=new Date().getTime();if(tinyMCE.isMSIE){var nodes=element.getElementsByTagName("hr");for(var i=0;i<nodes.length;i++){if(nodes[i].id=="null")nodes[i].removeAttribute("id");}tinyMCE.setInnerHTML(element,tinyMCE.regexpReplace(element.innerHTML,'<p>[ \n\r]*<hr.*>[ \n\r]*</p>','<hr />','gi'));tinyMCE.setInnerHTML(element,tinyMCE.regexpReplace(element.innerHTML,'<!([^-(DOCTYPE)]* )|<!/[^-]*>','','gi'));}var html=this.cleanupNode(element);if(tinyMCE.settings['debug'])tinyMCE.debug("Cleanup process executed in: "+(new Date().getTime()-startTime)+" ms.");html=tinyMCE.regexpReplace(html,'<p><hr /></p>','<hr />');html=tinyMCE.regexpReplace(html,'<p>&nbsp;</p><hr /><p>&nbsp;</p>','<hr />');html=tinyMCE.regexpReplace(html,'<td>\\s*<br />\\s*</td>','<td>&nbsp;</td>');html=tinyMCE.regexpReplace(html,'<p>\\s*<br />\\s*</p>','<p>&nbsp;</p>');html=tinyMCE.regexpReplace(html,'<p>\\s*&nbsp;\\s*<br />\\s*&nbsp;\\s*</p>','<p>&nbsp;</p>');html=tinyMCE.regexpReplace(html,'<p>\\s*&nbsp;\\s*<br />\\s*</p>','<p>&nbsp;</p>');html=tinyMCE.regexpReplace(html,'<p>\\s*<br />\\s*&nbsp;\\s*</p>','<p>&nbsp;</p>');html=html.replace(new RegExp('<a>(.*?)</a>','gi'),'$1');if(!tinyMCE.isMSIE)html=html.replace(new RegExp('<o:p _moz-userdefined="" />','g'),"");if(tinyMCE.settings['remove_linebreaks'])html=html.replace(new RegExp('\r|\n','g'),' ');if(tinyMCE.getParam('apply_source_formatting')){html=html.replace(new RegExp('<(p|div)([^>]*)>','g'),"\n<$1$2>\n");html=html.replace(new RegExp('<\/(p|div)([^>]*)>','g'),"\n</$1$2>\n");html=html.replace(new RegExp('<br />','g'),"<br />\n");}if(tinyMCE.settings['force_br_newlines']){var re=new RegExp('<p>&nbsp;</p>','g');html=html.replace(re,"<br />");}if(tinyMCE.isGecko&&tinyMCE.settings['remove_lt_gt']){var re=new RegExp('&lt;&gt;','g');html=html.replace(re,"");}html=tinyMCE._customCleanup(inst,on_save?"get_from_editor":"insert_to_editor",html);var chk=tinyMCE.regexpReplace(html,"[ \t\r\n]","").toLowerCase();if(chk=="<br/>"||chk=="<br>"||chk=="<p>&nbsp;</p>"||chk=="<p>&#160;</p>"||chk=="<p></p>")html="";if(tinyMCE.settings["preformatted"])return "<pre>"+html+"</pre>";return html;};TinyMCE.prototype.insertLink=function(href,target,title,onclick,style_class){tinyMCE.execCommand('mceBeginUndoLevel');if(this.selectedInstance&&this.selectedElement&&this.selectedElement.nodeName.toLowerCase()=="img"){var doc=this.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(this.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true;}href=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");tinyMCE.setAttrib(linkElement,'href',href);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',title);tinyMCE.setAttrib(linkElement,'onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(this.selectedElement.cloneNode(true));this.selectedElement.parentNode.replaceChild(linkElement,this.selectedElement);}return;}if(!this.linkElement&&this.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,'<a href="'+tinyMCE.uniqueURL+'">'+this.selectedInstance.getSelectedHTML()+'</a>');}else this.selectedInstance.contentDocument.execCommand("createlink",false,tinyMCE.uniqueURL);tinyMCE.linkElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);var elementArray=this.getElementsByAttributeValue(this.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);for(var i=0;i<elementArray.length;i++){href=eval(tinyMCE.settings['urlconverter_callback']+"(href, elementArray[i]);");tinyMCE.setAttrib(elementArray[i],'href',href);tinyMCE.setAttrib(elementArray[i],'mce_real_href',href);tinyMCE.setAttrib(elementArray[i],'target',target);tinyMCE.setAttrib(elementArray[i],'title',title);tinyMCE.setAttrib(elementArray[i],'onclick',onclick);tinyMCE.setAttrib(elementArray[i],'class',style_class);}tinyMCE.linkElement=elementArray[0];}if(this.linkElement){href=eval(tinyMCE.settings['urlconverter_callback']+"(href, this.linkElement);");tinyMCE.setAttrib(this.linkElement,'href',href);tinyMCE.setAttrib(this.linkElement,'mce_real_href',href);tinyMCE.setAttrib(this.linkElement,'target',target);tinyMCE.setAttrib(this.linkElement,'title',title);tinyMCE.setAttrib(this.linkElement,'onclick',onclick);tinyMCE.setAttrib(this.linkElement,'class',style_class);}tinyMCE.execCommand('mceEndUndoLevel');};TinyMCE.prototype.insertImage=function(src,alt,border,hspace,vspace,width,height,align,title,onmouseover,onmouseout){tinyMCE.execCommand('mceBeginUndoLevel');if(src=="")return;if(!this.imgElement&&tinyMCE.isSafari){var html="";html+='<img src="'+src+'" alt="'+alt+'"';html+=' border="'+border+'" hspace="'+hspace+'"';html+=' vspace="'+vspace+'" width="'+width+'"';html+=' height="'+height+'" align="'+align+'" title="'+title+'" onmouseover="'+onmouseover+'" onmouseout="'+onmouseout+'" />';tinyMCE.execCommand("mceInsertContent",false,html);}else{if(!this.imgElement&&this.selectedInstance){if(tinyMCE.isSafari)tinyMCE.execCommand("mceInsertContent",false,'<img src="'+tinyMCE.uniqueURL+'" />');else this.selectedInstance.contentDocument.execCommand("insertimage",false,tinyMCE.uniqueURL);tinyMCE.imgElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"img","src",tinyMCE.uniqueURL);}}if(this.imgElement){var needsRepaint=false;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, tinyMCE.imgElement);");if(onmouseover&&onmouseover!="")onmouseover="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, tinyMCE.imgElement);")+"';";if(onmouseout&&onmouseout!="")onmouseout="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, tinyMCE.imgElement);")+"';";if(typeof(title)=="undefined")title=alt;if(width!=this.imgElement.getAttribute("width")||height!=this.imgElement.getAttribute("height")||align!=this.imgElement.getAttribute("align"))needsRepaint=true;tinyMCE.setAttrib(this.imgElement,'src',src);tinyMCE.setAttrib(this.imgElement,'mce_real_src',src);tinyMCE.setAttrib(this.imgElement,'alt',alt);tinyMCE.setAttrib(this.imgElement,'title',title);tinyMCE.setAttrib(this.imgElement,'align',align);tinyMCE.setAttrib(this.imgElement,'border',border,true);tinyMCE.setAttrib(this.imgElement,'hspace',hspace,true);tinyMCE.setAttrib(this.imgElement,'vspace',vspace,true);tinyMCE.setAttrib(this.imgElement,'width',width,true);tinyMCE.setAttrib(this.imgElement,'height',height,true);tinyMCE.setAttrib(this.imgElement,'onmouseover',onmouseover);tinyMCE.setAttrib(this.imgElement,'onmouseout',onmouseout);if(width&&width!="")this.imgElement.style.pixelWidth=width;if(height&&height!="")this.imgElement.style.pixelHeight=height;if(needsRepaint)tinyMCE.selectedInstance.repaint();}tinyMCE.execCommand('mceEndUndoLevel');};TinyMCE.prototype.getElementByAttributeValue=function(node,element_name,attrib,value){var elements=this.getElementsByAttributeValue(node,element_name,attrib,value);if(elements.length==0)return null;return elements[0];};TinyMCE.prototype.getElementsByAttributeValue=function(node,element_name,attrib,value){var elements=new Array();if(node&&node.nodeName.toLowerCase()==element_name){if(node.getAttribute(attrib)&&node.getAttribute(attrib).indexOf(value)!=-1)elements[elements.length]=node;}if(node&&node.hasChildNodes()){for(var x=0,n=node.childNodes.length;x<n;x++){var childElements=this.getElementsByAttributeValue(node.childNodes[x],element_name,attrib,value);for(var i=0,m=childElements.length;i<m;i++)elements[elements.length]=childElements[i];}}return elements;};TinyMCE.prototype.isBlockElement=function(node){return node!=null&&node.nodeType==1&&this.blockRegExp.test(node.nodeName);};TinyMCE.prototype.getParentBlockElement=function(node){while(node){if(this.blockRegExp.test(node.nodeName))return node;node=node.parentNode;}return null;};TinyMCE.prototype.getNodeTree=function(node,node_array,type,node_name){if(typeof(type)=="undefined"||node.nodeType==type&&(typeof(node_name)=="undefined"||node.nodeName==node_name))node_array[node_array.length]=node;if(node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++)tinyMCE.getNodeTree(node.childNodes[i],node_array,type,node_name);}return node_array;};TinyMCE.prototype.getParentElement=function(node,names,attrib_name,attrib_value){if(typeof(names)=="undefined"){if(node.nodeType==1)return node;while((node=node.parentNode)!=null&&node.nodeType!=1);return node;}var namesAr=names.split(',');if(node==null)return null;do{for(var i=0;i<namesAr.length;i++){if(node.nodeName.toLowerCase()==namesAr[i].toLowerCase()||names=="*"){if(typeof(attrib_name)=="undefined")return node;else if(node.getAttribute(attrib_name)){if(typeof(attrib_value)=="undefined"){if(node.getAttribute(attrib_name)!="")return node;}else if(node.getAttribute(attrib_name)==attrib_value)return node;}}}}while((node=node.parentNode)!=null);return null;};TinyMCE.prototype.convertURL=function(url,node,on_save){var prot=document.location.protocol;var host=document.location.hostname;var port=document.location.port;var fileProto=(prot=="file:");url=tinyMCE.regexpReplace(url,'(http|https):///','/');if(url.indexOf('mailto:')!=-1||url.indexOf('javascript:')!=-1||tinyMCE.regexpReplace(url,'[ \t\r\n\+]|%20','').charAt(0)=="#")return url;if(!tinyMCE.isMSIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings['base_href']+url;if(!tinyMCE.getParam('relative_urls')){var urlParts=tinyMCE.parseURL(url);var baseUrlParts=tinyMCE.parseURL(tinyMCE.settings['base_href']);if(urlParts['anchor']&&urlParts['path']==baseUrlParts['path'])return "#"+urlParts['anchor'];}if(on_save&&tinyMCE.getParam('relative_urls')){var urlParts=tinyMCE.parseURL(url);var tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings['document_base_url']);if(urlParts['host']==tmpUrlParts['host']&&(!urlParts['port']||urlParts['port']==tmpUrlParts['port']))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings['document_base_url'],url);}if(!fileProto&&tinyMCE.getParam('remove_script_host')){var start="",portPart="";if(port!="")portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1);if(!tinyMCE.getParam('relative_urls')&&url.indexOf('://')==-1&&url.charAt(0)!='/')url='/'+url;}return url;};TinyMCE.prototype.parseURL=function(url_str){var urlParts=new Array();if(url_str){var pos,lastPos;pos=url_str.indexOf('://');if(pos!=-1){urlParts['protocol']=url_str.substring(0,pos);lastPos=pos+3;}for(var i=lastPos;i<url_str.length;i++){var chr=url_str.charAt(i);if(chr==':')break;if(chr=='/')break;}pos=i;urlParts['host']=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)==':'){pos=url_str.indexOf('/',lastPos);urlParts['port']=url_str.substring(lastPos+1,pos);}lastPos=pos;pos=url_str.indexOf('?',lastPos);if(pos==-1)pos=url_str.indexOf('#',lastPos);if(pos==-1)pos=url_str.length;urlParts['path']=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)=='?'){pos=url_str.indexOf('#');pos=(pos==-1)?url_str.length:pos;urlParts['query']=url_str.substring(lastPos+1,pos);}lastPos=pos;if(url_str.charAt(pos)=='#'){pos=url_str.length;urlParts['anchor']=url_str.substring(lastPos+1,pos);}}return urlParts;};TinyMCE.prototype.serializeURL=function(up){var url="";if(up['protocol'])url+=up['protocol']+"://";if(up['host'])url+=up['host'];if(up['port'])url+=":"+up['port'];if(up['path'])url+=up['path'];if(up['query'])url+="?"+up['query'];if(up['anchor'])url+="#"+up['anchor'];return url;};TinyMCE.prototype.convertAbsoluteURLToRelativeURL=function(base_url,url_to_relative){var baseURL=this.parseURL(base_url);var targetURL=this.parseURL(url_to_relative);var strTok1;var strTok2;var breakPoint=0;var outPath="";var forceSlash=false;if(targetURL.path=="")targetURL.path="/";else forceSlash=true;base_url=baseURL.path.substring(0,baseURL.path.lastIndexOf('/'));strTok1=base_url.split('/');strTok2=targetURL.path.split('/');if(strTok1.length>=strTok2.length){for(var i=0;i<strTok1.length;i++){if(i>=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(strTok1.length<strTok2.length){for(var i=0;i<strTok2.length;i++){if(i>=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(breakPoint==1)return targetURL.path;for(var i=0;i<(strTok1.length-(breakPoint-1));i++)outPath+="../";for(var i=breakPoint-1;i<strTok2.length;i++){if(i!=(breakPoint-1))outPath+="/"+strTok2[i];else outPath+=strTok2[i];}targetURL.protocol=null;targetURL.host=null;targetURL.port=null;targetURL.path=outPath==""&&forceSlash?"/":outPath;return this.serializeURL(targetURL);};TinyMCE.prototype.convertRelativeToAbsoluteURL=function(base_url,relative_url){var baseURL=TinyMCE.prototype.parseURL(base_url);var relURL=TinyMCE.prototype.parseURL(relative_url);if(relative_url==""||relative_url.charAt(0)=='/'||relative_url.indexOf('://')!=-1||relative_url.indexOf('mailto:')!=-1||relative_url.indexOf('javascript:')!=-1)return relative_url;baseURLParts=baseURL['path'].split('/');relURLParts=relURL['path'].split('/');var newBaseURLParts=new Array();for(var i=baseURLParts.length-1;i>=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i];}baseURLParts=newBaseURLParts.reverse();var newRelURLParts=new Array();var numBack=0;for(var i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue;}if(numBack>0){numBack--;continue;}newRelURLParts[newRelURLParts.length]=relURLParts[i];}relURLParts=newRelURLParts.reverse();var len=baseURLParts.length-numBack;var absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');var start="",end="";relURL.protocol=baseURL.protocol;relURL.host=baseURL.host;relURL.port=baseURL.port;if(relURL.path.charAt(relURL.path.length-1)=="/")absPath+="/";relURL.path=absPath;return TinyMCE.prototype.serializeURL(relURL);};TinyMCE.prototype.getParam=function(name,default_value,strip_whitespace,split_chr){var value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);var outArray=new Array();for(var i=0;i<value.length;i++){if(value[i]&&value[i]!="")outArray[outArray.length]=value[i];}value=outArray;}return value;};TinyMCE.prototype.getLang=function(name,default_value,parse_entities){var value=(typeof(tinyMCELang[name])=="undefined")?default_value:tinyMCELang[name];if(parse_entities){var el=document.createElement("div");el.innerHTML=value;value=el.innerHTML;}return value;};TinyMCE.prototype.addToLang=function(prefix,ar){for(var key in ar){if(typeof(ar[key])=='function')continue;tinyMCELang[(key.indexOf('lang_')==-1?'lang_':'')+(prefix!=''?(prefix+"_"):'')+key]=ar[key];}};TinyMCE.prototype.replaceVar=function(replace_haystack,replace_var,replace_str){var re=new RegExp('{\\\$'+replace_var+'}','g');return replace_haystack.replace(re,replace_str);};TinyMCE.prototype.replaceVars=function(replace_haystack,replace_vars){for(var key in replace_vars){var value=replace_vars[key];if(typeof(value)=='function')continue;replace_haystack=tinyMCE.replaceVar(replace_haystack,key,value);}return replace_haystack;};TinyMCE.prototype.triggerNodeChange=function(focus,setup_content){if(tinyMCE.settings['handleNodeChangeCallback']){if(tinyMCE.selectedInstance){var inst=tinyMCE.selectedInstance;var editorId=inst.editorId;var elm=(typeof(setup_content)!="undefined"&&setup_content)?tinyMCE.selectedElement:inst.getFocusElement();var undoIndex=-1;var undoLevels=-1;var anySelection=false;var selectedText=inst.getSelectedText();if(tinyMCE.settings["auto_resize"]){var doc=inst.getDoc();inst.iframeElement.style.width=doc.body.offsetWidth+"px";inst.iframeElement.style.height=doc.body.offsetHeight+"px";}if(tinyMCE.selectedElement)anySelection=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(selectedText&&selectedText.length>0);if(tinyMCE.settings['custom_undo_redo']){undoIndex=inst.undoIndex;undoLevels=inst.undoLevels.length;}tinyMCE.executeCallback('handleNodeChangeCallback','_handleNodeChange',0,editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection,setup_content);}}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus();};TinyMCE.prototype._customCleanup=function(inst,type,content){var customCleanup=tinyMCE.settings['cleanup_callback'];if(customCleanup!=""&&eval("typeof("+customCleanup+")")!="undefined")content=eval(customCleanup+"(type, content, inst);");var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){if(eval("typeof(TinyMCE_"+plugins[i]+"_cleanup)")!="undefined")content=eval("TinyMCE_"+plugins[i]+"_cleanup(type, content, inst);");}return content;};TinyMCE.prototype.getContent=function(editor_id){if(typeof(editor_id)!="undefined")tinyMCE.selectedInstance=tinyMCE.getInstanceById(editor_id);if(tinyMCE.selectedInstance){var old=this.selectedInstance.getBody().innerHTML;var html=tinyMCE._cleanupHTML(this.selectedInstance,this.selectedInstance.getDoc(),tinyMCE.settings,this.selectedInstance.getBody(),false,true);tinyMCE.setInnerHTML(this.selectedInstance.getBody(),old);return html;}return null;};TinyMCE.prototype.setContent=function(html_content){if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.execCommand('mceSetContent',false,html_content);tinyMCE.selectedInstance.repaint();}};TinyMCE.prototype.importThemeLanguagePack=function(name){if(typeof(name)=="undefined")name=tinyMCE.settings['theme'];tinyMCE.loadScript(tinyMCE.baseURL+'/themes/'+name+'/langs/'+tinyMCE.settings['language']+'.js');};TinyMCE.prototype.importPluginLanguagePack=function(name,valid_languages){var lang="en";valid_languages=valid_languages.split(',');for(var i=0;i<valid_languages.length;i++){if(tinyMCE.settings['language']==valid_languages[i])lang=tinyMCE.settings['language'];}tinyMCE.loadScript(tinyMCE.baseURL+'/plugins/'+name+'/langs/'+lang+'.js');};TinyMCE.prototype.applyTemplate=function(html,args){html=tinyMCE.replaceVar(html,"themeurl",tinyMCE.themeURL);if(typeof(args)!="undefined")html=tinyMCE.replaceVars(html,args);html=tinyMCE.replaceVars(html,tinyMCE.settings);html=tinyMCE.replaceVars(html,tinyMCELang);return html;};TinyMCE.prototype.openWindow=function(template,args){var html,width,height,x,y,resizable,scrollbars,url;args['mce_template_file']=template['file'];args['mce_width']=template['width'];args['mce_height']=template['height'];tinyMCE.windowArgs=args;html=template['html'];if(!(width=parseInt(template['width'])))width=320;if(!(height=parseInt(template['height'])))height=200;if(tinyMCE.isMSIE)height+=40;else height+=20;x=parseInt(screen.width/2.0)-(width/2.0);y=parseInt(screen.height/2.0)-(height/2.0);resizable=(args&&args['resizable'])?args['resizable']:"no";scrollbars=(args&&args['scrollbars'])?args['scrollbars']:"no";if(template['file'].charAt(0)!='/'&&template['file'].indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template['file'];else url=template['file'];for(var name in args){if(typeof(args[name])=='function')continue;url=tinyMCE.replaceVar(url,name,escape(args[name]));}if(html){html=tinyMCE.replaceVar(html,"css",this.settings['popups_css']);html=tinyMCE.applyTemplate(html,args);var win=window.open("","mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog=yes,minimizable="+resizable+",modal=yes,width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang['lang_popup_blocked']);return;}win.document.write(html);win.document.close();win.resizeTo(width,height);win.focus();}else{if(tinyMCE.isMSIE&&resizable!='yes'&&tinyMCE.settings["dialog_type"]=="modal"){var features="resizable:"+resizable+";scroll:"+scrollbars+";status:yes;center:yes;help:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px;";window.showModalDialog(url,window,features);}else{var modal=(resizable=="yes")?"no":"yes";if(tinyMCE.isGecko&&tinyMCE.isMac)modal="no";if(template['close_previous']!="no")try{tinyMCE.lastWindow.close();}catch(ex){}var win=window.open(url,"mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog="+modal+",minimizable="+resizable+",modal="+modal+",width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang['lang_popup_blocked']);return;}if(template['close_previous']!="no")tinyMCE.lastWindow=win;eval('try { win.resizeTo(width, height); } catch(e) { }');if(tinyMCE.isGecko){if(win.document.defaultView.statusbar.visible)win.resizeBy(0,tinyMCE.isMac?10:24);}win.focus();}}};TinyMCE.prototype.closeWindow=function(win){win.close();};TinyMCE.prototype.getVisualAidClass=function(class_name,state){var aidClass=tinyMCE.settings['visual_table_class'];if(typeof(state)=="undefined")state=tinyMCE.settings['visual'];var classNames=new Array();var ar=class_name.split(' ');for(var i=0;i<ar.length;i++){if(ar[i]==aidClass)ar[i]="";if(ar[i]!="")classNames[classNames.length]=ar[i];}if(state)classNames[classNames.length]=aidClass;var className="";for(var i=0;i<classNames.length;i++){if(i>0)className+=" ";className+=classNames[i];}return className;};TinyMCE.prototype.handleVisualAid=function(el,deep,state,inst){if(!el)return;var tableElement=null;switch(el.nodeName){case "TABLE":var oldW=el.style.width;var oldH=el.style.height;var bo=tinyMCE.getAttrib(el,"border");bo=bo==""||bo=="0"?true:false;tinyMCE.setAttrib(el,"class",tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el,"class"),state&&bo));el.style.width=oldW;el.style.height=oldH;for(var y=0;y<el.rows.length;y++){for(var x=0;x<el.rows[y].cells.length;x++){var cn=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x],"class"),state&&bo);tinyMCE.setAttrib(el.rows[y].cells[x],"class",cn);}}break;case "A":var anchorName=tinyMCE.getAttrib(el,"name");if(anchorName!=''&&state){el.title=anchorName;el.className='mceItemAnchor';}else if(anchorName!=''&&!state)el.className='';break;}if(deep&&el.hasChildNodes()){for(var i=0;i<el.childNodes.length;i++)tinyMCE.handleVisualAid(el.childNodes[i],deep,state,inst);}};TinyMCE.prototype.getAttrib=function(elm,name,default_value){if(typeof(default_value)=="undefined")default_value="";if(!elm||elm.nodeType!=1)return default_value;var v=elm.getAttribute(name);if(name=="class"&&!v)v=elm.className;if(name=="style"&&!tinyMCE.isOpera)v=elm.style.cssText;return(v&&v!="")?v:default_value;};TinyMCE.prototype.setAttrib=function(element,name,value,fix_value){if(typeof(value)=="number"&&value!=null)value=""+value;if(fix_value){if(value==null)value="";var re=new RegExp('[^0-9%]','g');value=value.replace(re,'');}if(name=="style")element.style.cssText=value;if(name=="class")element.className=value;if(value!=null&&value!=""&&value!=-1)element.setAttribute(name,value);else element.removeAttribute(name);};TinyMCE.prototype.setStyleAttrib=function(elm,name,value){eval('elm.style.'+name+'=value;');if(tinyMCE.isMSIE&&value==null||value==''){var str=tinyMCE.serializeStyle(tinyMCE.parseStyle(elm.style.cssText));elm.style.cssText=str;elm.setAttribute("style",str);}};TinyMCE.prototype.convertSpansToFonts=function(doc){var sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');var h=doc.body.innerHTML;h=h.replace(/<span/gi,'<font');h=h.replace(/<\/span/gi,'</font');doc.body.innerHTML=h;var s=doc.getElementsByTagName("font");for(var i=0;i<s.length;i++){var size=tinyMCE.trim(s[i].style.fontSize).toLowerCase();var fSize=0;for(var x=0;x<sizes.length;x++){if(sizes[x]==size){fSize=x+1;break;}}if(fSize>0){tinyMCE.setAttrib(s[i],'size',fSize);s[i].style.fontSize='';}var fFace=s[i].style.fontFamily;if(fFace!=null&&fFace!=""){tinyMCE.setAttrib(s[i],'face',fFace);s[i].style.fontFamily='';}var fColor=s[i].style.color;if(fColor!=null&&fColor!=""){tinyMCE.setAttrib(s[i],'color',tinyMCE.convertRGBToHex(fColor));s[i].style.color='';}}};TinyMCE.prototype.convertFontsToSpans=function(doc){var sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');var h=doc.body.innerHTML;h=h.replace(/<font/gi,'<span');h=h.replace(/<\/font/gi,'</span');doc.body.innerHTML=h;var fsClasses=tinyMCE.getParam('font_size_classes');if(fsClasses!='')fsClasses=fsClasses.replace(/\s+/,'').split(',');else fsClasses=null;var s=doc.getElementsByTagName("span");for(var i=0;i<s.length;i++){var fSize,fFace,fColor;fSize=tinyMCE.getAttrib(s[i],'size');fFace=tinyMCE.getAttrib(s[i],'face');fColor=tinyMCE.getAttrib(s[i],'color');if(fSize!=""){fSize=parseInt(fSize);if(fSize>0&&fSize<8){if(fsClasses!=null)tinyMCE.setAttrib(s[i],'class',fsClasses[fSize-1]);else s[i].style.fontSize=sizes[fSize-1];}s[i].removeAttribute('size');}if(fFace!=""){s[i].style.fontFamily=fFace;s[i].removeAttribute('face');}if(fColor!=""){s[i].style.color=fColor;s[i].removeAttribute('color');}}};TinyMCE.prototype.setInnerHTML=function(e,h){if(tinyMCE.isMSIE&&!tinyMCE.isOpera){e.innerHTML='<div id="mceTMPElement" style="display: none">TMP</div>'+h;e.firstChild.removeNode(true);}else e.innerHTML=h;};TinyMCE.prototype.getOuterHTML=function(e){if(tinyMCE.isMSIE)return e.outerHTML;var d=e.ownerDocument.createElement("body");d.appendChild(e);return d.innerHTML;};TinyMCE.prototype.setOuterHTML=function(doc,e,h){if(tinyMCE.isMSIE){e.outerHTML=h;return;}var d=e.ownerDocument.createElement("body");d.innerHTML=h;e.parentNode.replaceChild(d.firstChild,e);};TinyMCE.prototype.insertAfter=function(nc,rc){if(rc.nextSibling)rc.parentNode.insertBefore(nc,rc.nextSibling);else rc.parentNode.appendChild(nc);};TinyMCE.prototype.cleanupAnchors=function(doc){var an=doc.getElementsByTagName("a");for(var i=0;i<an.length;i++){if(tinyMCE.getAttrib(an[i],"name")!=""){var cn=an[i].childNodes;for(var x=cn.length-1;x>=0;x--)tinyMCE.insertAfter(cn[x],an[i]);}}};TinyMCE.prototype._setHTML=function(doc,html_content){html_content=tinyMCE.cleanupHTMLCode(html_content);try{tinyMCE.setInnerHTML(doc.body,html_content);}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content);}if(tinyMCE.isMSIE&&tinyMCE.settings['fix_content_duplication']){var paras=doc.getElementsByTagName("P");for(var i=0;i<paras.length;i++){var node=paras[i];while((node=node.parentNode)!=null){if(node.nodeName.toLowerCase()=="p")node.outerHTML=node.innerHTML;}}var html=doc.body.innerHTML;if(html.indexOf('="mso')!=-1){for(var i=0;i<doc.body.all.length;i++){var el=doc.body.all[i];el.removeAttribute("className","",0);el.removeAttribute("style","",0);}html=doc.body.innerHTML;html=tinyMCE.regexpReplace(html,"<o:p><\/o:p>","<br />");html=tinyMCE.regexpReplace(html,"<o:p>&nbsp;<\/o:p>","");html=tinyMCE.regexpReplace(html,"<st1:.*?>","");html=tinyMCE.regexpReplace(html,"<p><\/p>","");html=tinyMCE.regexpReplace(html,"<p><\/p>\r\n<p><\/p>","");html=tinyMCE.regexpReplace(html,"<p>&nbsp;<\/p>","<br />");html=tinyMCE.regexpReplace(html,"<p>\s*(<p>\s*)?","<p>");html=tinyMCE.regexpReplace(html,"<\/p>\s*(<\/p>\s*)?","</p>");}tinyMCE.setInnerHTML(doc.body,html);}tinyMCE.cleanupAnchors(doc);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);};TinyMCE.prototype.getImageSrc=function(str){var pos=-1;if(!str)return "";if((pos=str.indexOf('this.src='))!=-1){var src=str.substring(pos+10);src=src.substring(0,src.indexOf('\''));return src;}return "";};TinyMCE.prototype._getElementById=function(element_id){var elm=document.getElementById(element_id);if(!elm){for(var j=0;j<document.forms.length;j++){for(var k=0;k<document.forms[j].elements.length;k++){if(document.forms[j].elements[k].name==element_id){elm=document.forms[j].elements[k];break;}}}}return elm;};TinyMCE.prototype.getEditorId=function(form_element){var inst=this.getInstanceById(form_element);if(!inst)return null;return inst.editorId;};TinyMCE.prototype.getInstanceById=function(editor_id){var inst=this.instances[editor_id];if(!inst){for(var n in tinyMCE.instances){var instance=tinyMCE.instances[n];if(!tinyMCE.isInstance(instance))continue;if(instance.formTargetElementId==editor_id){inst=instance;break;}}}return inst;};TinyMCE.prototype.queryInstanceCommandValue=function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandValue(command);return false;};TinyMCE.prototype.queryInstanceCommandState=function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandState(command);return null;};TinyMCE.prototype.setWindowArg=function(name,value){this.windowArgs[name]=value;};TinyMCE.prototype.getWindowArg=function(name,default_value){return(typeof(this.windowArgs[name])=="undefined")?default_value:this.windowArgs[name];};TinyMCE.prototype.getCSSClasses=function(editor_id,doc){var output=new Array();if(typeof(tinyMCE.cssClasses)!="undefined")return tinyMCE.cssClasses;if(typeof(editor_id)=="undefined"&&typeof(doc)=="undefined"){var instance;for(var instanceName in tinyMCE.instances){instance=tinyMCE.instances[instanceName];if(!tinyMCE.isInstance(instance))continue;break;}doc=instance.getDoc();}if(typeof(doc)=="undefined"){var instance=tinyMCE.getInstanceById(editor_id);doc=instance.getDoc();}if(doc){var styles=tinyMCE.isMSIE?doc.styleSheets:doc.styleSheets;if(styles&&styles.length>0){for(var x=0;x<styles.length;x++){var csses=null;eval("try {var csses = tinyMCE.isMSIE ? doc.styleSheets("+x+").rules : doc.styleSheets["+x+"].cssRules;} catch(e) {}");if(!csses)return new Array();for(var i=0;i<csses.length;i++){var selectorText=csses[i].selectorText;if(selectorText){var rules=selectorText.split(',');for(var c=0;c<rules.length;c++){if(rules[c].indexOf(' ')!=-1||rules[c].indexOf(':')!=-1||rules[c].indexOf('mceItem')!=-1)continue;if(rules[c]=="."+tinyMCE.settings['visual_table_class'])continue;if(rules[c].indexOf('.')!=-1){output[output.length]=rules[c].substring(rules[c].indexOf('.')+1);}}}}}}}if(output.length>0)tinyMCE.cssClasses=output;return output;};TinyMCE.prototype.regexpReplace=function(in_str,reg_exp,replace_str,opts){if(in_str==null)return in_str;if(typeof(opts)=="undefined")opts='g';var re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str);};TinyMCE.prototype.trim=function(str){return str.replace(/^\s*|\s*$/g,"");};TinyMCE.prototype.cleanupEventStr=function(str){str=""+str;str=str.replace('function anonymous()\n{\n','');str=str.replace('\n}','');str=str.replace(/^return true;/gi,'');return str;};TinyMCE.prototype.getAbsPosition=function(node){var pos=new Object();pos.absLeft=pos.absTop=0;var parentNode=node;while(parentNode){pos.absLeft+=parentNode.offsetLeft;pos.absTop+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}return pos;};TinyMCE.prototype.getControlHTML=function(control_name){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_getControlHTML";if(eval("typeof("+templateFunction+")")!='undefined'){var html=eval(templateFunction+"('"+control_name+"');");if(html!="")return tinyMCE.replaceVar(html,"pluginurl",tinyMCE.baseURL+"/plugins/"+themePlugins[i]);}}return eval('TinyMCE_'+tinyMCE.settings['theme']+"_getControlHTML"+"('"+control_name+"');");};TinyMCE.prototype._themeExecCommand=function(editor_id,element,command,user_interface,value){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined'){if(eval(templateFunction+"(editor_id, element, command, user_interface, value);"))return true;}}templateFunction='TinyMCE_'+tinyMCE.settings['theme']+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined')return eval(templateFunction+"(editor_id, element, command, user_interface, value);");return false;};TinyMCE.prototype._getThemeFunction=function(suffix,skip_plugins){if(skip_plugins)return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+suffix;if(eval("typeof("+templateFunction+")")!='undefined')return templateFunction;}return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;};TinyMCE.prototype.isFunc=function(func_name){if(func_name==null||func_name=="")return false;return eval("typeof("+func_name+")")!="undefined";};TinyMCE.prototype.exec=function(func_name,args){var str=func_name+'(';for(var i=3;i<args.length;i++){str+='args['+i+']';if(i<args.length-1)str+=',';}str+=');';return eval(str);};TinyMCE.prototype.executeCallback=function(param,suffix,mode){switch(mode){case 0:var state=false;var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){var func="TinyMCE_"+plugins[i]+suffix;if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}}var func='TinyMCE_'+tinyMCE.settings['theme']+suffix;if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}var func=tinyMCE.getParam(param,'');if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}return state;case 1:var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){var func="TinyMCE_"+plugins[i]+suffix;if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}}var func='TinyMCE_'+tinyMCE.settings['theme']+suffix;if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}var func=tinyMCE.getParam(param,'');if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}return false;}};TinyMCE.prototype.debug=function(){var msg="";var elm=document.getElementById("tinymce_debug");if(!elm){var debugDiv=document.createElement("div");debugDiv.setAttribute("className","debugger");debugDiv.className="debugger";debugDiv.innerHTML='\
Debug output:\
- <textarea id="tinymce_debug" style="width: 100%; height: 300px"></textarea>';document.body.appendChild(debugDiv);elm=document.getElementById("tinymce_debug");}var args=this.debug.arguments;for(var i=0;i<args.length;i++){msg+=args[i];if(i<args.length-1)msg+=', ';}elm.value+=msg+"\n";};function TinyMCEControl(settings){this.undoLevels=new Array();this.undoIndex=0;this.typingUndoIndex=-1;this.undoRedo=true;this.settings=settings;this.settings['theme']=tinyMCE.getParam("theme","default");this.settings['width']=tinyMCE.getParam("width",-1);this.settings['height']=tinyMCE.getParam("height",-1);};TinyMCEControl.prototype.repaint=function(){if(tinyMCE.isMSIE)return;this.getBody().style.display='none';this.getBody().style.display='block';};TinyMCEControl.prototype.switchSettings=function(){if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings['index']){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings['index'];}};TinyMCEControl.prototype.fixBrokenURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i<elms.length;i++){var src=elms[i].getAttribute('mce_real_src');if(src&&src!="")elms[i].setAttribute("src",src);}var elms=body.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var href=elms[i].getAttribute('mce_real_href');if(href&&href!="")elms[i].setAttribute("href",href);}};TinyMCEControl.prototype.convertAllRelativeURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i<elms.length;i++){var src=elms[i].getAttribute('src');if(src&&src!=""){src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],src);elms[i].setAttribute("src",src);elms[i].setAttribute("mce_real_src",src);}}var elms=body.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var href=elms[i].getAttribute('href');if(href&&href!=""){href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],href);elms[i].setAttribute("href",href);elms[i].setAttribute("mce_real_href",href);}}};TinyMCEControl.prototype.getSelectedHTML=function(){if(tinyMCE.isSafari){return this.getRng().toString();}var elm=document.createElement("body");if(tinyMCE.isGecko)elm.appendChild(this.getRng().cloneContents());else elm.innerHTML=this.getRng().htmlText;return tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,elm,this.visualAid);};TinyMCEControl.prototype.getBookmark=function(){var rng=this.getRng();if(tinyMCE.isSafari)return rng;if(tinyMCE.isMSIE)return rng;if(tinyMCE.isGecko)return rng.cloneRange();return null;};TinyMCEControl.prototype.moveToBookmark=function(bookmark){if(tinyMCE.isSafari){var sel=this.getSel().realSelection;sel.setBaseAndExtent(bookmark.startContainer,bookmark.startOffset,bookmark.endContainer,bookmark.endOffset);return true;}if(tinyMCE.isMSIE)return bookmark.select();if(tinyMCE.isGecko){var rng=this.getDoc().createRange();var sel=this.getSel();rng.setStart(bookmark.startContainer,bookmark.startOffset);rng.setEnd(bookmark.endContainer,bookmark.endOffset);sel.removeAllRanges();sel.addRange(rng);return true;}return false;};TinyMCEControl.prototype.getSelectedText=function(){if(tinyMCE.isMSIE){var doc=this.getDoc();if(doc.selection.type=="Text"){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText='';}else{var sel=this.getSel();if(sel&&sel.toString)selectedText=sel.toString();else selectedText='';}return selectedText;};TinyMCEControl.prototype.selectNode=function(node,collapse,select_text_node,to_start){if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(tinyMCE.isMSIE){var rng=this.getBody().createTextRange();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select();}catch(e){}}else{var sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.realSelection.setBaseAndExtent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.realSelection.collapseToStart();else sel.realSelection.collapseToEnd();}this.scrollToNode(node);return;}var rng=this.getDoc().createRange();if(select_text_node){var nodes=tinyMCE.getNodeTree(node,new Array(),3);if(nodes.length>0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node);}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length);}else rng.collapse(to_start);}sel.removeAllRanges();sel.addRange(rng);}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node;};TinyMCEControl.prototype.scrollToNode=function(node){var pos=tinyMCE.getAbsPosition(node);var doc=this.getDoc();var scrollX=doc.body.scrollLeft+doc.documentElement.scrollLeft;var scrollY=doc.body.scrollTop+doc.documentElement.scrollTop;var height=tinyMCE.isMSIE?document.getElementById(this.editorId).style.pixelHeight:this.targetElement.clientHeight;if(!tinyMCE.settings['auto_resize']&&!(node.absTop>scrollY&&node.absTop<(scrollY-25+height)))this.contentWindow.scrollTo(pos.absLeft,pos.absTop-height+25);};TinyMCEControl.prototype.getBody=function(){return this.getDoc().body;};TinyMCEControl.prototype.getDoc=function(){return this.contentWindow.document;};TinyMCEControl.prototype.getWin=function(){return this.contentWindow;};TinyMCEControl.prototype.getSel=function(){if(tinyMCE.isMSIE)return this.getDoc().selection;var sel=this.contentWindow.getSelection();if(tinyMCE.isSafari&&!sel.getRangeAt){var newSel=new Object();var doc=this.getDoc();function getRangeAt(idx){var rng=new Object();rng.startContainer=this.focusNode;rng.endContainer=this.anchorNode;rng.commonAncestorContainer=this.focusNode;rng.createContextualFragment=function(html){if(html.charAt(0)=='<'){var elm=doc.createElement("div");elm.innerHTML=html;return elm.firstChild;}return doc.createTextNode("UNSUPPORTED, DUE TO LIMITATIONS IN SAFARI!");};rng.deleteContents=function(){doc.execCommand("Delete",false,"");};return rng;}newSel.focusNode=sel.baseNode;newSel.focusOffset=sel.baseOffset;newSel.anchorNode=sel.extentNode;newSel.anchorOffset=sel.extentOffset;newSel.getRangeAt=getRangeAt;newSel.text=""+sel;newSel.realSelection=sel;newSel.toString=function(){return this.text;};return newSel;}return sel;};TinyMCEControl.prototype.getRng=function(){var sel=this.getSel();if(sel==null)return null;if(tinyMCE.isMSIE)return sel.createRange();if(tinyMCE.isSafari){var rng=this.getDoc().createRange();var sel=this.getSel().realSelection;rng.setStart(sel.baseNode,sel.baseOffset);rng.setEnd(sel.extentNode,sel.extentOffset);return rng;}return this.getSel().getRangeAt(0);};TinyMCEControl.prototype._insertPara=function(e){function isEmpty(para){function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()=="";}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;var nodes=tinyMCE.getNodeTree(para,new Array(),3);for(var i=0;i<nodes.length;i++){if(!isEmptyHTML(nodes[i].nodeValue))return false;}return true;}var doc=this.getDoc();var sel=this.getSel();var win=this.contentWindow;var rng=sel.getRangeAt(0);var body=doc.body;var rootElm=doc.documentElement;var self=this;var blockName="P";var rngBefore=doc.createRange();rngBefore.setStart(sel.anchorNode,sel.anchorOffset);rngBefore.collapse(true);var rngAfter=doc.createRange();rngAfter.setStart(sel.focusNode,sel.focusOffset);rngAfter.collapse(true);var direct=rngBefore.compareBoundaryPoints(rngBefore.START_TO_END,rngAfter)<0;var startNode=direct?sel.anchorNode:sel.focusNode;var startOffset=direct?sel.anchorOffset:sel.focusOffset;var endNode=direct?sel.focusNode:sel.anchorNode;var endOffset=direct?sel.focusOffset:sel.anchorOffset;var startBlock=tinyMCE.getParentBlockElement(startNode);var endBlock=tinyMCE.getParentBlockElement(endNode);if(startBlock!=null){blockName=startBlock.nodeName.toUpperCase();if(blockName=="TD"||blockName=="TABLE")blockName="P";}if((startBlock!=null&&startBlock.nodeName.toLowerCase()=="li")||(endBlock!=null&&endBlock.nodeName.toLowerCase()=="li"))return false;if((startBlock!=null&&startBlock.nodeName.toLowerCase()=="table")||(endBlock!=null&&endBlock.nodeName.toLowerCase()=="table"))startBlock=endBlock=null;var paraBefore=(startBlock!=null&&startBlock.nodeName.toUpperCase()==blockName)?startBlock.cloneNode(false):doc.createElement(blockName);var paraAfter=(endBlock!=null&&endBlock.nodeName.toUpperCase()==blockName)?endBlock.cloneNode(false):doc.createElement(blockName);var startChop=startNode;var endChop=endNode;node=startChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;startChop=node;}while((node=node.previousSibling?node.previousSibling:node.parentNode));node=endChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;endChop=node;}while((node=node.nextSibling?node.nextSibling:node.parentNode));if(startBlock==null){rng.deleteContents();sel.removeAllRanges();if(startChop!=rootElm&&endChop!=rootElm){rngBefore=rng.cloneRange();if(startChop==body)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);paraBefore.appendChild(rngBefore.cloneContents());if(endChop.parentNode.nodeName==blockName)endChop=endChop.parentNode;rng.setEndAfter(endChop);var contents=rng.cloneContents();if(contents.firstChild&&(contents.firstChild.nodeName==blockName||contents.firstChild.nodeName.toLowerCase()=="body")){var nodes=contents.firstChild.childNodes;for(var i=0;i<nodes.length;i++){if(nodes[i].nodeName.toLowerCase()!="body")paraAfter.appendChild(nodes[i]);}}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng.deleteContents();rngAfter.deleteContents();rngBefore.deleteContents();paraAfter.normalize();rngBefore.insertNode(paraAfter);paraBefore.normalize();rngBefore.insertNode(paraBefore);}else{body.innerHTML="<"+blockName+">&nbsp;</"+blockName+"><"+blockName+">&nbsp;</"+blockName+">";paraAfter=body.childNodes[1];}this.selectNode(paraAfter,true,true);return true;}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);var contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){var nodes=contents.firstChild.childNodes;for(var i=0;i<nodes.length;i++){if(nodes[i].nodeName.toLowerCase()!="body")paraAfter.appendChild(nodes[i]);}}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";var rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode);}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockName&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset);}if(!endChop.nextSibling&&endChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.parentNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();rng.insertNode(paraAfter);rng.insertNode(paraBefore);paraAfter.normalize();paraBefore.normalize();this.selectNode(paraAfter,true,true);return true;};TinyMCEControl.prototype._handleBackSpace=function(evt_type){var doc=this.getDoc();var sel=this.getSel();if(sel==null)return false;var rng=sel.getRangeAt(0);var node=rng.startContainer;var elm=node.nodeType==3?node.parentNode:node;if(node==null)return;if(elm&&elm.nodeName==""){var para=doc.createElement("p");while(elm.firstChild)para.appendChild(elm.firstChild);elm.parentNode.insertBefore(para,elm);elm.parentNode.removeChild(elm);var rng=rng.cloneRange();rng.setStartBefore(node.nextSibling);rng.setEndAfter(node.nextSibling);rng.extractContents();this.selectNode(node.nextSibling,true,true);}var para=tinyMCE.getParentBlockElement(node);if(para!=null&&para.nodeName.toLowerCase()=='p'&&evt_type=="keypress"){var htm=para.innerHTML;var block=tinyMCE.getParentBlockElement(node);if(htm==""||htm=="&nbsp;"||block.nodeName.toLowerCase()=="li"){var prevElm=para.previousSibling;while(prevElm!=null&&prevElm.nodeType!=1)prevElm=prevElm.previousSibling;if(prevElm==null)return false;var nodes=tinyMCE.getNodeTree(prevElm,new Array(),3);var lastTextNode=nodes.length==0?null:nodes[nodes.length-1];if(lastTextNode!=null)this.selectNode(lastTextNode,true,false,false);para.parentNode.removeChild(para);return true;}}return false;};TinyMCEControl.prototype._insertSpace=function(){return true;};TinyMCEControl.prototype.autoResetDesignMode=function(){if(!tinyMCE.isMSIE&&tinyMCE.settings['auto_reset_designmode']){var sel=this.getSel();if(!sel||!sel.rangeCount||sel.rangeCount==0)eval('try { this.getDoc().designMode = "On"; } catch(e) {}');}};TinyMCEControl.prototype.isDirty=function(){return this.startContent!=tinyMCE.trim(this.getBody().innerHTML)&&!tinyMCE.isNotDirty;};TinyMCEControl.prototype._mergeElements=function(pa,ch,override){ch=ch.cloneNode(true);var st=tinyMCE.parseStyle(tinyMCE.getAttrib(pa,"style"));var stc=tinyMCE.parseStyle(tinyMCE.getAttrib(ch,"style"));var className=tinyMCE.getAttrib(pa,"class");className+=" "+tinyMCE.getAttrib(ch,"class");if(override){for(var n in st)stc[n]=st[n];}else{for(var n in stc)st[n]=stc[n];}tinyMCE.setAttrib(ch,"style",tinyMCE.serializeStyle(st));tinyMCE.setAttrib(ch,"class",tinyMCE.trim(className));pa.parentNode.replaceChild(ch,pa);};TinyMCEControl.prototype.execCommand=function(command,user_interface,value){var doc=this.getDoc();var win=this.getWin();var focusElm=this.getFocusElement();if(this.lastSafariSelection&&!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel','gi').test(command)){this.moveToBookmark(this.lastSafariSelection);tinyMCE.selectedElement=this.lastSafariSelectedElement;}if(!tinyMCE.isMSIE&&!this.useCSS){doc.execCommand("useCSS",false,true);this.useCSS=true;}this.contentDocument=doc;if(tinyMCE._themeExecCommand(this.editorId,this.getBody(),command,user_interface,value))return;if(focusElm&&focusElm.nodeName=="IMG"){var align=focusElm.getAttribute('align');var img=command=="JustifyCenter"?focusElm.cloneNode(false):focusElm;switch(command){case "JustifyLeft":if(align=='left')img.removeAttribute('align');else img.setAttribute('align','left');var div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case "JustifyCenter":img.removeAttribute('align');var div=tinyMCE.getParentElement(focusElm,"div");if(div&&div.style.textAlign=="center"){if(div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);}else{var div=this.getDoc().createElement("div");div.style.textAlign='center';div.appendChild(img);focusElm.parentNode.replaceChild(div,focusElm);}this.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case "JustifyRight":if(align=='right')img.removeAttribute('align');else img.setAttribute('align','right');var div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;}}if(tinyMCE.settings['force_br_newlines']){var alignValue="";if(doc.selection.type!="Control"){switch(command){case "JustifyLeft":alignValue="left";break;case "JustifyCenter":alignValue="center";break;case "JustifyFull":alignValue="justify";break;case "JustifyRight":alignValue="right";break;}if(alignValue!=""){var rng=doc.selection.createRange();if((divElm=tinyMCE.getParentElement(rng.parentElement(),"div"))!=null)divElm.setAttribute("align",alignValue);else if(rng.pasteHTML&&rng.htmlText.length>0)rng.pasteHTML('<div align="'+alignValue+'">'+rng.htmlText+"</div>");tinyMCE.triggerNodeChange();return;}}}switch(command){case "mceRepaint":this.repaint();return true;case "mceStoreSelection":this.selectionBookmark=this.getBookmark();return true;case "mceRestoreSelection":this.moveToBookmark(this.selectionBookmark);return true;case "InsertUnorderedList":case "InsertOrderedList":var tag=(command=="InsertUnorderedList")?"ul":"ol";if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<"+tag+"><li>&nbsp;</li><"+tag+">");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "Strikethrough":if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<strike>"+this.getSelectedHTML()+"</strike>");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "mceSelectNode":this.selectNode(value);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=value;break;case "FormatBlock":if(value==null||value==""){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm)this.execCommand("mceRemoveNode",false,elm);}else this.getDoc().execCommand("FormatBlock",false,value);tinyMCE.triggerNodeChange();break;case "mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isMSIE){value.outerHTML=value.innerHTML;}else{var rng=value.ownerDocument.createRange();rng.setStartBefore(value);rng.setEndAfter(value);rng.deleteContents();rng.insertNode(rng.createContextualFragment(value.innerHTML));}tinyMCE.triggerNodeChange();break;case "mceSelectNodeDepth":var parentNode=this.getFocusElement();for(var i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=parentNode.parentNode;continue;}if(i==value){this.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return;}parentNode=parentNode.parentNode;}break;case "SetStyleInfo":var rng=this.getRng();var sel=this.getSel();var scmd=value['command'];var sname=value['name'];var svalue=value['value'];var wrapper=value['wrapper']?value['wrapper']:"span";var parentElm=null;if(tinyMCE.isMSIE){if(rng.item)parentElm=rng.item(0);else{var pelm=rng.parentElement();var prng=doc.selection.createRange();prng.moveToElementText(pelm);if(rng.htmlText==prng.htmlText||rng.boundingWidth==0)parentElm=pelm;}}else{var felm=this.getFocusElement();if(sel.isCollapsed||(/td|tr|tbody|table/ig.test(felm.nodeName)&&sel.anchorNode==felm.parentNode))parentElm=felm;}if(parentElm){if(scmd=="setstyle")eval("parentElm.style."+sname+" = svalue;");if(scmd=="setattrib")tinyMCE.setAttrib(parentElm,sname,svalue);}else{doc.execCommand("fontname",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;x<elementArray.length;x++){elm=elementArray[x];if(elm){var spanElm=doc.createElement(wrapper);if(scmd=="setstyle")eval("spanElm.style."+sname+" = svalue;");if(scmd=="setattrib")tinyMCE.setAttrib(spanElm,sname,svalue);if(elm.hasChildNodes()){for(var i=0;i<elm.childNodes.length;i++)spanElm.appendChild(elm.childNodes[i].cloneNode(true));}spanElm.setAttribute("mce_new","true");elm.parentNode.replaceChild(spanElm,elm);}}}var nodes=doc.getElementsByTagName(wrapper);for(var i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isNew=tinyMCE.getAttrib(elm,"mce_new")=="true";elm.removeAttribute("mce_new");if(elm.childNodes&&elm.childNodes.length==1&&elm.childNodes[0].nodeType==1){this._mergeElements(elm,elm.childNodes[0],isNew);continue;}if(elm.parentNode.childNodes.length==1){this._mergeElements(elm.parentNode,elm,false);}}var nodes=doc.getElementsByTagName(wrapper);for(var i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isEmpty=true;var tmp=doc.createElement("body");tmp.appendChild(elm.cloneNode(false));if(new RegExp('<span>|<span style="">','gi').test(tmp.innerHTML)){for(var i=elm.childNodes.length-1;i>=0;i--){if(elm.parentNode!=null){elm.parentNode.insertBefore(elm.childNodes[i].cloneNode(true),elm);elm.parentNode.removeChild(elm);}}}}tinyMCE.triggerNodeChange();break;case "FontName":if(tinyMCE.getParam("convert_fonts_to_styles"))this.execCommand("SetStyleInfo",false,{command:"setstyle",name:"fontFamily",value:value});else this.getDoc().execCommand('FontName',false,value);break;case "FontSize":if(tinyMCE.getParam("convert_fonts_to_styles")){var sizes=new Array('',8,10,12,14,18,24,36);var size=sizes[value]==''?'':sizes[value]+'px';this.execCommand("SetStyleInfo",false,{command:"setstyle",name:"fontSize",value:size});}else this.getDoc().execCommand('FontSize',false,value);break;case "forecolor":if(tinyMCE.getParam("convert_fonts_to_styles"))this.execCommand("SetStyleInfo",false,{command:"setstyle",name:"color",value:value});else{if(tinyMCE.isGecko){this.getDoc().execCommand("useCSS",false,true);this.getDoc().execCommand('forecolor',false,value);this.getDoc().execCommand("useCSS",false,true);}else this.getDoc().execCommand('forecolor',false,value);}break;case "HiliteColor":if(tinyMCE.getParam("convert_fonts_to_styles"))this.execCommand("SetStyleInfo",false,{command:"setstyle",name:"backgroundColor",value:value});else{if(tinyMCE.isGecko){this.getDoc().execCommand("useCSS",false,false);this.getDoc().execCommand('hilitecolor',false,value);this.getDoc().execCommand("useCSS",false,true);}else this.getDoc().execCommand('BackColor',false,value);}break;case "Cut":case "Copy":case "Paste":var cmdFailed=false;eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');if(tinyMCE.isGecko&&cmdFailed){if(confirm(tinyMCE.getLang('lang_clipboard_msg')))window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');return;}else tinyMCE.triggerNodeChange();break;case "mceSetContent":if(!value)value="";value=tinyMCE._customCleanup(this,"insert_to_editor",value);tinyMCE._setHTML(doc,value);doc.body.innerHTML=tinyMCE._cleanupHTML(this,doc,tinyMCE.settings,doc.body);tinyMCE.handleVisualAid(doc.body,true,this.visualAid,this);tinyMCE._setEventsEnabled(doc.body,true);return true;case "mceLink":var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText=this.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return;}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_real_href');if(mceRealHref!="")href=mceRealHref;href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");action="update";}if(this.settings['insertlink_callback']){var returnVal=eval(this.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])tinyMCE.insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class']);}else{tinyMCE.openWindow(this.insertLinkTemplate,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class});}break;case "mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img;}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h);}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttrib(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyMCE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:"";}onmouseover=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover));onmouseout=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout));mceRealSrc=tinyMCE.getAttrib(img,'mce_real_src');if(mceRealSrc!="")src=mceRealSrc;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");if(onmouseover!="")onmouseover=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, img, true);");if(onmouseout!="")onmouseout=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, img, true);");action="update";}if(this.settings['insertimage_callback']){var returnVal=eval(this.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])tinyMCE.insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout']);}else tinyMCE.openWindow(this.insertImageTemplate,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action});break;case "mceCleanup":tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);this.getBody().innerHTML=tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,this.getBody(),this.visualAid);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),true);this.repaint();tinyMCE.triggerNodeChange();break;case "mceReplaceContent":var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText=this.getSel().toString();if(selectedText.length>0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value);}tinyMCE.triggerNodeChange();break;case "mceSetAttribute":if(typeof(value)=='object'){var targetElms=(typeof(value['targets'])=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value['targets'];var targetNode=tinyMCE.getParentElement(this.getFocusElement(),targetElms);if(targetNode){targetNode.setAttribute(value['name'],value['value']);tinyMCE.triggerNodeChange();}}break;case "mceSetCSSClass":this.execCommand("SetStyleInfo",false,{command:"setattrib",name:"class",value:value});break;case "mceInsertRawHTML":var key='tiny_mce_marker';this.execCommand('mceBeginUndoLevel');this.execCommand('mceInsertContent',false,key);var scrollX=this.getDoc().body.scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getDoc().body.scrollTop+this.getDoc().documentElement.scrollTop;var html=this.getBody().innerHTML;if((pos=html.indexOf(key))!=-1)this.getBody().innerHTML=html.substring(0,pos)+value+html.substring(pos+key.length);this.contentWindow.scrollTo(scrollX,scrollY);this.execCommand('mceEndUndoLevel');break;case "mceInsertContent":if(!tinyMCE.isMSIE){var sel=this.getSel();var rng=this.getRng();var isHTML=value.indexOf('<')!=-1;if(isHTML){if(tinyMCE.isSafari){var tmpRng=this.getDoc().createRange();tmpRng.setStart(this.getBody(),0);tmpRng.setEnd(this.getBody(),0);value=tmpRng.createContextualFragment(value);}else value=rng.createContextualFragment(value);}else{var el=document.createElement("div");el.innerHTML=value;value=el.firstChild.nodeValue;value=doc.createTextNode(value);}if(tinyMCE.isSafari&&!isHTML){this.execCommand('InsertText',false,value.nodeValue);tinyMCE.triggerNodeChange();return true;}else if(tinyMCE.isSafari&&isHTML){rng.deleteContents();rng.insertNode(value);tinyMCE.triggerNodeChange();return true;}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(value,node);}else rng.insertNode(value);if(!isHTML){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(value);rng.collapse(false);sel.addRange(rng);}else rng.collapse(false);}else{var rng=doc.selection.createRange();if(rng.item)rng.item(0).outerHTML=value;else rng.pasteHTML(value);}tinyMCE.triggerNodeChange();break;case "mceStartTyping":if(tinyMCE.settings['custom_undo_redo']&&this.typingUndoIndex==-1){this.typingUndoIndex=this.undoIndex;this.execCommand('mceAddUndoLevel');}break;case "mceEndTyping":if(tinyMCE.settings['custom_undo_redo']&&this.typingUndoIndex!=-1){this.execCommand('mceAddUndoLevel');this.typingUndoIndex=-1;}break;case "mceBeginUndoLevel":this.undoRedo=false;break;case "mceEndUndoLevel":this.undoRedo=true;this.execCommand('mceAddUndoLevel');break;case "mceAddUndoLevel":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedo){if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;}var newHTML=tinyMCE.trim(this.getBody().innerHTML);if(newHTML!=this.undoLevels[this.undoIndex]){tinyMCE.executeCallback('onchange_callback','_onchange',0,this);var customUndoLevels=tinyMCE.settings['custom_undo_redo_levels'];if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(var i=0;i<this.undoLevels.length-1;i++){this.undoLevels[i]=this.undoLevels[i+1];}this.undoLevels.length--;this.undoIndex--;}this.undoIndex++;this.undoLevels[this.undoIndex]=newHTML;this.undoLevels.length=this.undoIndex+1;tinyMCE.triggerNodeChange(false);}}break;case "Undo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");if(this.undoIndex>0){this.undoIndex--;this.getBody().innerHTML=this.undoLevels[this.undoIndex];this.repaint();}tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case "Redo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;this.getBody().innerHTML=this.undoLevels[this.undoIndex];this.repaint();}tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case "mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case "removeformat":var text=this.getSelectedText();if(tinyMCE.isMSIE){try{win.focus();var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null);if(rng.text==rng.parentElement().innerText){rng.moveToElementText(rng.parentElement());rng.select();}rng.pasteHTML(rng.text);}catch(e){}}else this.getDoc().execCommand(command,user_interface,value);if(text.length==0)this.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();}if(command!="mceAddUndoLevel"&&command!="Undo"&&command!="Redo"&&command!="mceStartTyping"&&command!="mceEndTyping")tinyMCE.execCommand("mceAddUndoLevel");};TinyMCEControl.prototype.queryCommandValue=function(command){return this.getDoc().queryCommandValue(command);};TinyMCEControl.prototype.queryCommandState=function(command){return this.getDoc().queryCommandState(command);};TinyMCEControl.prototype.onAdd=function(replace_element,form_element_name,target_document){var targetDoc=target_document?target_document:document;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings['theme'];this.settings['themeurl']=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false;}var templateFunction=tinyMCE._getThemeFunction('_getInsertLinkTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertLinkTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getInsertImageTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertImageTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getEditorTemplate');if(eval("typeof("+templateFunction+")")=='undefined'){alert("Error: Could not find the template function: "+templateFunction);return false;}var editorTemplate=eval(templateFunction+'(this.settings, this.editorId);');var deltaWidth=editorTemplate['delta_width']?editorTemplate['delta_width']:0;var deltaHeight=editorTemplate['delta_height']?editorTemplate['delta_height']:0;var html='<span id="'+this.editorId+'_parent">'+editorTemplate['html'];var templateFunction=tinyMCE._getThemeFunction('_handleNodeChange',true);if(eval("typeof("+templateFunction+")")!='undefined')this.settings['handleNodeChangeCallback']=templateFunction;html=tinyMCE.replaceVar(html,"editor_id",this.editorId);this.settings['default_document']=tinyMCE.baseURL+"/blank.htm";this.settings['old_width']=this.settings['width'];this.settings['old_height']=this.settings['height'];if(this.settings['width']==-1)this.settings['width']=replace_element.offsetWidth;if(this.settings['height']==-1)this.settings['height']=replace_element.offsetHeight;if(this.settings['width']==0)this.settings['width']=replace_element.style.width;if(this.settings['height']==0)this.settings['height']=replace_element.style.height;if(this.settings['width']==0)this.settings['width']=320;if(this.settings['height']==0)this.settings['height']=240;this.settings['area_width']=parseInt(this.settings['width']);this.settings['area_height']=parseInt(this.settings['height']);this.settings['area_width']+=deltaWidth;this.settings['area_height']+=deltaHeight;if((""+this.settings['width']).indexOf('%')!=-1)this.settings['area_width']="100%";if((""+this.settings['height']).indexOf('%')!=-1)this.settings['area_height']="100%";if((""+replace_element.style.width).indexOf('%')!=-1){this.settings['width']=replace_element.style.width;this.settings['area_width']="100%";}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings['height']=replace_element.style.height;this.settings['area_height']="100%";}html=tinyMCE.applyTemplate(html);this.settings['width']=this.settings['old_width'];this.settings['height']=this.settings['old_height'];this.visualAid=this.settings['visual'];this.formTargetElementId=form_element_name;if(replace_element.nodeName=="TEXTAREA"||replace_element.nodeName=="INPUT")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName.toLowerCase()!="textarea"){this.oldTargetElement=replace_element.cloneNode(true);if(tinyMCE.settings['debug'])html+='<textarea wrap="off" id="'+form_element_name+'" name="'+form_element_name+'" cols="100" rows="15"></textarea>';else html+='<input type="hidden" type="text" id="'+form_element_name+'" name="'+form_element_name+'" />';html+='</span>';if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.replaceChild(fragment,replace_element);}else replace_element.outerHTML=html;}else{html+='</span>';this.oldTargetElement=replace_element;if(!tinyMCE.settings['debug'])this.oldTargetElement.style.display="none";if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.insertBefore(fragment,replace_element);}else replace_element.insertAdjacentHTML("beforeBegin",html);}var dynamicIFrame=false;var tElm=targetDoc.getElementById(this.editorId);if(!tinyMCE.isMSIE){if(tElm&&tElm.nodeName.toLowerCase()=="span"){tElm=tinyMCE._createIFrame(tElm);dynamicIFrame=true;}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName.toLowerCase()=="span")tElm=tinyMCE._createIFrame(tElm);else tElm=targetDoc.frames[this.editorId];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);this.contentDocument=tElm.window.document;this.contentWindow=tElm.window;this.getDoc().designMode="on";}var doc=this.contentDocument;if(dynamicIFrame){var html='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><base href="'+tinyMCE.settings['base_href']+'" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';try{this.getDoc().designMode="on";doc.open();doc.write(html);doc.close();}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm";}}if(tinyMCE.isMSIE)window.setTimeout("TinyMCE.prototype.addEventHandlers('"+this.editorId+"');",1);tinyMCE.setupContent(this.editorId,true);return true;};TinyMCEControl.prototype.getFocusElement=function(){if(tinyMCE.isMSIE){var doc=this.getDoc();var rng=doc.selection.createRange();if(rng.collapse)rng.collapse(true);var elm=rng.item?rng.item(0):rng.parentElement();}else{var sel=this.getSel();var rng=this.getRng();var elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if(rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset];}}}elm=tinyMCE.getParentElement(elm);}return elm;};var tinyMCE=new TinyMCE();var tinyMCELang=new Array(); \ No newline at end of file
+ <textarea id="tinymce_debug" style="width: 100%; height: 300px" wrap="nowrap"></textarea>';document.body.appendChild(debugDiv);elm=document.getElementById("tinymce_debug");}var args=this.debug.arguments;for(var i=0;i<args.length;i++){msg+=args[i];if(i<args.length-1)msg+=', ';}elm.value+=msg+"\n";};function TinyMCEControl(settings){this.undoLevels=new Array();this.undoIndex=0;this.typingUndoIndex=-1;this.undoRedo=true;this.isTinyMCEControl=true;this.settings=settings;this.settings['theme']=tinyMCE.getParam("theme","default");this.settings['width']=tinyMCE.getParam("width",-1);this.settings['height']=tinyMCE.getParam("height",-1);};TinyMCEControl.prototype.repaint=function(){if(tinyMCE.isMSIE)return;this.getBody().style.display='none';this.getBody().style.display='block';};TinyMCEControl.prototype.switchSettings=function(){if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings['index']){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings['index'];}};TinyMCEControl.prototype.fixBrokenURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i<elms.length;i++){var src=elms[i].getAttribute('mce_real_src');if(src&&src!="")elms[i].setAttribute("src",src);}var elms=body.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var href=elms[i].getAttribute('mce_real_href');if(href&&href!="")elms[i].setAttribute("href",href);}};TinyMCEControl.prototype.convertAllRelativeURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i<elms.length;i++){var src=elms[i].getAttribute('src');if(src&&src!=""){src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],src);elms[i].setAttribute("src",src);elms[i].setAttribute("mce_real_src",src);}}var elms=body.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var href=elms[i].getAttribute('href');if(href&&href!=""){href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],href);elms[i].setAttribute("href",href);elms[i].setAttribute("mce_real_href",href);}}};TinyMCEControl.prototype.getSelectedHTML=function(){if(tinyMCE.isSafari){return this.getRng().toString();}var elm=document.createElement("body");if(tinyMCE.isGecko)elm.appendChild(this.getRng().cloneContents());else elm.innerHTML=this.getRng().htmlText;return tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,elm,this.visualAid);};TinyMCEControl.prototype.getBookmark=function(){var rng=this.getRng();if(tinyMCE.isSafari)return rng;if(tinyMCE.isMSIE)return rng;if(tinyMCE.isGecko)return rng.cloneRange();return null;};TinyMCEControl.prototype.moveToBookmark=function(bookmark){if(tinyMCE.isSafari){var sel=this.getSel().realSelection;sel.setBaseAndExtent(bookmark.startContainer,bookmark.startOffset,bookmark.endContainer,bookmark.endOffset);return true;}if(tinyMCE.isMSIE)return bookmark.select();if(tinyMCE.isGecko){var rng=this.getDoc().createRange();var sel=this.getSel();rng.setStart(bookmark.startContainer,bookmark.startOffset);rng.setEnd(bookmark.endContainer,bookmark.endOffset);sel.removeAllRanges();sel.addRange(rng);return true;}return false;};TinyMCEControl.prototype.getSelectedText=function(){if(tinyMCE.isMSIE){var doc=this.getDoc();if(doc.selection.type=="Text"){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText='';}else{var sel=this.getSel();if(sel&&sel.toString)selectedText=sel.toString();else selectedText='';}return selectedText;};TinyMCEControl.prototype.selectNode=function(node,collapse,select_text_node,to_start){if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(tinyMCE.isMSIE){var rng=this.getBody().createTextRange();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select();}catch(e){}}else{var sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.realSelection.setBaseAndExtent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.realSelection.collapseToStart();else sel.realSelection.collapseToEnd();}this.scrollToNode(node);return;}var rng=this.getDoc().createRange();if(select_text_node){var nodes=tinyMCE.getNodeTree(node,new Array(),3);if(nodes.length>0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node);}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length);}else rng.collapse(to_start);}sel.removeAllRanges();sel.addRange(rng);}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node;};TinyMCEControl.prototype.scrollToNode=function(node){var pos=tinyMCE.getAbsPosition(node);var doc=this.getDoc();var scrollX=doc.body.scrollLeft+doc.documentElement.scrollLeft;var scrollY=doc.body.scrollTop+doc.documentElement.scrollTop;var height=tinyMCE.isMSIE?document.getElementById(this.editorId).style.pixelHeight:this.targetElement.clientHeight;if(!tinyMCE.settings['auto_resize']&&!(pos.absTop>scrollY&&pos.absTop<(scrollY-25+height)))this.contentWindow.scrollTo(pos.absLeft,pos.absTop-height+25);};TinyMCEControl.prototype.getBody=function(){return this.getDoc().body;};TinyMCEControl.prototype.getDoc=function(){return this.contentWindow.document;};TinyMCEControl.prototype.getWin=function(){return this.contentWindow;};TinyMCEControl.prototype.getSel=function(){if(tinyMCE.isMSIE&&!tinyMCE.isOpera)return this.getDoc().selection;var sel=this.contentWindow.getSelection();if(tinyMCE.isSafari&&!sel.getRangeAt){var newSel=new Object();var doc=this.getDoc();function getRangeAt(idx){var rng=new Object();rng.startContainer=this.focusNode;rng.endContainer=this.anchorNode;rng.commonAncestorContainer=this.focusNode;rng.createContextualFragment=function(html){if(html.charAt(0)=='<'){var elm=doc.createElement("div");elm.innerHTML=html;return elm.firstChild;}return doc.createTextNode("UNSUPPORTED, DUE TO LIMITATIONS IN SAFARI!");};rng.deleteContents=function(){doc.execCommand("Delete",false,"");};return rng;}newSel.focusNode=sel.baseNode;newSel.focusOffset=sel.baseOffset;newSel.anchorNode=sel.extentNode;newSel.anchorOffset=sel.extentOffset;newSel.getRangeAt=getRangeAt;newSel.text=""+sel;newSel.realSelection=sel;newSel.toString=function(){return this.text;};return newSel;}return sel;};TinyMCEControl.prototype.getRng=function(){var sel=this.getSel();if(sel==null)return null;if(tinyMCE.isMSIE&&!tinyMCE.isOpera)return sel.createRange();if(tinyMCE.isSafari){var rng=this.getDoc().createRange();var sel=this.getSel().realSelection;rng.setStart(sel.baseNode,sel.baseOffset);rng.setEnd(sel.extentNode,sel.extentOffset);return rng;}return this.getSel().getRangeAt(0);};TinyMCEControl.prototype._insertPara=function(e){function isEmpty(para){function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()=="";}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;var nodes=tinyMCE.getNodeTree(para,new Array(),3);for(var i=0;i<nodes.length;i++){if(!isEmptyHTML(nodes[i].nodeValue))return false;}return true;}var doc=this.getDoc();var sel=this.getSel();var win=this.contentWindow;var rng=sel.getRangeAt(0);var body=doc.body;var rootElm=doc.documentElement;var self=this;var blockName="P";var rngBefore=doc.createRange();rngBefore.setStart(sel.anchorNode,sel.anchorOffset);rngBefore.collapse(true);var rngAfter=doc.createRange();rngAfter.setStart(sel.focusNode,sel.focusOffset);rngAfter.collapse(true);var direct=rngBefore.compareBoundaryPoints(rngBefore.START_TO_END,rngAfter)<0;var startNode=direct?sel.anchorNode:sel.focusNode;var startOffset=direct?sel.anchorOffset:sel.focusOffset;var endNode=direct?sel.focusNode:sel.anchorNode;var endOffset=direct?sel.focusOffset:sel.anchorOffset;startNode=startNode.nodeName=="BODY"?startNode.firstChild:startNode;endNode=endNode.nodeName=="BODY"?endNode.firstChild:endNode;var startBlock=tinyMCE.getParentBlockElement(startNode);var endBlock=tinyMCE.getParentBlockElement(endNode);if(startBlock!=null){blockName=startBlock.nodeName;if(blockName=="TD"||blockName=="TABLE"||(blockName=="DIV"&&new RegExp('left|right','gi').test(startBlock.style.cssFloat)))blockName="P";}if(tinyMCE.getParentElement(startBlock,"OL,UL")!=null)return false;if((startBlock!=null&&startBlock.nodeName=="TABLE")||(endBlock!=null&&endBlock.nodeName=="TABLE"))startBlock=endBlock=null;var paraBefore=(startBlock!=null&&startBlock.nodeName==blockName)?startBlock.cloneNode(false):doc.createElement(blockName);var paraAfter=(endBlock!=null&&endBlock.nodeName==blockName)?endBlock.cloneNode(false):doc.createElement(blockName);if(/^(H[1-6])$/.test(blockName))paraAfter=doc.createElement("p");var startChop=startNode;var endChop=endNode;node=startChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;startChop=node;}while((node=node.previousSibling?node.previousSibling:node.parentNode));node=endChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;endChop=node;}while((node=node.nextSibling?node.nextSibling:node.parentNode));if(startChop.nodeName=="TD")startChop=startChop.firstChild;if(endChop.nodeName=="TD")endChop=endChop.lastChild;if(startBlock==null){rng.deleteContents();sel.removeAllRanges();if(startChop!=rootElm&&endChop!=rootElm){rngBefore=rng.cloneRange();if(startChop==body)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);paraBefore.appendChild(rngBefore.cloneContents());if(endChop.parentNode.nodeName==blockName)endChop=endChop.parentNode;rng.setEndAfter(endChop);if(endChop.nodeName!="#text"&&endChop.nodeName!="BODY")rngBefore.setEndAfter(endChop);var contents=rng.cloneContents();if(contents.firstChild&&(contents.firstChild.nodeName==blockName||contents.firstChild.nodeName=="BODY"))paraAfter.innerHTML=contents.firstChild.innerHTML;else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng.deleteContents();rngAfter.deleteContents();rngBefore.deleteContents();paraAfter.normalize();rngBefore.insertNode(paraAfter);paraBefore.normalize();rngBefore.insertNode(paraBefore);}else{body.innerHTML="<"+blockName+">&nbsp;</"+blockName+"><"+blockName+">&nbsp;</"+blockName+">";paraAfter=body.childNodes[1];}this.selectNode(paraAfter,true,true);return true;}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);var contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){paraAfter.innerHTML=contents.firstChild.innerHTML;}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";var rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode);}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockName&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset);}if(!endChop.nextSibling&&endChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.parentNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();rng.insertNode(paraAfter);rng.insertNode(paraBefore);paraAfter.normalize();paraBefore.normalize();this.selectNode(paraAfter,true,true);return true;};TinyMCEControl.prototype._handleBackSpace=function(evt_type){var doc=this.getDoc();var sel=this.getSel();if(sel==null)return false;var rng=sel.getRangeAt(0);var node=rng.startContainer;var elm=node.nodeType==3?node.parentNode:node;if(node==null)return;if(elm&&elm.nodeName==""){var para=doc.createElement("p");while(elm.firstChild)para.appendChild(elm.firstChild);elm.parentNode.insertBefore(para,elm);elm.parentNode.removeChild(elm);var rng=rng.cloneRange();rng.setStartBefore(node.nextSibling);rng.setEndAfter(node.nextSibling);rng.extractContents();this.selectNode(node.nextSibling,true,true);}var para=tinyMCE.getParentBlockElement(node);if(para!=null&&para.nodeName.toLowerCase()=='p'&&evt_type=="keypress"){var htm=para.innerHTML;var block=tinyMCE.getParentBlockElement(node);if(htm==""||htm=="&nbsp;"||block.nodeName.toLowerCase()=="li"){var prevElm=para.previousSibling;while(prevElm!=null&&prevElm.nodeType!=1)prevElm=prevElm.previousSibling;if(prevElm==null)return false;var nodes=tinyMCE.getNodeTree(prevElm,new Array(),3);var lastTextNode=nodes.length==0?null:nodes[nodes.length-1];if(lastTextNode!=null)this.selectNode(lastTextNode,true,false,false);para.parentNode.removeChild(para);return true;}}return false;};TinyMCEControl.prototype._insertSpace=function(){return true;};TinyMCEControl.prototype.autoResetDesignMode=function(){if(!tinyMCE.isMSIE&&tinyMCE.settings['auto_reset_designmode']){var sel=this.getSel();if(!sel||!sel.rangeCount||sel.rangeCount==0)eval('try { this.getDoc().designMode = "On"; } catch(e) {}');}};TinyMCEControl.prototype.isDirty=function(){return this.startContent!=tinyMCE.trim(this.getBody().innerHTML)&&!tinyMCE.isNotDirty;};TinyMCEControl.prototype._mergeElements=function(scmd,pa,ch,override){if(scmd=="removeformat"){pa.className="";pa.style.cssText="";ch.className="";ch.style.cssText="";return;}var st=tinyMCE.parseStyle(tinyMCE.getAttrib(pa,"style"));var stc=tinyMCE.parseStyle(tinyMCE.getAttrib(ch,"style"));var className=tinyMCE.getAttrib(pa,"class");className+=" "+tinyMCE.getAttrib(ch,"class");if(override){for(var n in st){if(typeof(st[n])=='function')continue;stc[n]=st[n];}}else{for(var n in stc){if(typeof(stc[n])=='function')continue;st[n]=stc[n];}}tinyMCE.setAttrib(pa,"style",tinyMCE.serializeStyle(st));tinyMCE.setAttrib(pa,"class",tinyMCE.trim(className));ch.className="";ch.style.cssText="";ch.removeAttribute("class");ch.removeAttribute("style");};TinyMCEControl.prototype.setUseCSS=function(b){var doc=this.getDoc();try{doc.execCommand("useCSS",false,!b);}catch(ex){}try{doc.execCommand("styleWithCSS",false,b);}catch(ex){}};TinyMCEControl.prototype.execCommand=function(command,user_interface,value){var doc=this.getDoc();var win=this.getWin();var focusElm=this.getFocusElement();if(this.lastSafariSelection&&!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel','gi').test(command)){this.moveToBookmark(this.lastSafariSelection);tinyMCE.selectedElement=this.lastSafariSelectedElement;}if(!tinyMCE.isMSIE&&!this.useCSS){this.setUseCSS(false);this.useCSS=true;}this.contentDocument=doc;if(tinyMCE._themeExecCommand(this.editorId,this.getBody(),command,user_interface,value))return;if(focusElm&&focusElm.nodeName=="IMG"){var align=focusElm.getAttribute('align');var img=command=="JustifyCenter"?focusElm.cloneNode(false):focusElm;switch(command){case "JustifyLeft":if(align=='left')img.removeAttribute('align');else img.setAttribute('align','left');var div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case "JustifyCenter":img.removeAttribute('align');var div=tinyMCE.getParentElement(focusElm,"div");if(div&&div.style.textAlign=="center"){if(div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);}else{var div=this.getDoc().createElement("div");div.style.textAlign='center';div.appendChild(img);focusElm.parentNode.replaceChild(div,focusElm);}this.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case "JustifyRight":if(align=='right')img.removeAttribute('align');else img.setAttribute('align','right');var div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;}}if(tinyMCE.settings['force_br_newlines']){var alignValue="";if(doc.selection.type!="Control"){switch(command){case "JustifyLeft":alignValue="left";break;case "JustifyCenter":alignValue="center";break;case "JustifyFull":alignValue="justify";break;case "JustifyRight":alignValue="right";break;}if(alignValue!=""){var rng=doc.selection.createRange();if((divElm=tinyMCE.getParentElement(rng.parentElement(),"div"))!=null)divElm.setAttribute("align",alignValue);else if(rng.pasteHTML&&rng.htmlText.length>0)rng.pasteHTML('<div align="'+alignValue+'">'+rng.htmlText+"</div>");tinyMCE.triggerNodeChange();return;}}}switch(command){case "mceRepaint":this.repaint();return true;case "mceStoreSelection":this.selectionBookmark=this.getBookmark();return true;case "mceRestoreSelection":this.moveToBookmark(this.selectionBookmark);return true;case "InsertUnorderedList":case "InsertOrderedList":var tag=(command=="InsertUnorderedList")?"ul":"ol";if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<"+tag+"><li>&nbsp;</li><"+tag+">");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "Strikethrough":if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<strike>"+this.getSelectedHTML()+"</strike>");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "mceSelectNode":this.selectNode(value);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=value;break;case "FormatBlock":if(value==null||value==""){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm)this.execCommand("mceRemoveNode",false,elm);}else this.getDoc().execCommand("FormatBlock",false,value);tinyMCE.triggerNodeChange();break;case "mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isMSIE){value.outerHTML=value.innerHTML;}else{var rng=value.ownerDocument.createRange();rng.setStartBefore(value);rng.setEndAfter(value);rng.deleteContents();rng.insertNode(rng.createContextualFragment(value.innerHTML));}tinyMCE.triggerNodeChange();break;case "mceSelectNodeDepth":var parentNode=this.getFocusElement();for(var i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=parentNode.parentNode;continue;}if(i==value){this.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return;}parentNode=parentNode.parentNode;}break;case "SetStyleInfo":var rng=this.getRng();var sel=this.getSel();var scmd=value['command'];var sname=value['name'];var svalue=value['value']==null?'':value['value'];var wrapper=value['wrapper']?value['wrapper']:"span";var parentElm=null;var invalidRe=new RegExp("^BODY|HTML$","g");var invalidParentsRe=tinyMCE.settings['merge_styles_invalid_parents']!=''?new RegExp(tinyMCE.settings['merge_styles_invalid_parents'],"gi"):null;if(tinyMCE.isMSIE){if(rng.item)parentElm=rng.item(0);else{var pelm=rng.parentElement();var prng=doc.selection.createRange();prng.moveToElementText(pelm);if(rng.htmlText==prng.htmlText||rng.boundingWidth==0){if(invalidParentsRe==null||!invalidParentsRe.test(pelm.nodeName))parentElm=pelm;}}}else{var felm=this.getFocusElement();if(sel.isCollapsed||(/td|tr|tbody|table/ig.test(felm.nodeName)&&sel.anchorNode==felm.parentNode))parentElm=felm;}if(parentElm&&!invalidRe.test(parentElm.nodeName)){if(scmd=="setstyle")tinyMCE.setStyleAttrib(parentElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(parentElm,sname,svalue);if(scmd=="removeformat"){parentElm.style.cssText='';tinyMCE.setAttrib(parentElm,'class','');}var ch=tinyMCE.getNodeTree(parentElm,new Array(),1);for(var z=0;z<ch.length;z++){if(ch[z]==parentElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','');}}}else{doc.execCommand("fontname",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;x<elementArray.length;x++){elm=elementArray[x];if(elm){var spanElm=doc.createElement(wrapper);if(scmd=="setstyle")tinyMCE.setStyleAttrib(spanElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(spanElm,sname,svalue);if(scmd=="removeformat"){spanElm.style.cssText='';tinyMCE.setAttrib(spanElm,'class','');}if(elm.hasChildNodes()){for(var i=0;i<elm.childNodes.length;i++)spanElm.appendChild(elm.childNodes[i].cloneNode(true));}spanElm.setAttribute("mce_new","true");elm.parentNode.replaceChild(spanElm,elm);var ch=tinyMCE.getNodeTree(spanElm,new Array(),1);for(var z=0;z<ch.length;z++){if(ch[z]==spanElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','');}}}}}var nodes=doc.getElementsByTagName(wrapper);for(var i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isNew=tinyMCE.getAttrib(elm,"mce_new")=="true";elm.removeAttribute("mce_new");if(elm.childNodes&&elm.childNodes.length==1&&elm.childNodes[0].nodeType==1){this._mergeElements(scmd,elm,elm.childNodes[0],isNew);continue;}if(elm.parentNode.childNodes.length==1&&!invalidRe.test(elm.nodeName)&&!invalidRe.test(elm.parentNode.nodeName)){if(invalidParentsRe==null||!invalidParentsRe.test(elm.parentNode.nodeName))this._mergeElements(scmd,elm.parentNode,elm,false);}}var nodes=doc.getElementsByTagName(wrapper);for(var i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isEmpty=true;var tmp=doc.createElement("body");tmp.appendChild(elm.cloneNode(false));tmp.innerHTML=tmp.innerHTML.replace(new RegExp('style=""|class=""','gi'),'');if(new RegExp('<span>','gi').test(tmp.innerHTML)){for(var x=0;x<elm.childNodes.length;x++){if(elm.parentNode!=null)elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true),elm);}elm.parentNode.removeChild(elm);}}if(scmd=="removeformat")tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case "FontName":this.getDoc().execCommand('FontName',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case "FontSize":this.getDoc().execCommand('FontSize',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case "forecolor":this.getDoc().execCommand('forecolor',false,value);break;case "HiliteColor":if(tinyMCE.isGecko){this.setUseCSS(true);this.getDoc().execCommand('hilitecolor',false,value);this.setUseCSS(false);}else this.getDoc().execCommand('BackColor',false,value);break;case "Cut":case "Copy":case "Paste":var cmdFailed=false;eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');if(tinyMCE.isOpera&&cmdFailed)alert('Currently not supported by your browser, use keyboard shortcuts instead.');if(tinyMCE.isGecko&&cmdFailed){if(confirm(tinyMCE.getLang('lang_clipboard_msg')))window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');return;}else tinyMCE.triggerNodeChange();break;case "mceSetContent":if(!value)value="";value=tinyMCE._customCleanup(this,"insert_to_editor",value);tinyMCE._setHTML(doc,value);tinyMCE.setInnerHTML(doc.body,tinyMCE._cleanupHTML(this,doc,tinyMCE.settings,doc.body));tinyMCE.handleVisualAid(doc.body,true,this.visualAid,this);tinyMCE._setEventsEnabled(doc.body,false);return true;case "mceLink":var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText=this.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return;}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_real_href');if(mceRealHref!="")href=mceRealHref;href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");action="update";}if(this.settings['insertlink_callback']){var returnVal=eval(this.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])tinyMCE.insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class']);}else{tinyMCE.openWindow(this.insertLinkTemplate,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class});}break;case "mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img;}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h);}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttrib(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyMCE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:"";}onmouseover=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover));onmouseout=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout));mceRealSrc=tinyMCE.getAttrib(img,'mce_real_src');if(mceRealSrc!="")src=mceRealSrc;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");if(onmouseover!="")onmouseover=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, img, true);");if(onmouseout!="")onmouseout=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, img, true);");action="update";}if(this.settings['insertimage_callback']){var returnVal=eval(this.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])tinyMCE.insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout']);}else tinyMCE.openWindow(this.insertImageTemplate,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action});break;case "mceCleanup":tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,this.getBody(),this.visualAid));tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);this.repaint();tinyMCE.triggerNodeChange();break;case "mceReplaceContent":this.getWin().focus();var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText=this.getSel().toString();if(selectedText.length>0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value);}tinyMCE.triggerNodeChange();break;case "mceSetAttribute":if(typeof(value)=='object'){var targetElms=(typeof(value['targets'])=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value['targets'];var targetNode=tinyMCE.getParentElement(this.getFocusElement(),targetElms);if(targetNode){targetNode.setAttribute(value['name'],value['value']);tinyMCE.triggerNodeChange();}}break;case "mceSetCSSClass":this.execCommand("SetStyleInfo",false,{command:"setattrib",name:"class",value:value});break;case "mceInsertRawHTML":var key='tiny_mce_marker';this.execCommand('mceBeginUndoLevel');this.execCommand('mceInsertContent',false,key);var scrollX=this.getDoc().body.scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getDoc().body.scrollTop+this.getDoc().documentElement.scrollTop;var html=this.getBody().innerHTML;if((pos=html.indexOf(key))!=-1)tinyMCE.setInnerHTML(this.getBody(),html.substring(0,pos)+value+html.substring(pos+key.length));this.contentWindow.scrollTo(scrollX,scrollY);this.execCommand('mceEndUndoLevel');break;case "mceInsertContent":var insertHTMLFailed=false;this.getWin().focus();if(tinyMCE.isGecko||tinyMCE.isOpera){try{this.getDoc().execCommand('inserthtml',false,value);}catch(ex){insertHTMLFailed=true;}if(!insertHTMLFailed){tinyMCE.triggerNodeChange();return;}}if(tinyMCE.isOpera&&insertHTMLFailed){this.getDoc().execCommand("insertimage",false,tinyMCE.uniqueURL);var ar=tinyMCE.getElementsByAttributeValue(this.getBody(),"img","src",tinyMCE.uniqueURL);ar[0].outerHTML=value;return;}if(!tinyMCE.isMSIE){var isHTML=value.indexOf('<')!=-1;var sel=this.getSel();var rng=this.getRng();if(isHTML){if(tinyMCE.isSafari){var tmpRng=this.getDoc().createRange();tmpRng.setStart(this.getBody(),0);tmpRng.setEnd(this.getBody(),0);value=tmpRng.createContextualFragment(value);}else value=rng.createContextualFragment(value);}else{var el=document.createElement("div");el.innerHTML=value;value=el.firstChild.nodeValue;value=doc.createTextNode(value);}if(tinyMCE.isSafari&&!isHTML){this.execCommand('InsertText',false,value.nodeValue);tinyMCE.triggerNodeChange();return true;}else if(tinyMCE.isSafari&&isHTML){rng.deleteContents();rng.insertNode(value);tinyMCE.triggerNodeChange();return true;}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(value,node);}else rng.insertNode(value);if(!isHTML){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(value);rng.collapse(false);sel.addRange(rng);}else rng.collapse(false);}else{var rng=doc.selection.createRange();if(rng.item)rng.item(0).outerHTML=value;else rng.pasteHTML(value);}tinyMCE.triggerNodeChange();break;case "mceStartTyping":if(tinyMCE.settings['custom_undo_redo']&&this.typingUndoIndex==-1){this.typingUndoIndex=this.undoIndex;this.execCommand('mceAddUndoLevel');}break;case "mceEndTyping":if(tinyMCE.settings['custom_undo_redo']&&this.typingUndoIndex!=-1){this.execCommand('mceAddUndoLevel');this.typingUndoIndex=-1;}break;case "mceBeginUndoLevel":this.undoRedo=false;break;case "mceEndUndoLevel":this.undoRedo=true;this.execCommand('mceAddUndoLevel');break;case "mceAddUndoLevel":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedo){if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;}var newHTML=tinyMCE.trim(this.getBody().innerHTML);if(newHTML!=this.undoLevels[this.undoIndex]){tinyMCE.executeCallback('onchange_callback','_onchange',0,this);var customUndoLevels=tinyMCE.settings['custom_undo_redo_levels'];if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(var i=0;i<this.undoLevels.length-1;i++){this.undoLevels[i]=this.undoLevels[i+1];}this.undoLevels.length--;this.undoIndex--;}this.undoIndex++;this.undoLevels[this.undoIndex]=newHTML;this.undoLevels.length=this.undoIndex+1;tinyMCE.triggerNodeChange(false);}}break;case "Undo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");if(this.undoIndex>0){this.undoIndex--;tinyMCE.setInnerHTML(this.getBody(),this.undoLevels[this.undoIndex]);this.repaint();}tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case "Redo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;tinyMCE.setInnerHTML(this.getBody(),this.undoLevels[this.undoIndex]);this.repaint();}tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case "mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case "Indent":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();if(tinyMCE.isMSIE){var n=tinyMCE.getParentElement(this.getFocusElement(),"blockquote");do{if(n&&n.nodeName=="BLOCKQUOTE"){n.removeAttribute("dir");n.removeAttribute("style");}}while(n!=null&&(n=n.parentNode)!=null);}break;case "removeformat":var text=this.getSelectedText();if(tinyMCE.isOpera){this.getDoc().execCommand("RemoveFormat",false,null);return;}if(tinyMCE.isMSIE){try{var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null);}catch(e){}this.execCommand("SetStyleInfo",false,{command:"removeformat"});}else{this.getDoc().execCommand(command,user_interface,value);this.execCommand("SetStyleInfo",false,{command:"removeformat"});}if(text.length==0)this.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);else tinyMCE.triggerNodeChange();}if(command!="mceAddUndoLevel"&&command!="Undo"&&command!="Redo"&&command!="mceStartTyping"&&command!="mceEndTyping")tinyMCE.execCommand("mceAddUndoLevel");};TinyMCEControl.prototype.queryCommandValue=function(command){return this.getDoc().queryCommandValue(command);};TinyMCEControl.prototype.queryCommandState=function(command){return this.getDoc().queryCommandState(command);};TinyMCEControl.prototype.onAdd=function(replace_element,form_element_name,target_document){var targetDoc=target_document?target_document:document;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings['theme'];this.settings['themeurl']=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false;}var templateFunction=tinyMCE._getThemeFunction('_getInsertLinkTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertLinkTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getInsertImageTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertImageTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getEditorTemplate');if(eval("typeof("+templateFunction+")")=='undefined'){alert("Error: Could not find the template function: "+templateFunction);return false;}var editorTemplate=eval(templateFunction+'(this.settings, this.editorId);');var deltaWidth=editorTemplate['delta_width']?editorTemplate['delta_width']:0;var deltaHeight=editorTemplate['delta_height']?editorTemplate['delta_height']:0;var html='<span id="'+this.editorId+'_parent">'+editorTemplate['html'];var templateFunction=tinyMCE._getThemeFunction('_handleNodeChange',true);if(eval("typeof("+templateFunction+")")!='undefined')this.settings['handleNodeChangeCallback']=templateFunction;html=tinyMCE.replaceVar(html,"editor_id",this.editorId);this.settings['default_document']=tinyMCE.baseURL+"/blank.htm";this.settings['old_width']=this.settings['width'];this.settings['old_height']=this.settings['height'];if(this.settings['width']==-1)this.settings['width']=replace_element.offsetWidth;if(this.settings['height']==-1)this.settings['height']=replace_element.offsetHeight;if(this.settings['width']==0)this.settings['width']=replace_element.style.width;if(this.settings['height']==0)this.settings['height']=replace_element.style.height;if(this.settings['width']==0)this.settings['width']=320;if(this.settings['height']==0)this.settings['height']=240;this.settings['area_width']=parseInt(this.settings['width']);this.settings['area_height']=parseInt(this.settings['height']);this.settings['area_width']+=deltaWidth;this.settings['area_height']+=deltaHeight;if((""+this.settings['width']).indexOf('%')!=-1)this.settings['area_width']="100%";if((""+this.settings['height']).indexOf('%')!=-1)this.settings['area_height']="100%";if((""+replace_element.style.width).indexOf('%')!=-1){this.settings['width']=replace_element.style.width;this.settings['area_width']="100%";}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings['height']=replace_element.style.height;this.settings['area_height']="100%";}html=tinyMCE.applyTemplate(html);this.settings['width']=this.settings['old_width'];this.settings['height']=this.settings['old_height'];this.visualAid=this.settings['visual'];this.formTargetElementId=form_element_name;if(replace_element.nodeName=="TEXTAREA"||replace_element.nodeName=="INPUT")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName.toLowerCase()!="textarea"){this.oldTargetElement=replace_element.cloneNode(true);if(tinyMCE.settings['debug'])html+='<textarea wrap="off" id="'+form_element_name+'" name="'+form_element_name+'" cols="100" rows="15"></textarea>';else html+='<input type="hidden" type="text" id="'+form_element_name+'" name="'+form_element_name+'" />';html+='</span>';if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.replaceChild(fragment,replace_element);}else replace_element.outerHTML=html;}else{html+='</span>';this.oldTargetElement=replace_element;if(!tinyMCE.settings['debug'])this.oldTargetElement.style.display="none";if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.insertBefore(fragment,replace_element);}else replace_element.insertAdjacentHTML("beforeBegin",html);}var dynamicIFrame=false;var tElm=targetDoc.getElementById(this.editorId);if(!tinyMCE.isMSIE){if(tElm&&tElm.nodeName.toLowerCase()=="span"){tElm=tinyMCE._createIFrame(tElm);dynamicIFrame=true;}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName.toLowerCase()=="span")tElm=tinyMCE._createIFrame(tElm);else tElm=targetDoc.frames[this.editorId];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);if(tinyMCE.isOpera){this.contentDocument=this.iframeElement.contentDocument;this.contentWindow=this.iframeElement.contentWindow;dynamicIFrame=true;}else{this.contentDocument=tElm.window.document;this.contentWindow=tElm.window;}this.getDoc().designMode="on";}var doc=this.contentDocument;if(dynamicIFrame){var html=tinyMCE.getParam('doctype')+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+tinyMCE.settings['base_href']+'" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';try{this.getDoc().designMode="on";doc.open();doc.write(html);doc.close();}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm";}}if(tinyMCE.isMSIE)window.setTimeout("TinyMCE.prototype.addEventHandlers('"+this.editorId+"');",1);tinyMCE.setupContent(this.editorId,true);return true;};TinyMCEControl.prototype.getFocusElement=function(){if(tinyMCE.isMSIE&&!tinyMCE.isOpera){var doc=this.getDoc();var rng=doc.selection.createRange();var elm=rng.item?rng.item(0):rng.parentElement();}else{var sel=this.getSel();var rng=this.getRng();var elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if(rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset];}}}elm=tinyMCE.getParentElement(elm);}return elm;};var tinyMCE=new TinyMCE();var tinyMCELang=new Array(); \ No newline at end of file
diff --git a/wp-inst/wp-includes/js/tinymce/tiny_mce_gzip.php b/wp-inst/wp-includes/js/tinymce/tiny_mce_gzip.php
index a5147a1..0955bc2 100644
--- a/wp-inst/wp-includes/js/tinymce/tiny_mce_gzip.php
+++ b/wp-inst/wp-includes/js/tinymce/tiny_mce_gzip.php
@@ -1,11 +1,12 @@
<?php
/**
* $RCSfile: tiny_mce_gzip.php,v $
- * $Revision: 1.1 $
- * $Date: 2005/06/14 18:55:34 $
+ * $Revision: $
+ * $Date: $
*
+ * @version 1.02
* @author Moxiecode
- * @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2005, Moxiecode Systems AB, All rights reserved.
*
* This file compresses the TinyMCE JavaScript using GZip and
* enables the browser to do two requests instead of one for each .js file.
@@ -15,6 +16,27 @@
* - Add local file cache for the GZip:ed version.
*/
+ @ include('../../../wp-config.php');
+
+ function wp_translate_tinymce_lang($text) {
+ if ( ! function_exists('__') ) {
+ return $text;
+ } else {
+ $search1 = "/^tinyMCELang\\[(['\"])(.*)\\1\]( ?= ?)(['\"])(.*)\\4/uem";
+ $replace1 = "'tinyMCELang[\\1\\2\\1]\\3'.stripslashes('\\4').__('\\5').stripslashes('\\4')";
+
+ $search2 = "/ : (['\"])(.*)\\1/uem";
+ $replace2 = "' : '.stripslashes('\\1').__('\\2').stripslashes('\\1')";
+
+ $search = array($search1, $search2);
+ $replace = array($replace1, $replace2);
+
+ $text = preg_replace($search, $replace, $text);
+
+ return $text;
+ }
+ }
+
// General options
$suffix = ""; // Set to "_src" to use source version
$expiresOffset = 3600 * 24 * 10; // 10 days util client cache expires
@@ -23,44 +45,66 @@
$theme = isset($_REQUEST['theme']) ? $_REQUEST['theme'] : "";
$language = isset($_REQUEST['language']) ? $_REQUEST['language'] : "";
$plugins = isset($_REQUEST['plugins']) ? $_REQUEST['plugins'] : "";
+ $lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : "en";
+ $index = isset($_REQUEST['index']) ? $_REQUEST['index'] : -1;
+
+ // Only gzip the contents if clients and server support it
+ $encodings = explode(',', strtolower($_SERVER['HTTP_ACCEPT_ENCODING']));
+ if (in_array('gzip', $encodings) && function_exists('ob_gzhandler'))
+ ob_start("ob_gzhandler");
- // GZip compress and cache it for 10 days
- ob_start ("ob_gzhandler");
+ // Output rest of headers
header("Content-type: text/javascript; charset: UTF-8");
- header("Cache-Control: must-revalidate");
+ // header("Cache-Control: must-revalidate");
+ header("Vary: Accept-Encoding"); // Handle proxies
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
- if ($theme) {
+ if ($index > -1) {
// Write main script and patch some things
- echo file_get_contents(realpath("tiny_mce" . $suffix . ".js"));
- echo 'TinyMCE.prototype.loadScript = function() {};';
- echo "tinyMCE.init(TinyMCECompressed_settings);";
+ if ($index == 0) {
+ echo file_get_contents(realpath("tiny_mce" . $suffix . ".js"));
+ echo "\n\n";
+ echo "TinyMCE.prototype.loadScript = function() {};\n";
+ }
+
+ // WP
+ $lang = $language = 'en';
+ echo "\n/* WP Cancels all TinyMCE language handling */\n";
+ echo "TinyMCE.prototype.importThemeLanguagePack = function() {};\n";
+ echo "TinyMCE.prototype.importPluginLanguagePack = function() {};\n\n";
+
+ // Do init based on index
+// WP echo "tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);\n\n";
// Load theme, language pack and theme language packs
- echo file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js"));
- echo file_get_contents(realpath("themes/" . $theme . "/langs/" . $language . ".js"));
- echo file_get_contents(realpath("langs/" . $language . ".js"));
+ if ($theme) {
+ echo file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js"));
+ echo wp_translate_tinymce_lang(file_get_contents(realpath("themes/" . $theme . "/langs/" . $lang . ".js")));
+ }
+
+ if ($language)
+ echo wp_translate_tinymce_lang(file_get_contents(realpath("langs/" . $language . ".js")));
// Load all plugins and their language packs
$plugins = explode(",", $plugins);
foreach ($plugins as $plugin) {
$pluginFile = realpath("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");
- $languageFile = realpath("plugins/" . $plugin . "/langs/" . $language . ".js");
+ $languageFile = realpath("plugins/" . $plugin . "/langs/" . $lang . ".js");
if ($pluginFile)
echo file_get_contents($pluginFile);
if ($languageFile)
- echo file_get_contents($languageFile);
+ echo wp_translate_tinymce_lang(file_get_contents($languageFile));
}
die;
}
?>
-var TinyMCECompressed_settings = null;
-
function TinyMCECompressed() {
+ this.configs = new Array();
+ this.loadedFiles = new Array();
}
TinyMCECompressed.prototype.init = function(settings) {
@@ -78,11 +122,43 @@ TinyMCECompressed.prototype.init = function(settings) {
settings["plugins"] = typeof(settings["plugins"]) != "undefined" ? settings["plugins"] : "";
settings["language"] = typeof(settings["language"]) != "undefined" ? settings["language"] : "en";
settings["button_tile_map"] = typeof(settings["button_tile_map"]) != "undefined" ? settings["button_tile_map"] : true;
+ this.configs[this.configs.length] = settings;
+ this.settings = settings;
- scriptURL += "?theme=" + escape(settings["theme"]) + "&language=" + escape(settings["language"]) + "&plugins=" + escape(settings["plugins"]);
+ scriptURL += "?theme=" + escape(this.getOnce(settings["theme"])) + "&language=" + escape(this.getOnce(settings["language"])) + "&plugins=" + escape(this.getOnce(settings["plugins"])) + "&lang=" + settings["language"] + "&index=" + escape(this.configs.length-1);
document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>');
+}
+
+TinyMCECompressed.prototype.getOnce = function(str) {
+ var ar = str.split(',');
+
+ for (var i=0; i<ar.length; i++) {
+ if (ar[i] == '')
+ continue;
+
+ // Skip load
+ for (var x=0; x<this.loadedFiles.length; x++) {
+ if (this.loadedFiles[x] == ar[i])
+ ar[i] = null;
+ }
+
+ this.loadedFiles[this.loadedFiles.length] = ar[i];
+ }
+
+ // Glue
+ str = "";
+ for (var i=0; i<ar.length; i++) {
+ if (ar[i] == null)
+ continue;
+
+ str += ar[i];
+
+ if (i != ar.length-1)
+ str += ",";
+ }
- TinyMCECompressed_settings = settings;
+ return str;
}
var tinyMCE = new TinyMCECompressed();
+var tinyMCECompressed = tinyMCE;
diff --git a/wp-inst/wp-includes/js/tinymce/tiny_mce_popup.js b/wp-inst/wp-includes/js/tinymce/tiny_mce_popup.js
index 0486e74..58b3964 100644
--- a/wp-inst/wp-includes/js/tinymce/tiny_mce_popup.js
+++ b/wp-inst/wp-includes/js/tinymce/tiny_mce_popup.js
@@ -1,7 +1,7 @@
/**
* $RCSfile: tiny_mce_popup.js,v $
- * $Revision: 1.14 $
- * $Date: 2005/08/23 17:01:39 $
+ * $Revision: 1.18 $
+ * $Date: 2005/10/29 19:13:20 $
*
* @author Moxiecode
* @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
@@ -20,6 +20,7 @@ TinyMCEPopup.prototype.init = function() {
window.opener = win;
this.windowOpener = win;
+ this.onLoadEval = "";
// Setup parent references
tinyMCE = win.tinyMCE;
@@ -33,6 +34,9 @@ TinyMCEPopup.prototype.init = function() {
this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
this.storeSelection = tinyMCE.isMSIE && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
+ if (this.isWindow)
+ window.focus();
+
// Store selection
if (this.storeSelection)
tinyMCE.selectedInstance.execCommand('mceStoreSelection');
@@ -62,6 +66,13 @@ TinyMCEPopup.prototype.init = function() {
TinyMCEPopup.prototype.onLoad = function() {
var body = document.body;
+ body.onkeydown = function (e) {
+ e = e ? e : window.event;
+ if ( e.keyCode == 27 && !e.shiftKey && !e.controlKey && !e.altKey ) {
+ tinyMCEPopup.close();
+ }
+ }
+
if (tinyMCE.getWindowArg('mce_replacevariables', true))
body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
@@ -76,9 +87,27 @@ TinyMCEPopup.prototype.onLoad = function() {
if (body.style.display == 'none')
body.style.display = 'block';
+
+ // Execute real onload (Opera fix)
+ if (tinyMCEPopup.onLoadEval != "") {
+ eval(tinyMCEPopup.onLoadEval);
+ }
+};
+
+TinyMCEPopup.prototype.executeOnLoad = function(str) {
+ if (tinyMCE.isOpera)
+ this.onLoadEval = str;
+ else
+ eval(str);
};
TinyMCEPopup.prototype.resizeToInnerSize = function() {
+ // Netscape 7.1 workaround
+ if (this.isWindow && tinyMCE.isNS71) {
+ window.resizeBy(0, 10);
+ return;
+ }
+
if (this.isWindow) {
var doc = document;
var body = doc.body;
@@ -114,7 +143,7 @@ TinyMCEPopup.prototype.resizeToInnerSize = function() {
// Create iframe
iframe = document.createElement("iframe");
iframe.id = "mcWinIframe";
- iframe.src = "about:blank";
+ iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings['default_document'];
iframe.width = "100%";
iframe.height = "100%";
iframe.style.margin = '0px';
diff --git a/wp-inst/wp-includes/js/tinymce/tiny_mce_src.js b/wp-inst/wp-includes/js/tinymce/tiny_mce_src.js
index 0147c8e..7e632cd 100644
--- a/wp-inst/wp-includes/js/tinymce/tiny_mce_src.js
+++ b/wp-inst/wp-includes/js/tinymce/tiny_mce_src.js
@@ -1,7 +1,7 @@
/**
* $RCSfile: tiny_mce_src.js,v $
- * $Revision: 1.233 $
- * $Date: 2005/08/26 15:20:32 $
+ * $Revision: 1.249 $
+ * $Date: 2005/10/30 16:06:57 $
*
* @author Moxiecode
* @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
@@ -9,8 +9,8 @@
function TinyMCE() {
this.majorVersion = "2";
- this.minorVersion = "0RC2";
- this.releaseDate = "2005-09-12";
+ this.minorVersion = "0RC4";
+ this.releaseDate = "2005-10-30";
this.instances = new Array();
this.stickyClassesLookup = new Array();
@@ -21,14 +21,26 @@ function TinyMCE() {
this.eventHandlers = new Array();
// Browser check
+ var ua = navigator.userAgent;
this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
- this.isMSIE5 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5') != -1);
- this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
- this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
- this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
- this.isMac = navigator.userAgent.indexOf('Mac') != -1;
+ this.isMSIE5 = this.isMSIE && (ua.indexOf('MSIE 5') != -1);
+ this.isMSIE5_0 = this.isMSIE && (ua.indexOf('MSIE 5.0') != -1);
+ this.isGecko = ua.indexOf('Gecko') != -1;
+ this.isGecko18 = ua.indexOf('Gecko') != -1 && ua.indexOf('rv:1.8') != -1;
+ this.isSafari = ua.indexOf('Safari') != -1;
+ this.isOpera = ua.indexOf('Opera') != -1;
+ this.isMac = ua.indexOf('Mac') != -1;
+ this.isNS7 = ua.indexOf('Netscape/7') != -1;
+ this.isNS71 = ua.indexOf('Netscape/7.1') != -1;
this.dialogCounter = 0;
+ // Fake MSIE on Opera and if Opera fakes IE, Gecko or Safari cancel those
+ if (this.isOpera) {
+ this.isMSIE = true;
+ this.isGecko = false;
+ this.isSafari = false;
+ }
+
// TinyMCE editor id instance counter
this.idCounter = 0;
};
@@ -86,7 +98,7 @@ TinyMCE.prototype.init = function(settings) {
this.defParam("textarea_trigger", "mce_editable");
this.defParam("editor_selector", "");
this.defParam("editor_deselector", "mceNoEditor");
- this.defParam("valid_elements", "+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/b[class|style],-em/i[class|style],-strike[class|style],-u[class|style],+p[style|dir|class|align],-ol[class],-ul[class],-li[class],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border=0|alt|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],-td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align],address[class|align],-h1[style|dir|class|align],-h2[style|dir|class|align],-h3[style|dir|class|align],-h4[style|dir|class|align],-h5[style|dir|class|align],-h6[style|dir|class|align],hr[class]");
+ this.defParam("valid_elements", "+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/b[class|style],-em/i[class|style],-strike[class|style],-u[class|style],+p[style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border=0|alt|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],-td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[style|dir|class|align],-h2[style|dir|class|align],-h3[style|dir|class|align],-h4[style|dir|class|align],-h5[style|dir|class|align],-h6[style|dir|class|align],hr[class|style],font[face|size|style|id|class|dir|color]");
this.defParam("extended_valid_elements", "");
this.defParam("invalid_elements", "");
this.defParam("encoding", "");
@@ -127,9 +139,17 @@ TinyMCE.prototype.init = function(settings) {
this.defParam("remove_linebreaks", true);
this.defParam("button_tile_map", false);
this.defParam("submit_patch", true);
- this.defParam("browsers", "msie,safari,gecko");
+ this.defParam("browsers", "msie,safari,gecko,opera");
this.defParam("dialog_type", "window");
- this.defParam("convert_fonts_to_styles", true);
+ this.defParam("accessibility_warnings", true);
+ this.defParam("merge_styles_invalid_parents", "");
+ this.defParam("force_hex_style_colors", true);
+ this.defParam("trim_span_elements", true);
+ this.defParam("convert_fonts_to_spans", false);
+ this.defParam("doctype", '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');
+ this.defParam("font_size_classes", '');
+ this.defParam("font_size_style_values", 'xx-small,x-small,small,medium,large,x-large,xx-large');
+ this.defParam("event_elements", 'a,img');
// Browser check IE
if (this.isMSIE && this.settings['browsers'].indexOf('msie') == -1)
@@ -143,6 +163,10 @@ TinyMCE.prototype.init = function(settings) {
if (this.isSafari && this.settings['browsers'].indexOf('safari') == -1)
return;
+ // Browser check Opera
+ if (this.isOpera && this.settings['browsers'].indexOf('opera') == -1)
+ return;
+
// Setup baseHREF
var baseHREF = tinyMCE.settings['document_base_url'];
if (baseHREF.indexOf('?') != -1)
@@ -150,9 +174,9 @@ TinyMCE.prototype.init = function(settings) {
this.settings['base_href'] = baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/";
theme = this.settings['theme'];
-
- this.blockRegExp = new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td)$", "i");
+ this.blockRegExp = new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|blockquote|center|dl|dir|fieldset|form|noscript|noframes|menu|isindex)$", "i");
this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40);
+ this.uniqueURL = 'http://tinymce.moxiecode.cp/mce_temp_url';
// Theme url
this.settings['theme_href'] = tinyMCE.baseURL + "/themes/" + theme;
@@ -212,7 +236,7 @@ TinyMCE.prototype.init = function(settings) {
if (this.configs.length == 0) {
// Is Safari enabled
if (this.isSafari && this.getParam('safari_warning', true))
- alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.");
+ alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.\nYou can disable this message by setting: safari_warning option to false");
tinyMCE.addEvent(window, "load", TinyMCE.prototype.onLoad);
@@ -231,7 +255,7 @@ TinyMCE.prototype.init = function(settings) {
this.loadScript(tinyMCE.baseURL + '/langs/' + this.settings['language'] + '.js');
this.loadCSS(this.settings['editor_css']);
- // Add theme plugins
+ // Add plugins
var themePlugins = tinyMCE.getParam('plugins', '', true, ',');
if (this.settings['plugins'] != '') {
for (var i=0; i<themePlugins.length; i++)
@@ -269,17 +293,16 @@ TinyMCE.prototype.importCSS = function(doc, css_file) {
if (css_file == '')
return;
- if (tinyMCE.isMSIE)
- var styleSheet = doc.createStyleSheet(css_file);
- else {
+ if (typeof(doc.createStyleSheet) == "undefined") {
var elm = doc.createElement("link");
elm.rel = "stylesheet";
elm.href = css_file;
- if (headArr = doc.getElementsByTagName("head"))
+ if ((headArr = doc.getElementsByTagName("head")) != null && headArr.length > 0)
headArr[0].appendChild(elm);
- }
+ } else
+ var styleSheet = doc.createStyleSheet(css_file);
};
TinyMCE.prototype.confirmAdd = function(e, settings) {
@@ -299,6 +322,8 @@ TinyMCE.prototype.updateContent = function(form_element_name) {
var formElement = document.getElementById(form_element_name);
for (var n in tinyMCE.instances) {
var inst = tinyMCE.instances[n];
+ if (!tinyMCE.isInstance(inst))
+ continue;
inst.switchSettings();
@@ -327,6 +352,8 @@ TinyMCE.prototype.triggerSave = function(skip_cleanup, skip_callback) {
// Cleanup and set all form fields
for (var n in tinyMCE.instances) {
var inst = tinyMCE.instances[n];
+ if (!tinyMCE.isInstance(inst))
+ continue;
inst.switchSettings();
@@ -345,7 +372,7 @@ TinyMCE.prototype.triggerSave = function(skip_cleanup, skip_callback) {
// Remove visual aids when cleanup is disabled
if (inst.settings['cleanup'] == false) {
tinyMCE.handleVisualAid(inst.getBody(), true, false, inst);
- tinyMCE._setEventsEnabled(inst.getBody(), false);
+ tinyMCE._setEventsEnabled(inst.getBody(), true);
}
tinyMCE._customCleanup(inst, "submit_content_dom", inst.contentWindow.document.body);
@@ -379,21 +406,24 @@ TinyMCE.prototype._setEventsEnabled = function(node, state) {
'onmousedown','onmouseup','onmouseover','onmousemove',
'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup');
- var elms = node.getElementsByTagName("a");
- for (var i=0; i<elms.length; i++) {
- var event = "";
+ var evs = tinyMCE.settings['event_elements'].split(',');
+ for (var y=0; y<evs.length; y++){
+ var elms = node.getElementsByTagName(evs[y]);
+ for (var i=0; i<elms.length; i++) {
+ var event = "";
- for (var x=0; x<events.length; x++) {
- if ((event = tinyMCE.getAttrib(elms[i], events[x])) != '') {
- event = tinyMCE.cleanupEventStr("" + event);
+ for (var x=0; x<events.length; x++) {
+ if ((event = tinyMCE.getAttrib(elms[i], events[x])) != '') {
+ event = tinyMCE.cleanupEventStr("" + event);
- if (state)
- event = "return true;" + event;
- else
- event = event.replace(/^return true;/gi, '');
+ if (!state)
+ event = "return true;" + event;
+ else
+ event = event.replace(/^return true;/gi, '');
- elms[i].removeAttribute(events[x]);
- elms[i].setAttribute(events[x], event);
+ elms[i].removeAttribute(events[x]);
+ elms[i].setAttribute(events[x], event);
+ }
}
}
}
@@ -404,6 +434,8 @@ TinyMCE.prototype.resetForm = function(form_index) {
for (var n in tinyMCE.instances) {
var inst = tinyMCE.instances[n];
+ if (!tinyMCE.isInstance(inst))
+ continue;
inst.switchSettings();
@@ -415,7 +447,7 @@ TinyMCE.prototype.resetForm = function(form_index) {
}
}
};
-
+var asdf = 0;
TinyMCE.prototype.execInstanceCommand = function(editor_id, command, user_interface, value, focus) {
var inst = tinyMCE.getInstanceById(editor_id);
if (inst) {
@@ -427,10 +459,14 @@ TinyMCE.prototype.execInstanceCommand = function(editor_id, command, user_interf
// Reset design mode if lost
inst.autoResetDesignMode();
-
+asdf = asdf + 1; if ( asdf == 1 ) alert ( 'asdf = 1' );
this.selectedElement = inst.getFocusElement();
this.selectedInstance = inst;
tinyMCE.execCommand(command, user_interface, value);
+
+ // Cancel event so it doesn't call onbeforeonunlaod
+ if (tinyMCE.isMSIE && window.event != null)
+ tinyMCE.cancelEvent(window.event);
}
};
@@ -481,6 +517,9 @@ TinyMCE.prototype.execCommand = function(command, user_interface, value) {
// Resets the designmode state of the editors in Gecko
if (!tinyMCE.isMSIE) {
for (var n in tinyMCE.instances) {
+ if (!tinyMCE.isInstance(tinyMCE.instances[n]))
+ continue;
+
try {
tinyMCE.instances[n].getDoc().designMode = "on";
} catch (e) {
@@ -492,9 +531,9 @@ TinyMCE.prototype.execCommand = function(command, user_interface, value) {
return;
}
- if (this.selectedInstance)
+ if (this.selectedInstance) {
this.selectedInstance.execCommand(command, user_interface, value);
- else if (tinyMCE.settings['focus_alert'])
+ } else if (tinyMCE.settings['focus_alert'])
alert(tinyMCELang['lang_focus_alert']);
};
@@ -504,13 +543,18 @@ TinyMCE.prototype.eventPatch = function(editor_id) {
return true;
for (var i=0; i<document.frames.length; i++) {
- if (document.frames[i].event) {
- var event = document.frames[i].event;
+ try {
+ if (document.frames[i].event) {
+ var event = document.frames[i].event;
- event.target = event.srcElement;
+ if (!event.target)
+ event.target = event.srcElement;
- TinyMCE.prototype.handleEvent(event);
- return;
+ TinyMCE.prototype.handleEvent(event);
+ return;
+ }
+ } catch (ex) {
+ // Ignore error if iframe is pointing to external URL
}
}
};
@@ -551,6 +595,22 @@ TinyMCE.prototype.addEventHandlers = function(editor_id) {
TinyMCE.prototype._createIFrame = function(replace_element) {
var iframe = document.createElement("iframe");
var id = replace_element.getAttribute("id");
+ var aw, ah;
+
+ aw = "" + tinyMCE.settings['area_width'];
+ ah = "" + tinyMCE.settings['area_height'];
+
+ if (aw.indexOf('%') == -1) {
+ aw = parseInt(aw);
+ aw = aw < 0 ? 300 : aw;
+ aw = aw + "px";
+ }
+
+ if (ah.indexOf('%') == -1) {
+ ah = parseInt(ah);
+ ah = ah < 0 ? 240 : ah;
+ ah = ah + "px";
+ }
iframe.setAttribute("id", id);
//iframe.setAttribute("className", "mceEditorArea");
@@ -560,22 +620,22 @@ TinyMCE.prototype._createIFrame = function(replace_element) {
iframe.setAttribute("marginHeight", "0");
iframe.setAttribute("leftMargin", "0");
iframe.setAttribute("topMargin", "0");
- iframe.setAttribute("width", tinyMCE.settings['area_width']);
- iframe.setAttribute("height", tinyMCE.settings['area_height']);
+ iframe.setAttribute("width", aw);
+ iframe.setAttribute("height", ah);
iframe.setAttribute("allowtransparency", "true");
if (tinyMCE.settings["auto_resize"])
iframe.setAttribute("scrolling", "no");
// Must have a src element in MSIE HTTPs breaks aswell as absoute URLs
- if (tinyMCE.isMSIE)
+ if (tinyMCE.isMSIE && !tinyMCE.isOpera)
iframe.setAttribute("src", this.settings['default_document']);
- iframe.style.width = tinyMCE.settings['area_width'];
- iframe.style.height = tinyMCE.settings['area_height'];
+ iframe.style.width = aw;
+ iframe.style.height = ah;
// MSIE 5.0 issue
- if (tinyMCE.isMSIE)
+ if (tinyMCE.isMSIE && !tinyMCE.isOpera)
replace_element.outerHTML = iframe.outerHTML;
else
replace_element.parentNode.replaceChild(iframe, replace_element);
@@ -592,12 +652,15 @@ TinyMCE.prototype.setupContent = function(editor_id) {
var head = doc.getElementsByTagName('head').item(0);
var content = inst.startContent;
+ tinyMCE.operaOpacityCounter = 100 * tinyMCE.idCounter;
+
inst.switchSettings();
// Not loaded correctly hit it again, Mozilla bug #997860
if (!tinyMCE.isMSIE && doc.title != "blank_page") {
// This part will remove the designMode status
- doc.location.href = tinyMCE.baseURL + "/blank.htm";
+ // Failes first time in Firefox 1.5b2 on Mac
+ try {doc.location.href = tinyMCE.baseURL + "/blank.htm";} catch (ex) {}
window.setTimeout("tinyMCE.setupContent('" + editor_id + "');", 1000);
return;
}
@@ -612,6 +675,10 @@ TinyMCE.prototype.setupContent = function(editor_id) {
tinyMCE.importCSS(inst.getDoc(), inst.settings['content_css']);
tinyMCE.executeCallback('init_instance_callback', '_initInstance', 0, inst);
+ // Setup span styles
+ if (tinyMCE.getParam("convert_fonts_to_spans"))
+ inst.getDoc().body.setAttribute('id', 'mceSpanFonts');
+
if (tinyMCE.settings['nowrap'])
doc.body.style.whiteSpace = "nowrap";
@@ -623,7 +690,7 @@ TinyMCE.prototype.setupContent = function(editor_id) {
doc.documentElement.editorId = editor_id;
// Setup base element
- base = doc.createElement("base");
+ var base = doc.createElement("base");
base.setAttribute('href', tinyMCE.settings['base_href']);
head.appendChild(base);
@@ -634,6 +701,9 @@ TinyMCE.prototype.setupContent = function(editor_id) {
content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi");
}
+ // Open closed anchors
+// content = content.replace(new RegExp('<a(.*?)/>', 'gi'), '<a$1></a>');
+
// Call custom cleanup code
content = tinyMCE._customCleanup(inst, "insert_to_editor", content);
@@ -652,6 +722,8 @@ TinyMCE.prototype.setupContent = function(editor_id) {
body.editorId = editor_id;
}
+ content = tinyMCE.cleanupHTMLCode(content);
+
// Fix for bug #958637
if (!tinyMCE.isMSIE) {
var contentElement = inst.getDoc().createElement("body");
@@ -660,11 +732,11 @@ TinyMCE.prototype.setupContent = function(editor_id) {
contentElement.innerHTML = content;
// Remove weridness!
- if (tinyMCE.settings['force_p_newlines'])
+ if (tinyMCE.isGecko && tinyMCE.settings['remove_lt_gt'])
content = content.replace(new RegExp('&lt;&gt;', 'g'), "");
if (tinyMCE.settings['cleanup_on_startup'])
- inst.getBody().innerHTML = tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement);
+ tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement));
else {
// Convert all strong/em to b/i
content = tinyMCE.regexpReplace(content, "<strong", "<b", "gi");
@@ -672,7 +744,7 @@ TinyMCE.prototype.setupContent = function(editor_id) {
content = tinyMCE.regexpReplace(content, "<em ", "<i ", "gi");
content = tinyMCE.regexpReplace(content, "</strong>", "</b>", "gi");
content = tinyMCE.regexpReplace(content, "</em>", "</i>", "gi");
- inst.getBody().innerHTML = content;
+ tinyMCE.setInnerHTML(inst.getBody(), content);
}
inst.convertAllRelativeURLs();
@@ -681,7 +753,7 @@ TinyMCE.prototype.setupContent = function(editor_id) {
tinyMCE._setHTML(inst.getDoc(), content);
// Produces permission denied error in MSIE 5.5
- eval('try {inst.getBody().innerHTML = tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody());} catch(e) {}');
+ eval('try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody());} catch(e) {}');
} else
tinyMCE._setHTML(inst.getDoc(), content);
}
@@ -715,10 +787,32 @@ TinyMCE.prototype.setupContent = function(editor_id) {
// Call custom DOM cleanup
tinyMCE._customCleanup(inst, "insert_to_editor_dom", inst.getBody());
tinyMCE._customCleanup(inst, "setup_content_dom", inst.getBody());
- tinyMCE._setEventsEnabled(inst.getBody(), true);
+ tinyMCE._setEventsEnabled(inst.getBody(), false);
+ tinyMCE.cleanupAnchors(inst.getDoc());
+
+ if (tinyMCE.getParam("convert_fonts_to_spans"))
+ tinyMCE.convertSpansToFonts(inst.getDoc());
inst.startContent = tinyMCE.trim(inst.getBody().innerHTML);
inst.undoLevels[inst.undoLevels.length] = inst.startContent;
+
+ tinyMCE.operaOpacityCounter = -1;
+};
+
+TinyMCE.prototype.cleanupHTMLCode = function(s) {
+ s = s.replace(/<p \/>/gi, '<p>&nbsp;</p>');
+ s = s.replace(/<p>\s*<\/p>/gi, '<p>&nbsp;</p>');
+ s = s.replace(/<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([^\\|>]*?)\/>/gi, '<$1$2></$1>');
+ s = s.replace(new RegExp('\\s+></', 'gi'), '></');
+
+ // Weird MSIE bug, <p><hr /></p> breaks runtime?
+ if (tinyMCE.isMSIE)
+ s = s.replace(/<p><hr \/><\/p>/gi, "<hr>");
+
+ // Convert relative anchors to absolute URLs ex: #something to file.htm#something
+ s = s.replace(new RegExp('(href=\"?)(\\s*?#)', 'gi'), '$1' + tinyMCE.settings['document_base_url'] + "#");
+
+ return s;
};
TinyMCE.prototype.cancelEvent = function(e) {
@@ -751,7 +845,7 @@ TinyMCE.prototype.accessibleEventHandler = function(e) {
}
// Execute onchange and remove piggyback
- if (e.keyCode == 13) {
+ if (e.keyCode == 13 || e.keyCode == 32) {
elm.onchange = elm.oldonchange;
elm.onchange();
elm.oldonchange = null;
@@ -824,7 +918,7 @@ TinyMCE.prototype.handleEvent = function(e) {
if (tinyMCE.selectedInstance._insertPara(e)) {
// Cancel event
tinyMCE.execCommand("mceAddUndoLevel");
- e.preventDefault();
+ tinyMCE.cancelEvent(e);
return false;
}
}
@@ -841,7 +935,7 @@ TinyMCE.prototype.handleEvent = function(e) {
}
// Mozilla custom key handling
- if (tinyMCE.isGecko && e.ctrlKey && tinyMCE.settings['custom_undo_redo']) {
+ if (tinyMCE.isGecko && (e.ctrlKey && !e.altKey) && tinyMCE.settings['custom_undo_redo']) {
if (tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']) {
if (e.charCode == 122) { // Ctrl+Z
tinyMCE.selectedInstance.execCommand("Undo");
@@ -991,8 +1085,6 @@ TinyMCE.prototype.handleEvent = function(e) {
}
}
- //tinyMCE.debug(e.keyCode);
-
// MSIE custom key handling
if (tinyMCE.isMSIE && tinyMCE.settings['custom_undo_redo']) {
var keys = new Array(8,46); // Backspace,Delete
@@ -1004,17 +1096,17 @@ TinyMCE.prototype.handleEvent = function(e) {
}
if (tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']) {
- if (e.keyCode == 90 && e.ctrlKey && e.type == "keydown") { // Ctrl+Z
+ if (e.keyCode == 90 && (e.ctrlKey && !e.altKey) && e.type == "keydown") { // Ctrl+Z
tinyMCE.selectedInstance.execCommand("Undo");
tinyMCE.triggerNodeChange(false);
}
- if (e.keyCode == 89 && e.ctrlKey && e.type == "keydown") { // Ctrl+Y
+ if (e.keyCode == 89 && (e.ctrlKey && !e.altKey) && e.type == "keydown") { // Ctrl+Y
tinyMCE.selectedInstance.execCommand("Redo");
tinyMCE.triggerNodeChange(false);
}
- if ((e.keyCode == 90 || e.keyCode == 89) && e.ctrlKey) {
+ if ((e.keyCode == 90 || e.keyCode == 89) && (e.ctrlKey && !e.altKey)) {
// Cancel event
e.returnValue = false;
e.cancelBubble = true;
@@ -1035,6 +1127,9 @@ TinyMCE.prototype.handleEvent = function(e) {
if (posKey && e.type == "keyup")
tinyMCE.triggerNodeChange(false);
+
+ if (tinyMCE.isMSIE && e.ctrlKey)
+ window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
break;
case "mousedown":
@@ -1047,6 +1142,9 @@ TinyMCE.prototype.handleEvent = function(e) {
// Check instance event trigged on
var targetBody = tinyMCE.getParentElement(e.target, "body");
for (var instanceName in tinyMCE.instances) {
+ if (!tinyMCE.isInstance(tinyMCE.instances[instanceName]))
+ continue;
+
var inst = tinyMCE.instances[instanceName];
// Reset design mode if lost (on everything just in case)
@@ -1144,6 +1242,28 @@ TinyMCE.prototype.switchClassSticky = function(element_name, class_name, lock_st
if (element != null && (lockChanged || !element.classLock)) {
element.className = class_name;
element.oldClassName = class_name;
+
+ // Fix opacity in Opera
+ if (tinyMCE.isOpera) {
+ if (class_name == "mceButtonDisabled") {
+ var suffix = "";
+
+ if (!element.mceOldSrc)
+ element.mceOldSrc = element.src;
+
+ if (this.operaOpacityCounter > -1)
+ suffix = '?rnd=' + this.operaOpacityCounter++;
+
+ element.src = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/images/opacity.png" + suffix;
+ element.style.backgroundImage = "url('" + element.mceOldSrc + "')";
+ } else {
+ if (element.mceOldSrc) {
+ element.src = element.mceOldSrc;
+ element.parentNode.style.backgroundImage = "";
+ element.mceOldSrc = null;
+ }
+ }
+ }
}
};
@@ -1169,7 +1289,7 @@ TinyMCE.prototype.addEvent = function(obj, name, handler) {
TinyMCE.prototype.submitPatch = function() {
tinyMCE.removeTinyMCEFormElements(this);
tinyMCE.triggerSave();
- this.oldSubmit();
+ this.mceOldSubmit();
tinyMCE.isNotDirty = true;
};
@@ -1193,7 +1313,7 @@ TinyMCE.prototype.onLoad = function() {
// Patch the form.submit function
if (tinyMCE.settings['submit_patch']) {
try {
- form.oldSubmit = form.submit;
+ form.mceOldSubmit = form.submit;
form.submit = TinyMCE.prototype.submitPatch;
} catch (e) {
// Do nothing
@@ -1295,6 +1415,9 @@ TinyMCE.prototype.removeMCEControl = function(editor_id) {
var tmpInstances = new Array();
for (var instanceName in tinyMCE.instances) {
var instance = tinyMCE.instances[instanceName];
+ if (!tinyMCE.isInstance(instance))
+ continue;
+
if (instanceName != editor_id)
tmpInstances[instanceName] = instance;
}
@@ -1522,10 +1645,6 @@ TinyMCE.prototype._cleanupAttribute = function(valid_attributes, element_name, a
return null;
}
- // Auto verify
- if (attribName == "mce_onclick")
- verified = true;
-
// Verify attrib
if (tinyMCE.cleanup_verify_html && !verified) {
for (var i=1; i<valid_attributes.length; i++) {
@@ -1568,12 +1687,30 @@ TinyMCE.prototype._cleanupAttribute = function(valid_attributes, element_name, a
attribValue = eval("element_node." + attribName);
break;
+ case "shape":
+ attribValue = attribValue.toLowerCase();
+ break;
+
+ case "cellspacing":
+ if (tinyMCE.isMSIE5)
+ attribValue = element_node.cellSpacing;
+ break;
+
+ case "cellpadding":
+ if (tinyMCE.isMSIE5)
+ attribValue = element_node.cellPadding;
+ break;
+
case "color":
if (tinyMCE.isMSIE5 && element_name == "font")
attribValue = element_node.color;
break;
case "class":
+ // Remove mceItem classes from anchors
+ if (tinyMCE.cleanup_on_save && attribValue.indexOf('mceItemAnchor') != -1)
+ attribValue = attribValue.replace(/mceItem[a-z0-9]+/gi, '');
+
if (element_name == "table" || element_name == "td") {
// Handle visual aid
if (tinyMCE.cleanup_visual_table_class != "")
@@ -1606,12 +1743,16 @@ TinyMCE.prototype._cleanupAttribute = function(valid_attributes, element_name, a
break;
case "style":
- attribValue = tinyMCE.serializeStyle(tinyMCE.parseStyle(element_node.style.cssText));
+ attribValue = tinyMCE.serializeStyle(tinyMCE.parseStyle(tinyMCE.getAttrib(element_node, "style")));
break;
// Convert the URLs of these
case "href":
case "src":
+ // Gecko 1.8 issue
+ if (tinyMCE.isGecko18 && attribName == "src")
+ attribValue = element_node.src;
+
// Fix for dragdrop/copy paste Mozilla issue
if (!tinyMCE.isMSIE && attribName == "href" && element_node.getAttribute("mce_real_href"))
attribValue = element_node.getAttribute("mce_real_href");
@@ -1621,7 +1762,7 @@ TinyMCE.prototype._cleanupAttribute = function(valid_attributes, element_name, a
attribValue = element_node.getAttribute("mce_real_src");
// Force absolute URLs in Firefox
- if (tinyMCE.isGecko && !tinyMCE.settings['relative_urls'])
+ if (tinyMCE.isGecko && !tinyMCE.getParam('relative_urls'))
attribValue = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], attribValue);
attribValue = eval(tinyMCE.cleanup_urlconverter_callback + "(attribValue, element_node, tinyMCE.cleanup_on_save);");
@@ -1664,10 +1805,28 @@ TinyMCE.prototype._cleanupAttribute = function(valid_attributes, element_name, a
return attrib;
};
+TinyMCE.prototype.clearArray = function(ar) {
+ // Since stupid people tend to extend core objects like
+ // Array with their own crap I needed to make functions that clean away
+ // this junk so the arrays get clean and nice as they should be
+ for (var key in ar)
+ ar[key] = null;
+};
+
+TinyMCE.prototype.isInstance = function(inst) {
+ return inst != null && typeof(inst) == "object" && inst.isTinyMCEControl;
+};
+
TinyMCE.prototype.parseStyle = function(str) {
var ar = new Array();
+
+ if (str == null)
+ return ar;
+
var st = str.split(';');
+ tinyMCE.clearArray(ar);
+
for (var i=0; i<st.length; i++) {
if (st[i] == '')
continue;
@@ -1718,6 +1877,8 @@ TinyMCE.prototype.serializeStyle = function(ar) {
for (var key in ar) {
var val = ar[key];
+ if (typeof(val) == 'function')
+ continue;
if (val != null && val != '') {
val = '' + val; // Force string
@@ -1725,6 +1886,10 @@ TinyMCE.prototype.serializeStyle = function(ar) {
// Fix style URL
val = val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)", 'gi'), "url('$1')");
+ // Force HEX colors
+ if (tinyMCE.getParam("force_hex_style_colors"))
+ val = tinyMCE.convertRGBToHex(val);
+
if (val != "url('')")
str += key.toLowerCase() + ": " + val + "; ";
}
@@ -1736,6 +1901,26 @@ TinyMCE.prototype.serializeStyle = function(ar) {
return str;
};
+TinyMCE.prototype.convertRGBToHex = function(s) {
+ if (s.toLowerCase().indexOf('rgb') != -1) {
+ var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
+ var rgb = s.replace(re, "$1,$2,$3").split(',');
+ if (rgb.length == 3) {
+ r = parseInt(rgb[0]).toString(16);
+ g = parseInt(rgb[1]).toString(16);
+ b = parseInt(rgb[2]).toString(16);
+
+ r = r.length == 1 ? '0' + r : r;
+ g = g.length == 1 ? '0' + g : g;
+ b = b.length == 1 ? '0' + b : b;
+
+ s = "#" + r + g + b;
+ }
+ }
+
+ return s;
+};
+
TinyMCE.prototype._verifyClass = function(node) {
// Sometimes the class gets set to null, weird Gecko bug?
if (tinyMCE.isGecko) {
@@ -1814,8 +1999,36 @@ TinyMCE.prototype.cleanupNode = function(node) {
}
if (tinyMCE.cleanup_on_save) {
- if (node.nodeName == "A" && node.className == "mceItemAnchor")
- return '<a name="' + this.convertStringToXML(node.getAttribute("name")) + '"></a>';
+ if (node.nodeName == "A" && node.className == "mceItemAnchor") {
+ if (node.hasChildNodes()) {
+ for (var i=0; i<node.childNodes.length; i++)
+ output += this.cleanupNode(node.childNodes[i]);
+ }
+
+ return '<a name="' + this.convertStringToXML(node.getAttribute("name")) + '"></a>' + output;
+ }
+ }
+
+ // Remove deprecated attributes
+ var re = new RegExp("^(TABLE|TD|TR)$");
+ if (re.test(node.nodeName)) {
+ // Move attrib to style
+ if ((node.nodeName != "TABLE" || tinyMCE.cleanup_inline_styles) && (width = tinyMCE.getAttrib(node, "width")) != '') {
+ node.style.width = width.indexOf('%') != -1 ? width : width.replace(/[^0-9]/gi, '') + "px";
+ node.removeAttribute("width");
+ }
+
+ // Is table and not inline
+ if ((node.nodeName == "TABLE" && !tinyMCE.cleanup_inline_styles) && node.style.width != '') {
+ tinyMCE.setAttrib(node, "width", node.style.width.replace('px',''));
+ node.style.width = '';
+ }
+
+ // Move attrib to style
+ if ((height = tinyMCE.getAttrib(node, "height")) != '') {
+ node.style.height = height.indexOf('%') != -1 ? height : height.replace(/[^0-9]/gi, '') + "px";
+ node.removeAttribute("height");
+ }
}
// Handle inline/outline styles
@@ -1873,15 +2086,28 @@ TinyMCE.prototype.cleanupNode = function(node) {
}
}
+ if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && elementName == "style")
+ return "<style>" + node.innerHTML + "</style>";
+
// Remove empty tables
if (elementName == "table" && !node.hasChildNodes())
return "";
// Handle element attributes
if (node.attributes.length > 0) {
+ var lastAttrib = "";
+
for (var i=0; i<node.attributes.length; i++) {
if (node.attributes[i].specified) {
- // tinyMCE.debug(node.attributes[i].nodeName + "=" + node.attributes[i].nodeValue);
+ // Is the attrib already processed (removed duplicate attributes in opera TD[align=left])
+ if (tinyMCE.isOpera) {
+ if (node.attributes[i].nodeName == lastAttrib)
+ continue;
+
+ lastAttrib = node.attributes[i].nodeName;
+ }
+
+ // tinyMCE.debug(node.nodeName, node.attributes[i].nodeName, node.attributes[i].nodeValue, node.innerHTML);
var attrib = tinyMCE._cleanupAttribute(elementValidAttribs, elementName, node.attributes[i], node);
if (attrib && attrib.value != "")
elementAttribs += " " + attrib.name + "=" + '"' + this.convertStringToXML("" + attrib.value) + '"';
@@ -1889,9 +2115,25 @@ TinyMCE.prototype.cleanupNode = function(node) {
}
}
- // MSIE table summary fix
+ // MSIE table summary fix (MSIE 5.5)
if (tinyMCE.isMSIE && elementName == "table" && node.getAttribute("summary") != null && elementAttribs.indexOf('summary') == -1) {
- elementAttribs += " summary=" + '"' + this.convertStringToXML("" + node.getAttribute("summary")) + '"';
+ var summary = tinyMCE.getAttrib(node, 'summary');
+ if (summary != '')
+ elementAttribs += " summary=" + '"' + this.convertStringToXML(summary) + '"';
+ }
+
+ // Handle missing attributes in MSIE 5.5
+ if (tinyMCE.isMSIE5 && /^(td|img|a)$/.test(elementName)) {
+ var ma = new Array("scope", "longdesc", "hreflang", "charset", "type");
+
+ for (var u=0; u<ma.length; u++) {
+ if (node.getAttribute(ma[u]) != null) {
+ var s = tinyMCE.getAttrib(node, ma[u]);
+
+ if (s != '')
+ elementAttribs += " " + ma[u] + "=" + '"' + this.convertStringToXML(s) + '"';
+ }
+ }
}
// MSIE form element issue
@@ -1917,20 +2159,26 @@ TinyMCE.prototype.cleanupNode = function(node) {
// Clean up children
if (node.hasChildNodes()) {
- // Force BR
- if (elementName == "p" && tinyMCE.cleanup_force_br_newlines)
- output += "<div" + elementAttribs + ">";
- else
- output += "<" + elementName + elementAttribs + ">";
+ // If not empty span
+ if (!(elementName == "span" && elementAttribs == "" && tinyMCE.getParam("trim_span_elements"))) {
+ // Force BR
+ if (elementName == "p" && tinyMCE.cleanup_force_br_newlines)
+ output += "<div" + elementAttribs + ">";
+ else
+ output += "<" + elementName + elementAttribs + ">";
+ }
for (var i=0; i<node.childNodes.length; i++)
output += this.cleanupNode(node.childNodes[i]);
- // Force BR
- if (elementName == "p" && tinyMCE.cleanup_force_br_newlines)
- output += "</div><br />";
- else
- output += "</" + elementName + ">";
+ // If not empty span
+ if (!(elementName == "span" && elementAttribs == "" && tinyMCE.getParam("trim_span_elements"))) {
+ // Force BR
+ if (elementName == "p" && tinyMCE.cleanup_force_br_newlines)
+ output += "</div><br />";
+ else
+ output += "</" + elementName + ">";
+ }
} else {
if (!nonEmptyTag) {
if (openTag)
@@ -1944,7 +2192,7 @@ TinyMCE.prototype.cleanupNode = function(node) {
case 3: // Text
// Do not convert script elements
- if (node.parentNode.nodeName.toLowerCase() == "script")
+ if (node.parentNode.nodeName == "SCRIPT" || node.parentNode.nodeName == "STYLE")
return node.nodeValue;
return this.convertStringToXML(node.nodeValue);
@@ -2096,6 +2344,9 @@ TinyMCE.prototype._cleanupHTML = function(inst, doc, config, element, visual, on
if (!tinyMCE.settings['cleanup'])
return element.innerHTML;
+ if (on_save && tinyMCE.getParam("convert_fonts_to_spans"))
+ tinyMCE.convertFontsToSpans(doc);
+
// Call custom cleanup code
tinyMCE._customCleanup(inst, on_save ? "get_from_editor_dom" : "insert_to_editor_dom", doc.body);
@@ -2126,8 +2377,8 @@ TinyMCE.prototype._cleanupHTML = function(inst, doc, config, element, visual, on
nodes[i].removeAttribute("id");
}
- element.innerHTML = tinyMCE.regexpReplace(element.innerHTML, '<p>[ \n\r]*<hr.*>[ \n\r]*</p>', '<hr />', 'gi');
- element.innerHTML = tinyMCE.regexpReplace(element.innerHTML, '<!([^-(DOCTYPE)]* )|<!/[^-]*>', '', 'gi');
+ tinyMCE.setInnerHTML(element, tinyMCE.regexpReplace(element.innerHTML, '<p>[ \n\r]*<hr.*>[ \n\r]*</p>', '<hr />', 'gi'));
+ tinyMCE.setInnerHTML(element, tinyMCE.regexpReplace(element.innerHTML, '<!([^-(DOCTYPE)]* )|<!/[^-]*>', '', 'gi'));
}
var html = this.cleanupNode(element);
@@ -2135,19 +2386,26 @@ TinyMCE.prototype._cleanupHTML = function(inst, doc, config, element, visual, on
if (tinyMCE.settings['debug'])
tinyMCE.debug("Cleanup process executed in: " + (new Date().getTime()-startTime) + " ms.");
- // Remove pesky HR paragraphs
+ // Remove pesky HR paragraphs and other crap
html = tinyMCE.regexpReplace(html, '<p><hr /></p>', '<hr />');
html = tinyMCE.regexpReplace(html, '<p>&nbsp;</p><hr /><p>&nbsp;</p>', '<hr />');
html = tinyMCE.regexpReplace(html, '<td>\\s*<br />\\s*</td>', '<td>&nbsp;</td>');
+ html = tinyMCE.regexpReplace(html, '<p>\\s*<br />\\s*</p>', '<p>&nbsp;</p>');
+ html = tinyMCE.regexpReplace(html, '<p>\\s*&nbsp;\\s*<br />\\s*&nbsp;\\s*</p>', '<p>&nbsp;</p>');
+ html = tinyMCE.regexpReplace(html, '<p>\\s*&nbsp;\\s*<br />\\s*</p>', '<p>&nbsp;</p>');
+ html = tinyMCE.regexpReplace(html, '<p>\\s*<br />\\s*&nbsp;\\s*</p>', '<p>&nbsp;</p>');
- // Remove empty achors
+ // Remove empty anchors
html = html.replace(new RegExp('<a>(.*?)</a>', 'gi'), '$1');
// Remove some mozilla crap
if (!tinyMCE.isMSIE)
html = html.replace(new RegExp('<o:p _moz-userdefined="" />', 'g'), "");
- if (tinyMCE.settings['apply_source_formatting']) {
+ if (tinyMCE.settings['remove_linebreaks'])
+ html = html.replace(new RegExp('\r|\n', 'g'), ' ');
+
+ if (tinyMCE.getParam('apply_source_formatting')) {
html = html.replace(new RegExp('<(p|div)([^>]*)>', 'g'), "\n<$1$2>\n");
html = html.replace(new RegExp('<\/(p|div)([^>]*)>', 'g'), "\n</$1$2>\n");
html = html.replace(new RegExp('<br />', 'g'), "<br />\n");
@@ -2158,15 +2416,12 @@ TinyMCE.prototype._cleanupHTML = function(inst, doc, config, element, visual, on
html = html.replace(re, "<br />");
}
- if (tinyMCE.settings['force_p_newlines']) {
+ if (tinyMCE.isGecko && tinyMCE.settings['remove_lt_gt']) {
// Remove weridness!
var re = new RegExp('&lt;&gt;', 'g');
html = html.replace(re, "");
}
- if (tinyMCE.settings['remove_linebreaks'])
- html = html.replace(new RegExp('\r|\n', 'g'), ' ');
-
// Call custom cleanup code
html = tinyMCE._customCleanup(inst, on_save ? "get_from_editor" : "insert_to_editor", html);
@@ -2211,13 +2466,13 @@ TinyMCE.prototype.insertLink = function(href, target, title, onclick, style_clas
if (!this.linkElement && this.selectedInstance) {
if (tinyMCE.isSafari) {
- tinyMCE.execCommand("mceInsertContent", false, '<a href="#mce_temp_url#">' + this.selectedInstance.getSelectedHTML() + '</a>');
+ tinyMCE.execCommand("mceInsertContent", false, '<a href="' + tinyMCE.uniqueURL + '">' + this.selectedInstance.getSelectedHTML() + '</a>');
} else
- this.selectedInstance.contentDocument.execCommand("createlink", false, "#mce_temp_url#");
+ this.selectedInstance.contentDocument.execCommand("createlink", false, tinyMCE.uniqueURL);
- tinyMCE.linkElement = this.getElementByAttributeValue(this.selectedInstance.contentDocument.body, "a", "href", "#mce_temp_url#");
+ tinyMCE.linkElement = this.getElementByAttributeValue(this.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL);
- var elementArray = this.getElementsByAttributeValue(this.selectedInstance.contentDocument.body, "a", "href", "#mce_temp_url#");
+ var elementArray = this.getElementsByAttributeValue(this.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL);
for (var i=0; i<elementArray.length; i++) {
href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, elementArray[i]);");
@@ -2263,11 +2518,11 @@ TinyMCE.prototype.insertImage = function(src, alt, border, hspace, vspace, width
} else {
if (!this.imgElement && this.selectedInstance) {
if (tinyMCE.isSafari)
- tinyMCE.execCommand("mceInsertContent", false, '<img src="#mce_temp_url#" />');
+ tinyMCE.execCommand("mceInsertContent", false, '<img src="' + tinyMCE.uniqueURL + '" />');
else
- this.selectedInstance.contentDocument.execCommand("insertimage", false, "#mce_temp_url#");
+ this.selectedInstance.contentDocument.execCommand("insertimage", false, tinyMCE.uniqueURL);
- tinyMCE.imgElement = this.getElementByAttributeValue(this.selectedInstance.contentDocument.body, "img", "src", "#mce_temp_url#");
+ tinyMCE.imgElement = this.getElementByAttributeValue(this.selectedInstance.contentDocument.body, "img", "src", tinyMCE.uniqueURL);
}
}
@@ -2332,7 +2587,7 @@ TinyMCE.prototype.getElementsByAttributeValue = function(node, element_name, att
elements[elements.length] = node;
}
- if (node.hasChildNodes) {
+ if (node && node.hasChildNodes()) {
for (var x=0, n=node.childNodes.length; x<n; x++) {
var childElements = this.getElementsByAttributeValue(node.childNodes[x], element_name, attrib, value);
for (var i=0, m=childElements.length; i<m; i++)
@@ -2401,7 +2656,7 @@ TinyMCE.prototype.getParentElement = function(node, names, attrib_name, attrib_v
}
}
}
- } while (node = node.parentNode);
+ } while ((node = node.parentNode) != null);
return null;
};
@@ -2425,7 +2680,7 @@ TinyMCE.prototype.convertURL = function(url, node, on_save) {
return tinyMCE.settings['base_href'] + url;
// Handle absolute url anchors
- if (!tinyMCE.settings['relative_urls']) {
+ if (!tinyMCE.getParam('relative_urls')) {
var urlParts = tinyMCE.parseURL(url);
var baseUrlParts = tinyMCE.parseURL(tinyMCE.settings['base_href']);
@@ -2435,7 +2690,7 @@ TinyMCE.prototype.convertURL = function(url, node, on_save) {
}
// Convert to relative urls
- if (on_save && tinyMCE.settings['relative_urls']) {
+ if (on_save && tinyMCE.getParam('relative_urls')) {
var urlParts = tinyMCE.parseURL(url);
// If not absolute url, do nothing (Mozilla)
@@ -2458,7 +2713,7 @@ TinyMCE.prototype.convertURL = function(url, node, on_save) {
}
// Remove current domain
- if (!fileProto && tinyMCE.settings['remove_script_host']) {
+ if (!fileProto && tinyMCE.getParam('remove_script_host')) {
var start = "", portPart = "";
if (port != "")
@@ -2470,7 +2725,7 @@ TinyMCE.prototype.convertURL = function(url, node, on_save) {
url = url.substring(start.length-1);
// Add first slash if missing on a absolute URL
- if (!tinyMCE.settings['relative_urls'] && url.indexOf('://') == -1 && url.charAt(0) != '/')
+ if (!tinyMCE.getParam('relative_urls') && url.indexOf('://') == -1 && url.charAt(0) != '/')
url = '/' + url;
}
@@ -2546,19 +2801,51 @@ TinyMCE.prototype.parseURL = function(url_str) {
return urlParts;
};
+TinyMCE.prototype.serializeURL = function(up) {
+ var url = "";
+
+ if (up['protocol'])
+ url += up['protocol'] + "://";
+
+ if (up['host'])
+ url += up['host'];
+
+ if (up['port'])
+ url += ":" + up['port'];
+
+ if (up['path'])
+ url += up['path'];
+
+ if (up['query'])
+ url += "?" + up['query'];
+
+ if (up['anchor'])
+ url += "#" + up['anchor'];
+
+ return url;
+};
+
/**
* Converts an absolute path to relative path.
*/
TinyMCE.prototype.convertAbsoluteURLToRelativeURL = function(base_url, url_to_relative) {
+ var baseURL = this.parseURL(base_url);
+ var targetURL = this.parseURL(url_to_relative);
var strTok1;
var strTok2;
var breakPoint = 0;
- var outputString = "";
+ var outPath = "";
+ var forceSlash = false;
+
+ if (targetURL.path == "")
+ targetURL.path = "/";
+ else
+ forceSlash = true;
// Crop away last path part
- base_url = base_url.substring(0, base_url.lastIndexOf('/'));
+ base_url = baseURL.path.substring(0, baseURL.path.lastIndexOf('/'));
strTok1 = base_url.split('/');
- strTok2 = url_to_relative.split('/');
+ strTok2 = targetURL.path.split('/');
if (strTok1.length >= strTok2.length) {
for (var i=0; i<strTok1.length; i++) {
@@ -2579,26 +2866,31 @@ TinyMCE.prototype.convertAbsoluteURLToRelativeURL = function(base_url, url_to_re
}
if (breakPoint == 1)
- return url_to_relative;
+ return targetURL.path;
for (var i=0; i<(strTok1.length-(breakPoint-1)); i++)
- outputString += "../";
+ outPath += "../";
for (var i=breakPoint-1; i<strTok2.length; i++) {
if (i != (breakPoint-1))
- outputString += "/" + strTok2[i];
+ outPath += "/" + strTok2[i];
else
- outputString += strTok2[i];
+ outPath += strTok2[i];
}
- return outputString;
+ targetURL.protocol = null;
+ targetURL.host = null;
+ targetURL.port = null;
+ targetURL.path = outPath == "" && forceSlash ? "/" : outPath;
+
+ return this.serializeURL(targetURL);
};
TinyMCE.prototype.convertRelativeToAbsoluteURL = function(base_url, relative_url) {
var baseURL = TinyMCE.prototype.parseURL(base_url);
var relURL = TinyMCE.prototype.parseURL(relative_url);
- if (relative_url == "" || relative_url.charAt(0) == '/' || relative_url.indexOf('://') != -1 || relative_url.indexOf('mailto:') != -1 || relative_url.indexOf('javascript:') != -1 || tinyMCE.regexpReplace(relative_url,'[ \t\r\n\+]|%20','').charAt(0) == "#")
+ if (relative_url == "" || relative_url.charAt(0) == '/' || relative_url.indexOf('://') != -1 || relative_url.indexOf('mailto:') != -1 || relative_url.indexOf('javascript:') != -1)
return relative_url;
// Split parts
@@ -2642,28 +2934,18 @@ TinyMCE.prototype.convertRelativeToAbsoluteURL = function(base_url, relative_url
var absPath = (len <= 0 ? "" : "/") + baseURLParts.slice(0, len).join('/') + "/" + relURLParts.join('/');
var start = "", end = "";
- // Build start part
- if (baseURL['protocol'])
- start += baseURL['protocol'] + "://";
-
- if (baseURL['host'])
- start += baseURL['host'];
-
- if (baseURL['port'])
- start += ":" + baseURL['port'];
-
- // Build end part
- if (relURL['query'])
- end += "?" + relURL['query'];
-
- if (relURL['anchor'])
- end += "#" + relURL['anchor'];
+ // Build output URL
+ relURL.protocol = baseURL.protocol;
+ relURL.host = baseURL.host;
+ relURL.port = baseURL.port;
// Re-add trailing slash if it's removed
- if (relative_url.charAt(relative_url.length-1) == "/")
- end += "/";
+ if (relURL.path.charAt(relURL.path.length-1) == "/")
+ absPath += "/";
- return start + absPath + end;
+ relURL.path = absPath;
+
+ return TinyMCE.prototype.serializeURL(relURL);
};
TinyMCE.prototype.getParam = function(name, default_value, strip_whitespace, split_chr) {
@@ -2704,8 +2986,12 @@ TinyMCE.prototype.getLang = function(name, default_value, parse_entities) {
};
TinyMCE.prototype.addToLang = function(prefix, ar) {
- for (var key in ar)
+ for (var key in ar) {
+ if (typeof(ar[key]) == 'function')
+ continue;
+
tinyMCELang[(key.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix != '' ? (prefix + "_") : '') + key] = ar[key];
+ }
// for (var key in ar)
// tinyMCELang[(key.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix != '' ? (prefix + "_") : '') + key] = "|" + ar[key] + "|";
@@ -2719,6 +3005,9 @@ TinyMCE.prototype.replaceVar = function(replace_haystack, replace_var, replace_s
TinyMCE.prototype.replaceVars = function(replace_haystack, replace_vars) {
for (var key in replace_vars) {
var value = replace_vars[key];
+ if (typeof(value) == 'function')
+ continue;
+
replace_haystack = tinyMCE.replaceVar(replace_haystack, key, value);
}
@@ -2751,7 +3040,7 @@ TinyMCE.prototype.triggerNodeChange = function(focus, setup_content) {
undoLevels = inst.undoLevels.length;
}
- tinyMCE.executeCallback('handleNodeChangeCallback', '_handleNodeChange', 0, editorId, elm, undoIndex, undoLevels, inst.visualAid, anySelection);
+ tinyMCE.executeCallback('handleNodeChangeCallback', '_handleNodeChange', 0, editorId, elm, undoIndex, undoLevels, inst.visualAid, anySelection, setup_content);
}
}
@@ -2779,8 +3068,12 @@ TinyMCE.prototype.getContent = function(editor_id) {
if (typeof(editor_id) != "undefined")
tinyMCE.selectedInstance = tinyMCE.getInstanceById(editor_id);
- if (tinyMCE.selectedInstance)
- return tinyMCE._cleanupHTML(this.selectedInstance, this.selectedInstance.getDoc(), tinyMCE.settings, this.selectedInstance.getBody(), false, true);
+ if (tinyMCE.selectedInstance) {
+ var old = this.selectedInstance.getBody().innerHTML;
+ var html = tinyMCE._cleanupHTML(this.selectedInstance, this.selectedInstance.getDoc(), tinyMCE.settings, this.selectedInstance.getBody(), false, true);
+ tinyMCE.setInnerHTML(this.selectedInstance.getBody(), old);
+ return html;
+ }
return null;
};
@@ -2859,8 +3152,12 @@ TinyMCE.prototype.openWindow = function(template, args) {
url = template['file'];
// Replace all args as variables in URL
- for (var name in args)
+ for (var name in args) {
+ if (typeof(args[name]) == 'function')
+ continue;
+
url = tinyMCE.replaceVar(url, name, escape(args[name]));
+ }
if (html) {
html = tinyMCE.replaceVar(html, "css", this.settings['popups_css']);
@@ -2890,12 +3187,18 @@ TinyMCE.prototype.openWindow = function(template, args) {
if (tinyMCE.isGecko && tinyMCE.isMac)
modal = "no";
+ if (template['close_previous'] != "no")
+ try {tinyMCE.lastWindow.close();} catch (ex) {}
+
var win = window.open(url, "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=" + modal + ",minimizable=" + resizable + ",modal=" + modal + ",width=" + width + ",height=" + height + ",resizable=" + resizable);
if (win == null) {
alert(tinyMCELang['lang_popup_blocked']);
return;
}
+ if (template['close_previous'] != "no")
+ tinyMCE.lastWindow = win;
+
eval('try { win.resizeTo(width, height); } catch(e) { }');
// Make it bigger if statusbar is forced
@@ -2945,46 +3248,49 @@ TinyMCE.prototype.getVisualAidClass = function(class_name, state) {
return className;
};
-TinyMCE.prototype.handleVisualAid = function(element, deep, state, inst) {
- if (!element)
+TinyMCE.prototype.handleVisualAid = function(el, deep, state, inst) {
+ if (!el)
return;
var tableElement = null;
- switch (element.nodeName) {
+ switch (el.nodeName) {
case "TABLE":
- var oldW = element.style.width;
- var oldH = element.style.height;
+ var oldW = el.style.width;
+ var oldH = el.style.height;
+ var bo = tinyMCE.getAttrib(el, "border");
+
+ bo = bo == "" || bo == "0" ? true : false;
- element.className = tinyMCE.getVisualAidClass(element.className, state && element.getAttribute("border") == 0);
+ tinyMCE.setAttrib(el, "class", tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el, "class"), state && bo));
- element.style.width = oldW;
- element.style.height = oldH;
+ el.style.width = oldW;
+ el.style.height = oldH;
- for (var y=0; y<element.rows.length; y++) {
- for (var x=0; x<element.rows[y].cells.length; x++) {
- var className = tinyMCE.getVisualAidClass(element.rows[y].cells[x].className, state && element.getAttribute("border") == 0);
- element.rows[y].cells[x].className = className;
+ for (var y=0; y<el.rows.length; y++) {
+ for (var x=0; x<el.rows[y].cells.length; x++) {
+ var cn = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x], "class"), state && bo);
+ tinyMCE.setAttrib(el.rows[y].cells[x], "class", cn);
}
}
break;
case "A":
- var anchorName = tinyMCE.getAttrib(element, "name");
+ var anchorName = tinyMCE.getAttrib(el, "name");
if (anchorName != '' && state) {
- element.title = anchorName;
- element.className = 'mceItemAnchor';
+ el.title = anchorName;
+ el.className = 'mceItemAnchor';
} else if (anchorName != '' && !state)
- element.className = '';
+ el.className = '';
break;
}
- if (deep && element.hasChildNodes()) {
- for (var i=0; i<element.childNodes.length; i++)
- tinyMCE.handleVisualAid(element.childNodes[i], deep, state, inst);
+ if (deep && el.hasChildNodes()) {
+ for (var i=0; i<el.childNodes.length; i++)
+ tinyMCE.handleVisualAid(el.childNodes[i], deep, state, inst);
}
};
@@ -3002,7 +3308,7 @@ TinyMCE.prototype.getAttrib = function(elm, name, default_value) {
if (name == "class" && !v)
v = elm.className;
- if (name == "style")
+ if (name == "style" && !tinyMCE.isOpera)
v = elm.style.cssText;
return (v && v != "") ? v : default_value;
@@ -3032,16 +3338,192 @@ TinyMCE.prototype.setAttrib = function(element, name, value, fix_value) {
element.removeAttribute(name);
};
-TinyMCE.prototype._setHTML = function(doc, html_content) {
- // Weird MSIE bug, <p><hr /></p> breaks runtime?
+TinyMCE.prototype.setStyleAttrib = function(elm, name, value) {
+ eval('elm.style.' + name + '=value;');
+
+ // Style attrib deleted
+ if (tinyMCE.isMSIE && value == null || value == '') {
+ var str = tinyMCE.serializeStyle(tinyMCE.parseStyle(elm.style.cssText));
+ elm.style.cssText = str;
+ elm.setAttribute("style", str);
+ }
+};
+
+TinyMCE.prototype.convertSpansToFonts = function(doc) {
+ var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(',');
+
+ var h = doc.body.innerHTML;
+ h = h.replace(/<span/gi, '<font');
+ h = h.replace(/<\/span/gi, '</font');
+ doc.body.innerHTML = h;
+
+ var s = doc.getElementsByTagName("font");
+ for (var i=0; i<s.length; i++) {
+ var size = tinyMCE.trim(s[i].style.fontSize).toLowerCase();
+ var fSize = 0;
+
+ for (var x=0; x<sizes.length; x++) {
+ if (sizes[x] == size) {
+ fSize = x + 1;
+ break;
+ }
+ }
+
+ if (fSize > 0) {
+ tinyMCE.setAttrib(s[i], 'size', fSize);
+ s[i].style.fontSize = '';
+ }
+
+ var fFace = s[i].style.fontFamily;
+ if (fFace != null && fFace != "") {
+ tinyMCE.setAttrib(s[i], 'face', fFace);
+ s[i].style.fontFamily = '';
+ }
+
+ var fColor = s[i].style.color;
+ if (fColor != null && fColor != "") {
+ tinyMCE.setAttrib(s[i], 'color', tinyMCE.convertRGBToHex(fColor));
+ s[i].style.color = '';
+ }
+ }
+};
+
+TinyMCE.prototype.convertFontsToSpans = function(doc) {
+ var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(',');
+
+ var h = doc.body.innerHTML;
+ h = h.replace(/<font/gi, '<span');
+ h = h.replace(/<\/font/gi, '</span');
+ doc.body.innerHTML = h;
+
+ var fsClasses = tinyMCE.getParam('font_size_classes');
+ if (fsClasses != '')
+ fsClasses = fsClasses.replace(/\s+/, '').split(',');
+ else
+ fsClasses = null;
+
+ var s = doc.getElementsByTagName("span");
+ for (var i=0; i<s.length; i++) {
+ var fSize, fFace, fColor;
+
+ fSize = tinyMCE.getAttrib(s[i], 'size');
+ fFace = tinyMCE.getAttrib(s[i], 'face');
+ fColor = tinyMCE.getAttrib(s[i], 'color');
+
+ if (fSize != "") {
+ fSize = parseInt(fSize);
+
+ if (fSize > 0 && fSize < 8) {
+ if (fsClasses != null)
+ tinyMCE.setAttrib(s[i], 'class', fsClasses[fSize-1]);
+ else
+ s[i].style.fontSize = sizes[fSize-1];
+ }
+
+ s[i].removeAttribute('size');
+ }
+
+ if (fFace != "") {
+ s[i].style.fontFamily = fFace;
+ s[i].removeAttribute('face');
+ }
+
+ if (fColor != "") {
+ s[i].style.color = fColor;
+ s[i].removeAttribute('color');
+ }
+ }
+};
+
+/*
+TinyMCE.prototype.applyClassesToFonts = function(doc, size) {
+ var f = doc.getElementsByTagName("font");
+ for (var i=0; i<f.length; i++) {
+ var s = tinyMCE.getAttrib(f[i], "size");
+
+ if (s != "")
+ tinyMCE.setAttrib(f[i], 'class', "mceItemFont" + s);
+ }
+
+ if (typeof(size) != "undefined") {
+ var css = "";
+
+ for (var x=0; x<doc.styleSheets.length; x++) {
+ for (var i=0; i<doc.styleSheets[x].rules.length; i++) {
+ if (doc.styleSheets[x].rules[i].selectorText == '#mceSpanFonts .mceItemFont' + size) {
+ css = doc.styleSheets[x].rules[i].style.cssText;
+ break;
+ }
+ }
+
+ if (css != "")
+ break;
+ }
+
+ if (doc.styleSheets[0].rules[0].selectorText == "FONT")
+ doc.styleSheets[0].removeRule(0);
+
+ doc.styleSheets[0].addRule("FONT", css, 0);
+ }
+};
+*/
+
+TinyMCE.prototype.setInnerHTML = function(e, h) {
+ if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
+ e.innerHTML = '<div id="mceTMPElement" style="display: none">TMP</div>' + h;
+ e.firstChild.removeNode(true);
+ } else
+ e.innerHTML = h;
+};
+
+TinyMCE.prototype.getOuterHTML = function(e) {
+ if (tinyMCE.isMSIE)
+ return e.outerHTML;
+
+ var d = e.ownerDocument.createElement("body");
+ d.appendChild(e);
+ return d.innerHTML;
+};
+
+TinyMCE.prototype.setOuterHTML = function(doc, e, h) {
if (tinyMCE.isMSIE) {
- var re = new RegExp('<p><hr /></p>', 'g');
- html_content = html_content.replace(re, "<hr>");
+ e.outerHTML = h;
+ return;
+ }
+
+ var d = e.ownerDocument.createElement("body");
+ d.innerHTML = h;
+ e.parentNode.replaceChild(d.firstChild, e);
+};
+
+TinyMCE.prototype.insertAfter = function(nc, rc){
+ if (rc.nextSibling)
+ rc.parentNode.insertBefore(nc, rc.nextSibling);
+ else
+ rc.parentNode.appendChild(nc);
+};
+
+TinyMCE.prototype.cleanupAnchors = function(doc) {
+ var an = doc.getElementsByTagName("a");
+
+ for (var i=0; i<an.length; i++) {
+ if (tinyMCE.getAttrib(an[i], "name") != "") {
+ var cn = an[i].childNodes;
+ for (var x=cn.length-1; x>=0; x--)
+ tinyMCE.insertAfter(cn[x], an[i]);
+ }
}
+};
+
+TinyMCE.prototype._setHTML = function(doc, html_content) {
+ // Force closed anchors open
+ //html_content = html_content.replace(new RegExp('<a(.*?)/>', 'gi'), '<a$1></a>');
+
+ html_content = tinyMCE.cleanupHTMLCode(html_content);
// Try innerHTML if it fails use pasteHTML in MSIE
try {
- doc.body.innerHTML = html_content;
+ tinyMCE.setInnerHTML(doc.body, html_content);
} catch (e) {
if (this.isMSIE)
doc.body.createTextRange().pasteHTML(html_content);
@@ -3081,8 +3563,13 @@ TinyMCE.prototype._setHTML = function(doc, html_content) {
}
// Always set the htmlText output
- doc.body.innerHTML = html;
+ tinyMCE.setInnerHTML(doc.body, html);
}
+
+ tinyMCE.cleanupAnchors(doc);
+
+ if (tinyMCE.getParam("convert_fonts_to_spans"))
+ tinyMCE.convertSpansToFonts(doc);
};
TinyMCE.prototype.getImageSrc = function(str) {
@@ -3130,8 +3617,11 @@ TinyMCE.prototype.getEditorId = function(form_element) {
TinyMCE.prototype.getInstanceById = function(editor_id) {
var inst = this.instances[editor_id];
if (!inst) {
- for (var instanceName in tinyMCE.instances) {
- var instance = tinyMCE.instances[instanceName];
+ for (var n in tinyMCE.instances) {
+ var instance = tinyMCE.instances[n];
+ if (!tinyMCE.isInstance(instance))
+ continue;
+
if (instance.formTargetElementId == editor_id) {
inst = instance;
break;
@@ -3178,6 +3668,9 @@ TinyMCE.prototype.getCSSClasses = function(editor_id, doc) {
for (var instanceName in tinyMCE.instances) {
instance = tinyMCE.instances[instanceName];
+ if (!tinyMCE.isInstance(instance))
+ continue;
+
break;
}
@@ -3235,6 +3728,9 @@ TinyMCE.prototype.getCSSClasses = function(editor_id, doc) {
};
TinyMCE.prototype.regexpReplace = function(in_str, reg_exp, replace_str, opts) {
+ if (in_str == null)
+ return in_str;
+
if (typeof(opts) == "undefined")
opts = 'g';
@@ -3250,7 +3746,7 @@ TinyMCE.prototype.cleanupEventStr = function(str) {
str = "" + str;
str = str.replace('function anonymous()\n{\n', '');
str = str.replace('\n}', '');
- str = str.replace(/^return true;/gi, '');
+ str = str.replace(/^return true;/gi, ''); // Remove event blocker
return str;
};
@@ -3423,7 +3919,7 @@ TinyMCE.prototype.debug = function() {
debugDiv.className = "debugger";
debugDiv.innerHTML = '\
Debug output:\
- <textarea id="tinymce_debug" style="width: 100%; height: 300px"></textarea>';
+ <textarea id="tinymce_debug" style="width: 100%; height: 300px" wrap="nowrap"></textarea>';
document.body.appendChild(debugDiv);
elm = document.getElementById("tinymce_debug");
@@ -3446,6 +3942,7 @@ function TinyMCEControl(settings) {
this.undoIndex = 0;
this.typingUndoIndex = -1;
this.undoRedo = true;
+ this.isTinyMCEControl = true;
// Default settings
this.settings = settings;
@@ -3683,8 +4180,8 @@ TinyMCEControl.prototype.scrollToNode = function(node) {
var height = tinyMCE.isMSIE ? document.getElementById(this.editorId).style.pixelHeight : this.targetElement.clientHeight;
// Only scroll if out of visible area
- if (!tinyMCE.settings['auto_resize'] && !(node.absTop > scrollY && node.absTop < (scrollY - 25 + height)))
- this.contentWindow.scrollTo(pos.absLeft, pos.absTop - height + 25);
+ if (!tinyMCE.settings['auto_resize'] && !(pos.absTop > scrollY && pos.absTop < (scrollY - 25 + height)))
+ this.contentWindow.scrollTo(pos.absLeft, pos.absTop - height + 25);
};
TinyMCEControl.prototype.getBody = function() {
@@ -3700,7 +4197,7 @@ TinyMCEControl.prototype.getWin = function() {
};
TinyMCEControl.prototype.getSel = function() {
- if (tinyMCE.isMSIE)
+ if (tinyMCE.isMSIE && !tinyMCE.isOpera)
return this.getDoc().selection;
var sel = this.contentWindow.getSelection();
@@ -3759,7 +4256,7 @@ TinyMCEControl.prototype.getRng = function() {
if (sel == null)
return null;
- if (tinyMCE.isMSIE)
+ if (tinyMCE.isMSIE && !tinyMCE.isOpera)
return sel.createRange();
if (tinyMCE.isSafari) {
@@ -3813,6 +4310,8 @@ TinyMCEControl.prototype._insertPara = function(e) {
var self = this;
var blockName = "P";
+// tinyMCE.debug(body.innerHTML);
+
// debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString());
// Setup before range
@@ -3832,30 +4331,39 @@ TinyMCEControl.prototype._insertPara = function(e) {
var endNode = direct ? sel.focusNode : sel.anchorNode;
var endOffset = direct ? sel.focusOffset : sel.anchorOffset;
+ startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode;
+ endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode;
+
+ // tinyMCE.debug(startNode, endNode);
+
// Get block elements
var startBlock = tinyMCE.getParentBlockElement(startNode);
var endBlock = tinyMCE.getParentBlockElement(endNode);
// Use current block name
if (startBlock != null) {
- blockName = startBlock.nodeName.toUpperCase();
+ blockName = startBlock.nodeName;
// Use P instead
- if (blockName == "TD" || blockName == "TABLE")
+ if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat)))
blockName = "P";
}
- // Within a list item (use normal behavior)
- if ((startBlock != null && startBlock.nodeName.toLowerCase() == "li") || (endBlock != null && endBlock.nodeName.toLowerCase() == "li"))
+ // Within a list use normal behaviour
+ if (tinyMCE.getParentElement(startBlock, "OL,UL") != null)
return false;
// Within a table create new paragraphs
- if ((startBlock != null && startBlock.nodeName.toLowerCase() == "table") || (endBlock != null && endBlock.nodeName.toLowerCase() == "table"))
+ if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE"))
startBlock = endBlock = null;
// Setup new paragraphs
- var paraBefore = (startBlock != null && startBlock.nodeName.toUpperCase() == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName);
- var paraAfter = (endBlock != null && endBlock.nodeName.toUpperCase() == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName);
+ var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName);
+ var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName);
+
+ // Is header, then force paragraph under
+ if (/^(H[1-6])$/.test(blockName))
+ paraAfter = doc.createElement("p");
// Setup chop nodes
var startChop = startNode;
@@ -3879,6 +4387,13 @@ TinyMCEControl.prototype._insertPara = function(e) {
endChop = node;
} while ((node = node.nextSibling ? node.nextSibling : node.parentNode));
+ // Fix when only a image is within the TD
+ if (startChop.nodeName == "TD")
+ startChop = startChop.firstChild;
+
+ if (endChop.nodeName == "TD")
+ endChop = endChop.lastChild;
+
// If not in a block element
if (startBlock == null) {
// Delete selection
@@ -3900,16 +4415,17 @@ TinyMCEControl.prototype._insertPara = function(e) {
if (endChop.parentNode.nodeName == blockName)
endChop = endChop.parentNode;
- rng.setEndAfter(endChop);
+ // If not after image
+ //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY")
+ rng.setEndAfter(endChop);
+
+ if (endChop.nodeName != "#text" && endChop.nodeName != "BODY")
+ rngBefore.setEndAfter(endChop);
var contents = rng.cloneContents();
- if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName.toLowerCase() == "body")) {
- var nodes = contents.firstChild.childNodes;
- for (var i=0; i<nodes.length; i++) {
- if (nodes[i].nodeName.toLowerCase() != "body")
- paraAfter.appendChild(nodes[i]);
- }
- } else
+ if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY"))
+ paraAfter.innerHTML = contents.firstChild.innerHTML;
+ else
paraAfter.appendChild(contents);
// Check if it's a empty paragraph
@@ -3931,7 +4447,7 @@ TinyMCEControl.prototype._insertPara = function(e) {
paraBefore.normalize();
rngBefore.insertNode(paraBefore);
-// tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML);
+ // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML);
} else {
body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">";
paraAfter = body.childNodes[1];
@@ -3947,6 +4463,7 @@ TinyMCEControl.prototype._insertPara = function(e) {
rngBefore.setStart(startChop, 0);
else
rngBefore.setStartBefore(startChop);
+
rngBefore.setEnd(startNode, startOffset);
paraBefore.appendChild(rngBefore.cloneContents());
@@ -3954,12 +4471,16 @@ TinyMCEControl.prototype._insertPara = function(e) {
rngAfter.setEndAfter(endChop);
rngAfter.setStart(endNode, endOffset);
var contents = rngAfter.cloneContents();
+
if (contents.firstChild && contents.firstChild.nodeName == blockName) {
- var nodes = contents.firstChild.childNodes;
+/* var nodes = contents.firstChild.childNodes;
for (var i=0; i<nodes.length; i++) {
- if (nodes[i].nodeName.toLowerCase() != "body")
+ //tinyMCE.debug(nodes[i].nodeName);
+ if (nodes[i].nodeName != "BODY")
paraAfter.appendChild(nodes[i]);
}
+*/
+ paraAfter.innerHTML = contents.firstChild.innerHTML;
} else
paraAfter.appendChild(contents);
@@ -3992,7 +4513,7 @@ TinyMCEControl.prototype._insertPara = function(e) {
rng.deleteContents();
rng.insertNode(paraAfter);
rng.insertNode(paraBefore);
- // debug("2", paraBefore.innerHTML, paraAfter.innerHTML);
+ //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML);
// Normalize
paraAfter.normalize();
@@ -4100,8 +4621,15 @@ TinyMCEControl.prototype.isDirty = function() {
return this.startContent != tinyMCE.trim(this.getBody().innerHTML) && !tinyMCE.isNotDirty;
};
-TinyMCEControl.prototype._mergeElements = function(pa, ch, override) {
- ch = ch.cloneNode(true);
+TinyMCEControl.prototype._mergeElements = function(scmd, pa, ch, override) {
+ if (scmd == "removeformat") {
+ pa.className = "";
+ pa.style.cssText = "";
+ ch.className = "";
+ ch.style.cssText = "";
+ return;
+ }
+
var st = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, "style"));
var stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style"));
var className = tinyMCE.getAttrib(pa, "class");
@@ -4109,16 +4637,33 @@ TinyMCEControl.prototype._mergeElements = function(pa, ch, override) {
className += " " + tinyMCE.getAttrib(ch, "class");
if (override) {
- for (var n in st)
+ for (var n in st) {
+ if (typeof(st[n]) == 'function')
+ continue;
+
stc[n] = st[n];
+ }
} else {
- for (var n in stc)
+ for (var n in stc) {
+ if (typeof(stc[n]) == 'function')
+ continue;
+
st[n] = stc[n];
+ }
}
- tinyMCE.setAttrib(ch, "style", tinyMCE.serializeStyle(st));
- tinyMCE.setAttrib(ch, "class", tinyMCE.trim(className));
- pa.parentNode.replaceChild(ch, pa);
+ tinyMCE.setAttrib(pa, "style", tinyMCE.serializeStyle(st));
+ tinyMCE.setAttrib(pa, "class", tinyMCE.trim(className));
+ ch.className = "";
+ ch.style.cssText = "";
+ ch.removeAttribute("class");
+ ch.removeAttribute("style");
+};
+
+TinyMCEControl.prototype.setUseCSS = function(b) {
+ var doc = this.getDoc();
+ try {doc.execCommand("useCSS", false, !b);} catch (ex) {}
+ try {doc.execCommand("styleWithCSS", false, b);} catch (ex) {}
};
TinyMCEControl.prototype.execCommand = function(command, user_interface, value) {
@@ -4133,7 +4678,7 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
// Mozilla issue
if (!tinyMCE.isMSIE && !this.useCSS) {
- doc.execCommand("useCSS", false, true);
+ this.setUseCSS(false);
this.useCSS = true;
}
@@ -4342,9 +4887,12 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
var sel = this.getSel();
var scmd = value['command'];
var sname = value['name'];
- var svalue = value['value'];
+ var svalue = value['value'] == null ? '' : value['value'];
+ //var svalue = value['value'] == null ? '' : value['value'];
var wrapper = value['wrapper'] ? value['wrapper'] : "span";
var parentElm = null;
+ var invalidRe = new RegExp("^BODY|HTML$", "g");
+ var invalidParentsRe = tinyMCE.settings['merge_styles_invalid_parents'] != '' ? new RegExp(tinyMCE.settings['merge_styles_invalid_parents'], "gi") : null;
// Whole element selected check
if (tinyMCE.isMSIE) {
@@ -4356,8 +4904,10 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
var prng = doc.selection.createRange();
prng.moveToElementText(pelm);
- if (rng.htmlText == prng.htmlText || rng.boundingWidth == 0)
- parentElm = pelm;
+ if (rng.htmlText == prng.htmlText || rng.boundingWidth == 0) {
+ if (invalidParentsRe == null || !invalidParentsRe.test(pelm.nodeName))
+ parentElm = pelm;
+ }
}
} else {
var felm = this.getFocusElement();
@@ -4366,12 +4916,35 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
}
// Whole element selected
- if (parentElm) {
+ if (parentElm && !invalidRe.test(parentElm.nodeName)) {
if (scmd == "setstyle")
- eval("parentElm.style." + sname + " = svalue;");
+ tinyMCE.setStyleAttrib(parentElm, sname, svalue);
if (scmd == "setattrib")
tinyMCE.setAttrib(parentElm, sname, svalue);
+
+ if (scmd == "removeformat") {
+ parentElm.style.cssText = '';
+ tinyMCE.setAttrib(parentElm, 'class', '');
+ }
+
+ // Remove style/attribs from all children
+ var ch = tinyMCE.getNodeTree(parentElm, new Array(), 1);
+ for (var z=0; z<ch.length; z++) {
+ if (ch[z] == parentElm)
+ continue;
+
+ if (scmd == "setstyle")
+ tinyMCE.setStyleAttrib(ch[z], sname, '');
+
+ if (scmd == "setattrib")
+ tinyMCE.setAttrib(ch[z], sname, '');
+
+ if (scmd == "removeformat") {
+ ch[z].style.cssText = '';
+ tinyMCE.setAttrib(ch[z], 'class', '');
+ }
+ }
} else {
doc.execCommand("fontname", false, "#mce_temp_font#");
var elementArray = tinyMCE.getElementsByAttributeValue(this.getBody(), "font", "face", "#mce_temp_font#");
@@ -4383,11 +4956,16 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
var spanElm = doc.createElement(wrapper);
if (scmd == "setstyle")
- eval("spanElm.style." + sname + " = svalue;");
+ tinyMCE.setStyleAttrib(spanElm, sname, svalue);
if (scmd == "setattrib")
tinyMCE.setAttrib(spanElm, sname, svalue);
+ if (scmd == "removeformat") {
+ spanElm.style.cssText = '';
+ tinyMCE.setAttrib(spanElm, 'class', '');
+ }
+
if (elm.hasChildNodes()) {
for (var i=0; i<elm.childNodes.length; i++)
spanElm.appendChild(elm.childNodes[i].cloneNode(true));
@@ -4395,6 +4973,24 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
spanElm.setAttribute("mce_new", "true");
elm.parentNode.replaceChild(spanElm, elm);
+
+ // Remove style/attribs from all children
+ var ch = tinyMCE.getNodeTree(spanElm, new Array(), 1);
+ for (var z=0; z<ch.length; z++) {
+ if (ch[z] == spanElm)
+ continue;
+
+ if (scmd == "setstyle")
+ tinyMCE.setStyleAttrib(ch[z], sname, '');
+
+ if (scmd == "setattrib")
+ tinyMCE.setAttrib(ch[z], sname, '');
+
+ if (scmd == "removeformat") {
+ ch[z].style.cssText = '';
+ tinyMCE.setAttrib(ch[z], 'class', '');
+ }
+ }
}
}
}
@@ -4409,15 +5005,16 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
// Is only child a element
if (elm.childNodes && elm.childNodes.length == 1 && elm.childNodes[0].nodeType == 1) {
- // tinyMCE.debug("merge1" + isNew);
- this._mergeElements(elm, elm.childNodes[0], isNew);
+ //tinyMCE.debug("merge1" + isNew);
+ this._mergeElements(scmd, elm, elm.childNodes[0], isNew);
continue;
}
// Is I the only child
- if (elm.parentNode.childNodes.length == 1) {
- // tinyMCE.debug("merge2" + isNew);
- this._mergeElements(elm.parentNode, elm, false);
+ if (elm.parentNode.childNodes.length == 1 && !invalidRe.test(elm.nodeName) && !invalidRe.test(elm.parentNode.nodeName)) {
+ //tinyMCE.debug("merge2" + isNew + "," + elm.nodeName + "," + elm.parentNode.nodeName);
+ if (invalidParentsRe == null || !invalidParentsRe.test(elm.parentNode.nodeName))
+ this._mergeElements(scmd, elm.parentNode, elm, false);
}
}
@@ -4432,63 +5029,53 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
tmp.appendChild(elm.cloneNode(false));
// Is empty span, remove it
- if (new RegExp('<span>|<span style="">', 'gi').test(tmp.innerHTML)) {
- for (var i=elm.childNodes.length-1; i>=0; i--) {
- if (elm.parentNode != null) {
- elm.parentNode.insertBefore(elm.childNodes[i].cloneNode(true), elm);
- elm.parentNode.removeChild(elm);
- }
+ tmp.innerHTML = tmp.innerHTML.replace(new RegExp('style=""|class=""', 'gi'), '');
+ //tinyMCE.debug(tmp.innerHTML);
+ if (new RegExp('<span>', 'gi').test(tmp.innerHTML)) {
+ for (var x=0; x<elm.childNodes.length; x++) {
+ if (elm.parentNode != null)
+ elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true), elm);
}
+
+ elm.parentNode.removeChild(elm);
}
}
+ // Re add the visual aids
+ if (scmd == "removeformat")
+ tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
+
tinyMCE.triggerNodeChange();
break;
case "FontName":
- if (tinyMCE.getParam("convert_fonts_to_styles"))
- this.execCommand("SetStyleInfo", false, {command : "setstyle", name : "fontFamily", value : value});
- else
- this.getDoc().execCommand('FontName', false, value);
- break;
+ this.getDoc().execCommand('FontName', false, value);
+
+ if (tinyMCE.isGecko)
+ window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
+
+ return;
case "FontSize":
- if (tinyMCE.getParam("convert_fonts_to_styles")) {
- var sizes = new Array('', 8, 10, 12, 14, 18, 24, 36);
- var size = sizes[value] == '' ? '' : sizes[value] + 'px';
+ this.getDoc().execCommand('FontSize', false, value);
- this.execCommand("SetStyleInfo", false, {command : "setstyle", name : "fontSize", value : size});
- } else
- this.getDoc().execCommand('FontSize', false, value);
+ if (tinyMCE.isGecko)
+ window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
- break;
+ return;
case "forecolor":
- if (tinyMCE.getParam("convert_fonts_to_styles"))
- this.execCommand("SetStyleInfo", false, {command : "setstyle", name : "color", value : value});
- else {
- if (tinyMCE.isGecko) {
- this.getDoc().execCommand("useCSS", false, true);
- this.getDoc().execCommand('forecolor', false, value);
- this.getDoc().execCommand("useCSS", false, true);
- } else
- this.getDoc().execCommand('forecolor', false, value);
- }
+ this.getDoc().execCommand('forecolor', false, value);
break;
case "HiliteColor":
- if (tinyMCE.getParam("convert_fonts_to_styles"))
- this.execCommand("SetStyleInfo", false, {command : "setstyle", name : "backgroundColor", value : value});
- else {
- if (tinyMCE.isGecko) {
- this.getDoc().execCommand("useCSS", false, false);
- this.getDoc().execCommand('hilitecolor', false, value);
- this.getDoc().execCommand("useCSS", false, true);
- } else
- this.getDoc().execCommand('BackColor', false, value);
- }
-
+ if (tinyMCE.isGecko) {
+ this.setUseCSS(true);
+ this.getDoc().execCommand('hilitecolor', false, value);
+ this.setUseCSS(false);
+ } else
+ this.getDoc().execCommand('BackColor', false, value);
break;
case "Cut":
@@ -4499,6 +5086,9 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
// Try executing command
eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');
+ if (tinyMCE.isOpera && cmdFailed)
+ alert('Currently not supported by your browser, use keyboard shortcuts instead.');
+
// Alert error in gecko if command failed
if (tinyMCE.isGecko && cmdFailed) {
// Confirm more info
@@ -4517,9 +5107,9 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
// Call custom cleanup code
value = tinyMCE._customCleanup(this, "insert_to_editor", value);
tinyMCE._setHTML(doc, value);
- doc.body.innerHTML = tinyMCE._cleanupHTML(this, doc, tinyMCE.settings, doc.body);
+ tinyMCE.setInnerHTML(doc.body, tinyMCE._cleanupHTML(this, doc, tinyMCE.settings, doc.body));
tinyMCE.handleVisualAid(doc.body, true, this.visualAid, this);
- tinyMCE._setEventsEnabled(doc.body, true);
+ tinyMCE._setEventsEnabled(doc.body, false);
return true;
case "mceLink":
@@ -4654,14 +5244,16 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
case "mceCleanup":
tinyMCE._setHTML(this.contentDocument, this.getBody().innerHTML);
- this.getBody().innerHTML = tinyMCE._cleanupHTML(this, this.contentDocument, this.settings, this.getBody(), this.visualAid);
+ tinyMCE.setInnerHTML(this.getBody(), tinyMCE._cleanupHTML(this, this.contentDocument, this.settings, this.getBody(), this.visualAid));
tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
- tinyMCE._setEventsEnabled(this.getBody(), true);
+ tinyMCE._setEventsEnabled(this.getBody(), false);
this.repaint();
tinyMCE.triggerNodeChange();
break;
case "mceReplaceContent":
+ this.getWin().focus();
+
var selectedText = "";
if (tinyMCE.isMSIE) {
@@ -4709,7 +5301,7 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
// Find marker and replace with RAW HTML
var html = this.getBody().innerHTML;
if ((pos = html.indexOf(key)) != -1)
- this.getBody().innerHTML = html.substring(0, pos) + value + html.substring(pos + key.length);
+ tinyMCE.setInnerHTML(this.getBody(), html.substring(0, pos) + value + html.substring(pos + key.length));
// Restore scoll pos
this.contentWindow.scrollTo(scrollX, scrollY);
@@ -4719,10 +5311,29 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
break;
case "mceInsertContent":
+ var insertHTMLFailed = false;
+ this.getWin().focus();
+
+ if (tinyMCE.isGecko || tinyMCE.isOpera) {
+ try {this.getDoc().execCommand('inserthtml', false, value);} catch (ex) {insertHTMLFailed = true;}
+ if (!insertHTMLFailed) {
+ tinyMCE.triggerNodeChange();
+ return;
+ }
+ }
+
+ // Ugly hack in Opera due to non working "inserthtml"
+ if (tinyMCE.isOpera && insertHTMLFailed) {
+ this.getDoc().execCommand("insertimage", false, tinyMCE.uniqueURL);
+ var ar = tinyMCE.getElementsByAttributeValue(this.getBody(), "img", "src", tinyMCE.uniqueURL);
+ ar[0].outerHTML = value;
+ return;
+ }
+
if (!tinyMCE.isMSIE) {
+ var isHTML = value.indexOf('<') != -1;
var sel = this.getSel();
var rng = this.getRng();
- var isHTML = value.indexOf('<') != -1;
if (isHTML) {
if (tinyMCE.isSafari) {
@@ -4860,7 +5471,7 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
// Do undo
if (this.undoIndex > 0) {
this.undoIndex--;
- this.getBody().innerHTML = this.undoLevels[this.undoIndex];
+ tinyMCE.setInnerHTML(this.getBody(), this.undoLevels[this.undoIndex]);
this.repaint();
}
@@ -4876,7 +5487,7 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
if (this.undoIndex < (this.undoLevels.length-1)) {
this.undoIndex++;
- this.getBody().innerHTML = this.undoLevels[this.undoIndex];
+ tinyMCE.setInnerHTML(this.getBody(), this.undoLevels[this.undoIndex]);
this.repaint();
// tinyMCE.debug("Redo - undo levels:" + this.undoLevels.length + ", undo index: " + this.undoIndex);
}
@@ -4892,28 +5503,43 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
tinyMCE.triggerNodeChange();
break;
+ case "Indent":
+ this.getDoc().execCommand(command, user_interface, value);
+ tinyMCE.triggerNodeChange();
+ if (tinyMCE.isMSIE) {
+ var n = tinyMCE.getParentElement(this.getFocusElement(), "blockquote");
+ do {
+ if (n && n.nodeName == "BLOCKQUOTE") {
+ n.removeAttribute("dir");
+ n.removeAttribute("style");
+ }
+ } while (n != null && (n = n.parentNode) != null);
+ }
+ break;
+
case "removeformat":
var text = this.getSelectedText();
+ if (tinyMCE.isOpera) {
+ this.getDoc().execCommand("RemoveFormat", false, null);
+ return;
+ }
+
if (tinyMCE.isMSIE) {
try {
- win.focus();
var rng = doc.selection.createRange();
rng.execCommand("RemoveFormat", false, null);
-
- // If all element contents is selected, move selection around element
- if (rng.text == rng.parentElement().innerText) {
- rng.moveToElementText(rng.parentElement());
- rng.select();
- }
-
- rng.pasteHTML(rng.text);
} catch (e) {
// Do nothing
}
- } else
+
+ this.execCommand("SetStyleInfo", false, {command : "removeformat"});
+ } else {
this.getDoc().execCommand(command, user_interface, value);
+ this.execCommand("SetStyleInfo", false, {command : "removeformat"});
+ }
+
// Remove class
if (text.length == 0)
this.execCommand("mceSetCSSClass", false, "");
@@ -4923,7 +5549,11 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
default:
this.getDoc().execCommand(command, user_interface, value);
- tinyMCE.triggerNodeChange();
+
+ if (tinyMCE.isGecko)
+ window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
+ else
+ tinyMCE.triggerNodeChange();
}
// Add undo level after modification
@@ -5105,15 +5735,23 @@ TinyMCEControl.prototype.onAdd = function(replace_element, form_element_name, ta
this.targetElement = tElm;
this.iframeElement = targetDoc.getElementById(this.editorId);
- this.contentDocument = tElm.window.document;
- this.contentWindow = tElm.window;
+
+ if (tinyMCE.isOpera) {
+ this.contentDocument = this.iframeElement.contentDocument;
+ this.contentWindow = this.iframeElement.contentWindow;
+ dynamicIFrame = true;
+ } else {
+ this.contentDocument = tElm.window.document;
+ this.contentWindow = tElm.window;
+ }
+
this.getDoc().designMode = "on";
}
// Setup base HTML
var doc = this.contentDocument;
if (dynamicIFrame) {
- var html = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><base href="' + tinyMCE.settings['base_href'] + '" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';
+ var html = tinyMCE.getParam('doctype') + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + tinyMCE.settings['base_href'] + '" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';
try {
this.getDoc().designMode = "on";
@@ -5137,17 +5775,18 @@ TinyMCEControl.prototype.onAdd = function(replace_element, form_element_name, ta
};
TinyMCEControl.prototype.getFocusElement = function() {
- if (tinyMCE.isMSIE) {
+ if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
var doc = this.getDoc();
var rng = doc.selection.createRange();
- if (rng.collapse)
- rng.collapse(true);
+// if (rng.collapse)
+// rng.collapse(true);
var elm = rng.item ? rng.item(0) : rng.parentElement();
} else {
var sel = this.getSel();
var rng = this.getRng();
+
var elm = rng.commonAncestorContainer;
//var elm = (sel && sel.anchorNode) ? sel.anchorNode : null;
diff --git a/wp-inst/wp-includes/js/tinymce/utils/form_utils.js b/wp-inst/wp-includes/js/tinymce/utils/form_utils.js
new file mode 100644
index 0000000..8fba405
--- /dev/null
+++ b/wp-inst/wp-includes/js/tinymce/utils/form_utils.js
@@ -0,0 +1,203 @@
+/**
+ * $RCSfile: form_utils.js,v $
+ * $Revision: 1.5 $
+ * $Date: 2005/10/25 16:01:51 $
+ *
+ * Various form utilitiy functions.
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2005, Moxiecode Systems AB, All rights reserved.
+ */
+
+function getColorPickerHTML(id, target_form_element) {
+ var html = "";
+
+ html += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
+ html += '<img id="' + id + '" src="../../themes/advanced/images/color.gif"';
+ html += ' onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');"';
+ html += ' onmouseout="tinyMCE.restoreClass(this);"';
+ html += ' onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');"';
+ html += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
+ html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
+
+ return html;
+}
+
+function pickColor(e, target_form_element) {
+ if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown")
+ tinyMCEPopup.pickColor(e, target_form_element);
+}
+
+function updateColor(img_id, form_element_id) {
+ document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
+}
+
+function setBrowserDisabled(id, state) {
+ var img = document.getElementById(id);
+ var lnk = document.getElementById(id + "_link");
+
+ if (lnk) {
+ if (state) {
+ lnk.setAttribute("realhref", lnk.getAttribute("href"));
+ lnk.removeAttribute("href");
+ tinyMCE.switchClass(img, 'mceButtonDisabled', true);
+ } else {
+ lnk.setAttribute("href", lnk.getAttribute("realhref"));
+ tinyMCE.switchClass(img, 'mceButtonNormal', false);
+ }
+ }
+}
+
+function getBrowserHTML(id, target_form_element, type, prefix) {
+ var option = prefix + "_" + type + "_browser_callback";
+ var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
+ if (cb == null)
+ return "";
+
+ var html = "";
+
+ html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
+ html += '<img id="' + id + '" src="../../themes/advanced/images/browse.gif"';
+ html += ' onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');"';
+ html += ' onmouseout="tinyMCE.restoreClass(this);"';
+ html += ' onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');"';
+ html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
+ html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
+
+ return html;
+}
+
+function openBrower(img_id, target_form_element, type, option) {
+ var img = document.getElementById(img_id);
+
+ if (img.className != "mceButtonDisabled")
+ tinyMCEPopup.openBrowser(target_form_element, type, option);
+}
+
+function selectByValue(form_obj, field_name, value, add_custom) {
+ if (!form_obj || !form_obj.elements[field_name])
+ return;
+
+ var sel = form_obj.elements[field_name];
+
+ var found = false;
+ for (var i=0; i<sel.options.length; i++) {
+ var option = sel.options[i];
+
+ if (option.value == value) {
+ option.selected = true;
+ found = true;
+ } else
+ option.selected = false;
+ }
+
+ if (!found && add_custom && value != '') {
+ var option = new Option('Value: ' + value, value);
+ option.selected = true;
+ sel.options[sel.options.length] = option;
+ }
+
+ return found;
+}
+
+function getSelectValue(form_obj, field_name) {
+ var elm = form_obj.elements[field_name];
+
+ if (elm == null || elm.options == null)
+ return "";
+
+ return elm.options[elm.selectedIndex].value;
+}
+
+function addClassesToList(list_id, specific_option) {
+ // Setup class droplist
+ var styleSelectElm = document.getElementById(list_id);
+ var styles = tinyMCE.getParam('theme_advanced_styles', false);
+ styles = tinyMCE.getParam(specific_option, styles);
+
+ if (styles) {
+ var stylesAr = styles.split(';');
+
+ for (var i=0; i<stylesAr.length; i++) {
+ if (stylesAr != "") {
+ var key, value;
+
+ key = stylesAr[i].split('=')[0];
+ value = stylesAr[i].split('=')[1];
+
+ styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
+ }
+ }
+ } else {
+ // Use auto impored classes
+ var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id'));
+ for (var i=0; i<csses.length; i++)
+ styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]);
+ }
+}
+
+function isVisible(element_id) {
+ var elm = document.getElementById(element_id);
+
+ return elm && elm.style.display != "none";
+}
+
+function convertRGBToHex(col) {
+ var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
+
+ var rgb = col.replace(re, "$1,$2,$3").split(',');
+ if (rgb.length == 3) {
+ r = parseInt(rgb[0]).toString(16);
+ g = parseInt(rgb[1]).toString(16);
+ b = parseInt(rgb[2]).toString(16);
+
+ r = r.length == 1 ? '0' + r : r;
+ g = g.length == 1 ? '0' + g : g;
+ b = b.length == 1 ? '0' + b : b;
+
+ return "#" + r + g + b;
+ }
+
+ return col;
+}
+
+function convertHexToRGB(col) {
+ if (col.indexOf('#') != -1) {
+ col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
+
+ r = parseInt(col.substring(0, 2), 16);
+ g = parseInt(col.substring(2, 4), 16);
+ b = parseInt(col.substring(4, 6), 16);
+
+ return "rgb(" + r + "," + g + "," + b + ")";
+ }
+
+ return col;
+}
+
+function trimSize(size) {
+ return size.replace(new RegExp('[^0-9%]', 'gi'), '');
+}
+
+function getCSSSize(size) {
+ size = trimSize(size);
+
+ if (size == "")
+ return "";
+
+ return size.indexOf('%') != -1 ? size : size + "px";
+}
+
+function getStyle(elm, attrib, style) {
+ var val = tinyMCE.getAttrib(elm, attrib);
+
+ if (val != '')
+ return '' + val;
+
+ if (typeof(style) == 'undefined')
+ style = attrib;
+
+ val = eval('elm.style.' + style);
+
+ return val == null ? '' : '' + val;
+}
diff --git a/wp-inst/wp-includes/js/tinymce/utils/mctabs.js b/wp-inst/wp-includes/js/tinymce/utils/mctabs.js
new file mode 100644
index 0000000..9554f8f
--- /dev/null
+++ b/wp-inst/wp-includes/js/tinymce/utils/mctabs.js
@@ -0,0 +1,76 @@
+/**
+ * $RCSfile: mctabs.js,v $
+ * $Revision: 1.1 $
+ * $Date: 2005/08/01 18:36:35 $
+ *
+ * Moxiecode DHTML Tabs script.
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
+ */
+
+function MCTabs() {
+ this.settings = new Array();
+};
+
+MCTabs.prototype.init = function(settings) {
+ this.settings = settings;
+};
+
+MCTabs.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;
+};
+
+MCTabs.prototype.displayTab = function(tab_id, panel_id) {
+ var panelElm = document.getElementById(panel_id);
+ var panelContainerElm = panelElm ? panelElm.parentNode : null;
+ var tabElm = document.getElementById(tab_id);
+ var tabContainerElm = tabElm ? tabElm.parentNode : null;
+ var selectionClass = this.getParam('selection_class', 'current');
+
+ if (tabElm && tabContainerElm) {
+ var nodes = tabContainerElm.childNodes;
+
+ // Hide all other tabs
+ for (var i=0; i<nodes.length; i++) {
+ if (nodes[i].nodeName == "LI")
+ nodes[i].className = '';
+ }
+
+ // Show selected tab
+ tabElm.className = 'current';
+ }
+
+ if (panelElm && panelContainerElm) {
+ var nodes = panelContainerElm.childNodes;
+
+ // Hide all other panels
+ for (var i=0; i<nodes.length; i++) {
+ if (nodes[i].nodeName == "DIV")
+ nodes[i].className = 'panel';
+ }
+
+ // Show selected panel
+ panelElm.className = 'current';
+ }
+};
+
+MCTabs.prototype.getAnchor = function() {
+ var pos, url = document.location.href;
+
+ if ((pos = url.lastIndexOf('#')) != -1)
+ return url.substring(pos + 1);
+
+ return "";
+};
+
+// Global instance
+var mcTabs = new MCTabs();
diff --git a/wp-inst/wp-includes/js/tinymce/utils/validate.js b/wp-inst/wp-includes/js/tinymce/utils/validate.js
new file mode 100644
index 0000000..95ae4d3
--- /dev/null
+++ b/wp-inst/wp-includes/js/tinymce/utils/validate.js
@@ -0,0 +1,50 @@
+/**
+ * $RCSfile: validate.js,v $
+ * $Revision: 1.2 $
+ * $Date: 2005/08/13 12:20:37 $
+ *
+ * Various form validation methods.
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2005, Moxiecode Systems AB, All rights reserved.
+ */
+
+function testRegExp(form_name, element_name, re) {
+ return new RegExp(re).test(document.forms[form_name].elements[element_name].value);
+}
+
+function validateString(form_name, element_name) {
+ return (document.forms[form_name].elements[element_name].value.length > 0);
+}
+
+function validateSelection(form_name, element_name) {
+ return (document.forms[form_name].elements[element_name].selectedIndex > 0);
+}
+
+function validateCheckBox(form_name, element_name) {
+ return document.forms[form_name].elements[element_name].checked;
+}
+
+function validateCleanString(form_name, element_name) {
+ return testRegExp(form_name, element_name, '^[A-Za-z0-9_]+$');
+}
+
+function validateEmail(form_name, element_name) {
+ return testRegExp(form_name, element_name, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
+}
+
+function validateAbsUrl(form_name, element_name) {
+ return testRegExp(form_name, element_name, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+$');
+}
+
+function validateNumber(form_name, element_name, allow_blank) {
+ return (!allow_blank && value == '') ? false : testRegExp(form_name, element_name, '^-?[0-9]*\\.?[0-9]*$');
+}
+
+function validateSize(form_name, element_name,) {
+ return testRegExp(form_name, element_name, '^[0-9]+(px|%)?$');
+}
+
+function validateID(form_name, element_name,) {
+ return testRegExp(form_name, element_name, '^[A-Za-z_]([A-Za-z0-9_])*$');
+}
diff --git a/wp-inst/wp-includes/registration-functions.php b/wp-inst/wp-includes/registration-functions.php
index 62a1468..35e2cb4 100644
--- a/wp-inst/wp-includes/registration-functions.php
+++ b/wp-inst/wp-includes/registration-functions.php
@@ -53,16 +53,18 @@ function wp_insert_user($userdata) {
clean_user_cache($user_login);
update_usermeta( $user_id, 'first_name', $first_name);
- update_usermeta( $user_id, 'middle_name', $middle_name);
update_usermeta( $user_id, 'last_name', $last_name);
update_usermeta( $user_id, 'nickname', $nickname );
update_usermeta( $user_id, 'description', $description );
update_usermeta( $user_id, 'jabber', $jabber );
update_usermeta( $user_id, 'aim', $aim );
update_usermeta( $user_id, 'yim', $yim );
- update_usermeta( $user_id, 'flickr_username', $flickr_username );
-
-
+
+ if ($update && !empty($role)) {
+ $user = new WP_User($user_id);
+ $user->set_role($role);
+ }
+
if ( !$update ) {
$user = new WP_User($user_id);
$user->set_role(get_settings('default_role'));
@@ -92,7 +94,7 @@ function wp_update_user($userdata) {
$plaintext_pass = $userdata['user_pass'];
$userdata['user_pass'] = md5($userdata['user_pass']);
}
-
+
// Merge old and new fields with new fields overwriting old ones.
$userdata = array_merge($user, $userdata);
$user_id = wp_insert_user($userdata);
diff --git a/wp-inst/wp-includes/template-functions-post.php b/wp-inst/wp-includes/template-functions-post.php
index 1f76b03..13ee081 100644
--- a/wp-inst/wp-includes/template-functions-post.php
+++ b/wp-inst/wp-includes/template-functions-post.php
@@ -419,7 +419,6 @@ function _page_level_out($parent, $page_tree, $args, $depth = 0, $echo = true) {
$format = $args['date_format'];
$output .= " " . mysql2date($format, $cur_page['ts']);
}
- $output .= "\n";
if ( isset($cur_page['children']) && is_array($cur_page['children']) ) {
$new_depth = $depth + 1;
diff --git a/wp-inst/wp-login.php b/wp-inst/wp-login.php
index ef3c9a5..fa224f8 100644
--- a/wp-inst/wp-login.php
+++ b/wp-inst/wp-login.php
@@ -169,9 +169,9 @@ default:
$user_pass = $_POST['pwd'];
$rememberme = $_POST['rememberme'];
} elseif ( !empty($_COOKIE) ) {
- if (! empty($_COOKIE[USER_COOKIE]) )
+ if ( !empty($_COOKIE[USER_COOKIE]) )
$user_login = $_COOKIE[USER_COOKIE];
- if (! empty($_COOKIE[PASS_COOKIE]) ) {
+ if ( !empty($_COOKIE[PASS_COOKIE]) ) {
$user_pass = $_COOKIE[PASS_COOKIE];
$using_cookie = true;
}
@@ -181,19 +181,19 @@ default:
if ($user_login && $user_pass) {
$user = new WP_User($user_login);
+
// If the user can't edit posts, send them to their profile.
- if ( ! $user->has_cap('edit_posts') )
- $redirect_to = get_settings('siteurl') . '/wp-admin/profile.php';
+ if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )
+ $redirect_to = get_settings('siteurl') . '/wp-admin/profile.php';
if ( wp_login($user_login, $user_pass, $using_cookie) ) {
- if ( !$using_cookie) {
+ if ( !$using_cookie )
wp_setcookie($user_login, $user_pass, false, '', '', $rememberme);
- }
do_action('wp_login', $user_login);
wp_redirect($redirect_to);
- exit();
+ exit;
} else {
- if ($using_cookie)
+ if ( $using_cookie )
$error = __('Your session has expired.');
}
}
diff --git a/wp-inst/xmlrpc.php b/wp-inst/xmlrpc.php
index 97c5a21..3c2e555 100644
--- a/wp-inst/xmlrpc.php
+++ b/wp-inst/xmlrpc.php
@@ -1179,6 +1179,9 @@ class wp_xmlrpc_server extends IXR_Server {
if ( !$post ) // Post_ID not found
return new IXR_Error(33, 'The specified target URI cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.');
+ if ( $post_ID == url_to_postid($pagelinkedfrom) )
+ return new IXR_Error(0, 'The source URI and the target URI cannot both point to the same resource.');
+
// Check if pings are on
if ( 'closed' == $post->ping_status )
return new IXR_Error(33, 'The specified target URI cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.');