Skip to content

Commit 8a87674

Browse files
committed
Update edit comment form. WIP
git-svn-id: https://develop.svn.wordpress.org/trunk@6923 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 4d5fccf commit 8a87674

5 files changed

Lines changed: 87 additions & 64 deletions

File tree

wp-admin/comment.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ function comment_footer_die( $msg ) { // $msg is assumed to contain HTML and be
2020
case 'editcomment' :
2121
$title = __('Edit Comment');
2222

23+
wp_enqueue_script('comment');
24+
//wp_enqueue_script('thickbox');
2325
require_once('admin-header.php');
2426

2527
$comment_id = absint( $_GET['c'] );

wp-admin/edit-form-comment.php

Lines changed: 68 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -18,71 +18,81 @@ function focusit() { // focus on first input field
1818
}
1919
addLoadEvent(focusit);
2020
</script>
21-
<fieldset id="namediv">
22-
<legend><label for="name"><?php _e('Name:') ?></label></legend>
23-
<div>
24-
<input type="text" name="newcomment_author" size="25" value="<?php echo attribute_escape( $comment->comment_author ); ?>" tabindex="1" id="name" />
25-
</div>
26-
</fieldset>
27-
<fieldset id="emaildiv">
28-
<legend><label for="email"><?php _e('E-mail:') ?></label></legend>
29-
<div>
30-
<input type="text" name="newcomment_author_email" size="20" value="<?php echo attribute_escape( $comment->comment_author_email ); ?>" tabindex="2" id="email" />
31-
</div>
32-
</fieldset>
33-
<fieldset id="uridiv">
34-
<legend><label for="newcomment_author_url"><?php _e('URL:') ?></label></legend>
35-
<div>
36-
<input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo attribute_escape( $comment->comment_author_url ); ?>" tabindex="2" />
37-
</div>
38-
</fieldset>
39-
40-
<fieldset style="clear: both;">
41-
<legend><?php _e('Comment') ?></legend>
42-
<?php the_editor($comment->comment_content, 'content', 'newcomment_author_url'); ?>
43-
</fieldset>
21+
22+
<div id="poststuff">
23+
24+
<div id="namediv" class="stuffbox">
25+
<h3><?php _e('Name') ?></h3>
26+
<div class="inside">
27+
<input type="text" name="newcomment_author" size="30" value="<?php echo attribute_escape( $comment->comment_author ); ?>" tabindex="1" id="name" />
28+
</div>
29+
</div>
30+
31+
<div id="emaildiv" class="stuffbox">
32+
<h3><?php _e('E-mail') ?></h3>
33+
<div class="inside">
34+
<input type="text" name="newcomment_author_email" size="30" value="<?php echo attribute_escape( $comment->comment_author_email ); ?>" tabindex="2" id="email" />
35+
</div>
36+
</div>
37+
38+
<div id="uridiv" class="stuffbox">
39+
<h3><?php _e('URL') ?></h3>
40+
<div class="inside">
41+
<input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" value="<?php echo attribute_escape( $comment->comment_author_url ); ?>" tabindex="2" />
42+
</div>
43+
</div>
44+
45+
<div id="postdiv" class="postarea">
46+
<h3><?php _e('Comment') ?></h3>
47+
<?php the_editor($comment->comment_content, 'content'); ?>
48+
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
49+
</div>
50+
51+
<div class="submitbox" id="submitcomment">
52+
53+
<div id="previewview">
54+
<a href="<?php echo get_comment_link(); ?>" target="_blank"><?php _e('View this Comment'); ?></a>
55+
</div>
56+
57+
<div class="inside">
58+
59+
<p><strong><?php _e('Approval Status') ?></strong></p>
60+
<p>
61+
<select name='comment_status'>
62+
<option<?php selected( $comment->comment_approved, '1' ); ?> value='1'><?php _e('Approved') ?></option>
63+
<option<?php selected( $comment->comment_approved, '0' ); ?> value='0'><?php _e('Moderated') ?></option>
64+
<option<?php selected( $comment->comment_approved, 'spam' ); ?> value='spam'><?php _e('Spam') ?></option>
65+
</select>
66+
</p>
4467

4568
<?php
46-
$post = get_post($comment->comment_post_ID); //get the post
47-
$post_title = $post->post_title; // and its title
69+
$stamp = __('Timestamp:<br />%1$s at %2$s');
70+
$date = mysql2date(get_option('date_format'), $comment->comment_date);
71+
$time = mysql2date(get_option('time_format'), $comment->comment_date);
4872
?>
49-
<div>
50-
<a href="<?php echo get_permalink($comment->comment_post_ID); ?>" class="view-comment-post-link" target="_blank"><?php echo sprintf('%s &raquo;',$post_title); ?></a>
51-
<p class="submit"><input type="submit" name="editcomment" id="editcomment" value="<?php echo $submitbutton_text ?>" style="font-weight: bold;" tabindex="6" />
52-
<input name="referredby" type="hidden" id="referredby" value="<?php echo wp_get_referer(); ?>" />
53-
</p>
54-
</div>
73+
<p><?php printf($stamp, $date, $time); ?>
74+
&nbsp;<a href="#edit_timestamp" class="edit-timestamp"><?php _e('Edit') ?></a></p>
75+
76+
<div id='timestamp'><?php touch_time(('editcomment' == $action), 0, 5); ?></div>
5577

5678
</div>
5779

58-
<div class="wrap">
59-
<h2><?php _e('Advanced'); ?></h2>
60-
61-
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
62-
<tr>
63-
<th scope="row" valign="top"><?php _e('Comment Status') ?>:</th>
64-
<td><label for="comment_status_approved" class="selectit"><input id="comment_status_approved" name="comment_status" type="radio" value="1" <?php checked($comment->comment_approved, '1'); ?> tabindex="4" /> <?php _e('Approved') ?></label> &nbsp;
65-
<label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment->comment_approved, '0'); ?> tabindex="4" /> <?php _e('Moderated') ?></label> &nbsp;
66-
<label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment->comment_approved, 'spam'); ?> tabindex="4" /> <?php _e('Spam') ?></label></td>
67-
</tr>
68-
69-
<?php if ( current_user_can('edit_posts') ) : ?>
70-
<tr>
71-
<th scope="row" valign="top"><?php _e('Edit time'); ?>:</th>
72-
<td><?php touch_time(('editcomment' == $action), 0, 5); ?> </td>
73-
</tr>
74-
<?php endif; ?>
75-
76-
<tr>
77-
<th scope="row" valign="top">&nbsp;</th>
78-
<td><input name="deletecomment" class="button delete" type="submit" id="deletecomment" tabindex="10" value="<?php _e('Delete this comment') ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n 'Cancel' to stop, 'OK' to delete.")) . "') ) { document.forms.post._wpnonce.value = '" . wp_create_nonce( 'delete-comment_' . $comment->comment_ID ) . "'; return true; } return false;\""; ?> />
79-
<input type="hidden" name="c" value="<?php echo $comment->comment_ID ?>" />
80-
<input type="hidden" name="p" value="<?php echo $comment->comment_post_ID ?>" />
81-
<input type="hidden" name="noredir" value="1" />
82-
</td>
83-
</tr>
84-
</table>
80+
<p class="submit">
81+
<input type="submit" name="save" value="<?php _e('Save'); ?>" style="font-weight: bold;" tabindex="4" />
82+
<?php
83+
echo "<a href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID", '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>";
84+
?>
85+
</p>
86+
<?php do_action('submitcomment_box'); ?>
87+
</div>
88+
89+
<?php do_meta_boxes('comment', 'normal', $comment); ?>
8590

91+
<input type="hidden" name="c" value="<?php echo $comment->comment_ID ?>" />
92+
<input type="hidden" name="p" value="<?php echo $comment->comment_post_ID ?>" />
93+
<input name="referredby" type="hidden" id="referredby" value="<?php echo wp_get_referer(); ?>" />
94+
<input type="hidden" name="noredir" value="1" />
95+
</div>
8696
</div>
8797

8898
</form>

wp-admin/js/comment.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
addLoadEvent( function() {
2+
add_postbox_toggles('comment');
3+
4+
jQuery('#timestamp').css('display', 'none');
5+
jQuery('.edit-timestamp').click(function () {
6+
if (jQuery('#timestamp').is(":hidden")) {
7+
jQuery('#timestamp').slideDown("normal");
8+
} else {
9+
jQuery('#timestamp').hide();
10+
}
11+
});
12+
});
13+
14+

wp-admin/wp-admin.css

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ input.disabled, textarea.disabled {
239239
background: #ccc;
240240
}
241241

242-
#postdiv, #titlediv, #guiddiv {
242+
#postdiv, #titlediv, #guiddiv, #poststuff .stuffbox {
243243
margin: 0 8px 0 0;
244244
padding: 0;
245245
}
@@ -411,10 +411,6 @@ input.delete:hover {
411411
background: #8B8;
412412
}
413413

414-
#namediv, #emaildiv, #uridiv {
415-
float: left;
416-
}
417-
418414
#ajax-response {
419415
padding: .5em;
420416
}
@@ -999,7 +995,7 @@ html, body {
999995
padding: 2px;
1000996
}
1001997

1002-
#poststuff .postbox, #titlediv, #poststuff .postarea {
998+
#poststuff .postbox, #titlediv, #poststuff .postarea, #poststuff .stuffbox {
1003999
margin-left: 20px;
10041000
border: 1px solid #ebebeb;
10051001
border-right: 1px solid #ccc;

wp-includes/script-loader.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ function default_scripts() {
155155
) );
156156
$this->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox'), '20080208' );
157157
$this->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20080131' );
158+
$this->add( 'comment', '/wp-admin/js/comment.js', array('postbox'), '20080219' );
158159
$this->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080109' );
159160
$this->localize( 'upload', 'uploadL10n', array(
160161
'browseTitle' => attribute_escape(__('Browse your files')),

0 commit comments

Comments
 (0)