Make WordPress Core

Changeset 3664


Ignore:
Timestamp:
03/30/2006 07:50:33 AM (19 years ago)
Author:
ryan
Message:

tinyMCE 2.0.5 coming at you live. fixes #2598

Location:
trunk
Files:
53 added
41 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-header.php

    r3660 r3664  
    5858<script type="text/javascript" src="../wp-includes/js/dbx-key.js"></script>
    5959<?php } ?>
    60 <?php if ( $editing && user_can_richedit() ) { ?>
    61 <script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php?ver=20051211"></script>
    62 <?php } ?>
     60<?php if ( $editing && user_can_richedit() ) { tinymce_include(); } ?>
    6361<?php if ( $cat_js ) { ?>
    6462<script type="text/javascript" src="cat-js.php"></script>
  • trunk/wp-admin/edit-form-advanced.php

    r3660 r3664  
    144144<legend><?php _e('Post') ?></legend>
    145145
    146 <?php
    147  $rows = get_settings('default_post_edit_rows');
    148  if (($rows < 3) || ($rows > 100)) {
    149      $rows = 12;
    150  }
    151 ?>
    152 <?php the_quicktags(); ?>
    153 
    154 <div><textarea <?php if ( user_can_richedit() ) echo 'title="true" '; ?>rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div>
    155 </fieldset>
    156 
    157 <script type="text/javascript">
    158 <!--
    159 edCanvas = document.getElementById('content');
    160 <?php if ( user_can_richedit() ) : ?>
    161 // This code is meant to allow tabbing from Title to Post (TinyMCE).
    162 if ( tinyMCE.isMSIE )
    163     document.getElementById('title').onkeydown = function (e)
    164         {
    165             e = e ? e : window.event;
    166             if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
    167                 var i = tinyMCE.selectedInstance;
    168                 if(typeof i ==  'undefined')
    169                     return true;
    170                                 tinyMCE.execCommand("mceStartTyping");
    171                 this.blur();
    172                 i.contentWindow.focus();
    173                 e.returnValue = false;
    174                 return false;
    175             }
    176         }
    177 else
    178     document.getElementById('title').onkeypress = function (e)
    179         {
    180             e = e ? e : window.event;
    181             if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
    182                 var i = tinyMCE.selectedInstance;
    183                 if(typeof i ==  'undefined')
    184                     return true;
    185                                 tinyMCE.execCommand("mceStartTyping");
    186                 this.blur();
    187                 i.contentWindow.focus();
    188                 e.returnValue = false;
    189                 return false;
    190             }
    191         }
    192 <?php endif; ?>
    193 //-->
    194 </script>
     146    <?php the_editor($post->post_content); ?>
    195147
    196148<?php echo $form_pingback ?>
  • trunk/wp-admin/edit-form-comment.php

    r3563 r3664  
    3838<fieldset style="clear: both;">
    3939        <legend><?php _e('Comment') ?></legend>
    40 <?php the_quicktags(); ?>
    41 
    42 <?php
    43  $rows = get_settings('default_post_edit_rows');
    44  if (($rows < 3) || ($rows > 100)) {
    45      $rows = 10;
    46  }
    47 ?>
    48 <div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content" style="width: 99%"><?php echo user_can_richedit() ? wp_richedit_pre($comment->comment_content) : $comment->comment_content; ?></textarea></div>
     40    <?php the_editor($comment->comment_content, 'content', 'newcomment_author_url'); ?>
    4941</fieldset>
    50 
    51 <script type="text/javascript">
    52 <!--
    53 edCanvas = document.getElementById('content');
    54 <?php if ( user_can_richedit() ) : ?>
    55 // This code is meant to allow tabbing from Author URL to Post (TinyMCE).
    56 if ( tinyMCE.isMSIE )
    57     document.getElementById('newcomment_author_url').onkeydown = function (e)
    58         {
    59             e = e ? e : window.event;
    60             if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
    61                 var i = tinyMCE.selectedInstance;
    62                 if(typeof i ==  'undefined')
    63                     return true;
    64                                 tinyMCE.execCommand("mceStartTyping");
    65                 this.blur();
    66                 i.contentWindow.focus();
    67                 e.returnValue = false;
    68                 return false;
    69             }
    70         }
    71 else
    72     document.getElementById('newcomment_author_url').onkeypress = function (e)
    73         {
    74             e = e ? e : window.event;
    75             if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
    76                 var i = tinyMCE.selectedInstance;
    77                 if(typeof i ==  'undefined')
    78                     return true;
    79                                 tinyMCE.execCommand("mceStartTyping");
    80                 this.blur();
    81                 i.contentWindow.focus();
    82                 e.returnValue = false;
    83                 return false;
    84             }
    85         }
    86 <?php endif; ?>
    87 //-->
    88 </script>
    8942
    9043<p class="submit"><input type="submit" name="editcomment" id="editcomment" value="<?php echo $submitbutton_text ?>" style="font-weight: bold;" tabindex="6" />
  • trunk/wp-admin/edit-page-form.php

    r3660 r3664  
    131131<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
    132132    <legend><?php _e('Page Content') ?></legend>
    133 <?php
    134  $rows = get_settings('default_post_edit_rows');
    135  if (($rows < 3) || ($rows > 100)) {
    136      $rows = 10;
    137  }
    138 ?>
    139 <?php the_quicktags(); ?>
    140 
    141 <div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div>
     133    <?php the_editor($post->post_content); ?>
    142134</fieldset>
    143 
    144 <script type="text/javascript">
    145 <!--
    146 edCanvas = document.getElementById('content');
    147 <?php if ( user_can_richedit() ) : ?>
    148 // This code is meant to allow tabbing from Title to Post (TinyMCE).
    149 if ( tinyMCE.isMSIE )
    150     document.getElementById('title').onkeydown = function (e)
    151         {
    152             e = e ? e : window.event;
    153             if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
    154                 var i = tinyMCE.selectedInstance;
    155                 if(typeof i ==  'undefined')
    156                     return true;
    157                                 tinyMCE.execCommand("mceStartTyping");
    158                 this.blur();
    159                 i.contentWindow.focus();
    160                 e.returnValue = false;
    161                 return false;
    162             }
    163         }
    164 else
    165     document.getElementById('title').onkeypress = function (e)
    166         {
    167             e = e ? e : window.event;
    168             if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
    169                 var i = tinyMCE.selectedInstance;
    170                 if(typeof i ==  'undefined')
    171                     return true;
    172                                 tinyMCE.execCommand("mceStartTyping");
    173                 this.blur();
    174                 i.contentWindow.focus();
    175                 e.returnValue = false;
    176                 return false;
    177             }
    178         }
    179 <?php endif; ?>
    180 //-->
    181 </script>
    182135
    183136<p class="submit">
  • trunk/wp-includes/functions-post.php

    r3663 r3664  
    10291029    generic_ping();
    10301030}
     1031
     1032/**
     1033 * Places two script links in <head>: one to get tinyMCE (big), one to configure and start it (small)
     1034 */
     1035function tinymce_include() {
     1036    $src1 = get_settings('siteurl') . '/wp-includes/js/tinymce/tiny_mce_gzip.php';
     1037    $src2 = get_settings('siteurl') . '/wp-includes/js/tinymce/tiny_mce_config.php';
     1038
     1039    echo "<script type='text/javascript' src='$src1'></script>\n";
     1040    echo "<script type='text/javascript' src='$src2'></script>\n";
     1041}
     1042
     1043/**
     1044 * Places a textarea according to the current user's preferences, filled with $content.
     1045 * Also places a script block that enables tabbing between Title and Content.
     1046 *
     1047 * @param string Editor contents
     1048 * @param string (optional) Previous form field's ID (for tabbing support)
     1049 */
     1050function the_editor($content, $id = 'content', $prev_id = 'title') {
     1051    $rows = get_settings('default_post_edit_rows');
     1052    if (($rows < 3) || ($rows > 100))
     1053        $rows = 12;
     1054
     1055    $rows = "rows='$rows'";
     1056
     1057    the_quicktags();
     1058
     1059    if ( user_can_richedit() )
     1060        add_filter('the_editor_content', 'wp_richedit_pre');
     1061
     1062    $the_editor = apply_filters('the_editor', "<div><textarea class='mceEditor' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n");
     1063    $the_editor_content = apply_filters('the_editor_content', $content);
     1064
     1065    printf($the_editor, $the_editor_content);
     1066
     1067    ?>
     1068    <script type="text/javascript">
     1069    //<!--
     1070    edCanvas = document.getElementById('<?php echo $id; ?>');
     1071    <?php if ( user_can_richedit() ) : ?>
     1072    // This code is meant to allow tabbing from Title to Post (TinyMCE).
     1073    if ( tinyMCE.isMSIE )
     1074        document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e)
     1075            {
     1076                e = e ? e : window.event;
     1077                if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     1078                    var i = tinyMCE.selectedInstance;
     1079                    if(typeof i ==  'undefined')
     1080                        return true;
     1081                                    tinyMCE.execCommand("mceStartTyping");
     1082                    this.blur();
     1083                    i.contentWindow.focus();
     1084                    e.returnValue = false;
     1085                    return false;
     1086                }
     1087            }
     1088    else
     1089        document.getElementById('<?php echo $prev_id; ?>').onkeypress = function (e)
     1090            {
     1091                e = e ? e : window.event;
     1092                if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     1093                    var i = tinyMCE.selectedInstance;
     1094                    if(typeof i ==  'undefined')
     1095                        return true;
     1096                                    tinyMCE.execCommand("mceStartTyping");
     1097                    this.blur();
     1098                    i.contentWindow.focus();
     1099                    e.returnValue = false;
     1100                    return false;
     1101                }
     1102            }
     1103    <?php endif; ?>
     1104    //-->
     1105    </script>
     1106    <?php
     1107}
     1108
    10311109?>
  • trunk/wp-includes/js/tinymce/langs/en.js

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

    r2993 r3664  
     1/**
     2 * $RCSfile: editor_plugin_src.js,v $
     3 * $Revision: 1.11 $
     4 * $Date: 2006/03/22 12:21:21 $
     5 *
     6 * @author Moxiecode
     7 * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
     8 */
     9
    110/* Import plugin specific language pack */
    2  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;
     11tinyMCE.importPluginLanguagePack('autosave', 'en,tr,sv,cs,he,nb,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,nn,fi,cy,es,is,pl,pt_br');
     12
     13var TinyMCE_AutoSavePlugin = {
     14    getInfo : function() {
     15        return {
     16            longname : 'Auto save',
     17            author : 'Moxiecode Systems',
     18            authorurl : 'http://tinymce.moxiecode.com',
     19            infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
     20            version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
     21        };
     22    },
     23
     24    // Private plugin internal methods
     25
     26    _beforeUnloadHandler : function() {
     27        var n, inst, anyDirty = false, msg = tinyMCE.getLang("lang_autosave_unload_msg");
     28
     29        if (tinyMCE.getParam("fullscreen_is_enabled"))
     30            return;
     31
     32        for (n in tinyMCE.instances) {
     33            inst = tinyMCE.instances[n];
     34
     35            if (!tinyMCE.isInstance(inst))
     36                continue;
     37
     38            if (inst.isDirty())
     39                return msg;
     40        }
     41
     42        return;
     43    }
     44};
     45
     46window.onbeforeunload = TinyMCE_AutoSavePlugin._beforeUnloadHandler;
     47
     48tinyMCE.addPlugin("autosave", TinyMCE_AutoSavePlugin);
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css

    r3136 r3664  
     1/* Window classes */
     2
     3.mceWindow {
     4    position: absolute;
     5    left: 0;
     6    top: 0;
     7    border: 1px solid black;
     8    background-color: #D4D0C8;
     9}
     10
     11.mceWindowHead {
     12    background-color: #334F8D;
     13    width: 100%;
     14    height: 18px;
     15    cursor: move;
     16    overflow: hidden;
     17}
     18
     19.mceWindowBody {
     20    clear: both;
     21    background-color: white;
     22}
     23
     24.mceWindowStatusbar {
     25    background-color: #D4D0C8;
     26    height: 12px;
     27    border-top: 1px solid black;
     28}
     29
     30.mceWindowTitle {
     31    float: left;
     32    font-family: "MS Sans Serif";
     33    font-size: 9pt;
     34    font-weight: bold;
     35    line-height: 18px;
     36    color: white;
     37    margin-left: 2px;
     38    overflow: hidden;
     39}
     40
     41.mceWindowHeadTools {
     42    margin-right: 2px;
     43}
     44
     45.mceWindowClose, .mceWindowMinimize, .mceWindowMaximize {
     46    display: block;
     47    float: right;
     48    overflow: hidden;
     49    margin-top: 2px;
     50}
     51
     52.mceWindowClose {
     53    margin-left: 2px;
     54}
     55
     56.mceWindowMinimize {
     57}
     58
     59.mceWindowMaximize {
     60}
     61
     62.mceWindowResize {
     63    display: block;
     64    float: right;
     65    overflow: hidden;
     66    cursor: se-resize;
     67    width: 12px;
     68    height: 12px;
     69}
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js

    r3136 r3664  
     1/**
     2 * $RCSfile: editor_plugin_src.js,v $
     3 * $Revision: 1.8 $
     4 * $Date: 2006/02/06 20:02:38 $
     5 *
     6 * Moxiecode DHTML Windows script.
     7 *
     8 * @author Moxiecode
     9 * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
     10 */
     11
     12// Patch openWindow, closeWindow TinyMCE functions
     13
     14var TinyMCE_InlinePopupsPlugin = {
     15    getInfo : function() {
     16        return {
     17            longname : 'Inline Popups',
     18            author : 'Moxiecode Systems',
     19            authorurl : 'http://tinymce.moxiecode.com',
     20            infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html',
     21            version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
     22        };
     23    }
     24};
     25
     26tinyMCE.addPlugin("inlinepopups", TinyMCE_InlinePopupsPlugin);
     27
     28// Patch openWindow, closeWindow TinyMCE functions
     29
     30TinyMCE_Engine.prototype.orgOpenWindow = TinyMCE_Engine.prototype.openWindow;
     31
     32TinyMCE_Engine.prototype.openWindow = function(template, args) {
     33    // Does the caller support inline
     34    if (args['inline'] != "yes" || tinyMCE.isOpera || tinyMCE.getParam("plugins").indexOf('inlinepopups') == -1) {
     35        mcWindows.selectedWindow = null;
     36        args['mce_inside_iframe'] = false;
     37        this.orgOpenWindow(template, args);
     38        return;
     39    }
     40
     41    var url, resizable, scrollbars;
     42
     43    args['mce_inside_iframe'] = true;
     44    tinyMCE.windowArgs = args;
     45
     46    if (template['file'].charAt(0) != '/' && template['file'].indexOf('://') == -1)
     47        url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template['file'];
     48    else
     49        url = template['file'];
     50
     51    if (!(width = parseInt(template['width'])))
     52        width = 320;
     53
     54    if (!(height = parseInt(template['height'])))
     55        height = 200;
     56
     57    resizable = (args && args['resizable']) ? args['resizable'] : "no";
     58    scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no";
     59
     60    height += 18;
     61
     62    // Replace all args as variables in URL
     63    for (var name in args) {
     64        if (typeof(args[name]) == 'function')
     65            continue;
     66
     67        url = tinyMCE.replaceVar(url, name, escape(args[name]));
     68    }
     69
     70    var elm = document.getElementById(this.selectedInstance.editorId + '_parent');
     71    var pos = tinyMCE.getAbsPosition(elm);
     72
     73    // Center div in editor area
     74    pos.absLeft += Math.round((elm.firstChild.clientWidth / 2) - (width / 2));
     75    pos.absTop += Math.round((elm.firstChild.clientHeight / 2) - (height / 2));
     76
     77    mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop);
     78};
     79
     80TinyMCE_Engine.prototype.orgCloseWindow = TinyMCE_Engine.prototype.closeWindow;
     81
     82TinyMCE_Engine.prototype.closeWindow = function(win) {
     83    if (mcWindows.selectedWindow != null)
     84        mcWindows.selectedWindow.close();
     85    else
     86        this.orgCloseWindow(win);
     87};
     88
     89TinyMCE_Engine.prototype.setWindowTitle = function(win_ref, title) {
     90    for (var n in mcWindows.windows) {
     91        var win = mcWindows.windows[n];
     92        if (typeof(win) == 'function')
     93            continue;
     94
     95        if (win_ref.name == win.id + "_iframe")
     96            window.frames[win.id + "_iframe"].document.getElementById(win.id + '_title').innerHTML = title;
     97    }
     98};
     99
     100// * * * * * TinyMCE_Windows classes below
     101
     102// Windows handler
     103function TinyMCE_Windows() {
     104    this.settings = new Array();
     105    this.windows = new Array();
     106    this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
     107    this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
     108    this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
     109    this.isMac = navigator.userAgent.indexOf('Mac') != -1;
     110    this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
     111    this.action = "none";
     112    this.selectedWindow = null;
     113    this.lastSelectedWindow = null;
     114    this.zindex = 100;
     115    this.mouseDownScreenX = 0;
     116    this.mouseDownScreenY = 0;
     117    this.mouseDownLayerX = 0;
     118    this.mouseDownLayerY = 0;
     119    this.mouseDownWidth = 0;
     120    this.mouseDownHeight = 0;
     121    this.idCounter = 0;
     122};
     123
     124TinyMCE_Windows.prototype.init = function(settings) {
     125    this.settings = settings;
     126
     127    if (this.isMSIE)
     128        this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
     129    else
     130        this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
     131
     132    this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
     133
     134    this.doc = document;
     135};
     136
     137TinyMCE_Windows.prototype.getParam = function(name, default_value) {
     138    var value = null;
     139
     140    value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
     141
     142    // Fix bool values
     143    if (value == "true" || value == "false")
     144        return (value == "true");
     145
     146    return value;
     147};
     148
     149TinyMCE_Windows.prototype.eventDispatcher = function(e) {
     150    e = typeof(e) == "undefined" ? window.event : e;
     151
     152    if (mcWindows.selectedWindow == null)
     153        return;
     154
     155    // Switch focus
     156    if (mcWindows.isGecko && e.type == "mousedown") {
     157        var elm = e.currentTarget;
     158
     159        for (var n in mcWindows.windows) {
     160            var win = mcWindows.windows[n];
     161
     162            if (win.headElement == elm || win.resizeElement == elm) {
     163                win.focus();
     164                break;
     165            }
     166        }
     167    }
     168
     169    switch (e.type) {
     170        case "mousemove":
     171            mcWindows.selectedWindow.onMouseMove(e);
     172            break;
     173
     174        case "mouseup":
     175            mcWindows.selectedWindow.onMouseUp(e);
     176            break;
     177
     178        case "mousedown":
     179            mcWindows.selectedWindow.onMouseDown(e);
     180            break;
     181
     182        case "focus":
     183            mcWindows.selectedWindow.onFocus(e);
     184            break;
     185    }
     186};
     187
     188TinyMCE_Windows.prototype.addEvent = function(obj, name, handler) {
     189    if (this.isMSIE)
     190        obj.attachEvent("on" + name, handler);
     191    else
     192        obj.addEventListener(name, handler, true);
     193};
     194
     195TinyMCE_Windows.prototype.cancelEvent = function(e) {
     196    if (this.isMSIE) {
     197        e.returnValue = false;
     198        e.cancelBubble = true;
     199    } else
     200        e.preventDefault();
     201};
     202
     203TinyMCE_Windows.prototype.parseFeatures = function(opts) {
     204    // Cleanup the options
     205    opts = opts.toLowerCase();
     206    opts = opts.replace(/;/g, ",");
     207    opts = opts.replace(/[^0-9a-z=,]/g, "");
     208
     209    var optionChunks = opts.split(',');
     210    var options = new Array();
     211
     212    options['left'] = "10";
     213    options['top'] = "10";
     214    options['width'] = "300";
     215    options['height'] = "300";
     216    options['resizable'] = "yes";
     217    options['minimizable'] = "yes";
     218    options['maximizable'] = "yes";
     219    options['close'] = "yes";
     220    options['movable'] = "yes";
     221    options['statusbar'] = "yes";
     222    options['scrollbars'] = "auto";
     223    options['modal'] = "no";
     224
     225    if (opts == "")
     226        return options;
     227
     228    for (var i=0; i<optionChunks.length; i++) {
     229        var parts = optionChunks[i].split('=');
     230
     231        if (parts.length == 2)
     232            options[parts[0]] = parts[1];
     233    }
     234
     235    options['left'] = parseInt(options['left']);
     236    options['top'] = parseInt(options['top']);
     237    options['width'] = parseInt(options['width']);
     238    options['height'] = parseInt(options['height']);
     239
     240    return options;
     241};
     242
     243TinyMCE_Windows.prototype.open = function(url, name, features) {
     244    this.lastSelectedWindow = this.selectedWindow;
     245
     246    var win = new TinyMCE_Window();
     247    var winDiv, html = "", id;
     248    var imgPath = this.getParam("images_path");
     249
     250    features = this.parseFeatures(features);
     251
     252    // Create div
     253    id = "mcWindow_" + name;
     254    win.deltaHeight = 18;
     255
     256    if (features['statusbar'] == "yes") {
     257        win.deltaHeight += 13;
     258
     259        if (this.isMSIE)
     260            win.deltaHeight += 1;
     261    }
     262
     263    width = parseInt(features['width']);
     264    height = parseInt(features['height'])-win.deltaHeight;
     265
     266    if (this.isMSIE)
     267        width -= 2;
     268
     269    // Setup first part of window
     270    win.id = id;
     271    win.url = url;
     272    win.name = name;
     273    win.features = features;
     274    this.windows[name] = win;
     275
     276    iframeWidth = width;
     277    iframeHeight = height;
     278
     279    // Create inner content
     280    html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
     281    html += '<html>';
     282    html += '<head>';
     283    html += '<title>Wrapper iframe</title>';
     284    html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
     285    html += '<link href="' + this.getParam("css_file") + '" rel="stylesheet" type="text/css" />';
     286    html += '</head>';
     287    html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
     288
     289    html += '<div id="' + id + '_container" class="mceWindow">';
     290    html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
     291    html += '  <div id="' + id + '_title" class="mceWindowTitle"';
     292    html += '  onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;"></div>';
     293    html += '    <div class="mceWindowHeadTools">';
     294    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>';
     295//  html += '      <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" target="_self" onmousedown="return false;" class="mceWindowMaximize"></a>';
     296//  html += '      <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" target="_self" onmousedown="return false;" class="mceWindowMinimize"></a>';
     297    html += '    </div>';
     298    html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
     299    html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe" scrolling="' + features['scrollbars'] + '"></iframe></div>';
     300
     301    if (features['statusbar'] == "yes") {
     302        html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
     303
     304        if (features['resizable'] == "yes") {
     305            if (this.isGecko)
     306                html += '<div id="' + id + '_resize" class="mceWindowResize"><div style="background-image: url(\'' + imgPath + '/window_resize.gif\'); width: 12px; height: 12px;"></div></div>';
     307            else
     308                html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="' + imgPath + '/window_resize.gif" /></div>';
     309        }
     310
     311        html += '</div>';
     312    }
     313
     314    html += '</div>';
     315
     316    html += '</body>';
     317    html += '</html>';
     318
     319    // Create iframe
     320    this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
     321};
     322
     323// Blocks the document events by placing a image over the whole document
     324TinyMCE_Windows.prototype.setDocumentLock = function(state) {
     325    if (state) {
     326        var elm = document.getElementById('mcWindowEventBlocker');
     327        if (elm == null) {
     328            elm = document.createElement("div");
     329
     330            elm.id = "mcWindowEventBlocker";
     331            elm.style.position = "absolute";
     332            elm.style.left = "0";
     333            elm.style.top = "0";
     334
     335            document.body.appendChild(elm);
     336        }
     337
     338        elm.style.display = "none";
     339
     340        var imgPath = this.getParam("images_path");
     341        var width = document.body.clientWidth;
     342        var height = document.body.clientHeight;
     343
     344        elm.style.width = width;
     345        elm.style.height = height;
     346        elm.innerHTML = '<img src="' + imgPath + '/spacer.gif" width="' + width + '" height="' + height + '" />';
     347
     348        elm.style.zIndex = mcWindows.zindex-1;
     349        elm.style.display = "block";
     350    } else {
     351        var elm = document.getElementById('mcWindowEventBlocker');
     352
     353        if (mcWindows.windows.length == 0)
     354            elm.parentNode.removeChild(elm);
     355        else
     356            elm.style.zIndex = mcWindows.zindex-1;
     357    }
     358};
     359
     360// Gets called when wrapper iframe is initialized
     361TinyMCE_Windows.prototype.onLoad = function(name) {
     362    var win = mcWindows.windows[name];
     363    var id = "mcWindow_" + name;
     364    var wrapperIframe = window.frames[id + "_iframe"].frames[0];
     365    var wrapperDoc = window.frames[id + "_iframe"].document;
     366    var doc = window.frames[id + "_iframe"].document;
     367    var winDiv = document.getElementById("mcWindow_" + name + "_div");
     368    var realIframe = window.frames[id + "_iframe"].frames[0];
     369
     370    // Set window data
     371    win.id = "mcWindow_" + name;
     372    win.winElement = winDiv;
     373    win.bodyElement = doc.getElementById(id + '_body');
     374    win.iframeElement = doc.getElementById(id + '_iframe');
     375    win.headElement = doc.getElementById(id + '_head');
     376    win.titleElement = doc.getElementById(id + '_title');
     377    win.resizeElement = doc.getElementById(id + '_resize');
     378    win.containerElement = doc.getElementById(id + '_container');
     379    win.left = win.features['left'];
     380    win.top = win.features['top'];
     381    win.frame = window.frames[id + '_iframe'].frames[0];
     382    win.wrapperFrame = window.frames[id + '_iframe'];
     383    win.wrapperIFrameElement = document.getElementById(id + "_iframe");
     384
     385    // Add event handlers
     386    mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
     387
     388    if (win.resizeElement != null)
     389        mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
     390
     391    if (mcWindows.isMSIE) {
     392        mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
     393        mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
     394    } else {
     395        mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
     396        mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
     397        mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
     398    }
     399
     400    for (var i=0; i<window.frames.length; i++) {
     401        if (!window.frames[i]._hasMouseHandlers) {
     402            if (mcWindows.isMSIE) {
     403                mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
     404                mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
     405            } else {
     406                mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
     407                mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
     408            }
     409
     410            window.frames[i]._hasMouseHandlers = true;
     411        }
     412    }
     413
     414    if (mcWindows.isMSIE) {
     415        mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
     416        mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
     417    } else {
     418        mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
     419        mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
     420        mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
     421    }
     422
     423    // Dispatch open window event
     424    var func = this.getParam("on_open_window", "");
     425    if (func != "")
     426        eval(func + "(win);");
     427
     428    win.focus();
     429
     430    if (win.features['modal'] == "yes")
     431        mcWindows.setDocumentLock(true);
     432};
     433
     434TinyMCE_Windows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
     435    var iframe = document.createElement("iframe");
     436    var div = document.createElement("div");
     437
     438    width = parseInt(width);
     439    height = parseInt(height)+1;
     440
     441    // Create wrapper div
     442    div.setAttribute("id", id_prefix + "_div");
     443    div.setAttribute("width", width);
     444    div.setAttribute("height", (height));
     445    div.style.position = "absolute";
     446    div.style.left = left + "px";
     447    div.style.top = top + "px";
     448    div.style.width = width + "px";
     449    div.style.height = (height) + "px";
     450    div.style.backgroundColor = "white";
     451    div.style.display = "none";
     452
     453    if (this.isGecko) {
     454        iframeWidth = width + 2;
     455        iframeHeight = height + 2;
     456    } else {
     457        iframeWidth = width;
     458        iframeHeight = height + 1;
     459    }
     460
     461    // Create iframe
     462    iframe.setAttribute("id", id_prefix + "_iframe");
     463    iframe.setAttribute("name", id_prefix + "_iframe");
     464    iframe.setAttribute("border", "0");
     465    iframe.setAttribute("frameBorder", "0");
     466    iframe.setAttribute("marginWidth", "0");
     467    iframe.setAttribute("marginHeight", "0");
     468    iframe.setAttribute("leftMargin", "0");
     469    iframe.setAttribute("topMargin", "0");
     470    iframe.setAttribute("width", iframeWidth);
     471    iframe.setAttribute("height", iframeHeight);
     472//  iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
     473    // iframe.setAttribute("allowtransparency", "false");
     474    iframe.setAttribute("scrolling", "no");
     475    iframe.style.width = iframeWidth + "px";
     476    iframe.style.height = iframeHeight + "px";
     477    iframe.style.backgroundColor = "white";
     478    div.appendChild(iframe);
     479
     480    document.body.appendChild(div);
     481
     482    // Fixed MSIE 5.0 issue
     483    div.innerHTML = div.innerHTML;
     484
     485    if (this.isSafari) {
     486        // Give Safari some time to setup
     487        window.setTimeout(function() {
     488            doc = window.frames[id_prefix + '_iframe'].document;
     489            doc.open();
     490            doc.write(html);
     491            doc.close();
     492        }, 10);
     493    } else {
     494        doc = window.frames[id_prefix + '_iframe'].window.document;
     495        doc.open();
     496        doc.write(html);
     497        doc.close();
     498    }
     499
     500    div.style.display = "block";
     501
     502    return div;
     503};
     504
     505// Window instance
     506function TinyMCE_Window() {
     507};
     508
     509TinyMCE_Window.prototype.focus = function() {
     510    if (this != mcWindows.selectedWindow) {
     511        this.winElement.style.zIndex = ++mcWindows.zindex;
     512        mcWindows.lastSelectedWindow = mcWindows.selectedWindow;
     513        mcWindows.selectedWindow = this;
     514    }
     515};
     516
     517TinyMCE_Window.prototype.minimize = function() {
     518};
     519
     520TinyMCE_Window.prototype.maximize = function() {
     521   
     522};
     523
     524TinyMCE_Window.prototype.startResize = function() {
     525    mcWindows.action = "resize";
     526};
     527
     528TinyMCE_Window.prototype.startMove = function(e) {
     529    mcWindows.action = "move";
     530};
     531
     532TinyMCE_Window.prototype.close = function() {
     533    if (this.frame && this.frame['tinyMCEPopup'])
     534        this.frame['tinyMCEPopup'].restoreSelection();
     535
     536    if (mcWindows.lastSelectedWindow != null)
     537        mcWindows.lastSelectedWindow.focus();
     538
     539    var mcWindowsNew = new Array();
     540    for (var n in mcWindows.windows) {
     541        var win = mcWindows.windows[n];
     542        if (typeof(win) == 'function')
     543            continue;
     544
     545        if (win.name != this.name)
     546            mcWindowsNew[n] = win;
     547    }
     548
     549    mcWindows.windows = mcWindowsNew;
     550
     551//  alert(mcWindows.doc.getElementById(this.id + "_iframe"));
     552
     553    var e = mcWindows.doc.getElementById(this.id + "_iframe");
     554    e.parentNode.removeChild(e);
     555
     556    var e = mcWindows.doc.getElementById(this.id + "_div");
     557    e.parentNode.removeChild(e);
     558
     559    mcWindows.setDocumentLock(false);
     560};
     561
     562TinyMCE_Window.prototype.onMouseMove = function(e) {
     563    var scrollX = 0;//this.doc.body.scrollLeft;
     564    var scrollY = 0;//this.doc.body.scrollTop;
     565
     566    // Calculate real X, Y
     567    var dx = e.screenX - mcWindows.mouseDownScreenX;
     568    var dy = e.screenY - mcWindows.mouseDownScreenY;
     569
     570    switch (mcWindows.action) {
     571        case "resize":
     572            width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX);
     573            height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY);
     574
     575            width = width < 100 ? 100 : width;
     576            height = height < 100 ? 100 : height;
     577
     578            this.wrapperIFrameElement.style.width = width+2;
     579            this.wrapperIFrameElement.style.height = height+2;
     580            this.wrapperIFrameElement.width = width+2;
     581            this.wrapperIFrameElement.height = height+2;
     582            this.winElement.style.width = width;
     583            this.winElement.style.height = height;
     584
     585            height = height - this.deltaHeight;
     586
     587            this.containerElement.style.width = width;
     588
     589            this.iframeElement.style.width = width;
     590            this.iframeElement.style.height = height;
     591            this.bodyElement.style.width = width;
     592            this.bodyElement.style.height = height;
     593            this.headElement.style.width = width;
     594            //this.statusElement.style.width = width;
     595
     596            mcWindows.cancelEvent(e);
     597            break;
     598
     599        case "move":
     600            this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
     601            this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
     602            this.winElement.style.left = this.left + "px";
     603            this.winElement.style.top = this.top + "px";
     604
     605            mcWindows.cancelEvent(e);
     606            break;
     607    }
     608};
     609
     610function debug(msg) {
     611    document.getElementById('debug').value += msg + "\n";
     612}
     613
     614TinyMCE_Window.prototype.onMouseUp = function(e) {
     615    mcWindows.action = "none";
     616};
     617
     618TinyMCE_Window.prototype.onFocus = function(e) {
     619    // Gecko only handler
     620    var winRef = e.currentTarget;
     621
     622    for (var n in mcWindows.windows) {
     623        var win = mcWindows.windows[n];
     624        if (typeof(win) == 'function')
     625            continue;
     626
     627        if (winRef.name == win.id + "_iframe") {
     628            win.focus();
     629            return;
     630        }
     631    }
     632};
     633
     634TinyMCE_Window.prototype.onMouseDown = function(e) {
     635    var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
     636
     637    var scrollX = 0;//this.doc.body.scrollLeft;
     638    var scrollY = 0;//this.doc.body.scrollTop;
     639
     640    mcWindows.mouseDownScreenX = e.screenX;
     641    mcWindows.mouseDownScreenY = e.screenY;
     642    mcWindows.mouseDownLayerX = this.left;
     643    mcWindows.mouseDownLayerY = this.top;
     644    mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
     645    mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
     646
     647    if (this.resizeElement != null && elm == this.resizeElement.firstChild)
     648        this.startResize(e);
     649    else
     650        this.startMove(e);
     651
     652    mcWindows.cancelEvent(e);
     653};
     654
     655// Global instance
     656var mcWindows = new TinyMCE_Windows();
     657
     658// Initialize windows
     659mcWindows.init({
     660    images_path : tinyMCE.baseURL + "/plugins/inlinepopups/images",
     661    css_file : tinyMCE.baseURL + "/plugins/inlinepopups/css/inlinepopup.css"
     662});
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js

    r3136 r3664  
     1/**
     2 * $RCSfile: mcwindows.js,v $
     3 * $Revision: 1.2 $
     4 * $Date: 2005/10/18 13:59:43 $
     5 *
     6 * Moxiecode DHTML Windows script.
     7 *
     8 * @author Moxiecode
     9 * @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
     10 */
     11
     12// Windows handler
     13function MCWindows() {
     14    this.settings = new Array();
     15    this.windows = new Array();
     16    this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
     17    this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
     18    this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
     19    this.isMac = navigator.userAgent.indexOf('Mac') != -1;
     20    this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
     21    this.action = "none";
     22    this.selectedWindow = null;
     23    this.zindex = 100;
     24    this.mouseDownScreenX = 0;
     25    this.mouseDownScreenY = 0;
     26    this.mouseDownLayerX = 0;
     27    this.mouseDownLayerY = 0;
     28    this.mouseDownWidth = 0;
     29    this.mouseDownHeight = 0;
     30};
     31
     32MCWindows.prototype.init = function(settings) {
     33    this.settings = settings;
     34
     35    if (this.isMSIE)
     36        this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
     37    else
     38        this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
     39
     40    this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
     41};
     42
     43MCWindows.prototype.getParam = function(name, default_value) {
     44    var value = null;
     45
     46    value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
     47
     48    // Fix bool values
     49    if (value == "true" || value == "false")
     50        return (value == "true");
     51
     52    return value;
     53};
     54
     55MCWindows.prototype.eventDispatcher = function(e) {
     56    e = typeof(e) == "undefined" ? window.event : e;
     57
     58    if (mcWindows.selectedWindow == null)
     59        return;
     60
     61    // Switch focus
     62    if (mcWindows.isGecko && e.type == "mousedown") {
     63        var elm = e.currentTarget;
     64
     65        for (var n in mcWindows.windows) {
     66            var win = mcWindows.windows[n];
     67            if (typeof(win) == 'function')
     68                continue;
     69
     70            if (win.headElement == elm || win.resizeElement == elm) {
     71                win.focus();
     72                break;
     73            }
     74        }
     75    }
     76
     77    switch (e.type) {
     78        case "mousemove":
     79            mcWindows.selectedWindow.onMouseMove(e);
     80            break;
     81
     82        case "mouseup":
     83            mcWindows.selectedWindow.onMouseUp(e);
     84            break;
     85
     86        case "mousedown":
     87            mcWindows.selectedWindow.onMouseDown(e);
     88            break;
     89
     90        case "focus":
     91            mcWindows.selectedWindow.onFocus(e);
     92            break;
     93    }
     94}
     95
     96MCWindows.prototype.addEvent = function(obj, name, handler) {
     97    if (this.isMSIE)
     98        obj.attachEvent("on" + name, handler);
     99    else
     100        obj.addEventListener(name, handler, true);
     101};
     102
     103MCWindows.prototype.cancelEvent = function(e) {
     104    if (this.isMSIE) {
     105        e.returnValue = false;
     106        e.cancelBubble = true;
     107    } else
     108        e.preventDefault();
     109};
     110
     111MCWindows.prototype.parseFeatures = function(opts) {
     112    // Cleanup the options
     113    opts = opts.toLowerCase();
     114    opts = opts.replace(/;/g, ",");
     115    opts = opts.replace(/[^0-9a-z=,]/g, "");
     116
     117    var optionChunks = opts.split(',');
     118    var options = new Array();
     119
     120    options['left'] = 10;
     121    options['top'] = 10;
     122    options['width'] = 300;
     123    options['height'] = 300;
     124    options['resizable'] = true;
     125    options['minimizable'] = true;
     126    options['maximizable'] = true;
     127    options['close'] = true;
     128    options['movable'] = true;
     129
     130    if (opts == "")
     131        return options;
     132
     133    for (var i=0; i<optionChunks.length; i++) {
     134        var parts = optionChunks[i].split('=');
     135
     136        if (parts.length == 2)
     137            options[parts[0]] = parts[1];
     138    }
     139
     140    return options;
     141};
     142
     143MCWindows.prototype.open = function(url, name, features) {
     144    var win = new MCWindow();
     145    var winDiv, html = "", id;
     146
     147    features = this.parseFeatures(features);
     148
     149    // Create div
     150    id = "mcWindow_" + name;
     151
     152    width = parseInt(features['width']);
     153    height = parseInt(features['height'])-12-19;
     154
     155    if (this.isMSIE)
     156        width -= 2;
     157
     158    // Setup first part of window
     159    win.id = id;
     160    win.url = url;
     161    win.name = name;
     162    win.features = features;
     163    this.windows[name] = win;
     164
     165    iframeWidth = width;
     166    iframeHeight = height;
     167
     168    // Create inner content
     169    html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
     170    html += '<html>';
     171    html += '<head>';
     172    html += '<title>Wrapper iframe</title>';
     173    html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
     174    html += '<link href="../jscripts/tiny_mce/themes/advanced/css/editor_ui.css" rel="stylesheet" type="text/css" />';
     175    html += '</head>';
     176    html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
     177
     178    html += '<div id="' + id + '_container" class="mceWindow">';
     179    html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
     180    html += '  <div id="' + id + '_title" class="mceWindowTitle"';
     181    html += '  onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;">No name window</div>';
     182    html += '    <div class="mceWindowHeadTools">';
     183    html += '      <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" onmousedown="return false;" class="mceWindowClose"><img border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_close.gif" /></a>';
     184//  html += '      <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" onmousedown="return false;" class="mceWindowMaximize"></a>';
     185//  html += '      <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" onmousedown="return false;" class="mceWindowMinimize"></a>';
     186    html += '    </div>';
     187    html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
     188    html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" onfocus="parent.mcWindows.windows[\'' + name + '\'].focus();" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe"></iframe></div>';
     189    html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
     190    html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_resize.gif" /></div>';
     191    html += '</div>';
     192    html += '</div>';
     193
     194    html += '</body>';
     195    html += '</html>';
     196
     197    // Create iframe
     198    this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
     199};
     200
     201// Gets called when wrapper iframe is initialized
     202MCWindows.prototype.onLoad = function(name) {
     203    var win = mcWindows.windows[name];
     204    var id = "mcWindow_" + name;
     205    var wrapperIframe = window.frames[id + "_iframe"].frames[0];
     206    var wrapperDoc = window.frames[id + "_iframe"].document;
     207    var doc = window.frames[id + "_iframe"].document;
     208    var winDiv = document.getElementById("mcWindow_" + name + "_div");
     209    var realIframe = window.frames[id + "_iframe"].frames[0];
     210
     211    // Set window data
     212    win.id = "mcWindow_" + name + "_iframe";
     213    win.winElement = winDiv;
     214    win.bodyElement = doc.getElementById(id + '_body');
     215    win.iframeElement = doc.getElementById(id + '_iframe');
     216    win.headElement = doc.getElementById(id + '_head');
     217    win.titleElement = doc.getElementById(id + '_title');
     218    win.resizeElement = doc.getElementById(id + '_resize');
     219    win.containerElement = doc.getElementById(id + '_container');
     220    win.left = win.features['left'];
     221    win.top = win.features['top'];
     222    win.frame = window.frames[id + '_iframe'].frames[0];
     223    win.wrapperFrame = window.frames[id + '_iframe'];
     224    win.wrapperIFrameElement = document.getElementById(id + "_iframe");
     225
     226    // Add event handlers
     227    mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
     228    mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
     229
     230    if (mcWindows.isMSIE) {
     231        mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
     232        mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
     233    } else {
     234        mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
     235        mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
     236        mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
     237    }
     238
     239    for (var i=0; i<window.frames.length; i++) {
     240        if (!window.frames[i]._hasMouseHandlers) {
     241            if (mcWindows.isMSIE) {
     242                mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
     243                mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
     244            } else {
     245                mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
     246                mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
     247            }
     248
     249            window.frames[i]._hasMouseHandlers = true;
     250        }
     251    }
     252
     253    if (mcWindows.isMSIE) {
     254        mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
     255        mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
     256    } else {
     257        mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
     258        mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
     259        mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
     260    }
     261
     262    this.selectedWindow = win;
     263};
     264
     265MCWindows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
     266    var iframe = document.createElement("iframe");
     267    var div = document.createElement("div");
     268
     269    width = parseInt(width);
     270    height = parseInt(height)+1;
     271
     272    // Create wrapper div
     273    div.setAttribute("id", id_prefix + "_div");
     274    div.setAttribute("width", width);
     275    div.setAttribute("height", (height));
     276    div.style.position = "absolute";
     277    div.style.left = left + "px";
     278    div.style.top = top + "px";
     279    div.style.width = width + "px";
     280    div.style.height = (height) + "px";
     281    div.style.backgroundColor = "white";
     282    div.style.display = "none";
     283
     284    if (this.isGecko) {
     285        iframeWidth = width + 2;
     286        iframeHeight = height + 2;
     287    } else {
     288        iframeWidth = width;
     289        iframeHeight = height + 1;
     290    }
     291
     292    // Create iframe
     293    iframe.setAttribute("id", id_prefix + "_iframe");
     294    iframe.setAttribute("name", id_prefix + "_iframe");
     295    iframe.setAttribute("border", "0");
     296    iframe.setAttribute("frameBorder", "0");
     297    iframe.setAttribute("marginWidth", "0");
     298    iframe.setAttribute("marginHeight", "0");
     299    iframe.setAttribute("leftMargin", "0");
     300    iframe.setAttribute("topMargin", "0");
     301    iframe.setAttribute("width", iframeWidth);
     302    iframe.setAttribute("height", iframeHeight);
     303//  iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
     304    // iframe.setAttribute("allowtransparency", "false");
     305    iframe.setAttribute("scrolling", "no");
     306    iframe.style.width = iframeWidth + "px";
     307    iframe.style.height = iframeHeight + "px";
     308    iframe.style.backgroundColor = "white";
     309    div.appendChild(iframe);
     310
     311    document.body.appendChild(div);
     312
     313    // Fixed MSIE 5.0 issue
     314    div.innerHTML = div.innerHTML;
     315
     316    if (this.isSafari) {
     317        // Give Safari some time to setup
     318        window.setTimeout(function() {
     319            doc = window.frames[id_prefix + '_iframe'].document;
     320            doc.open();
     321            doc.write(html);
     322            doc.close();
     323        }, 10);
     324    } else {
     325        doc = window.frames[id_prefix + '_iframe'].window.document
     326        doc.open();
     327        doc.write(html);
     328        doc.close();
     329    }
     330
     331    div.style.display = "block";
     332
     333    return div;
     334};
     335
     336// Window instance
     337function MCWindow() {
     338};
     339
     340MCWindow.prototype.focus = function() {
     341    this.winElement.style.zIndex = mcWindows.zindex++;
     342    mcWindows.selectedWindow = this;
     343};
     344
     345MCWindow.prototype.minimize = function() {
     346};
     347
     348MCWindow.prototype.maximize = function() {
     349   
     350};
     351
     352MCWindow.prototype.startResize = function() {
     353    mcWindows.action = "resize";
     354};
     355
     356MCWindow.prototype.startMove = function(e) {
     357    mcWindows.action = "move";
     358};
     359
     360MCWindow.prototype.close = function() {
     361    document.body.removeChild(this.winElement);
     362    mcWindows.windows[this.name] = null;
     363};
     364
     365MCWindow.prototype.onMouseMove = function(e) {
     366    var scrollX = 0;//this.doc.body.scrollLeft;
     367    var scrollY = 0;//this.doc.body.scrollTop;
     368
     369    // Calculate real X, Y
     370    var dx = e.screenX - mcWindows.mouseDownScreenX;
     371    var dy = e.screenY - mcWindows.mouseDownScreenY;
     372
     373    switch (mcWindows.action) {
     374        case "resize":
     375            width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX);
     376            height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY);
     377
     378            width = width < 100 ? 100 : width;
     379            height = height < 100 ? 100 : height;
     380
     381            this.wrapperIFrameElement.style.width = width+2;
     382            this.wrapperIFrameElement.style.height = height+2;
     383            this.wrapperIFrameElement.width = width+2;
     384            this.wrapperIFrameElement.height = height+2;
     385            this.winElement.style.width = width;
     386            this.winElement.style.height = height;
     387
     388            height = height-12-19;
     389
     390            this.containerElement.style.width = width;
     391
     392            this.iframeElement.style.width = width;
     393            this.iframeElement.style.height = height;
     394            this.bodyElement.style.width = width;
     395            this.bodyElement.style.height = height;
     396            this.headElement.style.width = width;
     397            //this.statusElement.style.width = width;
     398
     399            mcWindows.cancelEvent(e);
     400            break;
     401
     402        case "move":
     403            this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
     404            this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
     405            this.winElement.style.left = this.left + "px";
     406            this.winElement.style.top = this.top + "px";
     407
     408            mcWindows.cancelEvent(e);
     409            break;
     410    }
     411};
     412
     413MCWindow.prototype.onMouseUp = function(e) {
     414    mcWindows.action = "none";
     415};
     416
     417MCWindow.prototype.onFocus = function(e) {
     418    // Gecko only handler
     419    var winRef = e.currentTarget;
     420
     421    for (var n in mcWindows.windows) {
     422        var win = mcWindows.windows[n];
     423        if (typeof(win) == 'function')
     424            continue;
     425
     426        if (winRef.name == win.id) {
     427            win.focus();
     428            return;
     429        }
     430    }
     431};
     432
     433MCWindow.prototype.onMouseDown = function(e) {
     434    var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
     435
     436    var scrollX = 0;//this.doc.body.scrollLeft;
     437    var scrollY = 0;//this.doc.body.scrollTop;
     438
     439    mcWindows.mouseDownScreenX = e.screenX;
     440    mcWindows.mouseDownScreenY = e.screenY;
     441    mcWindows.mouseDownLayerX = this.left;
     442    mcWindows.mouseDownLayerY = this.top;
     443    mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
     444    mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
     445
     446    if (elm == this.resizeElement.firstChild)
     447        this.startResize(e);
     448    else
     449        this.startMove(e);
     450
     451    mcWindows.cancelEvent(e);
     452};
     453
     454// Global instance
     455var mcWindows = new MCWindows();
  • trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js

    r3517 r3664  
    11/* Import plugin specific language pack */
    2 tinyMCE.importPluginLanguagePack('wordpress', '');
    3 
    4 function TinyMCE_wordpress_initInstance(inst) {
    5     if (!tinyMCE.settings['wordpress_skip_plugin_css'])
    6         tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/wordpress/wordpress.css");
    7 }
    8 
    9 function TinyMCE_wordpress_getControlHTML(control_name) {
    10     switch (control_name) {
    11         case "wordpress":
    12             var titleMore = tinyMCE.getLang('lang_wordpress_more_button');
    13             var titlePage = tinyMCE.getLang('lang_wordpress_page_button');
    14             var titleHelp = tinyMCE.getLang('lang_wordpress_help_button');
    15             var buttons = '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\');return false;"><img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="'+titleMore+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
    16             // Add this to the buttons var to put the Page button into the toolbar.
    17             // '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\')" target="_self" onclick="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\');return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="'+titlePage+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
    18             return buttons;
    19     }
    20 
    21     return '';
    22 }
    23 
    24 function TinyMCE_wordpress_parseAttributes(attribute_string) {
    25     var attributeName = "";
    26     var attributeValue = "";
    27     var withInName;
    28     var withInValue;
    29     var attributes = new Array();
    30     var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
    31     var titleText = tinyMCE.getLang('lang_wordpress_more');
    32     var titleTextPage = tinyMCE.getLang('lang_wordpress_page');
    33 
    34     if (attribute_string == null || attribute_string.length < 2)
    35         return null;
    36 
    37     withInName = withInValue = false;
    38 
    39     for (var i=0; i<attribute_string.length; i++) {
    40         var chr = attribute_string.charAt(i);
    41 
    42         if ((chr == '"' || chr == "'") && !withInValue)
    43             withInValue = true;
    44         else if ((chr == '"' || chr == "'") && withInValue) {
    45             withInValue = false;
    46 
    47             var pos = attributeName.lastIndexOf(' ');
    48             if (pos != -1)
    49                 attributeName = attributeName.substring(pos+1);
    50 
    51             attributes[attributeName.toLowerCase()] = attributeValue.substring(1).toLowerCase();
    52 
    53             attributeName = "";
    54             attributeValue = "";
    55         } else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
    56             withInName = true;
    57 
    58         if (chr == '=' && withInName)
    59             withInName = false;
    60 
    61         if (withInName)
    62             attributeName += chr;
    63 
    64         if (withInValue)
    65             attributeValue += chr;
    66     }
    67 
    68     return attributes;
    69 }
    70 
    71 function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interface, value) {
    72     var inst = tinyMCE.getInstanceById(editor_id);
    73     var focusElm = inst.getFocusElement();
    74     var doc = inst.getDoc();
    75 
    76     function getAttrib(elm, name) {
    77         return elm.getAttribute(name) ? elm.getAttribute(name) : "";
    78     }
    79 
    80     // Handle commands
    81     switch (command) {
    82             case "mcewordpressmore":
     2tinyMCE.importPluginLanguagePack('wordpress', 'en');
     3
     4var TinyMCE_wordpressPlugin = {
     5    getInfo : function() {
     6        return {
     7            longname : 'WordPress Plugin',
     8            author : 'WordPress',
     9            authorurl : 'http://wordpress.org',
     10            infourl : 'http://wordpress.org',
     11            version : '1'
     12        };
     13    },
     14
     15    getControlHTML : function(control_name) {
     16        switch (control_name) {
     17            case "wp_more":
     18                return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_more_button', '{$pluginurl}/images/more.gif', 'wpMore');
     19            case "wp_page":
     20                return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_page_button', '{$pluginurl}/images/page.gif', 'wpPage');
     21            case "wp_help":
     22                var buttons = tinyMCE.getButtonHTML(control_name, 'lang_help_button_title', '{$pluginurl}/images/help.gif', 'wpHelp');
     23                var hiddenControls = '<div class="zerosize">'
     24                + '<input type="button" accesskey="n" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSpellCheck\',false);" />'
     25                + '<input type="button" accesskey="k" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Strikethrough\',false);" />'
     26                + '<input type="button" accesskey="l" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertUnorderedList\',false);" />'
     27                + '<input type="button" accesskey="o" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertOrderedList\',false);" />'
     28                + '<input type="button" accesskey="w" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Outdent\',false);" />'
     29                + '<input type="button" accesskey="q" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Indent\',false);" />'
     30                + '<input type="button" accesskey="f" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyLeft\',false);" />'
     31                + '<input type="button" accesskey="c" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyCenter\',false);" />'
     32                + '<input type="button" accesskey="r" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyRight\',false);" />'
     33                + '<input type="button" accesskey="j" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyFull\',false);" />'
     34                + '<input type="button" accesskey="a" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceLink\',true);" />'
     35                + '<input type="button" accesskey="s" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'unlink\',false);" />'
     36                + '<input type="button" accesskey="m" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceImage\',true);" />'
     37                + '<input type="button" accesskey="t" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpMore\');" />'
     38                + '<input type="button" accesskey="g" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpPage\');" />'
     39                + '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />'
     40                + '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />'
     41                + '<input type="button" accesskey="e" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceCodeEditor\',false);" />'
     42                + '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpHelp\',false);" />'
     43                + '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpAdv\',false);" />'
     44                + '</div>';
     45                return buttons+hiddenControls;
     46            case "wp_adv":
     47                return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_adv_button', '{$pluginurl}/images/toolbars.gif', 'wpAdv');
     48            case "wp_adv_start":
     49                return '<div id="wpadvbar" style="display:none;"><br />';
     50            case "wp_adv_end":
     51                return '</div>';
     52        }
     53        return '';
     54    },
     55
     56    execCommand : function(editor_id, element, command, user_interface, value) {
     57        var inst = tinyMCE.getInstanceById(editor_id);
     58        var focusElm = inst.getFocusElement();
     59        var doc = inst.getDoc();
     60
     61        function getAttrib(elm, name) {
     62            return elm.getAttribute(name) ? elm.getAttribute(name) : "";
     63        }
     64
     65        // Handle commands
     66        switch (command) {
     67            case "wpMore":
    8368                var flag = "";
    8469                var template = new Array();
     
    9984                    + ' width="100%" height="10px" '
    10085                    + 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
    101                 tinyMCE.execCommand("mceInsertContent",true,html);
     86                tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false, html);
    10287                tinyMCE.selectedInstance.repaint();
    10388                return true;
    104             case "mcewordpresspage":
     89
     90            case "wpPage":
    10591                var flag = "";
    10692                var template = new Array();
     
    124110                tinyMCE.selectedInstance.repaint();
    125111                return true;
     112
     113            case "wpHelp":
     114                var template = new Array();
     115
     116                template['file']   = tinyMCE.baseURL + '/wp-mce-help.php';
     117                template['width']  = 480;
     118                template['height'] = 380;
     119
     120                args = {
     121                    resizable : 'yes',
     122                    scrollbars : 'yes'
     123                };
     124
     125                tinyMCE.openWindow(template, args);
     126                return true;
     127            case "wpAdv":
     128                var adv = document.getElementById('wpadvbar');
     129                if ( adv.style.display == 'none' ) {
     130                    adv.style.display = 'block';
     131                    tinyMCE.switchClass(editor_id + '_wp_adv', 'mceButtonSelected');
     132                } else {
     133                    adv.style.display = 'none';
     134                    tinyMCE.switchClass(editor_id + '_wp_adv', 'mceButtonNormal');
     135                }
     136                return true;
     137        }
     138
     139        // Pass to next handler in chain
     140        return false;
     141    },
     142
     143    cleanup : function(type, content) {
     144        switch (type) {
     145
     146            case "insert_to_editor":
     147                var startPos = 0;
     148                var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
     149                var altPage = tinyMCE.getLang('lang_wordpress_page_alt');
     150
     151                // Parse all <!--more--> tags and replace them with images
     152                while ((startPos = content.indexOf('<!--more-->', startPos)) != -1) {
     153                    // Insert image
     154                    var contentAfter = content.substring(startPos + 11);
     155                    content = content.substring(0, startPos);
     156                    content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
     157                    content += ' width="100%" height="10px" ';
     158                    content += 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
     159                    content += contentAfter;
     160
     161                    startPos++;
     162                }
     163                var startPos = 0;
     164
     165                // Parse all <!--page--> tags and replace them with images
     166                while ((startPos = content.indexOf('<!--nextpage-->', startPos)) != -1) {
     167                    // Insert image
     168                    var contentAfter = content.substring(startPos + 15);
     169                    content = content.substring(0, startPos);
     170                    content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
     171                    content += ' width="100%" height="10px" ';
     172                    content += 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
     173                    content += contentAfter;
     174
     175                    startPos++;
     176                }
     177
     178                // Look for \n in <pre>, replace with <br>
     179                var startPos = -1;
     180                while ((startPos = content.indexOf('<pre', startPos+1)) != -1) {
     181                    var endPos = content.indexOf('</pre>', startPos+1);
     182                    var innerPos = content.indexOf('>', startPos+1);
     183                    var chunkBefore = content.substring(0, innerPos);
     184                    var chunkAfter = content.substring(endPos);
     185                   
     186                    var innards = content.substring(innerPos, endPos);
     187                    innards = innards.replace(/\n/g, '<br />');
     188                    content = chunkBefore + innards + chunkAfter;
     189                }
     190
     191                break;
     192
     193            case "get_from_editor":
     194                // Parse all img tags and replace them with <!--more-->
     195                var startPos = -1;
     196                while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
     197                    var endPos = content.indexOf('/>', startPos);
     198                    var attribs = this._parseAttributes(content.substring(startPos + 4, endPos));
     199
     200                    if (attribs['class'] == "mce_plugin_wordpress_more" || attribs['name'] == "mce_plugin_wordpress_more") {
     201                        endPos += 2;
     202
     203                        var embedHTML = '<!--more-->';
     204
     205                        // Insert embed/object chunk
     206                        chunkBefore = content.substring(0, startPos);
     207                        chunkAfter = content.substring(endPos);
     208                        content = chunkBefore + embedHTML + chunkAfter;
     209                    }
     210                    if (attribs['class'] == "mce_plugin_wordpress_page" || attribs['name'] == "mce_plugin_wordpress_page") {
     211                        endPos += 2;
     212
     213                        var embedHTML = '<!--nextpage-->';
     214
     215                        // Insert embed/object chunk
     216                        chunkBefore = content.substring(0, startPos);
     217                        chunkAfter = content.substring(endPos);
     218                        content = chunkBefore + embedHTML + chunkAfter;
     219                    }
     220                }
     221
     222                // Remove normal line breaks
     223                content = content.replace(/\n|\r/g, ' ');
     224
     225                // Look for <br> in <pre>, replace with \n
     226                var startPos = -1;
     227                while ((startPos = content.indexOf('<pre', startPos+1)) != -1) {
     228                    var endPos = content.indexOf('</pre>', startPos+1);
     229                    var innerPos = content.indexOf('>', startPos+1);
     230                    var chunkBefore = content.substring(0, innerPos);
     231                    var chunkAfter = content.substring(endPos);
     232                   
     233                    var innards = content.substring(innerPos, endPos);
     234                    innards = innards.replace(new RegExp('<br\\s?/?>', 'g'), '\n');
     235                    innards = innards.replace(new RegExp('\\s$', ''), '');
     236                    content = chunkBefore + innards + chunkAfter;
     237                }
     238
     239                // Remove anonymous, empty paragraphs.
     240                content = content.replace(new RegExp('<p>(\\s|&nbsp;)*</p>', 'mg'), '');
     241   
     242                // Handle table badness.
     243                content = content.replace(new RegExp('<(table( [^>]*)?)>.*?<((tr|thead)( [^>]*)?)>', 'mg'), '<$1><$3>');
     244                content = content.replace(new RegExp('<(tr|thead|tfoot)>.*?<((td|th)( [^>]*)?)>', 'mg'), '<$1><$2>');
     245                content = content.replace(new RegExp('</(td|th)>.*?<(td( [^>]*)?|th( [^>]*)?|/tr|/thead|/tfoot)>', 'mg'), '</$1><$2>');
     246                content = content.replace(new RegExp('</tr>.*?<(tr|/table)>', 'mg'), '</tr><$1>');
     247                content = content.replace(new RegExp('<(/?(table|tbody|tr|th|td)[^>]*)>(\\s*|(<br ?/?>)*)*', 'g'), '<$1>');
     248   
     249                // Pretty it up for the source editor.
     250                var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre|p';
     251                content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
     252                content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)>\\s*', 'mg'), '\n<$1>');
     253                content = content.replace(new RegExp('<((li|/?tr|/?thead|/?tfoot)( [^>]*)?)>', 'g'), '\t<$1>');
     254                content = content.replace(new RegExp('<((td|th)( [^>]*)?)>', 'g'), '\t\t<$1>');
     255                content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n');
     256                content = content.replace(new RegExp('^\\s*', ''), '');
     257                content = content.replace(new RegExp('\\s*$', ''), '');
     258
     259                break;
     260        }
     261
     262        // Pass through to next handler in chain
     263        return content;
     264    },
     265
     266    handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
     267
     268        tinyMCE.switchClass(editor_id + '_wp_more', 'mceButtonNormal');
     269        tinyMCE.switchClass(editor_id + '_wp_page', 'mceButtonNormal');
     270
     271        if (node == null)
     272            return;
     273
     274        do {
     275            if (node.nodeName.toLowerCase() == "img" && tinyMCE.getAttrib(node, 'class').indexOf('mce_plugin_wordpress_more') == 0)
     276                tinyMCE.switchClass(editor_id + '_wp_more', 'mceButtonSelected');
     277            if (node.nodeName.toLowerCase() == "img" && tinyMCE.getAttrib(node, 'class').indexOf('mce_plugin_wordpress_page') == 0)
     278                tinyMCE.switchClass(editor_id + '_wp_page', 'mceButtonSelected');
     279        } while ((node = node.parentNode));
     280
     281        return true;
     282    },
     283
     284    saveCallback : function(el, content, body) {
     285        // We have a TON of cleanup to do.
     286
     287        // Mark </p> if it has any attributes.
     288        content = content.replace(new RegExp('(<p[^>]+>.*?)</p>', 'mg'), '$1</p#>');
     289
     290        // Decode the ampersands of time.
     291        // content = content.replace(new RegExp('&amp;', 'g'), '&');
     292
     293        // Get it ready for wpautop.
     294        content = content.replace(new RegExp('[\\s]*<p>[\\s]*', 'mgi'), '');
     295        content = content.replace(new RegExp('[\\s]*</p>[\\s]*', 'mgi'), '\n\n');
     296        content = content.replace(new RegExp('\\n\\s*\\n\\s*\\n*', 'mgi'), '\n\n');
     297        content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
     298
     299        // Fix some block element newline issues
     300        var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre';
     301        content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
     302        content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
     303        content = content.replace(new RegExp('<li>', 'g'), '\t<li>');
     304
     305        // Unmark special paragraph closing tags
     306        content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
     307        content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1');
     308
     309        // Trim any whitespace
     310        content = content.replace(new RegExp('^\\s*', ''), '');
     311        content = content.replace(new RegExp('\\s*$', ''), '');
     312
     313        // Hope.
     314        return content;
     315
     316    },
     317
     318    _parseAttributes : function(attribute_string) {
     319        var attributeName = "";
     320        var attributeValue = "";
     321        var withInName;
     322        var withInValue;
     323        var attributes = new Array();
     324        var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
     325        var titleText = tinyMCE.getLang('lang_wordpress_more');
     326        var titleTextPage = tinyMCE.getLang('lang_wordpress_page');
     327
     328        if (attribute_string == null || attribute_string.length < 2)
     329            return null;
     330
     331        withInName = withInValue = false;
     332
     333        for (var i=0; i<attribute_string.length; i++) {
     334            var chr = attribute_string.charAt(i);
     335
     336            if ((chr == '"' || chr == "'") && !withInValue)
     337                withInValue = true;
     338            else if ((chr == '"' || chr == "'") && withInValue) {
     339                withInValue = false;
     340
     341                var pos = attributeName.lastIndexOf(' ');
     342                if (pos != -1)
     343                    attributeName = attributeName.substring(pos+1);
     344
     345                attributes[attributeName.toLowerCase()] = attributeValue.substring(1).toLowerCase();
     346
     347                attributeName = "";
     348                attributeValue = "";
     349            } else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
     350                withInName = true;
     351
     352            if (chr == '=' && withInName)
     353                withInName = false;
     354
     355            if (withInName)
     356                attributeName += chr;
     357
     358            if (withInValue)
     359                attributeValue += chr;
     360        }
     361
     362        return attributes;
    126363    }
    127 
    128     // Pass to next handler in chain
    129     return false;
    130 }
    131 
    132 function TinyMCE_wordpress_cleanup(type, content) {
    133     switch (type) {
    134 
    135         case "insert_to_editor":
    136             var startPos = 0;
    137             var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
    138             var altPage = tinyMCE.getLang('lang_wordpress_page_alt');
    139 
    140             // Parse all <!--more--> tags and replace them with images
    141             while ((startPos = content.indexOf('<!--more-->', startPos)) != -1) {
    142                 // Insert image
    143                 var contentAfter = content.substring(startPos + 11);
    144                 content = content.substring(0, startPos);
    145                 content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
    146                 content += ' width="100%" height="10px" ';
    147                 content += 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" />';
    148                 content += contentAfter;
    149 
    150                 startPos++;
    151             }
    152             var startPos = 0;
    153 
    154             // Parse all <!--page--> tags and replace them with images
    155             while ((startPos = content.indexOf('<!--nextpage-->', startPos)) != -1) {
    156                 // Insert image
    157                 var contentAfter = content.substring(startPos + 15);
    158                 content = content.substring(0, startPos);
    159                 content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
    160                 content += ' width="100%" height="10px" ';
    161                 content += 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" />';
    162                 content += contentAfter;
    163 
    164                 startPos++;
    165             }
    166 
    167             // It's supposed to be WYSIWYG, right?
    168             content = content.replace(new RegExp('&', 'g'), '&amp;');
    169 
    170             break;
    171 
    172         case "get_from_editor":
    173             // Parse all img tags and replace them with <!--more-->
    174             var startPos = -1;
    175             while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
    176                 var endPos = content.indexOf('/>', startPos);
    177                 var attribs = TinyMCE_wordpress_parseAttributes(content.substring(startPos + 4, endPos));
    178 
    179                 if (attribs['class'] == "mce_plugin_wordpress_more") {
    180                     endPos += 2;
    181 
    182                     var embedHTML = '<!--more-->';
    183 
    184                     // Insert embed/object chunk
    185                     chunkBefore = content.substring(0, startPos);
    186                     chunkAfter = content.substring(endPos);
    187                     content = chunkBefore + embedHTML + chunkAfter;
    188                 }
    189                 if (attribs['class'] == "mce_plugin_wordpress_page") {
    190                     endPos += 2;
    191 
    192                     var embedHTML = '<!--nextpage-->';
    193 
    194                     // Insert embed/object chunk
    195                     chunkBefore = content.substring(0, startPos);
    196                     chunkAfter = content.substring(endPos);
    197                     content = chunkBefore + embedHTML + chunkAfter;
    198                 }
    199             }
    200 
    201             // If it says & in the WYSIWYG editor, it should say &amp; in the html.
    202             content = content.replace(new RegExp('&', 'g'), '&amp;');
    203             content = content.replace(new RegExp('&amp;nbsp;', 'g'), '&nbsp;');
    204 
    205             // Remove anonymous, empty paragraphs.
    206             content = content.replace(new RegExp('<p>(\\s|&nbsp;)*</p>', 'mg'), '');
    207 
    208             // Handle table badness.
    209             content = content.replace(new RegExp('<(table( [^>]*)?)>.*?<((tr|thead)( [^>]*)?)>', 'mg'), '<$1><$3>');
    210             content = content.replace(new RegExp('<(tr|thead|tfoot)>.*?<((td|th)( [^>]*)?)>', 'mg'), '<$1><$2>');
    211             content = content.replace(new RegExp('</(td|th)>.*?<(td( [^>]*)?|th( [^>]*)?|/tr|/thead|/tfoot)>', 'mg'), '</$1><$2>');
    212             content = content.replace(new RegExp('</tr>.*?<(tr|/table)>', 'mg'), '</tr><$1>');
    213             content = content.replace(new RegExp('<(/?(table|tbody|tr|th|td)[^>]*)>(\\s*|(<br ?/?>)*)*', 'g'), '<$1>');
    214 
    215             // Pretty it up for the source editor.
    216             var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre|p';
    217             content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
    218             content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)>\\s*', 'mg'), '\n<$1>');
    219             content = content.replace(new RegExp('<((li|/?tr|/?thead|/?tfoot)( [^>]*)?)>', 'g'), '\t<$1>');
    220             content = content.replace(new RegExp('<((td|th)( [^>]*)?)>', 'g'), '\t\t<$1>');
    221             content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n');
    222             content = content.replace(new RegExp('^\\s*', ''), '');
    223             content = content.replace(new RegExp('\\s*$', ''), '');
    224 
    225             break;
     364};
     365
     366tinyMCE.addPlugin("wordpress", TinyMCE_wordpressPlugin);
     367
     368/* This little hack protects our More and Page placeholders from the removeformat command */
     369tinyMCE.orgExecCommand = tinyMCE.execCommand;
     370tinyMCE.execCommand = function (command, user_interface, value) {
     371    re = this.orgExecCommand(command, user_interface, value);
     372
     373    if ( command == 'removeformat' ) {
     374        var inst = tinyMCE.getInstanceById('mce_editor_0');
     375        doc = inst.getDoc();
     376        var imgs = doc.getElementsByTagName('img');
     377        for (i=0;img=imgs[i];i++)
     378            img.className = img.name;
    226379    }
    227 
    228     // Pass through to next handler in chain
    229     return content;
    230 }
    231 
    232 function TinyMCE_wordpress_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
    233     function getAttrib(elm, name) {
    234         return elm.getAttribute(name) ? elm.getAttribute(name) : "";
    235     }
    236 
    237     tinyMCE.switchClassSticky(editor_id + '_wordpress_more', 'mceButtonNormal');
    238     tinyMCE.switchClassSticky(editor_id + '_wordpress_page', 'mceButtonNormal');
    239 
    240     if (node == null)
    241         return;
    242 
    243     do {
    244         if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'class').indexOf('mce_plugin_wordpress_more') == 0)
    245             tinyMCE.switchClassSticky(editor_id + '_wordpress_more', 'mceButtonSelected');
    246         if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'class').indexOf('mce_plugin_wordpress_page') == 0)
    247             tinyMCE.switchClassSticky(editor_id + '_wordpress_page', 'mceButtonSelected');
    248     } while ((node = node.parentNode));
    249 
    250     return true;
    251 }
    252 
    253 function wp_save_callback(el, content, body) {
    254     // We have a TON of cleanup to do.
    255 
    256     // Mark </p> if it has any attributes.
    257     content = content.replace(new RegExp('(<p[^>]+>.*?)</p>', 'mg'), '$1</p#>');
    258 
    259     // Decode the ampersands of time.
    260     content = content.replace(new RegExp('&amp;', 'g'), '&');
    261 
    262     // Get it ready for wpautop.
    263     content = content.replace(new RegExp('[\\s]*<p>[\\s]*', 'mgi'), '');
    264     content = content.replace(new RegExp('[\\s]*</p>[\\s]*', 'mgi'), '\n\n');
    265     content = content.replace(new RegExp('\\n\\s*\\n\\s*\\n*', 'mgi'), '\n\n');
    266     content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
    267 
    268     // Fix some block element newline issues
    269     var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre';
    270     content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
    271     content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
    272     content = content.replace(new RegExp('<li>', 'g'), '\t<li>');
    273 
    274     // Unmark special paragraph closing tags
    275     content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
    276     content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1');
    277 
    278     // Trim any whitespace
    279     content = content.replace(new RegExp('^\\s*', ''), '');
    280     content = content.replace(new RegExp('\\s*$', ''), '');
    281 
    282     // Hope.
    283     return content;
    284 
    285 }
     380    return re;
     381};
     382
     383tinyMCE.orgFixGeckoBaseHREFBug = tinyMCE.fixGeckoBaseHREFBug;
     384tinyMCE.fixGeckoBaseHREFBug = function(m, e, h) {
     385    if ( tinyMCE.isGecko && m == 1 )
     386        h = h.replace(new RegExp('<((a|img|select|area|iframe|base|input|script|embed|object|link)\\s([^>]*\\s)?)(src|href)\\s*=', 'gi'), '<$1 x$4=');
     387    else
     388        h = tinyMCE.orgFixGeckoBaseHREFBug(m, e, h);
     389
     390    return h;
     391};
     392
     393tinyMCE.orgStoreAwayURLs = tinyMCE.storeAwayURLs;
     394tinyMCE.storeAwayURLs = function(s) {
     395        // Remove all mce_src, mce_href and replace them with new ones
     396        s = s.replace(new RegExp('mce_(href|src)\\s*=\\s*\"[^ >\"]*\"', 'gi'), '');
     397        s = s.replace(new RegExp('<((a|img|select|area|iframe|base|input|script|embed|object|link)\\s([^>]*\\s)?)(src|href)\\s*=\\s*"([^"]*)"', 'gi'), '<$1 $4="$5" mce_$4="$5"');
     398
     399        return s;
     400};
  • trunk/wp-includes/js/tinymce/plugins/wordpress/langs/en.js

    r3569 r3664  
    1010
    1111tinyMCE.addToLang('',{
    12 wordpress_more_button : 'Split post with More tag (' + metaKey + '-t)',
     12wordpress_more_button : 'Split post with More tag (' + metaKey + '+t)',
    1313wordpress_page_button : 'Split post with Page tag',
     14wordpress_adv_button : 'Show/Hide Advanced Toolbar (' + metaKey + '+b)',
    1415wordpress_more_alt : 'More...',
    15 wordpress_page_alt : '...page...'
     16wordpress_page_alt : '...page...',
     17help_button_title : 'Help (' + metaKey + '+h)',
     18bold_desc : 'Bold (Ctrl+B)',
     19italic_desc : 'Italic (Ctrl+I)',
     20underline_desc : 'Underline (Ctrl+U)',
     21link_desc : 'Insert/edit link (' + metaKey + '+a)',
     22unlink_desc : 'Unlink (' + metaKey + '+s)',
     23image_desc : 'Insert/edit image (' + metaKey + '+m)',
     24striketrough_desc : 'Strikethrough (' + metaKey + '+k)',
     25justifyleft_desc : 'Align left (' + metaKey + '+f)',
     26justifycenter_desc : 'Align center (' + metaKey + '+c)',
     27justifyright_desc : 'Align right (' + metaKey + '+r)',
     28justifyfull_desc : 'Align full (' + metaKey + '+j)',
     29bullist_desc : 'Unordered list (' + metaKey + '+l)',
     30numlist_desc : 'Ordered list (' + metaKey + '+o)',
     31outdent_desc : 'Outdent (' + metaKey + '+w)',
     32indent_desc : 'Indent List/Blockquote (' + metaKey + '+q)'
    1633});
  • trunk/wp-includes/js/tinymce/plugins/wordpress/wordpress.css

    r2820 r3664  
    2020    background-position: right top;
    2121}
     22
     23/* This file contains the CSS data for the editable area(iframe) of TinyMCE */
     24/* You can extend this CSS by adding your own CSS file with the the content_css option */
     25
     26body {
     27    font-family: Verdana, Arial, Helvetica, sans-serif;
     28    font-size: 0.9em;
     29    line-height: 1.2em;
     30    padding: .3em;
     31    background-color: #FFFFFF;
     32}
     33
     34td {
     35    font-size: 10px;
     36}
     37
     38pre {
     39    font-family: "Courier New", fixed;
     40    font-size: 11px;
     41    line-height: 13px;
     42}
     43
     44.mceVisualAid {
     45    border: 1px dashed #BBBBBB !important;
     46}
     47
     48.mceItemAnchor {
     49    width: 12px;
     50    line-height: 6px;
     51    overflow: hidden;
     52    padding-left: 12px;
     53    background-image: url('../images/anchor_symbol.gif');
     54    background-position: bottom;
     55    background-repeat: no-repeat;
     56}
     57
     58/* Important is needed in Gecko browsers inorder to style links */
     59/*
     60a {
     61    color: green !important;
     62}
     63*/
     64
     65/* Style selection range colors in Gecko browsers */
     66/*
     67::-moz-selection {
     68    background-color: red;
     69    color: green;
     70}
     71*/
     72
     73/* MSIE specific */
     74
     75* html body {
     76    scrollbar-3dlight-color: #F0F0EE;
     77    scrollbar-arrow-color: #676662;
     78    scrollbar-base-color: #F0F0EE;
     79    scrollbar-darkshadow-color: #DDDDDD;
     80    scrollbar-face-color: #E0E0DD;
     81    scrollbar-highlight-color: #F0F0EE;
     82    scrollbar-shadow-color: #F0F0EE;
     83    scrollbar-track-color: #F5F5F5;
     84}
  • trunk/wp-includes/js/tinymce/themes/advanced/about.htm

    r3062 r3664  
    55    <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
    66    <script language="javascript" type="text/javascript" src="jscripts/about.js"></script>
    7     <link href="css/dialog_about.css" rel="stylesheet" type="text/css" />
     7    <base target="_self" />
    88</head>
    99<body id="about" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
     
    2222                <p>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under <a href="../../license.txt" target="_blank">LGPL</a>
    2323                by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</p>
    24                 <p>Copyright &copy; 2005, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
     24                <p>Copyright &copy; 2003-2006, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
    2525                <p>For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.</p>
    2626
  • trunk/wp-includes/js/tinymce/themes/advanced/anchor.htm

    r3062 r3664  
    44    <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
    55    <script language="javascript" type="text/javascript" src="jscripts/anchor.js"></script>
     6    <base target="_self" />
    67</head>
    78<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
  • trunk/wp-includes/js/tinymce/themes/advanced/charmap.htm

    r3062 r3664  
    55    <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
    66    <script language="javascript" type="text/javascript" src="jscripts/charmap.js"></script>
     7    <base target="_self" />
    78</head>
    8 <body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
     9<body onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';document.getElementById('insert').focus();" style="display: none">
    910<table align="center" border="0" cellspacing="0" cellpadding="2">
    1011    <tr>
  • trunk/wp-includes/js/tinymce/themes/advanced/color_picker.htm

    r3062 r3664  
    44    <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
    55    <script language="javascript" type="text/javascript" src="jscripts/color_picker.js"></script>
     6    <base target="_self" />
    67</head>
    7 <body onload="tinyMCEPopup.executeOnLoad('init();');" marginheight="3" topmargin="3" leftmargin="3" marginwidth="3" style="display: none">
     8<body onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';document.getElementById('insert').focus();" style="margin: 3px; display: none">
    89    <div align="center">
    910       <script language="javascript" type="text/javascript">renderColorMap();</script>
  • trunk/wp-includes/js/tinymce/themes/advanced/css/editor_content.css

    r3015 r3664  
    22/* You can extend this CSS by adding your own CSS file with the the content_css option */
    33
    4 body {
    5     background-color: #FFFFFF;
    6     font-family: Verdana, Arial, Helvetica, sans-serif;
    7     font-size: 0.9em;
    8     line-height: 1.2em;
    9     padding: .3em;
    10 }
    11 
    12 td {
     4body, td, pre {
    135    font-family: Verdana, Arial, Helvetica, sans-serif;
    146    font-size: 10px;
    157}
    168
    17 pre {
    18     font-family: Verdana, Arial, Helvetica, sans-serif;
    19     font-size: 10px;
     9body {
     10    background-color: #FFFFFF;
    2011}
    2112
     
    4839}
    4940*/
     41
     42/* MSIE specific */
     43
     44* html body {
     45    scrollbar-3dlight-color: #F0F0EE;
     46    scrollbar-arrow-color: #676662;
     47    scrollbar-base-color: #F0F0EE;
     48    scrollbar-darkshadow-color: #DDDDDD;
     49    scrollbar-face-color: #E0E0DD;
     50    scrollbar-highlight-color: #F0F0EE;
     51    scrollbar-shadow-color: #F0F0EE;
     52    scrollbar-track-color: #F5F5F5;
     53}
  • trunk/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css

    r2916 r3664  
    3636
    3737.input_noborder {
    38     border: 0px solid #808080;
    39 }
    40 
    41 #insert {
     38    border: 0;
     39}
     40
     41#insert, .updateButton {
    4242   font-weight: bold;
    4343   width: 90px;
    4444   height: 21px;
    45    border: 0px;
     45   border: 0;
    4646   background-image: url('../images/insert_button_bg.gif');
    4747   cursor: pointer;
     
    5252   width: 90px;
    5353   height: 21px;
    54    border: 0px;
     54   border: 0;
    5555   background-image: url('../images/cancel_button_bg.gif');
    5656   cursor: pointer;
     
    8585td.charmapOver {
    8686    background-color: #CCCCCC;
    87     cursor: arrow;
     87    cursor: default;
    8888}
    8989
     
    121121    border-right: 1px solid;
    122122    border-color: #F0F0EE;
    123     cursor: arrow;
     123    cursor: default;
    124124}
    125125
    126126.mceButtonOver {
    127127    border: 1px solid #0A246A;
    128     cursor: arrow;
     128    cursor: default;
    129129    background-color: #B6BDD2;
    130130}
    131131
    132132.mceButtonDown {
    133     cursor: arrow;
     133    cursor: default;
    134134    border: 1px solid #0A246A;
    135135    background-color: #8592B5;
     
    145145    border-right: 1px solid;
    146146    border-color: #F0F0EE;
    147     cursor: arrow;
     147    cursor: default;
    148148}
    149149
     
    163163.tabs ul {
    164164    margin: 0;
    165     padding: 0px 0px 0;
     165    padding: 0 0 0;
    166166    list-style: none;
    167167}
     
    171171    background: url("../images/xp/tab_bg.gif") no-repeat left top;
    172172    margin: 0;
    173     margin-left: 0px;
     173    margin-left: 0;
    174174    margin-right: 2px;
    175175    padding: 0 0 0 10px;
     
    186186    display: block;
    187187    background: url("../images/xp/tab_end.gif") no-repeat right top;
    188     padding: 0px 10px 0px 0px;
     188    padding: 0px 10px 0 0;
    189189}
    190190
     
    236236    font-family: Verdana, Arial;
    237237    font-size: 10px;
    238     padding: 0px;
    239     margin: 0px;
     238    padding: 0;
     239    margin: 0;
    240240    padding: 4px;
    241241}
     
    296296h1, h2, h3, h4 {
    297297    color: #2B6FB6;
    298     margin: 0px;
    299     padding: 0px;
     298    margin: 0;
     299    padding: 0;
    300300    padding-top: 5px;
    301301}
     
    303303h3 {
    304304    font-size: 14px;
     305}
     306
     307#link .panel_wrapper, #link div.current {
     308    height: 125px;
     309}
     310
     311#image .panel_wrapper, #image div.current {
     312    height: 190px;
    305313}
    306314
     
    318326}
    319327*/
     328
     329/* Below this line is WordPress customizations */
     330#insert, #cancel, .submitbutton {
     331    font: 11px Verdana, Arial, Helvetica, sans-serif;
     332    height: auto;
     333    width: auto;
     334    background-color: transparent;
     335    background-image: url(../../../../../../wp-admin/images/fade-butt.png);
     336    background-repeat: repeat;
     337    border: 3px double;
     338    border-right-color: rgb(153, 153, 153);
     339    border-bottom-color: rgb(153, 153, 153);
     340    border-left-color: rgb(204, 204, 204);
     341    border-top-color: rgb(204, 204, 204);
     342    color: rgb(51, 51, 51);
     343    padding: 0.1em 0.5em;
     344}
     345
     346#insert:active, #cancel:active, .submitbutton:active {
     347    background: #f4f4f4;
     348    border-left-color: #999;
     349    border-top-color: #999;
     350}
     351
     352#styleSelectRow {
     353    display: none;
     354}
  • trunk/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css

    r2993 r3664  
    22
    33.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {
    4     border: 0px; margin: 0px; padding: 0px; background: transparent;
    5 }
    6 
    7 .mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceSeparatorLine, .mceButtonDisabled, .mceButtonSelected {
    8     border: 0px; margin: 0px; padding: 0px; background: transparent;
    9     margin-top: 1px;
    10     margin-left: 1px;
    11 }
    12 
    13 .mceButtonNormal {
    14     border-top: 1px solid;
    15     border-left: 1px solid;
    16     border-bottom: 1px solid;
    17     border-right: 1px solid;
    18     border-color: #F0F0EE;
    19     cursor: arrow;
    20 }
    21 
    22 .mceButtonOver {
    23     border: 1px solid #0A246A;
    24     cursor: arrow;
    25     background-color: #B6BDD2;
    26 }
    27 
    28 .mceButtonDown {
    29     cursor: arrow;
    30     border: 1px solid #0A246A;
    31     background-color: #8592B5;
    32 }
    33 
    34 .mceButtonSelected {
    35     border: 1px solid;
    36     border-color: #C0C0BB;
    37     cursor: arrow;
    38 }
    39 
    40 .mceButtonDisabled {
    41     filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
    42     -moz-opacity:0.3;
    43     opacity: 0.3;
    44     border-top: 1px solid;
    45     border-left: 1px solid;
    46     border-bottom: 1px solid;
    47     border-right: 1px solid;
    48     border-color: #F0F0EE;
    49     cursor: arrow;
    50 }
    51 
    52 .mceSeparator {
    53     border-top: 1px solid buttonhighlight;
    54     border-left: 1px solid buttonhighlight;
    55     border-bottom: 1px solid buttonshadow;
    56     border-right: 1px solid buttonshadow;
     4    border: 0; margin: 0; padding: 0; background: transparent;
     5}
     6
     7.mceSeparatorLine {
     8    border: 0;
     9    padding: 0;
     10    margin-left: 4px;
    5711    margin-right: 2px;
    58     margin-left: 2px;
    59 }
    60 
    61 .mceSeparatorLine {
    62     margin:2px;
    63     margin-left: 4px;
    64     background-color: #F0F0EE;
    65     border-top: 1px solid buttonshadow;
    66     border-left: 1px solid buttonshadow;
    67     border-bottom: 1px solid buttonhighlight;
    68     border-right: 1px solid buttonhighlight;
    69     width: 0px;
    70     height: 15px;
    7112}
    7213
    7314.mceSelectList {
    74     font-family: "MS Sans Serif";
    75     font-size: 7pt;
     15    font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
     16    font-size: 7pt !important;
    7617    font-weight: normal;
    7718    margin-top: 3px;
    78     padding: 0px;
     19    padding: 0;
    7920    display: inline;
    8021    vertical-align: top;
    81     background-color: #F0F0EE
     22    background-color: #F0F0EE;
    8223}
    8324
     
    9940    background: #F0F0EE;
    10041    border: 1px solid #cccccc;
    101     padding: 0px;
    102     margin: 0px;
     42    padding: 0;
     43    margin: 0;
    10344}
    10445
     
    10647    font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
    10748    background: #FFFFFF;
    108     padding: 0px;
    109     margin: 0px;
     49    padding: 0;
     50    margin: 0;
    11051}
    11152
     
    11859.mceToolbarTop {
    11960    border-bottom: 1px solid #cccccc;
     61    padding-bottom: 1px;
    12062}
    12163
     
    177119    display: none;
    178120    border: 1px dotted gray;
    179     margin: 0px;
    180     padding: 0px;
    181 }
     121    margin: 0;
     122    padding: 0;
     123}
     124
     125/* Button CSS rules */
     126
     127a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img {
     128    width: 20px;
     129    height: 20px;
     130    cursor: default;
     131    margin-top: 1px;
     132    margin-left: 1px;
     133}
     134
     135a.mceButtonDisabled img {
     136    border: 0 !important;
     137}
     138
     139a.mceButtonNormal img, a.mceButtonSelected img {
     140    border: 1px solid #F0F0EE !important;
     141}
     142
     143a.mceButtonSelected img {
     144    border: 1px solid #6779AA !important;
     145    background-color: #D4D5D8;
     146}
     147
     148a.mceButtonNormal img:hover, a.mceButtonSelected img:hover {
     149    border: 1px solid #0A246A !important;
     150    cursor: default;
     151    background-color: #B6BDD2;
     152}
     153
     154a.mceButtonDisabled img {
     155    -moz-opacity:0.3;
     156    opacity: 0.3;
     157    border: 1px solid #F0F0EE !important;
     158    cursor: default;
     159}
     160
     161a.mceTiledButton img {
     162    background-image: url('../images/buttons.gif');
     163    background-repeat: no-repeat;
     164}
     165
     166/* MSIE specific rules */
     167
     168* html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img {
     169    border: 0 !important;
     170    margin-top: 2px;
     171    margin-bottom: 1px;
     172}
     173
     174* html a.mceButtonDisabled img {
     175    filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
     176    border: 0 !important;
     177}
     178
     179* html a.mceButtonDisabled {
     180    border: 1px solid #F0F0EE !important;
     181}
     182
     183* html a.mceButtonNormal, * html a.mceButtonSelected {
     184    border: 1px solid #F0F0EE !important;
     185    cursor: default;
     186}
     187
     188* html a.mceButtonSelected {
     189    border: 1px solid #6779AA !important;
     190    background-color: #D4D5D8;
     191}
     192
     193* html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover {
     194    border: 1px solid #0A246A !important;
     195    cursor: default;
     196    background-color: #B6BDD2;
     197}
     198
     199* html .mceSelectList {
     200    margin-top: 2px;
     201}
     202
     203/* Menu button CSS rules */
     204
     205span.mceMenuButton img, span.mceMenuButtonSelected img {
     206    border: 1px solid #F0F0EE;
     207    margin-left: 1px;
     208}
     209
     210span.mceMenuButtonSelected img {
     211    border: 1px solid #6779AA;
     212    background-color: #B6BDD2;
     213}
     214
     215span.mceMenuButtonSelected img.mceMenuButton {
     216    border: 1px solid #F0F0EE;
     217    background-color: transparent;
     218}
     219
     220span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton {
     221    border-left: 0;
     222    margin-left: 0;
     223}
     224
     225span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img {
     226    border: 1px solid #0A246A;
     227    background-color: #B6BDD2;
     228}
     229
     230span.mceMenuButton:hover img.mceMenuButton, span.mceMenuButtonSelected:hover img.mceMenuButton {
     231    border-left: 0;
     232}
     233
     234span.mceMenuButtonFocus img {
     235    border: 1px solid gray;
     236    border-right: 0;
     237    margin-left: 1px;
     238    background-color: #F5F4F2;
     239}
     240
     241span.mceMenuButtonFocus img.mceMenuButton {
     242    border: 1px solid gray;
     243    border-left: 1px solid #F5F4F2;
     244    margin-left: 0;
     245}
     246
     247/* Menu button MSIE specific rules */
     248
     249* html span.mceMenuButton, * html span.mceMenuButtonFocus {
     250    position: relative;
     251    left: 0;
     252    top: 0;
     253}
     254
     255* html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {
     256    position: relative;
     257    top: 1px;
     258}
     259
     260* html span.mceMenuHover img {
     261    border: 1px solid #0A246A;
     262    background-color: #B6BDD2;
     263}
     264
     265* html span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {
     266    border: 1px solid #0A246A;
     267    background-color: #B6BDD2;
     268    border-left: 0;
     269}
     270
     271/* Menu */
     272
     273.mceMenu {
     274    position: absolute;
     275    left: 0;
     276    top: 0;
     277    display: none;
     278    z-index: 100;
     279    background-color: white;
     280    border: 1px solid gray;
     281    font-weight: normal;
     282}
     283
     284.mceMenu a, .mceMenuTitle, .mceMenuDisabled {
     285    display: block;
     286    width: 100%;
     287    text-decoration: none;
     288    background-color: white;
     289    font-family: Tahoma, Verdana, Arial, Helvetica;
     290    font-size: 11px;
     291    line-height: 20px;
     292    color: black;
     293}
     294
     295.mceMenu a:hover {
     296    background-color: #B6BDD2;
     297    color: black;
     298}
     299
     300.mceMenu span {
     301    padding-left: 10px;
     302    padding-right: 10px;
     303    display: block;
     304    line-height: 20px;
     305}
     306
     307.mceMenuSeparator {
     308    border-bottom: 1px solid gray;
     309    background-color: gray;
     310    height: 1px;
     311}
     312
     313.mceMenuTitle span {
     314    padding-left: 5px;
     315}
     316
     317.mceMenuTitle {
     318    background-color: #DDDDDD;
     319    font-weight: bold;
     320}
     321
     322.mceMenuDisabled {
     323    color: gray;
     324}
     325
     326span.mceMenuSelectedItem {
     327    background-image: url('../images/menu_check.gif');
     328    background-repeat: no-repeat;
     329    background-position: 5px 8px;
     330    padding-left: 20px;
     331}
     332
     333span.mceMenuCheckItem {
     334    padding-left: 20px;
     335}
     336
     337span.mceMenuLine {
     338    display: block;
     339    position: absolute;
     340    left: 0;
     341    top: -1px;
     342    background-color: #F5F4F2;
     343    width: 30px;
     344    height: 1px;
     345    overflow: hidden;
     346    padding-left: 0;
     347    padding-right: 0;
     348}
  • trunk/wp-includes/js/tinymce/themes/advanced/editor_template.js

    r3163 r3664  
     1/**
     2 * $RCSfile: editor_template_src.js,v $
     3 * $Revision: 1.93 $
     4 * $Date: 2006/03/14 17:33:50 $
     5 *
     6 * @author Moxiecode
     7 * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
     8 */
     9
    110/* Import theme specific language pack */
    2  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">\
    3         <option value="0">{$lang_theme_font_size}</option>\
    4         <option value="1">1 (8 pt)</option>\
    5         <option value="2">2 (10 pt)</option>\
    6         <option value="3">3 (12 pt)</option>\
    7         <option value="4">4 (14 pt)</option>\
    8         <option value="5">5 (18 pt)</option>\
    9         <option value="6">6 (24 pt)</option>\
    10         <option value="7">7 (36 pt)</option>\
    11         </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">\
    12                                                 <span id="{$editor_id}"></span>\
    13                                                 </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']=160;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']=165;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');}}};
     11tinyMCE.importThemeLanguagePack('advanced');
     12
     13var TinyMCE_AdvancedTheme = {
     14    // Private theme fields
     15    _autoImportCSSClasses : true,
     16    _resizer : {},
     17    _buttons : [
     18        // Control id, button img, button title, command, user_interface, value
     19        ['bold', '{$lang_bold_img}', 'lang_bold_desc', 'Bold'],
     20        ['italic', '{$lang_italic_img}', 'lang_italic_desc', 'Italic'],
     21        ['underline', '{$lang_underline_img}', 'lang_underline_desc', 'Underline'],
     22        ['strikethrough', 'strikethrough.gif', 'lang_striketrough_desc', 'Strikethrough'],
     23        ['justifyleft', 'justifyleft.gif', 'lang_justifyleft_desc', 'JustifyLeft'],
     24        ['justifycenter', 'justifycenter.gif', 'lang_justifycenter_desc', 'JustifyCenter'],
     25        ['justifyright', 'justifyright.gif', 'lang_justifyright_desc', 'JustifyRight'],
     26        ['justifyfull', 'justifyfull.gif', 'lang_justifyfull_desc', 'JustifyFull'],
     27        ['bullist', 'bullist.gif', 'lang_bullist_desc', 'InsertUnorderedList'],
     28        ['numlist', 'numlist.gif', 'lang_numlist_desc', 'InsertOrderedList'],
     29        ['outdent', 'outdent.gif', 'lang_outdent_desc', 'Outdent'],
     30        ['indent', 'indent.gif', 'lang_indent_desc', 'Indent'],
     31        ['cut', 'cut.gif', 'lang_cut_desc', 'Cut'],
     32        ['copy', 'copy.gif', 'lang_copy_desc', 'Copy'],
     33        ['paste', 'paste.gif', 'lang_paste_desc', 'Paste'],
     34        ['undo', 'undo.gif', 'lang_undo_desc', 'Undo'],
     35        ['redo', 'redo.gif', 'lang_redo_desc', 'Redo'],
     36        ['link', 'link.gif', 'lang_link_desc', 'mceLink', true],
     37        ['unlink', 'unlink.gif', 'lang_unlink_desc', 'unlink'],
     38        ['image', 'image.gif', 'lang_image_desc', 'mceImage', true],
     39        ['cleanup', 'cleanup.gif', 'lang_cleanup_desc', 'mceCleanup'],
     40        ['help', 'help.gif', 'lang_help_desc', 'mceHelp'],
     41        ['code', 'code.gif', 'lang_theme_code_desc', 'mceCodeEditor'],
     42        ['hr', 'hr.gif', 'lang_theme_hr_desc', 'inserthorizontalrule'],
     43        ['removeformat', 'removeformat.gif', 'lang_theme_removeformat_desc', 'removeformat'],
     44        ['sub', 'sub.gif', 'lang_theme_sub_desc', 'subscript'],
     45        ['sup', 'sup.gif', 'lang_theme_sup_desc', 'superscript'],
     46        ['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'mceForeColor', true],
     47        ['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'mceBackColor', true],
     48        ['charmap', 'charmap.gif', 'lang_theme_charmap_desc', 'mceCharMap'],
     49        ['visualaid', 'visualaid.gif', 'lang_theme_visualaid_desc', 'mceToggleVisualAid'],
     50        ['anchor', 'anchor.gif', 'lang_theme_anchor_desc', 'mceInsertAnchor'],
     51        ['newdocument', 'newdocument.gif', 'lang_newdocument_desc', 'mceNewDocument']
     52    ],
     53
     54    _buttonMap : 'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells',
     55
     56    /**
     57     * Returns HTML code for the specificed control.
     58     */
     59    getControlHTML : function(button_name) {
     60        var i, x;
     61
     62        // Lookup button in button list
     63        for (i=0; i<TinyMCE_AdvancedTheme._buttons.length; i++) {
     64            var but = TinyMCE_AdvancedTheme._buttons[i];
     65
     66            if (but[0] == button_name)
     67                return tinyMCE.getButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null));
     68        }
     69
     70        // Custom controlls other than buttons
     71        switch (button_name) {
     72            case "formatselect":
     73                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">';
     74                var formats = tinyMCE.getParam("theme_advanced_blockformats", "p,address,pre,h1,h2,h3,h4,h5,h6", true).split(',');
     75                var lookup = [
     76                    ['p', '{$lang_theme_paragraph}'],
     77                    ['address', '{$lang_theme_address}'],
     78                    ['pre', '{$lang_theme_pre}'],
     79                    ['h1', '{$lang_theme_h1}'],
     80                    ['h2', '{$lang_theme_h2}'],
     81                    ['h3', '{$lang_theme_h3}'],
     82                    ['h4', '{$lang_theme_h4}'],
     83                    ['h5', '{$lang_theme_h5}'],
     84                    ['h6', '{$lang_theme_h6}']
     85                ];
     86
     87                html += '<option value="">{$lang_theme_block}</option>';
     88
     89                // Build format select
     90                for (var i=0; i<formats.length; i++) {
     91                    for (var x=0; x<lookup.length; x++) {
     92                        if (formats[i] == lookup[x][0])
     93                            html += '<option value="<' + lookup[x][0] + '>">' + lookup[x][1] + '</option>';
     94                    }
     95                }
     96
     97                html += '</select>';
     98
     99                return html;
     100
     101            case "styleselect":
     102                return '<select id="{$editor_id}_styleSelect" onmousedown="tinyMCE.themes.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>';
     103
     104            case "fontselect":
     105                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>';
     106                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';
     107                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';
     108                var fonts = tinyMCE.getParam("theme_advanced_fonts", nFonts).split(';');
     109                for (i=0; i<fonts.length; i++) {
     110                    if (fonts[i] != '') {
     111                        var parts = fonts[i].split('=');
     112                        fontHTML += '<option value="' + parts[1] + '">' + parts[0] + '</option>';
     113                    }
     114                }
     115
     116                fontHTML += '</select>';
     117                return fontHTML;
     118
     119            case "fontsizeselect":
     120                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">\
     121                        <option value="0">{$lang_theme_font_size}</option>\
     122                        <option value="1">1 (8 pt)</option>\
     123                        <option value="2">2 (10 pt)</option>\
     124                        <option value="3">3 (12 pt)</option>\
     125                        <option value="4">4 (14 pt)</option>\
     126                        <option value="5">5 (18 pt)</option>\
     127                        <option value="6">6 (24 pt)</option>\
     128                        <option value="7">7 (36 pt)</option>\
     129                        </select>';
     130
     131            case "|":
     132            case "separator":
     133                return '<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" />';
     134
     135            case "spacer":
     136                return '<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" />';
     137
     138            case "rowseparator":
     139                return '<br />';
     140        }
     141
     142        return "";
     143    },
     144
     145    /**
     146     * Theme specific execcommand handling.
     147     */
     148    execCommand : function(editor_id, element, command, user_interface, value) {
     149        switch (command) {
     150            case "mceLink":
     151                var inst = tinyMCE.getInstanceById(editor_id);
     152                var doc = inst.getDoc();
     153                var selectedText = "";
     154
     155                if (tinyMCE.isMSIE) {
     156                    var rng = doc.selection.createRange();
     157                    selectedText = rng.text;
     158                } else
     159                    selectedText = inst.getSel().toString();
     160
     161                if (!tinyMCE.linkElement) {
     162                    if ((tinyMCE.selectedElement.nodeName.toLowerCase() != "img") && (selectedText.length <= 0))
     163                        return true;
     164                }
     165
     166                var href = "", target = "", title = "", onclick = "", action = "insert", style_class = "";
     167
     168                if (tinyMCE.selectedElement.nodeName.toLowerCase() == "a")
     169                    tinyMCE.linkElement = tinyMCE.selectedElement;
     170
     171                // Is anchor not a link
     172                if (tinyMCE.linkElement != null && tinyMCE.getAttrib(tinyMCE.linkElement, 'href') == "")
     173                    tinyMCE.linkElement = null;
     174
     175                if (tinyMCE.linkElement) {
     176                    href = tinyMCE.getAttrib(tinyMCE.linkElement, 'href');
     177                    target = tinyMCE.getAttrib(tinyMCE.linkElement, 'target');
     178                    title = tinyMCE.getAttrib(tinyMCE.linkElement, 'title');
     179                    onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick');
     180                    style_class = tinyMCE.getAttrib(tinyMCE.linkElement, 'class');
     181
     182                    // Try old onclick to if copy/pasted content
     183                    if (onclick == "")
     184                        onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick');
     185
     186                    onclick = tinyMCE.cleanupEventStr(onclick);
     187
     188                    href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement, true);");
     189
     190                    // Use mce_href if defined
     191                    mceRealHref = tinyMCE.getAttrib(tinyMCE.linkElement, 'mce_href');
     192                    if (mceRealHref != "") {
     193                        href = mceRealHref;
     194
     195                        if (tinyMCE.getParam('convert_urls'))
     196                            href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement, true);");
     197                    }
     198
     199                    action = "update";
     200                }
     201
     202                var template = new Array();
     203
     204                template['file'] = 'link.htm';
     205                template['width'] = 310;
     206                template['height'] = 200;
     207
     208                // Language specific width and height addons
     209                template['width'] += tinyMCE.getLang('lang_insert_link_delta_width', 0);
     210                template['height'] += tinyMCE.getLang('lang_insert_link_delta_height', 0);
     211
     212                if (inst.settings['insertlink_callback']) {
     213                    var returnVal = eval(inst.settings['insertlink_callback'] + "(href, target, title, onclick, action, style_class);");
     214                    if (returnVal && returnVal['href'])
     215                        TinyMCE_AdvancedTheme._insertLink(returnVal['href'], returnVal['target'], returnVal['title'], returnVal['onclick'], returnVal['style_class']);
     216                } else {
     217                    tinyMCE.openWindow(template, {href : href, target : target, title : title, onclick : onclick, action : action, className : style_class, inline : "yes"});
     218                }
     219
     220                return true;
     221
     222            case "mceImage":
     223                var src = "", alt = "", border = "", hspace = "", vspace = "", width = "", height = "", align = "";
     224                var title = "", onmouseover = "", onmouseout = "", action = "insert";
     225                var img = tinyMCE.imgElement;
     226                var inst = tinyMCE.getInstanceById(editor_id);
     227
     228                if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "img") {
     229                    img = tinyMCE.selectedElement;
     230                    tinyMCE.imgElement = img;
     231                }
     232
     233                if (img) {
     234                    // Is it a internal MCE visual aid image, then skip this one.
     235                    if (tinyMCE.getAttrib(img, 'name').indexOf('mce_') == 0)
     236                        return true;
     237
     238                    src = tinyMCE.getAttrib(img, 'src');
     239                    alt = tinyMCE.getAttrib(img, 'alt');
     240
     241                    // Try polling out the title
     242                    if (alt == "")
     243                        alt = tinyMCE.getAttrib(img, 'title');
     244
     245                    // Fix width/height attributes if the styles is specified
     246                    if (tinyMCE.isGecko) {
     247                        var w = img.style.width;
     248                        if (w != null && w != "")
     249                            img.setAttribute("width", w);
     250
     251                        var h = img.style.height;
     252                        if (h != null && h != "")
     253                            img.setAttribute("height", h);
     254                    }
     255
     256                    border = tinyMCE.getAttrib(img, 'border');
     257                    hspace = tinyMCE.getAttrib(img, 'hspace');
     258                    vspace = tinyMCE.getAttrib(img, 'vspace');
     259                    width = tinyMCE.getAttrib(img, 'width');
     260                    height = tinyMCE.getAttrib(img, 'height');
     261                    align = tinyMCE.getAttrib(img, 'align');
     262                    onmouseover = tinyMCE.getAttrib(img, 'onmouseover');
     263                    onmouseout = tinyMCE.getAttrib(img, 'onmouseout');
     264                    title = tinyMCE.getAttrib(img, 'title');
     265
     266                    // Is realy specified?
     267                    if (tinyMCE.isMSIE) {
     268                        width = img.attributes['width'].specified ? width : "";
     269                        height = img.attributes['height'].specified ? height : "";
     270                    }
     271
     272                    //onmouseover = tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover));
     273                    //onmouseout = tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout));
     274
     275                    src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, img, true);");
     276
     277                    // Use mce_src if defined
     278                    mceRealSrc = tinyMCE.getAttrib(img, 'mce_src');
     279                    if (mceRealSrc != "") {
     280                        src = mceRealSrc;
     281
     282                        if (tinyMCE.getParam('convert_urls'))
     283                            src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, img, true);");
     284                    }
     285
     286                    //if (onmouseover != "")
     287                    //  onmouseover = eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseover, img, true);");
     288
     289                    //if (onmouseout != "")
     290                    //  onmouseout = eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseout, img, true);");
     291
     292                    action = "update";
     293                }
     294
     295                var template = new Array();
     296
     297                template['file'] = 'image.htm?src={$src}';
     298                template['width'] = 355;
     299                template['height'] = 265 + (tinyMCE.isMSIE ? 25 : 0);
     300
     301                // Language specific width and height addons
     302                template['width'] += tinyMCE.getLang('lang_insert_image_delta_width', 0);
     303                template['height'] += tinyMCE.getLang('lang_insert_image_delta_height', 0);
     304
     305                if (inst.settings['insertimage_callback']) {
     306                    var returnVal = eval(inst.settings['insertimage_callback'] + "(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");
     307                    if (returnVal && returnVal['src'])
     308                        TinyMCE_AdvancedTheme._insertImage(returnVal['src'], returnVal['alt'], returnVal['border'], returnVal['hspace'], returnVal['vspace'], returnVal['width'], returnVal['height'], returnVal['align'], returnVal['title'], returnVal['onmouseover'], returnVal['onmouseout']);
     309                } else
     310                    tinyMCE.openWindow(template, {src : src, alt : alt, border : border, hspace : hspace, vspace : vspace, width : width, height : height, align : align, title : title, onmouseover : onmouseover, onmouseout : onmouseout, action : action, inline : "yes"});
     311
     312                return true;
     313
     314            case "mceForeColor":
     315                var template = new Array();
     316                var elm = tinyMCE.selectedInstance.getFocusElement();
     317                var inputColor = tinyMCE.getAttrib(elm, "color");
     318
     319                if (inputColor == '')
     320                    inputColor = elm.style.color;
     321
     322                if (!inputColor)
     323                    inputColor = "#000000";
     324
     325                template['file'] = 'color_picker.htm';
     326                template['width'] = 220;
     327                template['height'] = 190;
     328
     329                tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "forecolor", input_color : inputColor});
     330            return true;
     331
     332            case "mceBackColor":
     333                var template = new Array();
     334                var elm = tinyMCE.selectedInstance.getFocusElement();
     335                var inputColor = elm.style.backgroundColor;
     336
     337                if (!inputColor)
     338                    inputColor = "#000000";
     339
     340                template['file'] = 'color_picker.htm';
     341                template['width'] = 220;
     342                template['height'] = 190;
     343
     344                template['width'] += tinyMCE.getLang('lang_theme_advanced_backcolor_delta_width', 0);
     345                template['height'] += tinyMCE.getLang('lang_theme_advanced_backcolor_delta_height', 0);
     346
     347                tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "HiliteColor", input_color : inputColor});
     348                //mceBackColor
     349            return true;
     350
     351            case "mceColorPicker":
     352                if (user_interface) {
     353                    var template = new Array();
     354                    var inputColor = value['document'].getElementById(value['element_id']).value;
     355
     356                    template['file'] = 'color_picker.htm';
     357                    template['width'] = 220;
     358                    template['height'] = 190;
     359                    template['close_previous'] = "no";
     360
     361                    template['width'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width', 0);
     362                    template['height'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height', 0);
     363
     364                    if (typeof(value['store_selection']) == "undefined")
     365                        value['store_selection'] = true;
     366
     367                    tinyMCE.lastColorPickerValue = value;
     368                    tinyMCE.openWindow(template, {editor_id : editor_id, mce_store_selection : value['store_selection'], inline : "yes", command : "mceColorPicker", input_color : inputColor});
     369                } else {
     370                    var savedVal = tinyMCE.lastColorPickerValue;
     371                    var elm = savedVal['document'].getElementById(savedVal['element_id']);
     372                    elm.value = value;
     373
     374                    if (elm.onchange != null && elm.onchange != '')
     375                        eval('elm.onchange();');
     376                }
     377            return true;
     378
     379            case "mceCodeEditor":
     380                var template = new Array();
     381
     382                template['file'] = 'source_editor.htm';
     383                template['width'] = parseInt(tinyMCE.getParam("theme_advanced_source_editor_width", 720));
     384                template['height'] = parseInt(tinyMCE.getParam("theme_advanced_source_editor_height", 580));
     385
     386                tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "no", inline : "yes"});
     387                return true;
     388
     389            case "mceCharMap":
     390                var template = new Array();
     391
     392                template['file'] = 'charmap.htm';
     393                template['width'] = 550 + (tinyMCE.isOpera ? 40 : 0);
     394                template['height'] = 250;
     395
     396                template['width'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_width', 0);
     397                template['height'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_height', 0);
     398
     399                tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
     400                return true;
     401
     402            case "mceInsertAnchor":
     403                var template = new Array();
     404
     405                template['file'] = 'anchor.htm';
     406                template['width'] = 320;
     407                template['height'] = 90 + (tinyMCE.isNS7 ? 30 : 0);
     408
     409                template['width'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_width', 0);
     410                template['height'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_height', 0);
     411
     412                tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
     413                return true;
     414
     415            case "mceNewDocument":
     416                if (confirm(tinyMCE.getLang('lang_newdocument')))
     417                    tinyMCE.execInstanceCommand(editor_id, 'mceSetContent', false, ' ');
     418
     419                return true;
     420        }
     421
     422        return false;
     423    },
     424
     425    /**
     426     * Editor instance template function.
     427     */
     428    getEditorTemplate : function(settings, editorId) {
     429        function removeFromArray(in_array, remove_array) {
     430            var outArray = new Array();
     431           
     432            for (var i=0; i<in_array.length; i++) {
     433                skip = false;
     434
     435                for (var j=0; j<remove_array.length; j++) {
     436                    if (in_array[i] == remove_array[j]) {
     437                        skip = true;
     438                    }
     439                }
     440
     441                if (!skip) {
     442                    outArray[outArray.length] = in_array[i];
     443                }
     444            }
     445
     446            return outArray;
     447        }
     448
     449        function addToArray(in_array, add_array) {
     450            for (var i=0; i<add_array.length; i++) {
     451                in_array[in_array.length] = add_array[i];
     452            }
     453
     454            return in_array;
     455        }
     456
     457        var template = new Array();
     458        var deltaHeight = 0;
     459        var resizing = tinyMCE.getParam("theme_advanced_resizing", false);
     460        var path = tinyMCE.getParam("theme_advanced_path", true);
     461        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.themes.advanced._setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />';
     462        var layoutManager = tinyMCE.getParam("theme_advanced_layout_manager", "SimpleLayout");
     463
     464        // Setup style select options -- MOVED UP FOR EXTERNAL TOOLBAR COMPATABILITY!
     465        var styleSelectHTML = '<option value="">{$lang_theme_style_select}</option>';
     466        if (settings['theme_advanced_styles']) {
     467            var stylesAr = settings['theme_advanced_styles'].split(';');
     468           
     469            for (var i=0; i<stylesAr.length; i++) {
     470                var key, value;
     471
     472                key = stylesAr[i].split('=')[0];
     473                value = stylesAr[i].split('=')[1];
     474
     475                styleSelectHTML += '<option value="' + value + '">' + key + '</option>';
     476            }
     477
     478            TinyMCE_AdvancedTheme._autoImportCSSClasses = false;
     479        }
     480
     481        switch(layoutManager) {
     482            case "SimpleLayout" : //the default TinyMCE Layout (for backwards compatibility)...
     483                var toolbarHTML = "";
     484                var toolbarLocation = tinyMCE.getParam("theme_advanced_toolbar_location", "bottom");
     485                var toolbarAlign = tinyMCE.getParam("theme_advanced_toolbar_align", "center");
     486                var pathLocation = tinyMCE.getParam("theme_advanced_path_location", "none"); // Compatiblity
     487                var statusbarLocation = tinyMCE.getParam("theme_advanced_statusbar_location", pathLocation);
     488                var defVals = {
     489                    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",
     490                    theme_advanced_buttons2 : "bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",
     491                    theme_advanced_buttons3 : "hr,removeformat,visualaid,separator,sub,sup,separator,charmap"
     492                };
     493
     494                // Add accessibility control
     495                toolbarHTML += '<a href="#" accesskey="q" title="' + tinyMCE.getLang("lang_toolbar_focus") + '"';
     496
     497                if (!tinyMCE.getParam("accessibility_focus"))
     498                    toolbarHTML += ' onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"';
     499
     500                toolbarHTML += '></a>';
     501
     502                // Render rows
     503                for (var i=1; i<100; i++) {
     504                    var def = defVals["theme_advanced_buttons" + i];
     505
     506                    var buttons = tinyMCE.getParam("theme_advanced_buttons" + i, def == null ? '' : def, true, ',');
     507                    if (buttons.length == 0)
     508                        break;
     509
     510                    buttons = removeFromArray(buttons, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
     511                    buttons = addToArray(buttons, tinyMCE.getParam("theme_advanced_buttons" + i + "_add", "", true, ','));
     512                    buttons = addToArray(tinyMCE.getParam("theme_advanced_buttons" + i + "_add_before", "", true, ','), buttons);
     513
     514                    for (var b=0; b<buttons.length; b++)
     515                        toolbarHTML += tinyMCE.getControlHTML(buttons[b]);
     516
     517                    if (buttons.length > 0) {
     518                        toolbarHTML += "<br />";
     519                        deltaHeight -= 23;
     520                    }
     521                }
     522
     523                // Add accessibility control
     524                toolbarHTML += '<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"></a>';
     525
     526                // Setup template html
     527                template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';
     528
     529                if (toolbarLocation == "top") {
     530                    template['html'] += '<tr><td class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap">' + toolbarHTML + '</td></tr>';
     531                }
     532
     533                if (statusbarLocation == "top") {
     534                    template['html'] += '<tr><td class="mceStatusbarTop" height="1">' + statusbarHTML + '</td></tr>';
     535                    deltaHeight -= 23;
     536                }
     537
     538                template['html'] += '<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';
     539
     540                if (toolbarLocation == "bottom") {
     541                    template['html'] += '<tr><td class="mceToolbarBottom" align="' + toolbarAlign + '" height="1">' + toolbarHTML + '</td></tr>';
     542                }
     543
     544                // External toolbar changes
     545                if (toolbarLocation == "external") {
     546                    var bod = document.body;
     547                    var elm = document.createElement ("div");
     548
     549                    toolbarHTML = tinyMCE.replaceVar(toolbarHTML, 'style_select_options', styleSelectHTML);
     550                    toolbarHTML = tinyMCE.applyTemplate(toolbarHTML, {editor_id : editorId});
     551
     552                    elm.className = "mceToolbarExternal";
     553                    elm.id = editorId+"_toolbar";
     554                    elm.innerHTML = '<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>';
     555                    bod.appendChild (elm);
     556                    // bod.style.marginTop = elm.offsetHeight + "px";
     557
     558                    deltaHeight = 0;
     559                    tinyMCE.getInstanceById(editorId).toolbarElement = elm;
     560
     561                    //template['html'] = '<div id="mceExternalToolbar" align="center" class="mceToolbarExternal"><table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table></div>' + template["html"];
     562                } else {
     563                    tinyMCE.getInstanceById(editorId).toolbarElement = null;
     564                }
     565
     566                if (statusbarLocation == "bottom") {
     567                    template['html'] += '<tr><td class="mceStatusbarBottom" height="1">' + statusbarHTML + '</td></tr>';
     568                    deltaHeight -= 23;
     569                }
     570
     571                template['html'] += '</tbody></table>';
     572                //"SimpleLayout"
     573            break;
     574
     575            case "RowLayout" : //Container Layout - containers defined in "theme_advanced_containers" are rendered from top to bottom.
     576                template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';
     577
     578                var containers = tinyMCE.getParam("theme_advanced_containers", "", true, ",");
     579                var defaultContainerCSS = tinyMCE.getParam("theme_advanced_containers_default_class", "container");
     580                var defaultContainerAlign = tinyMCE.getParam("theme_advanced_containers_default_align", "center");
     581
     582                //Render Containers:
     583                for (var i = 0; i < containers.length; i++)
     584                {
     585                    if (containers[i] == "mceEditor") //Exceptions for mceEditor and ...
     586                    {
     587                        template['html'] += '<tr><td align="center" class="mceEditor_border">\
     588                                                    <span id="{$editor_id}"></span>\
     589                                                    </td></tr>';
     590                    }
     591                    else if (containers[i] == "mceElementpath" || containers[i] == "mceStatusbar") // ... mceElementpath:
     592                    {
     593                        var pathClass = "mceStatusbar";
     594
     595                        if (i == containers.length-1)
     596                        {
     597                            pathClass = "mceStatusbarBottom";
     598                        }
     599                        else if (i == 0)
     600                        {
     601                            pathClass = "mceStatusbar";
     602                        }
     603                        else
     604                        {
     605                            deltaHeight-=2;
     606                        }
     607
     608                        template['html'] += '<tr><td class="' + pathClass + '" height="1">' + statusbarHTML + '</td></tr>';
     609                        deltaHeight -= 22;
     610                    } else { // Render normal Container
     611                        var curContainer = tinyMCE.getParam("theme_advanced_container_"+containers[i], "", true, ',');
     612                        var curContainerHTML = "";
     613                        var curAlign = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align", defaultContainerAlign);
     614                        var curCSS = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class", defaultContainerCSS);
     615
     616                        for (var j=0; j<curContainer.length; j++) {
     617                            curContainerHTML += tinyMCE.getControlHTML(curContainer[j]);
     618                        }
     619
     620                        if (curContainer.length > 0) {
     621                            curContainerHTML += "<br />";
     622                            deltaHeight -= 23;
     623                        }
     624
     625                        template['html'] += '<tr><td class="' + curCSS + '" align="' + curAlign + '" height="1">' + curContainerHTML + '</td></tr>';
     626                    }
     627                }
     628
     629                template['html'] += '</tbody></table>';
     630                //RowLayout
     631            break;
     632
     633            case "CustomLayout" : //User defined layout callback...
     634                var customLayout = tinyMCE.getParam("theme_advanced_custom_layout","");
     635
     636                if (customLayout != "" && eval("typeof(" + customLayout + ")") != "undefined") {
     637                    template = eval(customLayout + "(template);");
     638                }
     639            break;
     640        }
     641
     642        if (resizing)
     643            template['html'] += '<span id="{$editor_id}_resize_box" class="mceResizeBox"></span>';
     644
     645        template['html'] = tinyMCE.replaceVar(template['html'], 'style_select_options', styleSelectHTML);
     646        template['delta_width'] = 0;
     647        template['delta_height'] = deltaHeight;
     648
     649        return template;
     650    },
     651
     652    initInstance : function(inst) {
     653        if (tinyMCE.getParam("theme_advanced_resizing", false)) {
     654            if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) {
     655                var w = TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_width");
     656                var h = TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_height");
     657
     658                TinyMCE_AdvancedTheme._resizeTo(inst, w, h, tinyMCE.getParam("theme_advanced_resize_horizontal", true));
     659            }
     660        }
     661
     662        inst.addShortcut('ctrl', 'k', 'lang_link_desc', 'mceLink');
     663    },
     664
     665    /**
     666     * Node change handler.
     667     */
     668    handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection, setup_content) {
     669        function selectByValue(select_elm, value, first_index) {
     670            first_index = typeof(first_index) == "undefined" ? false : true;
     671
     672            if (select_elm) {
     673                for (var i=0; i<select_elm.options.length; i++) {
     674                    var ov = "" + select_elm.options[i].value;
     675
     676                    if (first_index && ov.toLowerCase().indexOf(value.toLowerCase()) == 0) {
     677                        select_elm.selectedIndex = i;
     678                        return true;
     679                    }
     680
     681                    if (ov == value) {
     682                        select_elm.selectedIndex = i;
     683                        return true;
     684                    }
     685                }
     686            }
     687
     688            return false;
     689        };
     690
     691        function getAttrib(elm, name) {
     692            return elm.getAttribute(name) ? elm.getAttribute(name) : "";
     693        };
     694
     695        // No node provided
     696        if (node == null)
     697            return;
     698
     699        // Update path
     700        var pathElm = document.getElementById(editor_id + "_path");
     701        var inst = tinyMCE.getInstanceById(editor_id);
     702        var doc = inst.getDoc();
     703
     704        if (pathElm) {
     705            // Get node path
     706            var parentNode = node;
     707            var path = new Array();
     708           
     709            while (parentNode != null) {
     710                if (parentNode.nodeName.toUpperCase() == "BODY") {
     711                    break;
     712                }
     713
     714                // Only append element nodes to path
     715                if (parentNode.nodeType == 1 && tinyMCE.getAttrib(parentNode, "class").indexOf('mceItemHidden') == -1) {
     716                    path[path.length] = parentNode;
     717                }
     718
     719                parentNode = parentNode.parentNode;
     720            }
     721
     722            // Setup HTML
     723            var html = "";
     724            for (var i=path.length-1; i>=0; i--) {
     725                var nodeName = path[i].nodeName.toLowerCase();
     726                var nodeData = "";
     727
     728                if (nodeName == "b") {
     729                    nodeName = "strong";
     730                }
     731
     732                if (nodeName == "i") {
     733                    nodeName = "em";
     734                }
     735
     736                if (nodeName == "span") {
     737                    var cn = tinyMCE.getAttrib(path[i], "class");
     738                    if (cn != "" && cn.indexOf('mceItem') == -1)
     739                        nodeData += "class: " + cn + " ";
     740
     741                    var st = tinyMCE.getAttrib(path[i], "style");
     742                    if (st != "") {
     743                        st = tinyMCE.serializeStyle(tinyMCE.parseStyle(st));
     744                        nodeData += "style: " + st + " ";
     745                    }
     746                }
     747
     748                if (nodeName == "font") {
     749                    if (tinyMCE.getParam("convert_fonts_to_spans"))
     750                        nodeName = "span";
     751
     752                    var face = tinyMCE.getAttrib(path[i], "face");
     753                    if (face != "")
     754                        nodeData += "font: " + face + " ";
     755
     756                    var size = tinyMCE.getAttrib(path[i], "size");
     757                    if (size != "")
     758                        nodeData += "size: " + size + " ";
     759
     760                    var color = tinyMCE.getAttrib(path[i], "color");
     761                    if (color != "")
     762                        nodeData += "color: " + color + " ";
     763                }
     764
     765                if (getAttrib(path[i], 'id') != "") {
     766                    nodeData += "id: " + path[i].getAttribute('id') + " ";
     767                }
     768
     769                var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false);
     770                if (className != "" && className.indexOf('mceItem') == -1)
     771                    nodeData += "class: " + className + " ";
     772
     773                if (getAttrib(path[i], 'src') != "") {
     774                    var src = tinyMCE.getAttrib(path[i], "mce_src");
     775
     776                    if (src == "")
     777                         src = tinyMCE.getAttrib(path[i], "src");
     778
     779                    nodeData += "src: " + src + " ";
     780                }
     781
     782                if (getAttrib(path[i], 'href') != "") {
     783                    var href = tinyMCE.getAttrib(path[i], "mce_href");
     784
     785                    if (href == "")
     786                         href = tinyMCE.getAttrib(path[i], "href");
     787
     788                    nodeData += "href: " + href + " ";
     789                }
     790
     791                if (nodeName == "img" && tinyMCE.getAttrib(path[i], "class").indexOf('mceItemFlash') != -1) {
     792                    nodeName = "flash";
     793                    nodeData = "src: " + path[i].getAttribute('title');
     794                }
     795
     796                if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "") {
     797                    nodeName = "a";
     798                    nodeName += "#" + anchor;
     799                    nodeData = "";
     800                }
     801
     802                if (getAttrib(path[i], 'name').indexOf("mce_") != 0) {
     803                    var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false);
     804                    if (className != "" && className.indexOf('mceItem') == -1) {
     805                        nodeName += "." + className;
     806                    }
     807                }
     808
     809                var cmd = 'tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');';
     810                html += '<a title="' + nodeData + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" target="_self" class="mcePathItem">' + nodeName + '</a>';
     811
     812                if (i > 0) {
     813                    html += " &raquo; ";
     814                }
     815            }
     816
     817            pathElm.innerHTML = '<a href="#" accesskey="x"></a>' + tinyMCE.getLang('lang_theme_path') + ": " + html + '&nbsp;';
     818        }
     819
     820        // Reset old states
     821        tinyMCE.switchClass(editor_id + '_justifyleft', 'mceButtonNormal');
     822        tinyMCE.switchClass(editor_id + '_justifyright', 'mceButtonNormal');
     823        tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonNormal');
     824        tinyMCE.switchClass(editor_id + '_justifyfull', 'mceButtonNormal');
     825        tinyMCE.switchClass(editor_id + '_bold', 'mceButtonNormal');
     826        tinyMCE.switchClass(editor_id + '_italic', 'mceButtonNormal');
     827        tinyMCE.switchClass(editor_id + '_underline', 'mceButtonNormal');
     828        tinyMCE.switchClass(editor_id + '_strikethrough', 'mceButtonNormal');
     829        tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonNormal');
     830        tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonNormal');
     831        tinyMCE.switchClass(editor_id + '_sub', 'mceButtonNormal');
     832        tinyMCE.switchClass(editor_id + '_sup', 'mceButtonNormal');
     833        tinyMCE.switchClass(editor_id + '_anchor', 'mceButtonNormal');
     834        tinyMCE.switchClass(editor_id + '_link', 'mceButtonDisabled');
     835        tinyMCE.switchClass(editor_id + '_unlink', 'mceButtonDisabled');
     836        tinyMCE.switchClass(editor_id + '_outdent', 'mceButtonDisabled');
     837        tinyMCE.switchClass(editor_id + '_image', 'mceButtonNormal');
     838        tinyMCE.switchClass(editor_id + '_hr', 'mceButtonNormal');
     839
     840        if (node.nodeName == "A" && tinyMCE.getAttrib(node, "class").indexOf('mceItemAnchor') != -1)
     841            tinyMCE.switchClass(editor_id + '_anchor', 'mceButtonSelected');
     842
     843        // Get link
     844        var anchorLink = tinyMCE.getParentElement(node, "a", "href");
     845
     846        if (anchorLink || any_selection) {
     847            tinyMCE.switchClass(editor_id + '_link', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal');
     848            tinyMCE.switchClass(editor_id + '_unlink', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal');
     849        }
     850
     851        // Handle visual aid
     852        tinyMCE.switchClass(editor_id + '_visualaid', visual_aid ? 'mceButtonSelected' : 'mceButtonNormal');
     853
     854        if (undo_levels != -1) {
     855            tinyMCE.switchClass(editor_id + '_undo', 'mceButtonDisabled');
     856            tinyMCE.switchClass(editor_id + '_redo', 'mceButtonDisabled');
     857        }
     858
     859        // Within li, blockquote
     860        if (tinyMCE.getParentElement(node, "li,blockquote"))
     861            tinyMCE.switchClass(editor_id + '_outdent', 'mceButtonNormal');
     862
     863        // Has redo levels
     864        if (undo_index != -1 && (undo_index < undo_levels-1 && undo_levels > 0))
     865            tinyMCE.switchClass(editor_id + '_redo', 'mceButtonNormal');
     866
     867        // Has undo levels
     868        if (undo_index != -1 && (undo_index > 0 && undo_levels > 0))
     869            tinyMCE.switchClass(editor_id + '_undo', 'mceButtonNormal');
     870
     871        // Select class in select box
     872        var selectElm = document.getElementById(editor_id + "_styleSelect");
     873       
     874        if (selectElm) {
     875            TinyMCE_AdvancedTheme._setupCSSClasses(editor_id);
     876
     877            classNode = node;
     878            breakOut = false;
     879            var index = 0;
     880
     881            do {
     882                if (classNode && classNode.className) {
     883                    for (var i=0; i<selectElm.options.length; i++) {
     884                        if (selectElm.options[i].value == classNode.className) {
     885                            index = i;
     886                            breakOut = true;
     887                            break;
     888                        }
     889                    }
     890                }
     891            } while (!breakOut && classNode != null && (classNode = classNode.parentNode) != null);
     892
     893            selectElm.selectedIndex = index;
     894        }
     895
     896        // Select formatblock
     897        var selectElm = document.getElementById(editor_id + "_formatSelect");
     898        if (selectElm) {
     899            var elm = tinyMCE.getParentElement(node, "p,div,h1,h2,h3,h4,h5,h6,pre,address");
     900
     901            if (elm)
     902                selectByValue(selectElm, "<" + elm.nodeName.toLowerCase() + ">");
     903            else
     904                selectByValue(selectElm, "");
     905        }
     906
     907        // Select fontselect
     908        var selectElm = document.getElementById(editor_id + "_fontNameSelect");
     909        if (selectElm) {
     910            if (!tinyMCE.isSafari && !(tinyMCE.isMSIE && !tinyMCE.isOpera)) {
     911                var face = inst.queryCommandValue('FontName');
     912
     913                face = face == null || face == "" ? "" : face;
     914
     915                selectByValue(selectElm, face, face != "");
     916            } else {
     917                var elm = tinyMCE.getParentElement(node, "font", "face");
     918
     919                if (elm) {
     920                    var family = tinyMCE.getAttrib(elm, "face");
     921
     922                    if (family == '')
     923                        family = '' + elm.style.fontFamily;
     924
     925                    if (!selectByValue(selectElm, family, family != ""))
     926                        selectByValue(selectElm, "");
     927                } else
     928                    selectByValue(selectElm, "");
     929            }
     930        }
     931
     932        // Select fontsize
     933        var selectElm = document.getElementById(editor_id + "_fontSizeSelect");
     934        if (selectElm) {
     935            if (!tinyMCE.isSafari && !tinyMCE.isOpera) {
     936                var size = inst.queryCommandValue('FontSize');
     937                selectByValue(selectElm, size == null || size == "" ? "0" : size);
     938            } else {
     939                var elm = tinyMCE.getParentElement(node, "font", "size");
     940                if (elm) {
     941                    var size = tinyMCE.getAttrib(elm, "size");
     942
     943                    if (size == '') {
     944                        var sizes = new Array('', '8px', '10px', '12px', '14px', '18px', '24px', '36px');
     945
     946                        size = '' + elm.style.fontSize;
     947
     948                        for (var i=0; i<sizes.length; i++) {
     949                            if (('' + sizes[i]) == size) {
     950                                size = i;
     951                                break;
     952                            }
     953                        }
     954                    }
     955
     956                    if (!selectByValue(selectElm, size))
     957                        selectByValue(selectElm, "");
     958                } else
     959                    selectByValue(selectElm, "0");
     960            }
     961        }
     962
     963        // Handle align attributes
     964        alignNode = node;
     965        breakOut = false;
     966        do {
     967            if (!alignNode.getAttribute || !alignNode.getAttribute('align'))
     968                continue;
     969
     970            switch (alignNode.getAttribute('align').toLowerCase()) {
     971                case "left":
     972                    tinyMCE.switchClass(editor_id + '_justifyleft', 'mceButtonSelected');
     973                    breakOut = true;
     974                break;
     975
     976                case "right":
     977                    tinyMCE.switchClass(editor_id + '_justifyright', 'mceButtonSelected');
     978                    breakOut = true;
     979                break;
     980
     981                case "middle":
     982                case "center":
     983                    tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonSelected');
     984                    breakOut = true;
     985                break;
     986
     987                case "justify":
     988                    tinyMCE.switchClass(editor_id + '_justifyfull', 'mceButtonSelected');
     989                    breakOut = true;
     990                break;
     991            }
     992        } while (!breakOut && (alignNode = alignNode.parentNode) != null);
     993
     994        // Div justification
     995        var div = tinyMCE.getParentElement(node, "div");
     996        if (div && div.style.textAlign == "center")
     997            tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonSelected');
     998
     999        // Do special text
     1000        if (!setup_content) {
     1001            // , "JustifyLeft", "_justifyleft", "JustifyCenter", "justifycenter", "JustifyRight", "justifyright", "JustifyFull", "justifyfull", "InsertUnorderedList", "bullist", "InsertOrderedList", "numlist", "InsertUnorderedList", "bullist", "Outdent", "outdent", "Indent", "indent", "subscript", "sub"
     1002            var ar = new Array("Bold", "_bold", "Italic", "_italic", "Strikethrough", "_strikethrough", "superscript", "_sup", "subscript", "_sub");
     1003            for (var i=0; i<ar.length; i+=2) {
     1004                if (inst.queryCommandState(ar[i]))
     1005                    tinyMCE.switchClass(editor_id + ar[i+1], 'mceButtonSelected');
     1006            }
     1007
     1008            if (inst.queryCommandState("Underline") && (node.parentNode == null || node.parentNode.nodeName != "A"))
     1009                tinyMCE.switchClass(editor_id + '_underline', 'mceButtonSelected');
     1010        }
     1011
     1012        // Handle elements
     1013        do {
     1014            switch (node.nodeName) {
     1015                case "UL":
     1016                    tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonSelected');
     1017                break;
     1018
     1019                case "OL":
     1020                    tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonSelected');
     1021                break;
     1022
     1023                case "HR":
     1024                     tinyMCE.switchClass(editor_id + '_hr', 'mceButtonSelected');
     1025                break;
     1026
     1027                case "IMG":
     1028                if (getAttrib(node, 'name').indexOf('mce_') != 0) {
     1029                    tinyMCE.switchClass(editor_id + '_image', 'mceButtonSelected');
     1030                }
     1031                break;
     1032            }
     1033        } while ((node = node.parentNode) != null);
     1034    },
     1035
     1036    // Private theme internal functions
     1037
     1038    // This function auto imports CSS classes into the class selection droplist
     1039    _setupCSSClasses : function(editor_id) {
     1040        var i, selectElm;
     1041
     1042        if (!TinyMCE_AdvancedTheme._autoImportCSSClasses)
     1043            return;
     1044
     1045        selectElm = document.getElementById(editor_id + '_styleSelect');
     1046
     1047        if (selectElm && selectElm.getAttribute('cssImported') != 'true') {
     1048            var csses = tinyMCE.getCSSClasses(editor_id);
     1049            if (csses && selectElm) {
     1050                for (i=0; i<csses.length; i++)
     1051                    selectElm.options[selectElm.options.length] = new Option(csses[i], csses[i]);
     1052            }
     1053
     1054            // Only do this once
     1055            if (csses != null && csses.length > 0)
     1056                selectElm.setAttribute('cssImported', 'true');
     1057        }
     1058    },
     1059
     1060    _setCookie : function(name, value, expires, path, domain, secure) {
     1061        var curCookie = name + "=" + escape(value) +
     1062            ((expires) ? "; expires=" + expires.toGMTString() : "") +
     1063            ((path) ? "; path=" + escape(path) : "") +
     1064            ((domain) ? "; domain=" + domain : "") +
     1065            ((secure) ? "; secure" : "");
     1066
     1067        document.cookie = curCookie;
     1068    },
     1069
     1070    _getCookie : function(name) {
     1071        var dc = document.cookie;
     1072        var prefix = name + "=";
     1073        var begin = dc.indexOf("; " + prefix);
     1074
     1075        if (begin == -1) {
     1076            begin = dc.indexOf(prefix);
     1077
     1078            if (begin != 0)
     1079                return null;
     1080        } else
     1081            begin += 2;
     1082
     1083        var end = document.cookie.indexOf(";", begin);
     1084
     1085        if (end == -1)
     1086            end = dc.length;
     1087
     1088        return unescape(dc.substring(begin + prefix.length, end));
     1089    },
     1090
     1091    _resizeTo : function(inst, w, h, set_w) {
     1092        var editorContainer = document.getElementById(inst.editorId + '_parent');
     1093        var tableElm = editorContainer.firstChild;
     1094        var iframe = inst.iframeElement;
     1095
     1096        if (w == null || w == "null") {
     1097            set_w = false;
     1098            w = 0;
     1099        }
     1100
     1101        if (h == null || h == "null")
     1102            return;
     1103
     1104        w = parseInt(w);
     1105        h = parseInt(h);
     1106
     1107        if (tinyMCE.isGecko) {
     1108            w += 2;
     1109            h += 2;
     1110        }
     1111
     1112        var dx = w - tableElm.clientWidth;
     1113        var dy = h - tableElm.clientHeight;
     1114
     1115        w = w < 1 ? 30 : w;
     1116        h = h < 1 ? 30 : h;
     1117
     1118        if (set_w)
     1119            tableElm.style.width = w + "px";
     1120
     1121        tableElm.style.height = h + "px";
     1122
     1123        iw = iframe.clientWidth + dx;
     1124        ih = iframe.clientHeight + dy;
     1125
     1126        iw = iw < 1 ? 30 : iw;
     1127        ih = ih < 1 ? 30 : ih;
     1128
     1129        if (tinyMCE.isGecko) {
     1130            iw -= 2;
     1131            ih -= 2;
     1132        }
     1133
     1134        if (set_w)
     1135            iframe.style.width = iw + "px";
     1136
     1137        iframe.style.height = ih + "px";
     1138
     1139        // Is it to small, make it bigger again
     1140        if (set_w) {
     1141            var tableBodyElm = tableElm.firstChild;
     1142            var minIframeWidth = tableBodyElm.scrollWidth;
     1143            if (inst.iframeElement.clientWidth < minIframeWidth) {
     1144                dx = minIframeWidth - inst.iframeElement.clientWidth;
     1145
     1146                inst.iframeElement.style.width = (iw + dx) + "px";
     1147            }
     1148        }
     1149    },
     1150
     1151    /**
     1152     * Handles resizing events.
     1153     */
     1154    _resizeEventHandler : function(e) {
     1155        var resizer = TinyMCE_AdvancedTheme._resizer;
     1156
     1157        // Do nothing
     1158        if (!resizer.resizing)
     1159            return;
     1160
     1161        e = typeof(e) == "undefined" ? window.event : e;
     1162
     1163        var dx = e.screenX - resizer.downX;
     1164        var dy = e.screenY - resizer.downY;
     1165        var resizeBox = resizer.resizeBox;
     1166        var editorId = resizer.editorId;
     1167
     1168        switch (e.type) {
     1169            case "mousemove":
     1170                var w, h;
     1171
     1172                w = resizer.width + dx;
     1173                h = resizer.height + dy;
     1174
     1175                w = w < 1 ? 1 : w;
     1176                h = h < 1 ? 1 : h;
     1177
     1178                if (resizer.horizontal)
     1179                    resizeBox.style.width = w + "px";
     1180
     1181                resizeBox.style.height = h + "px";
     1182                break;
     1183
     1184            case "mouseup":
     1185                TinyMCE_AdvancedTheme._setResizing(e, editorId, false);
     1186                TinyMCE_AdvancedTheme._resizeTo(tinyMCE.getInstanceById(editorId), resizer.width + dx, resizer.height + dy, resizer.horizontal);
     1187
     1188                // Expire in a month
     1189                if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) {
     1190                    var expires = new Date();
     1191                    expires.setTime(expires.getTime() + 3600000 * 24 * 30);
     1192
     1193                    // Set the cookies
     1194                    TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + editorId + "_width", "" + (resizer.horizontal ? resizer.width + dx : ""), expires);
     1195                    TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + editorId + "_height", "" + (resizer.height + dy), expires);
     1196                }
     1197                break;
     1198        }
     1199    },
     1200
     1201    /**
     1202     * Starts/stops the editor resizing.
     1203     */
     1204    _setResizing : function(e, editor_id, state) {
     1205        e = typeof(e) == "undefined" ? window.event : e;
     1206
     1207        var resizer = TinyMCE_AdvancedTheme._resizer;
     1208        var editorContainer = document.getElementById(editor_id + '_parent');
     1209        var editorArea = document.getElementById(editor_id + '_parent').firstChild;
     1210        var resizeBox = document.getElementById(editor_id + '_resize_box');
     1211        var inst = tinyMCE.getInstanceById(editor_id);
     1212
     1213        if (state) {
     1214            // Place box over editor area
     1215            var width = editorArea.clientWidth;
     1216            var height = editorArea.clientHeight;
     1217
     1218            resizeBox.style.width = width + "px";
     1219            resizeBox.style.height = height + "px";
     1220
     1221            resizer.iframeWidth = inst.iframeElement.clientWidth;
     1222            resizer.iframeHeight = inst.iframeElement.clientHeight;
     1223
     1224            // Hide editor and show resize box
     1225            editorArea.style.display = "none";
     1226            resizeBox.style.display = "block";
     1227
     1228            // Add event handlers, only once
     1229            if (!resizer.eventHandlers) {
     1230                if (tinyMCE.isMSIE)
     1231                    tinyMCE.addEvent(document, "mousemove", TinyMCE_AdvancedTheme._resizeEventHandler);
     1232                else
     1233                    tinyMCE.addEvent(window, "mousemove", TinyMCE_AdvancedTheme._resizeEventHandler);
     1234
     1235                tinyMCE.addEvent(document, "mouseup", TinyMCE_AdvancedTheme._resizeEventHandler);
     1236
     1237                resizer.eventHandlers = true;
     1238            }
     1239
     1240            resizer.resizing = true;
     1241            resizer.downX = e.screenX;
     1242            resizer.downY = e.screenY;
     1243            resizer.width = parseInt(resizeBox.style.width);
     1244            resizer.height = parseInt(resizeBox.style.height);
     1245            resizer.editorId = editor_id;
     1246            resizer.resizeBox = resizeBox;
     1247            resizer.horizontal = tinyMCE.getParam("theme_advanced_resize_horizontal", true);
     1248        } else {
     1249            resizer.resizing = false;
     1250            resizeBox.style.display = "none";
     1251            editorArea.style.display = tinyMCE.isMSIE && !tinyMCE.isOpera ? "block" : "table";
     1252            tinyMCE.execCommand('mceResetDesignMode');
     1253        }
     1254    },
     1255
     1256    _insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) {
     1257        tinyMCE.execCommand('mceBeginUndoLevel');
     1258
     1259        if (src == "")
     1260            return;
     1261
     1262        if (!tinyMCE.imgElement && tinyMCE.isSafari) {
     1263            var html = "";
     1264
     1265            html += '<img src="' + src + '" alt="' + alt + '"';
     1266            html += ' border="' + border + '" hspace="' + hspace + '"';
     1267            html += ' vspace="' + vspace + '" width="' + width + '"';
     1268            html += ' height="' + height + '" align="' + align + '" title="' + title + '" onmouseover="' + onmouseover + '" onmouseout="' + onmouseout + '" />';
     1269
     1270            tinyMCE.execCommand("mceInsertContent", false, html);
     1271        } else {
     1272            if (!tinyMCE.imgElement && tinyMCE.selectedInstance) {
     1273                if (tinyMCE.isSafari)
     1274                    tinyMCE.execCommand("mceInsertContent", false, '<img src="' + tinyMCE.uniqueURL + '" />');
     1275                else
     1276                    tinyMCE.selectedInstance.contentDocument.execCommand("insertimage", false, tinyMCE.uniqueURL);
     1277
     1278                tinyMCE.imgElement = tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "img", "src", tinyMCE.uniqueURL);
     1279            }
     1280        }
     1281
     1282        if (tinyMCE.imgElement) {
     1283            var needsRepaint = false;
     1284            var msrc = src;
     1285
     1286            src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, tinyMCE.imgElement);");
     1287
     1288            if (tinyMCE.getParam('convert_urls'))
     1289                msrc = src;
     1290
     1291            if (onmouseover && onmouseover != "")
     1292                onmouseover = "this.src='" + eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseover, tinyMCE.imgElement);") + "';";
     1293
     1294            if (onmouseout && onmouseout != "")
     1295                onmouseout = "this.src='" + eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseout, tinyMCE.imgElement);") + "';";
     1296
     1297            // Use alt as title if it's undefined
     1298            if (typeof(title) == "undefined")
     1299                title = alt;
     1300
     1301            if (width != tinyMCE.imgElement.getAttribute("width") || height != tinyMCE.imgElement.getAttribute("height") || align != tinyMCE.imgElement.getAttribute("align"))
     1302                needsRepaint = true;
     1303
     1304            tinyMCE.setAttrib(tinyMCE.imgElement, 'src', src);
     1305            tinyMCE.setAttrib(tinyMCE.imgElement, 'mce_src', msrc);
     1306            tinyMCE.setAttrib(tinyMCE.imgElement, 'alt', alt);
     1307            tinyMCE.setAttrib(tinyMCE.imgElement, 'title', title);
     1308            tinyMCE.setAttrib(tinyMCE.imgElement, 'align', align);
     1309            tinyMCE.setAttrib(tinyMCE.imgElement, 'border', border, true);
     1310            tinyMCE.setAttrib(tinyMCE.imgElement, 'hspace', hspace, true);
     1311            tinyMCE.setAttrib(tinyMCE.imgElement, 'vspace', vspace, true);
     1312            tinyMCE.setAttrib(tinyMCE.imgElement, 'width', width, true);
     1313            tinyMCE.setAttrib(tinyMCE.imgElement, 'height', height, true);
     1314            tinyMCE.setAttrib(tinyMCE.imgElement, 'onmouseover', onmouseover);
     1315            tinyMCE.setAttrib(tinyMCE.imgElement, 'onmouseout', onmouseout);
     1316
     1317            // Fix for bug #989846 - Image resize bug
     1318            if (width && width != "")
     1319                tinyMCE.imgElement.style.pixelWidth = width;
     1320
     1321            if (height && height != "")
     1322                tinyMCE.imgElement.style.pixelHeight = height;
     1323
     1324            if (needsRepaint)
     1325                tinyMCE.selectedInstance.repaint();
     1326        }
     1327
     1328        tinyMCE.execCommand('mceEndUndoLevel');
     1329    },
     1330
     1331    _insertLink : function(href, target, title, onclick, style_class) {
     1332        tinyMCE.execCommand('mceBeginUndoLevel');
     1333
     1334        if (tinyMCE.selectedInstance && tinyMCE.selectedElement && tinyMCE.selectedElement.nodeName.toLowerCase() == "img") {
     1335            var doc = tinyMCE.selectedInstance.getDoc();
     1336            var linkElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "a");
     1337            var newLink = false;
     1338
     1339            if (!linkElement) {
     1340                linkElement = doc.createElement("a");
     1341                newLink = true;
     1342            }
     1343
     1344            var mhref = href;
     1345            var thref = eval(tinyMCE.settings['urlconverter_callback'] + "(href, linkElement);");
     1346            mhref = tinyMCE.getParam('convert_urls') ? href : mhref;
     1347
     1348            tinyMCE.setAttrib(linkElement, 'href', thref);
     1349            tinyMCE.setAttrib(linkElement, 'mce_href', mhref);
     1350            tinyMCE.setAttrib(linkElement, 'target', target);
     1351            tinyMCE.setAttrib(linkElement, 'title', title);
     1352            tinyMCE.setAttrib(linkElement, 'onclick', onclick);
     1353            tinyMCE.setAttrib(linkElement, 'class', style_class);
     1354
     1355            if (newLink) {
     1356                linkElement.appendChild(tinyMCE.selectedElement.cloneNode(true));
     1357                tinyMCE.selectedElement.parentNode.replaceChild(linkElement, tinyMCE.selectedElement);
     1358            }
     1359
     1360            return;
     1361        }
     1362
     1363        if (!tinyMCE.linkElement && tinyMCE.selectedInstance) {
     1364            if (tinyMCE.isSafari) {
     1365                tinyMCE.execCommand("mceInsertContent", false, '<a href="' + tinyMCE.uniqueURL + '">' + tinyMCE.selectedInstance.selection.getSelectedHTML() + '</a>');
     1366            } else
     1367                tinyMCE.selectedInstance.contentDocument.execCommand("createlink", false, tinyMCE.uniqueURL);
     1368
     1369            tinyMCE.linkElement = tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL);
     1370
     1371            var elementArray = tinyMCE.getElementsByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL);
     1372
     1373            for (var i=0; i<elementArray.length; i++) {
     1374                var mhref = href;
     1375                var thref = eval(tinyMCE.settings['urlconverter_callback'] + "(href, elementArray[i]);");
     1376                mhref = tinyMCE.getParam('convert_urls') ? href : mhref;
     1377
     1378                tinyMCE.setAttrib(elementArray[i], 'href', thref);
     1379                tinyMCE.setAttrib(elementArray[i], 'mce_href', mhref);
     1380                tinyMCE.setAttrib(elementArray[i], 'target', target);
     1381                tinyMCE.setAttrib(elementArray[i], 'title', title);
     1382                tinyMCE.setAttrib(elementArray[i], 'onclick', onclick);
     1383                tinyMCE.setAttrib(elementArray[i], 'class', style_class);
     1384            }
     1385
     1386            tinyMCE.linkElement = elementArray[0];
     1387        }
     1388
     1389        if (tinyMCE.linkElement) {
     1390            var mhref = href;
     1391            href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement);");
     1392            mhref = tinyMCE.getParam('convert_urls') ? href : mhref;
     1393
     1394            tinyMCE.setAttrib(tinyMCE.linkElement, 'href', href);
     1395            tinyMCE.setAttrib(tinyMCE.linkElement, 'mce_href', mhref);
     1396            tinyMCE.setAttrib(tinyMCE.linkElement, 'target', target);
     1397            tinyMCE.setAttrib(tinyMCE.linkElement, 'title', title);
     1398            tinyMCE.setAttrib(tinyMCE.linkElement, 'onclick', onclick);
     1399            tinyMCE.setAttrib(tinyMCE.linkElement, 'class', style_class);
     1400        }
     1401
     1402        tinyMCE.execCommand('mceEndUndoLevel');
     1403    }
     1404};
     1405
     1406tinyMCE.addTheme("advanced", TinyMCE_AdvancedTheme);
     1407
     1408// Add default buttons maps for advanced theme and all internal plugins
     1409tinyMCE.addButtonMap(TinyMCE_AdvancedTheme._buttonMap);
  • trunk/wp-includes/js/tinymce/themes/advanced/image.htm

    r3163 r3664  
    33    <title>{$lang_insert_image_title}</title>
    44    <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
     5    <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
    56    <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
    67    <script language="javascript" type="text/javascript" src="jscripts/image.js"></script>
    7     <style type="text/css">
    8         #insert, #cancel {
    9             font: 13px Verdana, Arial, Helvetica, sans-serif;
    10             height:auto;
    11             width: auto;
    12             background-color: transparent;
    13             background-image: url(../../../../../wp-admin/images/fade-butt.png);
    14             background-repeat: repeat;
    15             border: 3px double;
    16             border-right-color: rgb(153, 153, 153);
    17             border-bottom-color: rgb(153, 153, 153);
    18             border-left-color: rgb(204, 204, 204);
    19             border-top-color: rgb(204, 204, 204);
    20             color: rgb(51, 51, 51);
    21             padding: 0.25em 1em;
    22         }
    23         #insert:active, #cancel:active {
    24             background: #f4f4f4;
    25             border-left-color: #999;
    26             border-top-color: #999;
    27         }
    28     </style>
     8    <base target="_self" />
    299</head>
    30 <body onload="tinyMCEPopup.executeOnLoad('init();');document.getElementById('src').focus();" style="display: none">
    31 <form onsubmit="insertImage();return false;">
    32   <table border="0" cellpadding="0" cellspacing="0" width="200">
    33     <tr>
    34       <td align="center" valign="middle"><table border="0" cellpadding="4" cellspacing="0">
     10<body id="image" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';document.getElementById('src').focus();" style="display: none">
     11<form onsubmit="insertImage();return false;" action="#">
     12    <div class="tabs">
     13        <ul>
     14            <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_image_title}</a></span></li>
     15        </ul>
     16    </div>
     17
     18    <div class="panel_wrapper">
     19        <div id="general_panel" class="panel current">
     20     <table border="0" cellpadding="4" cellspacing="0">
    3521          <tr>
    36             <td colspan="2" class="title" nowrap="nowrap">{$lang_insert_image_title}</td>
    37           </tr>
    38           <tr>
    39             <td nowrap="nowrap">{$lang_insert_image_src}:</td>
     22            <td nowrap="nowrap"><label for="src">{$lang_insert_image_src}</label></td>
    4023            <td><table border="0" cellspacing="0" cellpadding="0">
    4124                <tr>
    42                   <td><input name="src" type="text" id="src" value="" style="width: 200px" onchange="getImageData();"></td>
     25                  <td><input id="src" name="src" type="text" value="" style="width: 200px" onchange="getImageData();"></td>
    4326                  <td id="srcbrowsercontainer">&nbsp;</td>
    4427                </tr>
     
    5033                var html = "";
    5134
    52                 html += '<tr><td>{$lang_image_list}:</td>';
    53                 html += '<td><select name="image_list" style="width: 200px" onchange="this.form.src.value=this.options[this.selectedIndex].value;resetImageData();getImageData();">';
     35                html += '<tr><td><label for="image_list">{$lang_image_list}</label></td>';
     36                html += '<td><select id="image_list" name="image_list" style="width: 200px" onchange="this.form.src.value=this.options[this.selectedIndex].value;resetImageData();getImageData();">';
    5437                html += '<option value="">---</option>';
    5538
     
    6447          <!-- /Image list -->
    6548          <tr>
    66             <td nowrap="nowrap">{$lang_insert_image_alt}:</td>
    67             <td><input name="alt" type="text" id="alt" value="" style="width: 200px"></td>
     49            <td nowrap="nowrap"><label for="alt">{$lang_insert_image_alt}</label></td>
     50            <td><input id="alt" name="alt" type="text" value="" style="width: 200px"></td>
    6851          </tr>
    6952          <tr>
    70             <td nowrap="nowrap">{$lang_insert_image_align}:</td>
    71             <td><select name="align">
     53            <td nowrap="nowrap"><label for="align">{$lang_insert_image_align}</label></td>
     54            <td><select id="align" name="align">
    7255                <option value="">{$lang_insert_image_align_default}</option>
    7356                <option value="baseline">{$lang_insert_image_align_baseline}</option>
     
    8366          </tr>
    8467          <tr>
    85             <td nowrap="nowrap"><!--{$lang_insert_image_dimensions}:</td>
    86             <td><input name="width" type="text" id="width" value="" size="3" maxlength="3">
     68            <td nowrap="nowrap"><label for="width">{$lang_insert_image_dimensions}</label></td>
     69            <td><input id="width" name="width" type="text" value="" size="3" maxlength="3">
    8770              x
    88               <input name="height" type="text" id="height" value="" size="3" maxlength="3">--></td>
    89           </tr>
    90 <!--          <tr>
    91             <td nowrap="nowrap">{$lang_insert_image_border}:</td>
    92             <td><input name="border" type="text" id="border" value="" size="3" maxlength="3"></td>
     71              <input id="height" name="height" type="text" value="" size="3" maxlength="3"></td>
    9372          </tr>
    9473          <tr>
    95             <td nowrap="nowrap">{$lang_insert_image_vspace}:</td>
    96             <td><input name="vspace" type="text" id="vspace" value="" size="3" maxlength="3"></td>
     74            <td nowrap="nowrap"><label for="border">{$lang_insert_image_border}</label></td>
     75            <td><input id="border" name="border" type="text" value="" size="3" maxlength="3"></td>
    9776          </tr>
    9877          <tr>
    99             <td nowrap="nowrap">{$lang_insert_image_hspace}:</td>
    100             <td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3"></td>
     78            <td nowrap="nowrap"><label for="vspace">{$lang_insert_image_vspace}</label></td>
     79            <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3"></td>
    10180          </tr>
    102 -->          <tr>
    103             <td nowrap="nowrap"><input type="submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();">
    104             </td>
    105             <td align="right"><input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();"></td>
     81          <tr>
     82            <td nowrap="nowrap"><label for="hspace">{$lang_insert_image_hspace}</label></td>
     83            <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3"></td>
    10684          </tr>
    107         </table></td>
    108     </tr>
    109   </table>
     85        </table>
     86        </div>
     87    </div>
     88
     89    <div class="mceActionPanel">
     90        <div style="float: left">
     91            <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
     92        </div>
     93
     94        <div style="float: right">
     95            <input type="submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();" />
     96        </div>
     97    </div>
    11098</form>
    11199</body>
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/about.js

    r3062 r3664  
    11function init() {
     2    var inst;
     3
    24    tinyMCEPopup.resizeToInnerSize();
     5    inst = tinyMCE.selectedInstance;
    36
    47    // Give FF some time
     
    2124    html += '<tbody>';
    2225
    23     for (var i=0; i<plugins.length; i++) {
    24         var info = getPluginInfo(plugins[i]);
     26    for (var i=0; i<inst.plugins.length; i++) {
     27        var info = getPluginInfo(inst.plugins[i]);
    2528
    2629        html += '<tr>';
     
    4750
    4851function getPluginInfo(name) {
    49     var fn = eval('tinyMCEPopup.windowOpener.TinyMCE_' + name + '_getInfo');
    50 
    51     if (typeof(fn) != 'undefined')
    52         return fn();
     52    if (tinyMCE.plugins[name].getInfo)
     53        return tinyMCE.plugins[name].getInfo();
    5354
    5455    return {
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/anchor.js

    r3062 r3664  
    2727function insertAnchor() {
    2828    var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
    29     var name = document.forms[0].anchorName.value;
     29    var name = document.forms[0].anchorName.value, e;
    3030
    3131    tinyMCEPopup.execCommand("mceBeginUndoLevel");
     
    4545        name = name.replace(/\"/g, '&quot;');
    4646        name = name.replace(/</g, '&lt;');
    47         name = name.replace(/>/g, '&gr;');
     47        name = name.replace(/>/g, '&gt;');
    4848
    49         html = '<a name="' + name + '"></a>';
     49        // Fix for bug #1447335
     50        if (tinyMCE.isGecko)
     51            html = '<a id="mceNewAnchor" name="' + name + '"></a>';
     52        else
     53            html = '<a name="' + name + '"></a>';
    5054
    5155        tinyMCEPopup.execCommand("mceInsertContent", false, html);
     56
     57        // Fix for bug #1447335 force cursor after the anchor element
     58        if (tinyMCE.isGecko) {
     59            e = inst.getDoc().getElementById('mceNewAnchor');
     60
     61            if (e) {
     62                inst.selection.selectNode(e, true, false, false);
     63                e.removeAttribute('id');
     64            }
     65        }
     66
    5267        tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst);
    5368    }
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js

    r3062 r3664  
    171171    ['&thorn;',   '&#254;',  true, 'thorn'],
    172172    ['&yuml;',    '&#255;',  true, 'y - diaeresis'],
    173 // ['&Alpha;',   '&#913;',  true, 'Alpha'],
     173    ['&Alpha;',   '&#913;',  true, 'Alpha'],
    174174    ['&Beta;',    '&#914;',  true, 'Beta'],
    175175    ['&Gamma;',   '&#915;',  true, 'Gamma'],
     
    280280            html += ''
    281281                + '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap"'
    282                 + ' onmouseover="tinyMCE.switchClass(this,\'charmapOver\');'
     282                + ' onmouseover="this.className=\'charmapOver\';'
    283283                + 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');"'
    284                 + ' onmouseout="tinyMCE.restoreClass(this,\'charmapOver\');"'
     284                + ' onmouseout="this.className=\'charmap\';"'
    285285                + ' 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] + '">'
    286286                + charmap[i][1]
     
    300300
    301301function insertChar(chr) {
    302     tinyMCEPopup.execCommand('mceInsertContent', false, '\&#' + chr + ';');
     302    tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';');
    303303
    304304    // Refocus in window
    305305    if (tinyMCEPopup.isWindow)
    306306        window.focus();
     307
     308    tinyMCEPopup.close();
    307309}
    308310
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js

    r3062 r3664  
    100100        + '</td></tr>'
    101101        + '</table>'
    102         + '<input type="button" id="insert" name="insert" value="{$lang_theme_colorpicker_apply}" style="margin-top:3px" onclick="selectColor();">'
     102        + '<div style="float: left"><input type="button" id="insert" name="insert" value="{$lang_theme_colorpicker_apply}" style="margin-top:3px" onclick="selectColor();"></div>'
     103        + '<div style="float: right"><input type="button" name="cancel" value="{$lang_cancel}" style="margin-top:3px" onclick="tinyMCEPopup.close();" id="cancel" /></div>'
    103104        + '</td></tr>'
    104105        + '</table>';
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/image.js

    r3517 r3664  
    99
    1010function insertImage() {
    11     if (window.opener) {
    12         var src = document.forms[0].src.value;
    13         var alt = document.forms[0].alt.value;
    14         var border = '';//document.forms[0].border.value;
    15         var vspace = '';//document.forms[0].vspace.value;
    16         var hspace = '';//document.forms[0].hspace.value;
    17         var width = '';//document.forms[0].width.value;
    18         var height = '';//document.forms[0].height.value;
    19         var align = document.forms[0].align.options[document.forms[0].align.selectedIndex].value;
     11    var src = document.forms[0].src.value;
     12    var alt = document.forms[0].alt.value;
     13    var border = document.forms[0].border.value;
     14    var vspace = document.forms[0].vspace.value;
     15    var hspace = document.forms[0].hspace.value;
     16    var width = document.forms[0].width.value;
     17    var height = document.forms[0].height.value;
     18    var align = document.forms[0].align.options[document.forms[0].align.selectedIndex].value;
    2019
    21         window.opener.tinyMCE.insertImage(src, alt, border, hspace, vspace, width, height, align);
    22         top.close();
    23     }
     20    tinyMCEPopup.restoreSelection();
     21    tinyMCE.themes['advanced']._insertImage(src, alt, border, hspace, vspace, width, height, align);
     22    tinyMCEPopup.close();
    2423}
    2524
     
    3837    formObj.src.value = tinyMCE.getWindowArg('src');
    3938    formObj.alt.value = tinyMCE.getWindowArg('alt');
    40 //  formObj.border.value = tinyMCE.getWindowArg('border');
    41 //  formObj.vspace.value = tinyMCE.getWindowArg('vspace');
    42 //  formObj.hspace.value = tinyMCE.getWindowArg('hspace');
    43 //  formObj.width.value = tinyMCE.getWindowArg('width');
    44 //  formObj.height.value = tinyMCE.getWindowArg('height');
     39    formObj.border.value = tinyMCE.getWindowArg('border');
     40    formObj.vspace.value = tinyMCE.getWindowArg('vspace');
     41    formObj.hspace.value = tinyMCE.getWindowArg('hspace');
     42    formObj.width.value = tinyMCE.getWindowArg('width');
     43    formObj.height.value = tinyMCE.getWindowArg('height');
    4544    formObj.insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
    4645
     
    6261function resetImageData() {
    6362    var formObj = document.forms[0];
    64     formObj.width.value = formObj.height.value = "";
     63    formObj.width.value = formObj.height.value = "";   
    6564}
    6665
     
    6867    var formObj = document.forms[0];
    6968
    70 //  if (formObj.width.value == "")
    71 //      formObj.width.value = preloadImg.width;
     69    if (formObj.width.value == "")
     70        formObj.width.value = preloadImg.width;
    7271
    73 //  if (formObj.height.value == "")
    74 //      formObj.height.value = preloadImg.height;
     72    if (formObj.height.value == "")
     73        formObj.height.value = preloadImg.height;
    7574}
    7675
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/link.js

    r3163 r3664  
    1111    tinyMCEPopup.resizeToInnerSize();
    1212
    13 //  document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','theme_advanced_link');
     13    document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','theme_advanced_link');
     14
     15    // Handle file browser
     16    if (isVisible('hrefbrowser'))
     17        document.getElementById('href').style.width = '180px';
    1418
    1519    var formObj = document.forms[0];
     
    2630    document.forms[0].insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
    2731
    28 //  addClassesToList('styleSelect', 'theme_advanced_link_styles');
    29 //  selectByValue(formObj, 'styleSelect', tinyMCE.getWindowArg('className'), true);
     32    addClassesToList('styleSelect', 'theme_advanced_link_styles');
     33    selectByValue(formObj, 'styleSelect', tinyMCE.getWindowArg('className'), true);
    3034
    31     // Handle file browser
    32     if (isVisible('hrefbrowser'))
    33         document.getElementById('href').style.width = '180px';
     35    // Hide css select row if no CSS classes
     36    if (formObj.styleSelect && formObj.styleSelect.options.length <= 1) {
     37        var sr = document.getElementById('styleSelectRow');
     38        sr.style.display = 'none';
     39        sr.parentNode.removeChild(sr);
     40    }
    3441
    3542    // Auto select link in list
     
    4552
    4653function insertLink() {
    47     if (window.opener) {
    48         var href = document.forms[0].href.value;
    49         var target = document.forms[0].target.options[document.forms[0].target.selectedIndex].value;
    50         var title = document.forms[0].linktitle.value;
    51         var style_class = '';//document.forms[0].styleSelect.value;
    52         var dummy;
     54    var href = document.forms[0].href.value;
     55    var target = document.forms[0].target.options[document.forms[0].target.selectedIndex].value;
     56    var title = document.forms[0].linktitle.value;
     57    var style_class = document.forms[0].styleSelect ? document.forms[0].styleSelect.value : "";
     58    var dummy;
    5359
    54         // Make anchors absolute
    55         if (href.charAt(0) == '#')
    56             href = tinyMCE.settings['document_base_url'] + href;
     60    // Make anchors absolute
     61    if (href.charAt(0) == '#')
     62        href = tinyMCE.settings['document_base_url'] + href;
    5763
    58         if (target == '_self')
    59             target = '';
     64    if (target == '_self')
     65        target = '';
    6066
    61         window.opener.tinyMCE.insertLink(href, target, title, dummy, style_class);
    62         tinyMCEPopup.close();
    63     }
     67    tinyMCEPopup.restoreSelection();
     68    tinyMCE.themes['advanced']._insertLink(href, target, title, dummy, style_class);
     69    tinyMCEPopup.close();
    6470}
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js

    r3136 r3664  
    66// Fixes some charcode issues
    77function fixContent(html) {
    8     // WP
    9     return html;
    10 
    11     html = html.replace(new RegExp('<(p|hr|table|tr|td|ol|ul|object|embed|li|blockquote)', 'gi'),'\n<$1');
     8/*  html = html.replace(new RegExp('<(p|hr|table|tr|td|ol|ul|object|embed|li|blockquote)', 'gi'),'\n<$1');
    129    html = html.replace(new RegExp('<\/(p|ol|ul|li|table|tr|td|blockquote|object)>', 'gi'),'</$1>\n');
    1310    html = tinyMCE.regexpReplace(html, '<br />','<br />\n','gi');
    14     html = tinyMCE.regexpReplace(html, '\n\n','\n','gi');
     11    html = tinyMCE.regexpReplace(html, '\n\n','\n','gi');*/
    1512    return html;
    1613}
     
    2118    document.forms[0].htmlSource.value = fixContent(tinyMCE.getContent(tinyMCE.getWindowArg('editor_id')));
    2219    resizeInputs();
    23     setWrap('off');
    2420}
    2521
    2622function setWrap(val) {
    27     // hard soft off
    28     document.forms[0].htmlSource.wrap = val;
     23    var s = document.forms[0].htmlSource;
     24
     25    s.wrap = val;
     26
     27    if (tinyMCE.isGecko) {
     28        var v = s.value;
     29        var n = s.cloneNode(false);
     30        n.setAttribute("wrap", val);
     31        s.parentNode.replaceChild(n, s);
     32        n.value = v;
     33    }
    2934}
    3035
     
    5257
    5358function renderWordWrap() {
    54     if (tinyMCE.isMSIE)
     59    if (tinyMCE.isMSIE || tinyMCE.isGecko)
    5560        document.write('<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{$lang_theme_code_wordwrap}</label>');
    5661}
  • trunk/wp-includes/js/tinymce/themes/advanced/langs/en.js

    r3163 r3664  
    33tinyMCE.addToLang('',{
    44theme_style_select : '-- Styles --',
    5 theme_code_desc : 'Edit HTML Source (Alt+e)',
     5theme_code_desc : 'Edit HTML Source',
    66theme_code_title : 'HTML Source Editor',
    77theme_code_wordwrap : 'Word wrap',
  • trunk/wp-includes/js/tinymce/themes/advanced/link.htm

    r3163 r3664  
    33    <title>{$lang_insert_link_title}</title>
    44    <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
     5    <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
    56    <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
    67    <script language="javascript" type="text/javascript" src="jscripts/link.js"></script>
    7     <style type="text/css">
    8         #insert, #cancel {
    9             font: 13px Verdana, Arial, Helvetica, sans-serif;
    10             height: auto;
    11             width: auto;
    12             background-color: transparent;
    13             background-image: url(../../../../../wp-admin/images/fade-butt.png);
    14             background-repeat: repeat;
    15             border: 3px double;
    16             border-right-color: rgb(153, 153, 153);
    17             border-bottom-color: rgb(153, 153, 153);
    18             border-left-color: rgb(204, 204, 204);
    19             border-top-color: rgb(204, 204, 204);
    20             color: rgb(51, 51, 51);
    21             padding: 0.25em 0.75em;
    22         }
    23         #insert:active, #cancel:active {
    24             background: #f4f4f4;
    25             border-left-color: #999;
    26             border-top-color: #999;
    27         }
    28     </style>
     8    <base target="_self" />
    299</head>
    30 <body onload="tinyMCEPopup.executeOnLoad('init();');document.getElementById('href').focus();" style="display: none">
    31 <form onsubmit="insertLink();return false;">
    32   <table border="0" cellpadding="0" cellspacing="0" width="100">
    33     <tr>
    34       <td align="center" valign="middle"><table border="0" cellpadding="4" cellspacing="0">
     10<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';document.getElementById('href').focus();" style="display: none">
     11<form onsubmit="insertLink();return false;" action="#">
     12    <div class="tabs">
     13        <ul>
     14            <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_link_title}</a></span></li>
     15        </ul>
     16    </div>
     17
     18    <div class="panel_wrapper">
     19        <div id="general_panel" class="panel current">
     20
     21        <table border="0" cellpadding="4" cellspacing="0">
    3522          <tr>
    36             <td colspan="2" class="title" nowrap="nowrap">{$lang_insert_link_title}</td>
    37           </tr>
    38           <tr>
    39             <td nowrap="nowrap">{$lang_insert_link_url}:</td>
    40             <td>              <table border="0" cellspacing="0" cellpadding="0">
    41                 <tr>
    42                   <td><input name="href" type="text" id="href" value="" style="width: 200px"></td>
    43                   <td id="hrefbrowsercontainer">&nbsp;</td>
    44                 </tr>
    45               </table></td>
     23            <td nowrap="nowrap"><label for="href">{$lang_insert_link_url}</label></td>
     24            <td><table border="0" cellspacing="0" cellpadding="0">
     25                  <tr>
     26                    <td><input id="href" name="href" type="text" value="" style="width: 200px" /></td>
     27                    <td id="hrefbrowsercontainer">&nbsp;</td>
     28                  </tr>
     29                </table></td>
    4630          </tr>
    4731          <!-- Link list -->
     
    5034                var html = "";
    5135
    52                 html += '<tr><td>{$lang_link_list}:</td>';
    53                 html += '<td><select name="link_list" style="width: 200px" onchange="this.form.href.value=this.options[this.selectedIndex].value;">';
     36                html += '<tr><td><label for="link_list">{$lang_link_list}</label></td>';
     37                html += '<td><select id="link_list" name="link_list" style="width: 200px" onchange="this.form.href.value=this.options[this.selectedIndex].value;">';
    5438                html += '<option value="">---</option>';
    5539
     
    6448          <!-- /Link list -->
    6549          <tr>
    66             <td nowrap="nowrap">{$lang_insert_link_target}:</td>
    67             <td><select name="target" style="width: 200px">
     50            <td nowrap="nowrap"><label for="target">{$lang_insert_link_target}</label></td>
     51            <td><select id="target" name="target" style="width: 200px">
    6852                <option value="_self">{$lang_insert_link_target_same}</option>
    6953                <option value="_blank">{$lang_insert_link_target_blank}</option>
     
    8973          </tr>
    9074          <tr>
    91             <td nowrap="nowrap">{$lang_theme_insert_link_titlefield}:</td>
    92             <td><input name="linktitle" type="text" id="linktitle" value="" style="width: 200px"></td>
     75            <td nowrap="nowrap"><label for="linktitle">{$lang_theme_insert_link_titlefield}</label></td>
     76            <td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px"></td>
    9377          </tr>
    9478          <tr id="styleSelectRow">
    95             <td><!--{$lang_class_name}:</td>
     79            <td><label for="styleSelect">{$lang_class_name}</label></td>
    9680            <td>
    9781             <select id="styleSelect" name="styleSelect">
    9882                <option value="" selected>{$lang_theme_style_select}</option>
    9983             </select></td>
    100             <td align="right">&nbsp;</td>
    101             <td align="right">&nbsp;--></td>
    10284          </tr>
    103           <tr>
    104             <td><input type="submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertLink();">
    105             </td>
    106             <td align="right"><input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();"></td>
    107           </tr>
    108         </table></td>
    109     </tr>
    110   </table>
     85        </table>
     86        </div>
     87    </div>
     88
     89    <div class="mceActionPanel">
     90        <div style="float: left">
     91            <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
     92        </div>
     93
     94        <div style="float: right">
     95            <input type="submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertLink();" />
     96        </div>
     97    </div>
    11198</form>
    11299</body>
  • trunk/wp-includes/js/tinymce/themes/advanced/source_editor.htm

    r3163 r3664  
    55    <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
    66    <script language="javascript" type="text/javascript" src="jscripts/source_editor.js"></script>
    7     <style type="text/css">
    8         #insert, #cancel {
    9             font: 13px Verdana, Arial, Helvetica, sans-serif;
    10             height: auto;
    11             width: auto;
    12             background-color: transparent;
    13             background-image: url(../../../../../wp-admin/images/fade-butt.png);
    14             background-repeat: repeat;
    15             border: 3px double;
    16             border-right-color: rgb(153, 153, 153);
    17             border-bottom-color: rgb(153, 153, 153);
    18             border-left-color: rgb(204, 204, 204);
    19             border-top-color: rgb(204, 204, 204);
    20             color: rgb(51, 51, 51);
    21             padding: 0.25em 0.75em;
    22         }
    23         #insert:active, #cancel:active {
    24             background: #f4f4f4;
    25             border-left-color: #999;
    26             border-top-color: #999;
    27         }
    28     </style>
     7    <base target="_self" />
    298</head>
    30 <body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');document.getElementById('htmlSource').focus();" onresize="resizeInputs();" style="display: none">
     9<body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');document.body.style.display='';document.getElementById('htmlSource').focus();" onresize="resizeInputs();" style="display: none">
    3110    <form name="source" onsubmit="saveContent();" action="#">
    3211        <div style="float: left" class="title">{$lang_theme_code_title}</div>
     
    3615        </div>
    3716
    38         <textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft"></textarea>
     17        <textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px" dir="ltr" wrap="off"></textarea>
    3918
    4019        <div class="mceActionPanel">
    4120            <div style="float: left">