Changeset 3136

Show
Ignore:
Timestamp:
11/17/05 17:47:29 (3 years ago)
Author:
ryan
Message:

Big tiny fixes from skeltoac. fixes #1897

Files:

Legend:

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

    r3135 r3136  
    101101    relative_urls : false, 
    102102    remove_script_host : false, 
     103    force_p_newlines : true, 
     104    force_br_newlines : false, 
     105    convert_newlines_to_brs : false, 
     106    remove_linebreaks : true, 
     107    save_callback : "wp_save_callback", 
    103108    valid_elements : "-a[href|title|rel],-strong/b,-em/i,-strike,-del,-u,p[class|align],-ol,-ul,-li,br,img[class|src|alt|title|width|height|align],-sub,-sup,-blockquote,-table[border=0|cellspacing|cellpadding|width|height|class|align],tr[class|rowspan|width|height|align|valign],td[dir|class|colspan|rowspan|width|height|align|valign],-div[dir|class|align],-span[class|align],-pre[class],address,-h1[class|align],-h2[class|align],-h3[class|align],-h4[class|align],-h5[class|align],-h6[class|align],hr", 
    104109    plugins : "wordpress,autosave" 
     
    336341require(ABSPATH . '/wp-admin/menu-header.php'); 
    337342 
    338 if ( $parent_file == 'options-general.php' ) { 
     343if ( $parent_file == 'options-personal.php' ) { 
    339344    require(ABSPATH . '/wp-admin/options-head.php'); 
    340345} 
  • trunk/wp-admin/edit-form-advanced.php

    r3135 r3136  
    88<?php endif; ?> 
    99 
     10<?php $richedit = ( 'true' != get_user_option('rich_editing') ) ? false : true; ?> 
     11 
    1012<form name="post" action="post.php" method="post" id="post"> 
    11 <?php if ( (isset($mode) && 'bookmarklet' == $mode) || 
    12             isset($_GET['popupurl']) ): ?> 
    13 <input type="hidden" name="mode" value="bookmarklet" /> 
    14 <?php endif; ?> 
    1513 
    1614<div class="wrap"> 
     
    138136</fieldset> 
    139137 
    140 <fieldset id="<?php echo ( 'true' != get_user_option('rich_editing') ) ? 'postdiv' : 'postdivrich'; ?>"> 
     138<fieldset id="<?php echo $richedit ? 'postdivrich' : 'postdiv'; ?>"> 
    141139<legend><?php _e('Post') ?></legend> 
    142140 
     
    147145 } 
    148146?> 
    149 <div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo $post->post_content ?></textarea></div> 
    150 </fieldset> 
    151  
    152 <?php if ( 'true' != get_user_option('rich_editing') ) : ?> 
    153 <?php the_quicktags(); ?> 
     147<?php if ( !$richedit ) the_quicktags(); ?> 
     148 
     149<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo $richedit ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div> 
     150</fieldset> 
     151 
     152<?php if ( !$richedit ) : ?> 
    154153<script type="text/javascript"> 
    155154<!-- 
     
    202201<p class="submit"><?php echo $saveasdraft; ?> <input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" />  
    203202<?php  
    204 if ('publish' != $post->post_status || 0 == $post_ID) { 
     203if ('publish' != $post_status || 0 == $post_ID) { 
    205204?> 
    206205<?php if ( current_user_can('publish_posts') ) : ?> 
     
    211210?> 
    212211<input name="referredby" type="hidden" id="referredby" value="<?php  
    213 if ( !empty($_REQUEST['popupurl']) ) 
    214     echo wp_specialchars($_REQUEST['popupurl']); 
    215 else if ( url_to_postid($_SERVER['HTTP_REFERER']) == $post_ID ) 
     212if ( url_to_postid($_SERVER['HTTP_REFERER']) == $post_ID ) 
    216213    echo 'redo'; 
    217214else 
     
    224221$uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID); 
    225222$uploading_iframe_src = "inline-uploading.php?action=view&amp;post=$uploading_iframe_ID"; 
    226 if ( !$attachments = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent = '$uploading_iframe_ID'") ) 
    227     $uploading_iframe_src = "inline-uploading.php?action=upload&amp;post=$uploading_iframe_ID"; 
    228223$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src); 
    229224if ( false != $uploading_iframe_src ) 
  • trunk/wp-admin/edit-form-comment.php

    r2789 r3136  
    55$form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment->comment_ID . "' />\n<input type='hidden' name='comment_post_ID' value='".$comment->comment_post_ID; 
    66?> 
     7<?php $richedit = ( 'true' != get_user_option('rich_editing') ) ? false : true; ?> 
    78 
    89<form name="post" action="post.php" method="post" id="post"> 
     
    3839<fieldset style="clear: both;"> 
    3940        <legend><?php _e('Comment') ?></legend> 
    40 <?php if ( 'true' != get_user_option('rich_editing') ) : ?> 
    41 <?php the_quicktags(); ?> 
    42 <script type="text/javascript"> 
    43 <!-- 
    44 edCanvas = document.getElementById('content'); 
    45 //--> 
    46 </script> 
    47 <?php endif; ?> 
     41<?php if ( !$richedit ) the_quicktags(); ?> 
     42 
    4843<?php 
    4944 $rows = get_settings('default_post_edit_rows'); 
     
    5550</fieldset> 
    5651 
     52<?php if ( !$richedit ) : ?> 
     53<script type="text/javascript"> 
     54<!-- 
     55edCanvas = document.getElementById('content'); 
     56//--> 
     57</script> 
     58<?php endif; ?> 
    5759 
    5860<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

    r3126 r3136  
    2020 
    2121?> 
     22 
     23<?php $richedit = ( 'true' != get_user_option('rich_editing') ) ? false : true; ?> 
    2224 
    2325<form name="post" action="post.php" method="post" id="post"> 
     
    118120 
    119121 
    120 <fieldset id="<?php echo ( 'true' != get_user_option('rich_editing') ) ? 'postdiv' : 'postdivrich'; ?>"> 
     122<fieldset id="<?php echo ( $richedit) ? 'postdivrich' : 'postdiv'; ?>"> 
    121123    <legend><?php _e('Page Content') ?></legend> 
    122124<?php 
     
    126128 } 
    127129?> 
    128 <div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo $post->post_content ?></textarea></div> 
     130<?php if (! $richedit ) the_quicktags(); ?> 
     131 
     132<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo $richedit ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div> 
    129133</fieldset> 
    130134 
    131 <?php if ( 'true' != get_user_option('rich_editing') ) : ?> 
    132 <?php the_quicktags(); ?> 
     135<?php if ( !$richedit ) : ?> 
    133136<script type="text/javascript"> 
    134137<!-- 
     
    141144<?php if ( $post_ID ) : ?> 
    142145<input name="save" type="submit" id="save" tabindex="5" value=" <?php _e('Save and Continue Editing'); ?> "/>  
    143 <input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php $post_ID ? _e('Save') : _e('Create New Page') ?> &raquo;" style="font-weight: bold;"/>  
     146<input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php $post_ID ? _e('Edit Page') : _e('Create New Page') ?> &raquo;" />  
    144147<?php else : ?> 
    145148<input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php _e('Create New Page') ?> &raquo;" />  
     
    151154$uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID); 
    152155$uploading_iframe_src = "inline-uploading.php?action=view&amp;post=$uploading_iframe_ID"; 
    153 if ( !$attachments = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent = '$uploading_iframe_ID'") ) 
    154     $uploading_iframe_src = "inline-uploading.php?action=upload&amp;post=$uploading_iframe_ID"; 
    155156$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src); 
    156157if ( false != $uploading_iframe_src ) 
  • trunk/wp-includes/functions-formatting.php

    r3114 r3136  
    6363    $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines  
    6464    $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates 
    65     $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "\t<p>$1</p>\n", $pee); // make paragraphs, including one at the end  
     65    $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end  
    6666    $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace  
    6767    $pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag 
     
    994994} 
    995995 
     996function wp_richedit_pre($text) { 
     997    // Filtering a blank results in an annoying <br />\n 
     998    if ( empty($text) ) return ''; 
     999 
     1000    $output = $text; 
     1001    $output = html_entity_decode($output); // undoes format_to_edit() 
     1002    $output = wptexturize($output); 
     1003    $output = convert_chars($output); 
     1004    $output = wpautop($output); 
     1005 
     1006    // These must be double-escaped or planets will collide. 
     1007    $output = str_replace('&lt;', '&amp;lt;', $output); 
     1008    $output = str_replace('&gt;', '&amp;gt;', $output); 
     1009 
     1010    return $output; 
     1011} 
     1012 
    9961013?> 
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css

    r2916 r3136  
    1 /* Window classes */ 
    2  
    3 .mceWindow { 
    4     position: absolute; 
    5     left: 0px; 
    6     top: 0px; 
    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

    r2993 r3136  
    1 /** 
    2  * $RCSfile: editor_plugin.js,v $ 
    3  * $Revision: 1.42 $ 
    4  * $Date: 2005/10/30 16:06:56 $ 
    5  * 
    6  * Moxiecode DHTML Windows script. 
    7  * 
    8  * @author Moxiecode 
    9  * @copyright Copyright � 2004, Moxiecode Systems AB, All rights reserved. 
    10  */ 
    11  function TinyMCE_inlinepopups_getInfo(){return{longname:'Inline Popups',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};};TinyMCE.prototype.orgOpenWindow=TinyMCE.prototype.openWindow;TinyMCE.prototype.openWindow=function(template,args){if(args['inline']!="yes"){mcWindows.selectedWindow=null;args['mce_inside_iframe']=false;this.orgOpenWindow(template,args);return;}var url,resizable,scrollbars;args['mce_inside_iframe']=true;tinyMCE.windowArgs=args;if(template['file'].charAt(0)!='/'&&template['file'].indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template['file'];else url=template['file'];if(!(width=parseInt(template['width'])))width=320;if(!(height=parseInt(template['height'])))height=200;resizable=(args&&args['resizable'])?args['resizable']:"no";scrollbars=(args&&args['scrollbars'])?args['scrollbars']:"no";height+=18;for(var name in args){if(typeof(args[name])=='function')continue;url=tinyMCE.replaceVar(url,name,escape(args[name]));}var elm=document.getElementById(this.selectedInstance.editorId+'_parent');var pos=tinyMCE.getAbsPosition(elm);pos.absLeft+=Math.round((elm.firstChild.clientWidth/2)-(width/2));pos.absTop+=Math.round((elm.firstChild.clientHeight/2)-(height/2));mcWindows.open(url,mcWindows.idCounter++,"modal=yes,width="+width+",height="+height+",resizable="+resizable+",scrollbars="+scrollbars+",statusbar="+resizable+",left="+pos.absLeft+",top="+pos.absTop);};TinyMCE.prototype.orgCloseWindow=TinyMCE.prototype.closeWindow;TinyMCE.prototype.closeWindow=function(win){if(mcWindows.selectedWindow!=null)mcWindows.selectedWindow.close();else this.orgCloseWindow(win);};TinyMCE.prototype.setWindowTitle=function(win_ref,title){for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(typeof(win)=='function')continue;if(win_ref.name==win.id+"_iframe")window.frames[win.id+"_iframe"].document.getElementById(win.id+'_title').innerHTML=title;}};function MCWindows(){this.settings=new Array();this.windows=new Array();this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isGecko=navigator.userAgent.indexOf('Gecko')!=-1;this.isSafari=navigator.userAgent.indexOf('Safari')!=-1;this.isMac=navigator.userAgent.indexOf('Mac')!=-1;this.isMSIE5_0=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5.0')!=-1);this.action="none";this.selectedWindow=null;this.lastSelectedWindow=null;this.zindex=100;this.mouseDownScreenX=0;this.mouseDownScreenY=0;this.mouseDownLayerX=0;this.mouseDownLayerY=0;this.mouseDownWidth=0;this.mouseDownHeight=0;this.idCounter=0;};MCWindows.prototype.init=function(settings){this.settings=settings;if(this.isMSIE)this.addEvent(document,"mousemove",mcWindows.eventDispatcher);else this.addEvent(window,"mousemove",mcWindows.eventDispatcher);this.addEvent(document,"mouseup",mcWindows.eventDispatcher);this.doc=document;};MCWindows.prototype.getParam=function(name,default_value){var value=null;value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");return value;};MCWindows.prototype.eventDispatcher=function(e){e=typeof(e)=="undefined"?window.event:e;if(mcWindows.selectedWindow==null)return;if(mcWindows.isGecko&&e.type=="mousedown"){var elm=e.currentTarget;for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(win.headElement==elm||win.resizeElement==elm){win.focus();break;}}}switch(e.type){case "mousemove":mcWindows.selectedWindow.onMouseMove(e);break;case "mouseup":mcWindows.selectedWindow.onMouseUp(e);break;case "mousedown":mcWindows.selectedWindow.onMouseDown(e);break;case "focus":mcWindows.selectedWindow.onFocus(e);break;}};MCWindows.prototype.addEvent=function(obj,name,handler){if(this.isMSIE)obj.attachEvent("on"+name,handler);else obj.addEventListener(name,handler,true);};MCWindows.prototype.cancelEvent=function(e){if(this.isMSIE){e.returnValue=false;e.cancelBubble=true;}else e.preventDefault();};MCWindows.prototype.parseFeatures=function(opts){opts=opts.toLowerCase();opts=opts.replace(/;/g,",");opts=opts.replace(/[^0-9a-z=,]/g,"");var optionChunks=opts.split(',');var options=new Array();options['left']="10";options['top']="10";options['width']="300";options['height']="300";options['resizable']="yes";options['minimizable']="yes";options['maximizable']="yes";options['close']="yes";options['movable']="yes";options['statusbar']="yes";options['scrollbars']="auto";options['modal']="no";if(opts=="")return options;for(var i=0;i<optionChunks.length;i++){var parts=optionChunks[i].split('=');if(parts.length==2)options[parts[0]]=parts[1];}options['left']=parseInt(options['left']);options['top']=parseInt(options['top']);options['width']=parseInt(options['width']);options['height']=parseInt(options['height']);return options;};MCWindows.prototype.open=function(url,name,features){this.lastSelectedWindow=this.selectedWindow;var win=new MCWindow();var winDiv,html="",id;var imgPath=this.getParam("images_path");features=this.parseFeatures(features);id="mcWindow_"+name;win.deltaHeight=18;if(features['statusbar']=="yes"){win.deltaHeight+=13;if(this.isMSIE)win.deltaHeight+=1;}width=parseInt(features['width']);height=parseInt(features['height'])-win.deltaHeight;if(this.isMSIE)width-=2;win.id=id;win.url=url;win.name=name;win.features=features;this.windows[name]=win;iframeWidth=width;iframeHeight=height;html+='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';html+='<html>';html+='<head>';html+='<title>Wrapper iframe</title>';html+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';html+='<link href="'+this.getParam("css_file")+'" rel="stylesheet" type="text/css" />';html+='</head>';html+='<body onload="parent.mcWindows.onLoad(\''+name+'\');">';html+='<div id="'+id+'_container" class="mceWindow">';html+='<div id="'+id+'_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\''+name+'\'].focus();">';html+='  <div id="'+id+'_title" class="mceWindowTitle"';html+='  onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;"></div>';html+='    <div class="mceWindowHeadTools">';html+='      <a href="javascript:parent.mcWindows.windows[\''+name+'\'].close();" target="_self" onmousedown="return false;" class="mceWindowClose"><img border="0" src="'+imgPath+'/window_close.gif" /></a>';html+='    </div>';html+='</div><div id="'+id+'_body" class="mceWindowBody" style="width: '+width+'px; height: '+height+'px;">';html+='<iframe id="'+id+'_iframe" name="'+id+'_iframe" frameborder="0" width="'+iframeWidth+'" height="'+iframeHeight+'" src="'+url+'" class="mceWindowBodyIframe" scrolling="'+features['scrollbars']+'"></iframe></div>';if(features['statusbar']=="yes"){html+='<div id="'+id+'_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\''+name+'\'].focus();">';if(features['resizable']=="yes"){if(this.isGecko)html+='<div id="'+id+'_resize" class="mceWindowResize"><div style="background-image: url(\''+imgPath+'/window_resize.gif\'); width: 12px; height: 12px;"></div></div>';else html+='<div id="'+id+'_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\''+name+'\'].focus();" border="0" src="'+imgPath+'/window_resize.gif" /></div>';}html+='</div>';}html+='</div>';html+='</body>';html+='</html>';this.createFloatingIFrame(id,features['left'],features['top'],features['width'],features['height'],html);};MCWindows.prototype.setDocumentLock=function(state){if(state){var elm=document.getElementById('mcWindowEventBlocker');if(elm==null){elm=document.createElement("div");elm.id="mcWindowEventBlocker";elm.style.position="absolute";elm.style.left="0px";elm.style.top="0px";document.body.appendChild(elm);}elm.style.display="none";var imgPath=this.getParam("images_path");var width=document.body.clientWidth;var height=document.body.clientHeight;elm.style.width=width;elm.style.height=height;elm.innerHTML='<img src="'+imgPath+'/spacer.gif" width="'+width+'" height="'+height+'" />';elm.style.zIndex=mcWindows.zindex-1;elm.style.display="block";}else{var elm=document.getElementById('mcWindowEventBlocker');if(mcWindows.windows.length==0)elm.parentNode.removeChild(elm);else elm.style.zIndex=mcWindows.zindex-1;}};MCWindows.prototype.onLoad=function(name){var win=mcWindows.windows[name];var id="mcWindow_"+name;var wrapperIframe=window.frames[id+"_iframe"].frames[0];var wrapperDoc=window.frames[id+"_iframe"].document;var doc=window.frames[id+"_iframe"].document;var winDiv=document.getElementById("mcWindow_"+name+"_div");var realIframe=window.frames[id+"_iframe"].frames[0];win.id="mcWindow_"+name;win.winElement=winDiv;win.bodyElement=doc.getElementById(id+'_body');win.iframeElement=doc.getElementById(id+'_iframe');win.headElement=doc.getElementById(id+'_head');win.titleElement=doc.getElementById(id+'_title');win.resizeElement=doc.getElementById(id+'_resize');win.containerElement=doc.getElementById(id+'_container');win.left=win.features['left'];win.top=win.features['top'];win.frame=window.frames[id+'_iframe'].frames[0];win.wrapperFrame=window.frames[id+'_iframe'];win.wrapperIFrameElement=document.getElementById(id+"_iframe");mcWindows.addEvent(win.headElement,"mousedown",mcWindows.eventDispatcher);if(win.resizeElement!=null)mcWindows.addEvent(win.resizeElement,"mousedown",mcWindows.eventDispatcher);if(mcWindows.isMSIE){mcWindows.addEvent(realIframe.document,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(realIframe.document,"mouseup",mcWindows.eventDispatcher);}else{mcWindows.addEvent(realIframe,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(realIframe,"mouseup",mcWindows.eventDispatcher);mcWindows.addEvent(realIframe,"focus",mcWindows.eventDispatcher);}for(var i=0;i<window.frames.length;i++){if(!window.frames[i]._hasMouseHandlers){if(mcWindows.isMSIE){mcWindows.addEvent(window.frames[i].document,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(window.frames[i].document,"mouseup",mcWindows.eventDispatcher);}else{mcWindows.addEvent(window.frames[i],"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(window.frames[i],"mouseup",mcWindows.eventDispatcher);}window.frames[i]._hasMouseHandlers=true;}}if(mcWindows.isMSIE){mcWindows.addEvent(win.frame.document,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(win.frame.document,"mouseup",mcWindows.eventDispatcher);}else{mcWindows.addEvent(win.frame,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(win.frame,"mouseup",mcWindows.eventDispatcher);mcWindows.addEvent(win.frame,"focus",mcWindows.eventDispatcher);}var func=this.getParam("on_open_window","");if(func!="")eval(func+"(win);");win.focus();if(win.features['modal']=="yes")mcWindows.setDocumentLock(true);};MCWindows.prototype.createFloatingIFrame=function(id_prefix,left,top,width,height,html){var iframe=document.createElement("iframe");var div=document.createElement("div");width=parseInt(width);height=parseInt(height)+1;div.setAttribute("id",id_prefix+"_div");div.setAttribute("width",width);div.setAttribute("height",(height));div.style.position="absolute";div.style.left=left+"px";div.style.top=top+"px";div.style.width=width+"px";div.style.height=(height)+"px";div.style.backgroundColor="white";div.style.display="none";if(this.isGecko){iframeWidth=width+2;iframeHeight=height+2;}else{iframeWidth=width;iframeHeight=height+1;}iframe.setAttribute("id",id_prefix+"_iframe");iframe.setAttribute("name",id_prefix+"_iframe");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMargin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",iframeWidth);iframe.setAttribute("height",iframeHeight);iframe.setAttribute("scrolling","no");iframe.style.width=iframeWidth+"px";iframe.style.height=iframeHeight+"px";iframe.style.backgroundColor="white";div.appendChild(iframe);document.body.appendChild(div);div.innerHTML=div.innerHTML;if(this.isSafari){window.setTimeout(function(){doc=window.frames[id_prefix+'_iframe'].document;doc.open();doc.write(html);doc.close();},10);}else{doc=window.frames[id_prefix+'_iframe'].window.document;doc.open();doc.write(html);doc.close();}div.style.display="block";return div;};function MCWindow(){};MCWindow.prototype.focus=function(){if(this!=mcWindows.selectedWindow){this.winElement.style.zIndex=++mcWindows.zindex;mcWindows.lastSelectedWindow=mcWindows.selectedWindow;mcWindows.selectedWindow=this;}};MCWindow.prototype.minimize=function(){};MCWindow.prototype.maximize=function(){};MCWindow.prototype.startResize=function(){mcWindows.action="resize";};MCWindow.prototype.startMove=function(e){mcWindows.action="move";};MCWindow.prototype.close=function(){if(mcWindows.lastSelectedWindow!=null)mcWindows.lastSelectedWindow.focus();var mcWindowsNew=new Array();for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(typeof(win)=='function')continue;if(win.name!=this.name)mcWindowsNew[n]=win;}mcWindows.windows=mcWindowsNew;var e=mcWindows.doc.getElementById(this.id+"_iframe");e.parentNode.removeChild(e);var e=mcWindows.doc.getElementById(this.id+"_div");e.parentNode.removeChild(e);mcWindows.setDocumentLock(false);};MCWindow.prototype.onMouseMove=function(e){var scrollX=0;var scrollY=0;var dx=e.screenX-mcWindows.mouseDownScreenX;var dy=e.screenY-mcWindows.mouseDownScreenY;switch(mcWindows.action){case "resize":width=mcWindows.mouseDownWidth+(e.screenX-mcWindows.mouseDownScreenX);height=mcWindows.mouseDownHeight+(e.screenY-mcWindows.mouseDownScreenY);width=width<100?100:width;height=height<100?100:height;this.wrapperIFrameElement.style.width=width+2;this.wrapperIFrameElement.style.height=height+2;this.wrapperIFrameElement.width=width+2;this.wrapperIFrameElement.height=height+2;this.winElement.style.width=width;this.winElement.style.height=height;height=height-this.deltaHeight;this.containerElement.style.width=width;this.iframeElement.style.width=width;this.iframeElement.style.height=height;this.bodyElement.style.width=width;this.bodyElement.style.height=height;this.headElement.style.width=width;mcWindows.cancelEvent(e);break;case "move":this.left=mcWindows.mouseDownLayerX+(e.screenX-mcWindows.mouseDownScreenX);this.top=mcWindows.mouseDownLayerY+(e.screenY-mcWindows.mouseDownScreenY);this.winElement.style.left=this.left+"px";this.winElement.style.top=this.top+"px";mcWindows.cancelEvent(e);break;}};function debug(msg){document.getElementById('debug').value+=msg+"\n";}MCWindow.prototype.onMouseUp=function(e){mcWindows.action="none";};MCWindow.prototype.onFocus=function(e){var winRef=e.currentTarget;for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(typeof(win)=='function')continue;if(winRef.name==win.id+"_iframe"){win.focus();return;}}};MCWindow.prototype.onMouseDown=function(e){var elm=mcWindows.isMSIE?this.wrapperFrame.event.srcElement:e.target;var scrollX=0;var scrollY=0;mcWindows.mouseDownScreenX=e.screenX;mcWindows.mouseDownScreenY=e.screenY;mcWindows.mouseDownLayerX=this.left;mcWindows.mouseDownLayerY=this.top;mcWindows.mouseDownWidth=parseInt(this.winElement.style.width);mcWindows.mouseDownHeight=parseInt(this.winElement.style.height);if(this.resizeElement!=null&&elm==this.resizeElement.firstChild)this.startResize(e);else this.startMove(e);mcWindows.cancelEvent(e);};var mcWindows=new MCWindows();mcWindows.init({images_path:tinyMCE.baseURL+"/plugins/inlinepopups/images",css_file:tinyMCE.baseURL+"/plugins/inlinepopups/css/inlinepopup.css"}); 
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js

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