WordPress.org

Make WordPress Core

Changeset 8913


Ignore:
Timestamp:
09/17/08 00:50:34 (9 years ago)
Author:
azaozz
Message:

Update for the Save box in edit comment form.

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-comment.php

    r8697 r8913  
    2121<h2><?php echo $toprow_title; ?></h2> 
    2222 
    23 <div id="previewview"> 
    24 <a class="button" href="<?php echo get_comment_link(); ?>" target="_blank"><?php _e('View this Comment'); ?></a> 
    25 </div> 
    2623<div id="poststuff"> 
    2724<input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" /> 
     
    3027// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). 
    3128 
    32 function comment_submit_meta_box($comment) { 
     29function comment_submit_meta_box($comment) { // not used, but keeping for a bit longer in case it's needed 
    3330?> 
    3431<div class="submitbox" id="submitcomment"> 
     
    3936<select name='comment_status' id='comment_status'> 
    4037<option<?php selected( $comment->comment_approved, '1' ); ?> value='1'><?php _e('Approved') ?></option> 
    41 <option<?php selected( $comment->comment_approved, '0' ); ?> value='0'><?php _e('Moderated') ?></option> 
     38<option<?php selected( $comment->comment_approved, '0' ); ?> value='0'><?php _e('Awaiting Moderation') ?></option> 
    4239<option<?php selected( $comment->comment_approved, 'spam' ); ?> value='spam'><?php _e('Spam') ?></option> 
    4340</select> 
    4441</p> 
     42 
     43<div class="insidebox" id="deletebutton"> 
     44<?php 
     45echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . wp_get_referer(), 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n  'Cancel' to stop, 'OK' to delete.")) . "') ) { return true;}return false;\">" . __('Delete comment') . "</a>"; ?> 
     46</div> 
    4547 
    4648<?php 
     
    4951$time = mysql2date(get_option('time_format'), $comment->comment_date); 
    5052?> 
    51 <p class="curtime"><?php printf($stamp, $date, $time); ?> 
    52 &nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><?php _e('Edit') ?></a></p> 
    53  
    54 <div id='timestampdiv' class='hide-if-js'><?php touch_time(('editcomment' == $action), 0, 5); ?></div> 
     53<div class="insidebox curtime"><span id="timestamp"><?php printf($stamp, $date, $time); ?></span> 
     54&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a> 
     55<div id='timestampdiv' class='hide-if-js'><?php touch_time(('editcomment' == $action), 0, 5); ?></div></div> 
    5556 
    5657</div> 
     
    5859<p class="submit"> 
    5960<input type="submit" name="save" value="<?php _e('Save'); ?>" tabindex="4" class="button button-highlighted" /> 
    60 <?php 
    61 echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . wp_get_referer(), 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n  'Cancel' to stop, 'OK' to delete.")) . "') ) { return true;}return false;\">" . __('Delete comment') . "</a>"; 
    62 ?> 
     61<a class="preview button" href="<?php echo get_comment_link(); ?>" target="_blank"><?php _e('View Comment'); ?></a> 
    6362</p> 
    6463</div> 
    6564<?php 
    6665} 
    67 add_meta_box('submitdiv', __('Save'), 'comment_submit_meta_box', 'comment', 'side', 'core'); 
     66// add_meta_box('submitdiv', __('Save'), 'comment_submit_meta_box', 'comment', 'side', 'core'); 
    6867?> 
    6968 
    7069<div id="side-info-column" class="inner-sidebar"> 
     70<div id="submitdiv" class="stuffbox" > 
     71<h3><span class='hndle'>Save</span></h3> 
    7172 
    72 <?php $side_meta_boxes = do_meta_boxes('comment', 'side', $comment); ?> 
     73<div class="submitbox" id="submitcomment"> 
     74<div class="inside-submitbox"> 
    7375 
     76<div class="insidebox"><strong><label for='comment_status'><?php _e('This comment is') ?></label></strong><br /> 
     77<select name='comment_status' id='comment_status'> 
     78<option<?php selected( $comment->comment_approved, '1' ); ?> value='1'><?php _e('Approved') ?></option> 
     79<option<?php selected( $comment->comment_approved, '0' ); ?> value='0'><?php _e('Awaiting Moderation') ?></option> 
     80<option<?php selected( $comment->comment_approved, 'spam' ); ?> value='spam'><?php _e('Spam') ?></option> 
     81</select> 
     82</div> 
     83 
     84<div class="insidebox" id="deletebutton"> 
     85<?php 
     86echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . wp_get_referer(), 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n  'Cancel' to stop, 'OK' to delete.")) . "') ) { return true;}return false;\">" . __('Delete comment') . "</a>"; ?> 
     87</div> 
     88 
     89<?php 
     90$stamp = __('%1$s at %2$s'); 
     91$date = mysql2date(get_option('date_format'), $comment->comment_date); 
     92$time = mysql2date(get_option('time_format'), $comment->comment_date); 
     93?> 
     94<div class="insidebox curtime"><span id="timestamp"><?php printf($stamp, $date, $time); ?></span>&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a> 
     95<div id='timestampdiv' class='hide-if-js'><?php touch_time(('editcomment' == $action), 0, 5); ?></div></div> 
     96 
     97</div> 
     98 
     99<p class="submit"> 
     100<input type="submit" name="save" value="<?php _e('Save'); ?>" tabindex="4" class="button button-highlighted" /> 
     101<a class="preview button" href="<?php echo get_comment_link(); ?>" target="_blank"><?php _e('View Comment'); ?></a> 
     102</p> 
     103</div> 
     104 
     105</div> 
    74106</div> 
    75107 
  • trunk/wp-admin/js/comment.js

    r8691 r8913  
    1 jQuery(document).ready( function() { 
     1jQuery(document).ready( function($) { 
    22    postboxes.add_postbox_toggles('comment'); 
    33 
     
    99    jQuery('.hide-if-js').hide(); 
    1010 
    11     jQuery('.edit-timestamp').click(function () { 
    12         if (jQuery('#timestampdiv').is(":hidden")) { 
    13             jQuery('#curtime').slideUp("normal"); 
    14             jQuery('#timestampdiv').slideDown("normal"); 
    15         } else { 
    16             jQuery('#timestampdiv').slideUp("normal"); 
    17             jQuery('#mm').val(jQuery('#hidden_mm').val()); 
    18             jQuery('#jj').val(jQuery('#hidden_jj').val()); 
    19             jQuery('#aa').val(jQuery('#hidden_aa').val()); 
    20             jQuery('#hh').val(jQuery('#hidden_hh').val()); 
    21             jQuery('#mn').val(jQuery('#hidden_mn').val()); 
    22             jQuery('#curtime').slideDown("normal"); 
     11    var stamp = $('#timestamp').html(); 
     12    $('.edit-timestamp').click(function () { 
     13        if ($('#timestampdiv').is(":hidden")) { 
     14            $('#timestampdiv').slideDown("normal"); 
     15            $('.edit-timestamp').hide(); 
    2316        } 
     17 
    2418        return false; 
    2519    }); 
    2620 
    27     jQuery('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels 
    28         jQuery('#timestampdiv').hide(); 
    29         var link = jQuery('.timestamp a').clone( true ); 
    30         jQuery('.timestamp').show().html( 
    31             jQuery( '#mm option[value=' + jQuery('#mm').val() + ']' ).text() + ' ' + 
    32             jQuery('#jj').val() + ',' + 
    33             jQuery('#aa').val() + '@' + 
    34             jQuery('#hh').val() + ':' + 
    35             jQuery('#mn').val() + ' ' 
    36         ).append( link ); 
    37         jQuery('#curtime').slideDown("normal"); 
     21    $('.cancel-timestamp').click(function() { 
     22        $('#timestampdiv').slideUp("normal"); 
     23        $('#mm').val($('#hidden_mm').val()); 
     24        $('#jj').val($('#hidden_jj').val()); 
     25        $('#aa').val($('#hidden_aa').val()); 
     26        $('#hh').val($('#hidden_hh').val()); 
     27        $('#mn').val($('#hidden_mn').val()); 
     28        $('#timestamp').html(stamp); 
     29        $('.edit-timestamp').show(); 
     30 
     31        return false; 
     32    }); 
     33 
     34    $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels 
     35        $('#timestampdiv').slideUp("normal"); 
     36        $('.edit-timestamp').show(); 
     37        $('#timestamp').html( 
     38            $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' + 
     39            $('#jj').val() + ', ' + 
     40            $('#aa').val() + ' @ ' + 
     41            $('#hh').val() + ':' + 
     42            $('#mn').val() + ' ' 
     43        ); 
     44 
    3845        return false; 
    3946    }); 
  • trunk/wp-admin/wp-admin.css

    r8909 r8913  
    10981098} 
    10991099 
    1100 #side-sortables .inside-submitbox .insidebox { 
     1100#side-sortables .inside-submitbox .insidebox, 
     1101.stuffbox .insidebox { 
    11011102    margin: 11px 0; 
    11021103} 
Note: See TracChangeset for help on using the changeset viewer.