Changeset 3664

Show
Ignore:
Timestamp:
03/30/06 07:50:33 (3 years ago)
Author:
ryan
Message:

tinyMCE 2.0.5 coming at you live. fixes #2598

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 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