Changeset 8720

Show
Ignore:
Timestamp:
08/24/08 06:56:22 (3 months ago)
Author:
azaozz
Message:

Reply to comments from admin, first run, see #7435

Files:

Legend:

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

    r8712 r8720  
    423423        ) ); 
    424424    } 
     425    $x->send(); 
     426    break; 
     427case 'replyto-comment' : 
     428    check_ajax_referer( $action ); 
     429 
     430    $comment_post_ID = (int) $_POST['comment_post_ID']; 
     431    if ( !current_user_can( 'edit_post', $comment_post_ID ) ) 
     432        die('-1'); 
     433 
     434    $status = $wpdb->get_var( $wpdb->prepare("SELECT post_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) ); 
     435 
     436    if ( empty($status) ) 
     437        die('1'); 
     438    elseif ( in_array($status->post_status, array('draft', 'pending') ) ) 
     439        die( __('Error: you are replying to comment on a draft post.') ); 
     440 
     441    $user = wp_get_current_user(); 
     442    if ( $user->ID ) { 
     443        $comment_author       = $wpdb->escape($user->display_name); 
     444        $comment_author_email = $wpdb->escape($user->user_email); 
     445        $comment_author_url   = $wpdb->escape($user->user_url); 
     446        $comment_content      = trim($_POST['comment']); 
     447        if ( current_user_can('unfiltered_html') ) { 
     448            if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) { 
     449                kses_remove_filters(); // start with a clean slate 
     450                kses_init_filters(); // set up the filters 
     451            } 
     452        } 
     453    } else { 
     454        die( __('Sorry, you must be logged in to reply to a comment.') ); 
     455    } 
     456 
     457    if ( '' == $comment_content ) 
     458        die( __('Error: please type a comment.') ); 
     459 
     460    $comment_parent = absint($_POST['comment_ID']); 
     461    $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); 
     462 
     463    $comment_id = wp_new_comment( $commentdata ); 
     464    $comment = get_comment($comment_id); 
     465    if ( ! $comment ) die('1'); 
     466 
     467    $mode = ( isset($_POST['mode']) && 'single' == $_POST['mode'] ) ? 'single' : 'detail'; 
     468    $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1'; 
     469    $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0; 
     470 
     471    if ( get_option('show_avatars') && 'single' != $mode ) 
     472        add_filter( 'comment_author', 'floated_admin_avatar' ); 
     473 
     474    $x = new WP_Ajax_Response(); 
     475 
     476    ob_start(); 
     477        _wp_comment_row( $comment->comment_ID, $mode, false, $checkbox ); 
     478        $comment_list_item = ob_get_contents(); 
     479    ob_end_clean(); 
     480 
     481    $x->add( array( 
     482        'what' => 'comment', 
     483        'id' => $comment->comment_ID, 
     484        'data' => $comment_list_item, 
     485        'position' => $position 
     486    )); 
     487 
    425488    $x->send(); 
    426489    break; 
  • trunk/wp-admin/admin-footer.php

    r8697 r8720  
    1111</div><!-- wpbody --> 
    1212</div><!-- wpcontent --> 
    13 </div><!-- wpwrap --> 
     13<br class="clear" /></div><!-- wpwrap --> 
    1414<div id="footer"> 
    1515<p><?php 
  • trunk/wp-admin/css/colors-classic.css

    r8691 r8720  
    5555 
    5656li.widget-list-control-item, div.nav, .tablenav, #dashboard-widgets p.dashboard-widget-links, 
    57 ul.view-switch li.current, .form-table tr, #poststuff h3, 
     57ul.view-switch li.current, .form-table tr, #poststuff h3, #replyhandle, 
    5858.login form, h3.info-box-title, #post-status-info { 
    5959    background-color: #cfebf7; 
     
    7171#post-body ul#category-tabs li.ui-tabs-selected, .button-secondary, 
    7272#quicktags, #login form .submit input, #post-search .button, 
    73 #post-search-prep .button
     73#post-search-prep .button, #ed_reply_toolbar
    7474    background-color: #8ebddc !important; 
    7575} 
     
    377377} 
    378378 
    379 #ed_toolbar input
     379#ed_toolbar input, #ed_reply_toolbar input
    380380    background: url( ../images/fade-butt.png ) #fff repeat-x 0 -2px; 
    381381} 
  • trunk/wp-admin/css/colors-fresh.css

    r8691 r8720  
    5555 
    5656li.widget-list-control-item, div.nav, .tablenav, #dashboard-widgets p.dashboard-widget-links, 
    57 ul.view-switch li.current, .form-table tr, #poststuff h3, 
     57ul.view-switch li.current, .form-table tr, #poststuff h3, #replyhandle, 
    5858.login form, h3.info-box-title, #post-status-info { 
    5959    background-color: #eaf3fa; 
     
    7171#post-body ul#category-tabs li.ui-tabs-selected, .button-secondary, 
    7272#quicktags, #login form .submit input, #post-search .button, 
    73 #post-search-prep .button
     73#post-search-prep .button, #ed_reply_toolbar
    7474    background-color: #cee1ef !important; 
    7575} 
     
    366366} 
    367367 
    368 #ed_toolbar input
     368#ed_toolbar input, #ed_reply_toolbar input
    369369    background: url( ../images/fade-butt.png ) #fff repeat-x 0 -2px; 
    370370} 
  • trunk/wp-admin/edit-comments.php

    r8710 r8720  
    1212$title = __('Edit Comments'); 
    1313wp_enqueue_script( 'admin-comments' ); 
    14 wp_enqueue_script('admin-forms'); 
     14wp_enqueue_script( 'admin-forms' ); 
     15wp_enqueue_script( 'quicktags' ); 
    1516 
    1617if ( !empty( $_REQUEST['delete_comments'] ) && isset($_REQUEST['action']) ) { 
     
    5455require_once('admin-header.php'); 
    5556 
    56 if ( empty($_GET['mode']) ) 
    57     $mode = 'detail'; 
    58 else 
    59     $mode = attribute_escape($_GET['mode']); 
    60  
    61 if ( isset($_GET['comment_status']) ) 
    62     $comment_status = attribute_escape($_GET['comment_status']); 
    63 else 
    64     $comment_status = ''; 
    65  
    66 if ( isset($_GET['s']) ) 
    67     $search_dirty = $_GET['s']; 
    68 else 
    69     $search_dirty = ''; 
     57$mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : attribute_escape($_GET['mode']); 
     58 
     59$comment_status = isset($_GET['comment_status']) ? attribute_escape($_GET['comment_status']) : ''; 
     60 
     61$search_dirty = ( isset($_GET['s']) ) ? $_GET['s'] : ''; 
    7062$search = attribute_escape( $search_dirty ); 
    7163?> 
     
    216208    <th scope="col" class="comment-column"><?php _e('Comment') ?></th> 
    217209    <th scope="col" class="author-column"><?php _e('Author') ?></th> 
    218     <th scope="col" class="date-column"><?php _e('Comment Submitted') ?></th> 
     210    <th scope="col" class="date-column"><?php _e('Submitted') ?></th> 
    219211    <th scope="col" class="response-column"><?php _e('In Response To This Post') ?></th> 
    220212  </tr> 
     
    270262</div> 
    271263 
    272 <?php include('admin-footer.php'); ?> 
     264<?php 
     265wp_comment_reply('-1', true, 'detail'); 
     266include('admin-footer.php'); ?> 
  • trunk/wp-admin/edit-form-advanced.php

    r8712 r8720  
    326326</table> 
    327327 
    328  
    329 <?php 
    330  
    331  
    332  
     328<?php 
    333329} 
    334330add_meta_box('commentstatusdiv', __('Comments on this Post'), 'post_comment_status_meta_box', 'post', 'normal', 'core'); 
     
    542538</form> 
    543539 
     540<?php wp_comment_reply(); ?> 
     541 
    544542<?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?> 
    545543<script type="text/javascript"> 
  • trunk/wp-admin/edit-pages.php

    r8682 r8720  
    6969if ( is_singular() ) 
    7070    wp_enqueue_script( 'admin-comments' ); 
     71 
    7172require_once('admin-header.php'); 
    7273 
     
    241242 
    242243<?php 
    243  
     244wp_comment_reply(); 
    244245endif; // comments 
    245246endif; // posts; 
  • trunk/wp-admin/edit.php

    r8694 r8720  
    5454list($post_stati, $avail_post_stati) = wp_edit_posts_query(); 
    5555 
    56 if ( 1 == count($posts) && is_singular() ) 
     56if ( 1 == count($posts) && is_singular() ) { 
    5757    wp_enqueue_script( 'admin-comments' ); 
     58    wp_enqueue_script( 'quicktags' ); 
     59} 
     60 
    5861require_once('admin-header.php'); 
    5962 
     
    268271 
    269272<?php 
    270  
     273wp_comment_reply(); 
    271274endif; // comments 
    272275endif; // posts; 
  • trunk/wp-admin/gears-manifest.php

    r8618 r8720  
    136136{ 
    137137"betaManifestVersion" : 1, 
    138 "version" : "<?php echo $man_version; ?>_20080731", 
     138"version" : "<?php echo $man_version; ?>_20080823", 
    139139"entries" : [ 
    140140<?php echo $defaults; ?> 
     
    174174{ "url" : "images/no.png" }, 
    175175{ "url" : "images/yes.png" }, 
     176{ "url" : "images/se.png" }, 
    176177 
    177178<?php if ( is_file('../wp-includes/js/tinymce/tiny_mce.js') ) { ?> 
  • trunk/wp-admin/includes/template.php

    r8715 r8720  
    800800 
    801801    if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 
    802         $actions['approve']   = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | '
    803         $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | '
     802        $actions['approve']   = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . "</a> | "
     803        $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . "</a> | "
    804804        $actions['edit']      = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a> | '; 
    805         $actions['flag']      = "<a href='#' class='no-crazy'>Flag for Follow-up</a> | "; 
    806         $actions['spam']      = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | '; 
     805        if ( 'spam' != $the_comment_status ) 
     806           $actions['spam']      = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | '; 
    807807        $actions['delete']    = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>'; 
    808808 
     
    817817        } 
    818818 
    819         if ( 'spam' == $the_comment_status ) 
    820             unset($actions['spam'])
     819        if ( 'spam' != $the_comment_status ) 
     820            $actions['reply'] = ' | <a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',this);return false;" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>'
    821821 
    822822        $actions = apply_filters( 'comment_row_actions', $actions, $comment ); 
    823823 
    824824        foreach ( $actions as $action => $link ) 
    825             echo "<span class='$action'>$link</span>"; 
     825            echo "<span class='$action'>$link</span>\n"; 
    826826    } 
    827827    ?> 
     
    842842<?php if ( 'single' !== $mode ) : ?> 
    843843    <td class="response-column"> 
    844     "<?php echo $post_link ?>" <?php echo sprintf('(%s comments)', $post->comment_count); ?><br/> 
     844    "<?php echo $post_link ?>" <?php echo sprintf('(%s comments)', $post->comment_count); ?><br /> 
    845845    <?php echo get_the_time(__('Y/m/d \a\t g:ia')); ?> 
    846846    </td> 
     
    848848  </tr> 
    849849    <?php 
     850} 
     851 
     852function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single') { 
     853    global $current_user; 
     854 
     855    // allow plugin to replace the popup content 
     856    $content = apply_filters( 'wp_comment_reply', '' ); 
     857     
     858    if ( ! empty($content) ) { 
     859        echo $content; 
     860        return; 
     861    } 
     862?> 
     863    <div id="replyerror" style="display:none;"> 
     864    <img src="images/logo.gif" /> 
     865    <h3 class="info-box-title"><?php _e('Comment Reply Error'); ?></h3> 
     866    <p id="replyerrtext"></p> 
     867    <p class="submit"><button id="close-button" onclick="commentReply.close();" class="button"><?php _e('Close'); ?></button></p> 
     868    </div> 
     869     
     870    <div id="replydiv" style="display:none;"> 
     871    <p id="replyhandle"><?php _e('Reply'); ?></p> 
     872    <form action="" method="post" id="replyform"> 
     873    <input type="hidden" name="user_ID" id="user_ID" value="<?php echo $current_user->ID; ?>" /> 
     874    <input type="hidden" name="action" value="replyto-comment" /> 
     875    <input type="hidden" name="comment_ID" id="comment_ID" value="" /> 
     876    <input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" /> 
     877    <input type="hidden" name="position" id="position" value="<?php echo $position; ?>" /> 
     878    <input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" /> 
     879    <input type="hidden" name="mode" id="mode" value="<?php echo $mode; ?>" /> 
     880    <?php wp_nonce_field( 'replyto-comment', '_ajax_nonce', false ); ?> 
     881    <?php wp_comment_form_unfiltered_html_nonce(); ?> 
     882 
     883    <div id="replycontainer"><textarea rows="5" cols="50" name="replycontent" tabindex="10" id="replycontent"></textarea></div> 
     884 
     885    <p id="replysubmit"><input type="button" onclick="commentReply.close();" class="button" value="<?php _e('Cancel'); ?>" /> 
     886    <input type="button" onclick="commentReply.send();" class="button" value="<?php _e('Submit Reply'); ?>" /></p> 
     887    </form> 
     888    </div> 
     889<?php 
    850890} 
    851891 
  • trunk/wp-admin/js/edit-comments.js

    r8691 r8720  
    7979theList = $('#the-comment-list').wpList( { alt: '', dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } ); 
    8080 
    81 } ); 
     81}); 
     82 
     83(function($){ 
     84 
     85commentReply = { 
     86 
     87    open : function(c, p) { 
     88        var d = $('#comment-'+c).offset(), H = $('#replydiv').height(), top = 200, left = 100, h = 120; 
     89 
     90        if ( d && H ) { 
     91            top = (d.top - H) < 10 ? 10 : d.top - H - 5; 
     92            left = d.left; 
     93        } 
     94 
     95        $('#replydiv').show(); 
     96        $('#replydiv #comment_post_ID').val(p); 
     97        $('#replydiv #comment_ID').val(c); 
     98 
     99        $('#replydiv').draggable({ 
     100            handle : '#replyhandle', 
     101            containment : '#wpwrap' 
     102        }); 
     103 
     104        $('#replydiv').resizable({ 
     105            handles : 'se', 
     106            minHeight : 200, 
     107            minWidth : 400, 
     108            containment : '#wpwrap', 
     109            resize : function(e,o) { 
     110                h = o.size.height - 80 - $('#ed_reply_qtags').height(); 
     111                $('#replycontainer').height(h); 
     112            }, 
     113            stop : function(e,o) { 
     114                if ( $.browser.msie ) 
     115                    $('#replycontent').height(h); 
     116            } 
     117        }); 
     118 
     119        $('.ui-resizable-se').css({ 
     120            border: '0 none', 
     121            width: '11px', 
     122            height: '12px', 
     123            background: 'transparent url(images/se.png) no-repeat scroll 0 0' 
     124        }); 
     125 
     126        $('#replydiv').css({ 
     127            'position' : 'absolute', 
     128            'top' : top, 
     129            'left' : left 
     130        }); 
     131 
     132        $('#replycontent').focus().keyup(function(e){ 
     133            if (e.which == 27) commentReply.close(); // close on Escape 
     134        }); 
     135         
     136        // emulate the Safari/Opera scrollIntoView 
     137        var to = $('#replydiv').offset(); 
     138        var scr = document.documentElement.scrollTop ? document.documentElement.scrollTop : 0; 
     139 
     140        if ( scr - 20 > to.top ) 
     141            window.scroll(0, to.top - 100); 
     142    }, 
     143 
     144    close : function() { 
     145        $('#replycontent').val(''); 
     146        $('#replyerror').hide(); 
     147 
     148        $('#replydiv').draggable('destroy').resizable('destroy').css('position','relative'); 
     149        $('#replydiv').hide(); 
     150        return false; 
     151    }, 
     152 
     153    send : function() { 
     154        var post = {}; 
     155 
     156        $('#replyform input').each(function() { 
     157            post[ $(this).attr('name') ] = $(this).val(); 
     158        }); 
     159 
     160        post.comment = $('#replycontent').val(); 
     161        post.id = post.comment_post_ID; 
     162 
     163        $.ajax({ 
     164            type : 'POST', 
     165            url : wpListL10n.url, 
     166            data : post, 
     167            success : function(x) { commentReply.show(x); }, 
     168            error : function(r) { commentReply.error(r); } 
     169        }); 
     170    }, 
     171 
     172    show : function(xml) { 
     173 
     174        if ( typeof(xml) == 'string' ) { 
     175            this.error({'responseText': xml}); 
     176            return; 
     177        } 
     178 
     179        var r = wpAjax.parseAjaxResponse(xml); 
     180        if ( r.errors ) 
     181            this.error({'responseText': wpAjax.broken}); 
     182 
     183        r = r.responses[0]; 
     184        this.close(); 
     185//      var scr1 = $('#the-comment-list').offset(), scr2 = $('#the-comment-list').height(); 
     186 
     187        if ( r.position == -1 ) { 
     188//          window.scroll(0, scr1.top - 100); // Scroll to the new comment? Seems annoing.. 
     189            $('#the-comment-list').prepend(r.data); 
     190        } else { 
     191//          window.scroll(0, scr1.top + scr2 + 200); 
     192            $('#the-comment-list').append(r.data); 
     193        } 
     194 
     195        $('#comment-'+r.id) 
     196            .animate( { backgroundColor:"#CFEBF7" }, 600 ) 
     197            .animate( { backgroundColor:"transparent" }, 600 ); 
     198    }, 
     199 
     200    error : function(r) { 
     201        var er = r.statusText; 
     202 
     203        if ( r.responseText ) 
     204            er = r.responseText.replace( /<.[^<>]*?>/g, '' ); 
     205 
     206        if ( er ) { 
     207            var o = $('#replydiv').offset(); 
     208            $('#replydiv').hide(); 
     209 
     210            $('#replyerror').css({ 
     211                'top' : o.top + 60 + 'px', 
     212                'left' : o.left + 'px' 
     213            }).show().draggable(); 
     214 
     215            $('#replyerrtext').html(er) 
     216            $('#close-button').css('outline','none').focus().keyup(function(e) { 
     217                if (e.which == 27) commentReply.close(); // close on Escape 
     218            }); 
     219        } 
     220    } 
     221
     222 
     223$(document).ready(function(){ 
     224    if ( typeof QTags != 'undefined' ) 
     225        ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more'); 
     226}); 
     227 
     228})(jQuery); 
  • trunk/wp-admin/js/editor.js

    r8600 r8720  
    11wpEditorInit = function() { 
    2     // Activate tinyMCE if it's the user's default editor 
    3     if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor ) { 
    4         document.getElementById('editorcontainer').style.padding = '0px'; 
    5         tinyMCE.execCommand("mceAddControl", false, "content"); 
     2    var H; 
     3 
     4    // Activate tinyMCE if it's the user's default editor 
     5    if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor ) { 
     6        try { document.getElementById('editorcontainer').style.padding = '0px'; } catch(e){}; 
     7        try { document.getElementById("quicktags").style.display = "none"; } catch(e){}; 
     8        tinyMCE.execCommand("mceAddControl", false, "content"); 
    69    } else { 
    7         var H; 
    8         if ( H = tinymce.util.Cookie.getHash("TinyMCE_content_size") ) 
    9             document.getElementById('content').style.height = H.ch - 30 + 'px'; 
    10     } 
     10        if ( H = tinymce.util.Cookie.getHash("TinyMCE_content_size") ) 
     11            try { document.getElementById('content').style.height = H.ch - 30 + 'px'; } catch(e){}; 
     12    } 
    1113}; 
    1214 
    1315switchEditors = { 
    1416 
    15     saveCallback : function(el, content, body) { 
     17   saveCallback : function(el, content, body) { 
    1618 
    17         document.getElementById(el).style.color = '#fff'; 
    18         if ( tinyMCE.activeEditor.isHidden() ) 
    19             content = document.getElementById(el).value; 
    20         else 
    21             content = this.pre_wpautop(content); 
     19       document.getElementById(el).style.color = '#fff'; 
     20       if ( tinyMCE.activeEditor.isHidden() ) 
     21           content = document.getElementById(el).value; 
     22       else 
     23           content = this.pre_wpautop(content); 
    2224 
    23         return content; 
    24     }, 
     25       return content; 
     26   }, 
    2527 
    26     pre_wpautop : function(content) { 
    27         // We have a TON of cleanup to do. Line breaks are already stripped. 
     28   pre_wpautop : function(content) { 
     29       // We have a TON of cleanup to do. Line breaks are already stripped. 
    2830 
    29         // Protect pre|script tags 
    30         content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) { 
    31             a = a.replace(/<br ?\/?>[\r\n]*/g, '<wp_temp>'); 
    32             return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '<wp_temp>'); 
    33         }); 
     31       // Protect pre|script tags 
     32       content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) { 
     33           a = a.replace(/<br ?\/?>[\r\n]*/g, '<wp_temp>'); 
     34           return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '<wp_temp>'); 
     35       }); 
    3436 
    35         // Pretty it up for the source editor 
    36         var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p'; 
    37         content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'mg'), '</$1>\n'); 
    38         content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>'); 
     37       // Pretty it up for the source editor 
     38       var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p'; 
     39       content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'mg'), '</$1>\n'); 
     40       content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>'); 
    3941 
    40         // Mark </p> if it has any attributes. 
    41         content = content.replace(new RegExp('(<p [^>]+>.*?)</p>', 'mg'), '$1</p#>'); 
     42       // Mark </p> if it has any attributes. 
     43       content = content.replace(new RegExp('(<p [^>]+>.*?)</p>', 'mg'), '$1</p#>'); 
    4244 
    43         // Sepatate <div> containing <p> 
    44         content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'mgi'), '<div$1>\n\n'); 
     45       // Sepatate <div> containing <p> 
     46       content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'mgi'), '<div$1>\n\n'); 
    4547 
    46         // Remove <p> and <br /> 
    47         content = content.replace(new RegExp('\\s*<p>', 'mgi'), ''); 
    48         content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n'); 
    49         content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n'); 
    50         content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n'); 
     48       // Remove <p> and <br /> 
     49       content = content.replace(new RegExp('\\s*<p>', 'mgi'), ''); 
     50       content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n'); 
     51       content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n'); 
     52       content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n'); 
    5153 
    52         // Fix some block element newline issues 
    53         content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div'); 
    54         content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n'); 
     54       // Fix some block element newline issues 
     55       content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div'); 
     56       content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n'); 
    5557        content = content.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '\n\n[caption$1[/caption]\n\n'); 
    5658        content = content.replace(new RegExp('caption\\]\\n\\n+\\[caption', 'g'), 'caption]\n\n[caption'); 
    5759 
    58         var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre'; 
    59         content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>'); 
    60         content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n'); 
    61         content = content.replace(new RegExp('<li([^>]*)>', 'g'), '\t<li$1>'); 
     60       var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre'; 
     61       content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>'); 
     62       content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n'); 
     63       content = content.replace(new RegExp('<li([^>]*)>', 'g'), '\t<li$1>'); 
    6264 
    63         if ( content.indexOf('<object') != -1 ) { 
    64             content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'mg'), "<param$1>"); 
    65             content = content.replace(new RegExp('\\s*</embed>\\s*', 'mg'), '</embed>'); 
    66        
     65       if ( content.indexOf('<object') != -1 ) { 
     66           content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'mg'), "<param$1>"); 
     67           content = content.replace(new RegExp('\\s*</embed>\\s*', 'mg'), '</embed>'); 
     68       
    6769 
    68         // Unmark special paragraph closing tags 
    69         content = content.replace(new RegExp('</p#>', 'g'), '</p>\n'); 
    70         content = content.replace(new RegExp('\\s*(<p [^>]+>.*</p>)', 'mg'), '\n$1'); 
     70       // Unmark special paragraph closing tags 
     71       content = content.replace(new RegExp('</p#>', 'g'), '</p>\n'); 
     72       content = content.replace(new RegExp('\\s*(<p [^>]+>.*</p>)', 'mg'), '\n$1'); 
    7173 
    72         // Trim whitespace 
    73         content = content.replace(new RegExp('^\\s*', ''), ''); 
    74         content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), ''); 
     74       // Trim whitespace 
     75       content = content.replace(new RegExp('^\\s*', ''), ''); 
     76       content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), ''); 
    7577 
    76         // put back the line breaks in pre|script 
    77         content = content.replace(/<wp_temp>/g, '\n'); 
     78       // put back the line breaks in pre|script 
     79       content = content.replace(/<wp_temp>/g, '\n'); 
    7880 
    79         // Hope. 
    80         return content; 
    81     }, 
     81       // Hope. 
     82       return content; 
     83   }, 
    8284 
    83     go : function(id) { 
    84         var ed = tinyMCE.get(id); 
    85         var qt = document.getElementById('quicktags'); 
    86         var H = document.getElementById('edButtonHTML'); 
    87         var P = document.getElementById('edButtonPreview'); 
    88         var ta = document.getElementById(id); 
    89         var ec = document.getElementById('editorcontainer'); 
     85   go : function(id) { 
     86       var ed = tinyMCE.get(id); 
     87       var qt = document.getElementById('quicktags'); 
     88       var H = document.getElementById('edButtonHTML'); 
     89       var P = document.getElementById('edButtonPreview'); 
     90       var ta = document.getElementById(id); 
     91       var ec = document.getElementById('editorcontainer'); 
    9092 
    91         if ( ! ed || ed.isHidden() ) { 
    92             ta.style.color = '#fff'; 
     93       if ( ! ed || ed.isHidden() ) { 
     94           ta.style.color = '#fff'; 
    9395 
    94             this.edToggle(P, H); 
    95             edCloseAllTags(); // :-( 
     96           this.edToggle(P, H); 
     97           edCloseAllTags(); // :-( 
    9698 
    97             qt.style.display = 'none'; 
    98             ec.style.padding = '0px'; 
    99             ta.style.padding = '0px'; 
     99           qt.style.display = 'none'; 
     100           ec.style.padding = '0px'; 
     101           ta.style.padding = '0px'; 
    100102 
    101             ta.value = this.wpautop(ta.value); 
     103           ta.value = this.wpautop(ta.value); 
    102104 
    103             if ( ed ) ed.show(); 
    104             else tinyMCE.execCommand("mceAddControl", false, id); 
     105           if ( ed ) ed.show(); 
     106           else tinyMCE.execCommand("mceAddControl", false, id); 
    105107 
    106             this.wpSetDefaultEditor('tinymce'); 
    107         } else { 
    108             this.edToggle(H, P); 
    109             ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px'; 
     108           this.wpSetDefaultEditor('tinymce'); 
     109       } else { 
     110           this.edToggle(H, P); 
     111           ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px'; 
    110112 
    111             ed.hide(); 
    112             qt.style.display = 'block'; 
     113           ed.hide(); 
     114           qt.style.display = 'block'; 
    113115 
    114             if ( tinymce.isIE6 ) { 
     116           if ( tinymce.isIE6 ) { 
    115117                ta.style.width = '98%'; 
    116118                ec.style.padding = '0px'; 
     
    119121                ta.style.width = '100%'; 
    120122                ec.style.padding = '6px'; 
    121            
     123           
    122124 
    123             ta.style.color = ''; 
    124             this.wpSetDefaultEditor('html'); 
    125        
    126     }, 
     125           ta.style.color = ''; 
     126           this.wpSetDefaultEditor('html'); 
     127       
     128   }, 
    127129 
    128     edToggle : function(A, B) { 
    129         A.className = 'active'; 
    130         B.className = ''; 
     130   edToggle : function(A, B) { 
     131       A.className = 'active'; 
     132       B.className = ''; 
    131133 
    132         B.onclick = A.onclick; 
    133         A.onclick = null; 
    134     }, 
     134       B.onclick = A.onclick; 
     135       A.onclick = null; 
     136   }, 
    135137 
    136     wpSetDefaultEditor : function(editor) { 
    137         try { 
    138             editor = escape( editor.toString() ); 
    139         } catch(err) { 
    140             editor = 'tinymce'; 
    141        
     138   wpSetDefaultEditor : function(editor) { 
     139       try { 
     140           editor = escape( editor.toString() ); 
     141       } catch(err) { 
     142           editor = 'tinymce'; 
     143       
    142144 
    143         var userID = document.getElementById('user-id'); 
    144         var date = new Date(); 
    145         date.setTime(date.getTime()+(10*365*24*60*60*1000)); 
    146         document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString(); 
    147     }, 
     145       var userID = document.getElementById('user-id'); 
     146       var date = new Date(); 
     147       date.setTime(date.getTime()+(10*365*24*60*60*1000)); 
     148       document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString(); 
     149   }, 
    148150 
    149     wpautop : function(pee) { 
    150         var blocklist = 'table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]'; 
     151   wpautop : function(pee) { 
     152       var blocklist = 'table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]'; 
    151153 
    152         pee = pee + "\n\n"; 
    153         pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n"); 
    154         pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1"); 
    155         pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), "$1\n\n"); 
    156         pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n"); 
    157         pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n"); 
    158         pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n"); 
    159         pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), ''); 
    160         pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1"); 
    161         pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1"); 
    162         pee = pee.replace(new RegExp('<p>\\s*<blockquote([^>]*)>', 'gi'), "<blockquote$1><p>"); 
    163         pee = pee.replace(new RegExp('</blockquote>\\s*</p>', 'gi'), '</p></blockquote>'); 
    164         pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1"); 
    165         pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1"); 
    166         pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n"); 
    167         pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1"); 
    168         pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1'); 
    169         pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]'); 
    170         // pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;'); 
     154       pee = pee + "\n\n"; 
     155       pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n"); 
     156       pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1"); 
     157       pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), "$1\n\n"); 
     158       pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n"); 
     159       pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n"); 
     160       pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n"); 
     161       pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), ''); 
     162       pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1"); 
     163       pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1"); 
     164       pee = pee.replace(new RegExp('<p>\\s*<blockquote([^>]*)>', 'gi'), "<blockquote$1><p>"); 
     165       pee = pee.replace(new RegExp('</blockquote>\\s*</p>', 'gi'), '</p></blockquote>'); 
     166       pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1"); 
     167       pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1"); 
     168       pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n"); 
     169       pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1"); 
     170       pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1'); 
     171       pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]'); 
     172       // pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;'); 
    171173 
    172         // Fix the pre|script tags 
    173         pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) { 
     174       // Fix the pre|script tags 
     175       pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) { 
    174176            a = a.replace(/<br ?\/?>[\r\n]*/g, '\n'); 
    175177            return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '\n'); 
    176         }); 
     178       }); 
    177179 
    178         return pee; 
    179    
     180       return pee; 
     181   
    180182} 
  • trunk/wp-admin/post.php

    r8691 r8720  
    131131    wp_enqueue_script('media-upload'); 
    132132    wp_enqueue_script('word-count'); 
     133    wp_enqueue_script( 'admin-comments' ); 
    133134 
    134135    if ( current_user_can('edit_post', $post_ID) ) { 
  • trunk/wp-admin/upload.php

    r8682 r8720  
    1010require_once('admin.php'); 
    1111add_thickbox(); 
    12 wp_enqueue_script('media-upload'); 
     12wp_enqueue_script( 'media-upload' ); 
     13wp_enqueue_script( 'quicktags' ); 
    1314 
    1415if (!current_user_can('upload_files')) 
     
    264265</div> 
    265266 
    266 <?php include('admin-footer.php'); ?> 
     267<?php  
     268wp_comment_reply(); 
     269include('admin-footer.php'); 
     270?> 
  • trunk/wp-admin/wp-admin.css

    r8700 r8720  
    321321} 
    322322 
    323 #ed_toolbar input { 
     323#ed_toolbar input, 
     324#ed_reply_toolbar input { 
    324325    margin: 3px 2px 2px; 
    325326    padding: 2px 4px; 
     
    328329} 
    329330 
    330 #quicktags #ed_strong { 
     331#quicktags #ed_strong, 
     332#ed_reply_toolbar #ed_reply_strong { 
    331333    font-weight: bold; 
    332334} 
    333335 
    334 #quicktags #ed_link { 
     336#quicktags #ed_link, 
     337#ed_reply_toolbar #ed_reply_link { 
    335338    text-decoration: underline; 
    336339} 
    337340 
    338 #quicktags #ed_del { 
     341#quicktags #ed_del, 
     342#ed_reply_toolbar #ed_reply_del { 
    339343    text-decoration: line-through; 
    340344} 
    341345 
    342 #quicktags #ed_em { 
     346#quicktags #ed_em, 
     347#ed_reply_toolbar #ed_reply_em { 
    343348    font-style: italic; 
    344349} 
    345350 
    346 #quicktags #ed_code { 
     351#quicktags #ed_code, 
     352#ed_reply_toolbar #ed_reply_code { 
    347353    font-family: "Courier New", Courier, mono; 
    348354    font-size: 1.1em; 
     
    503509} 
    504510 
     511.comment-column p { 
     512    margin-top: 0; 
     513} 
     514 
    505515.comment-column { 
    506516    width: 50%; 
    507 } 
    508  
    509 .comment-column p { 
    510     margin-top: 0; 
    511517} 
    512518 
     
    17611767