Make WordPress Core


Ignore:
Timestamp:
08/20/2008 04:06:36 AM (16 years ago)
Author:
ryan
Message:

Merge crazyhorse management pages. see #7552

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/template.php

    r8646 r8682  
    344344    $posts_columns = array();
    345345    $posts_columns['cb'] = '<input type="checkbox" />';
     346    $posts_columns['title'] = __('Title');
    346347    if ( isset($_GET['post_status']) && 'draft' === $_GET['post_status'] )
    347348        $posts_columns['modified'] = __('Modified');
     
    350351    else
    351352        $posts_columns['date'] = __('Date');
    352     $posts_columns['title'] = __('Title');
    353     $posts_columns['author'] = __('Author');
     353    //$posts_columns['author'] = __('Author');
    354354    $posts_columns['categories'] = __('Categories');
    355355    $posts_columns['tags'] = __('Tags');
     
    368368    $posts_columns['icon'] = '';
    369369    $posts_columns['media'] = _c('Media|media column header');
    370     $posts_columns['desc'] = _c('Description|media column header');
     370    $posts_columns['tags'] = _c('Tags|media column header');
     371//  $posts_columns['desc'] = _c('Description|media column header');
    371372    $posts_columns['date'] = _c('Date Added|media column header');
    372373    $posts_columns['parent'] = _c('Appears with|media column header');
    373374    $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
    374     $posts_columns['location'] = _c('Location|media column header');
     375//  $posts_columns['actions'] = _c('Actions|media column header');
    375376    $posts_columns = apply_filters('manage_media_columns', $posts_columns);
    376377
     
    742743    $authordata = get_userdata($post->post_author);
    743744    $the_comment_status = wp_get_comment_status($comment->comment_ID);
    744     $class = ('unapproved' == $the_comment_status) ? 'unapproved' : '';
    745745
    746746    if ( current_user_can( 'edit_post', $post->ID ) ) {
    747747        $post_link = "<a href='" . get_comment_link() . "'>";
    748 
    749748        $post_link .= get_the_title($comment->comment_post_ID) . '</a>';
    750 
    751         $edit_link_start = "<a class='row-title' href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>";
    752         $edit_link_end = '</a>';
    753749    } else {
    754750        $post_link = get_the_title($comment->comment_post_ID);
    755         $edit_link_start = $edit_link_end ='';
    756751    }
    757752
     
    775770
    776771?>
    777   <tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'>
     772  <tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $the_comment_status; ?>'>
    778773<?php if ( $checkbox ) : ?>
    779774    <td class="check-column"><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
    780775<?php endif; ?>
    781     <td class="comment">
    782     <p class="comment-author"><strong><?php echo $edit_link_start; comment_author(); echo $edit_link_end; ?></strong><br />
    783     <?php if ( !empty($author_url) ) : ?>
    784     <a href="<?php echo $author_url ?>"><?php echo $author_url_display; ?></a> |
    785     <?php endif; ?>
    786     <?php if ( current_user_can( 'edit_post', $post->ID ) ) : ?>
    787     <?php if ( !empty($comment->comment_author_email) ): ?>
    788     <?php comment_author_email_link() ?> |
    789     <?php endif; ?>
    790     <a href="edit-comments.php?s=<?php comment_author_IP() ?>&amp;mode=detail"><?php comment_author_IP() ?></a>
    791     <?php endif; //current_user_can?>
    792     </p>
    793     <?php if ( 'detail' == $mode ) comment_text(); ?>
    794     <p><?php printf(__('From %1$s, %2$s'), $post_link, $ptime) ?></p>
    795     </td>
    796     <td><?php comment_date(__('Y/m/d')); ?></td>
    797     <td class="action-links">
     776    <td class="comment-column">
     777    <?php if ( 'detail' == $mode || 'single' == $mode ) comment_text(); ?>
     778   
    798779<?php
    799 
    800780    $actions = array();
    801781
     
    803783        $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> | ';
    804784        $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> | ';
    805 
    806         // we're looking at list of only approved or only unapproved comments
    807         if ( 'moderated' == $comment_status ) {
    808             $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
    809             unset($actions['unapprove']);
    810         } elseif ( 'approved' == $comment_status ) {
    811             $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
    812             unset($actions['approve']);
    813         }
    814 
     785        $actions['edit']      = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a> | ';
     786        $actions['flag']      = "<a href='#' class='no-crazy'>Flag for Follow-up</a> | ";
    815787        $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> | ';
    816788        $actions['delete']    = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>';
     789
     790        if ( $comment_status ) { // not looking at all comments
     791            if ( 'approved' == $the_comment_status ) {
     792                $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
     793                unset($actions['approve']);
     794            } else {
     795                $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
     796                unset($actions['unapprove']);
     797            }
     798        }
     799
     800        if ( 'spam' == $the_comment_status )
     801            unset($actions['spam']);
     802
    817803        $actions = apply_filters( 'comment_row_actions', $actions, $comment );
     804
    818805        foreach ( $actions as $action => $link )
    819806            echo "<span class='$action'>$link</span>";
    820807    }
    821808    ?>
     809    </td>
     810    <td class="author-column">
     811        <strong><?php comment_author(); ?></strong><br />
     812        <?php if ( !empty($author_url) ) : ?>
     813        <a href="<?php echo $author_url ?>"><?php echo $author_url_display; ?></a><br />
     814        <?php endif; ?>
     815        <?php if ( current_user_can( 'edit_post', $post->ID ) ) : ?>
     816        <?php if ( !empty($comment->comment_author_email) ): ?>
     817        <?php comment_author_email_link() ?><br />
     818        <?php endif; ?>
     819        <a href="edit-comments.php?s=<?php comment_author_IP() ?>&amp;mode=detail"><?php comment_author_IP() ?></a>
     820        <?php endif; //current_user_can?>   
    822821    </td>
     822    <td class="date-column"><?php comment_date(__('Y/m/d \a\t g:ia')); ?></td>
     823<?php if ( 'single' !== $mode ) : ?>
     824    <td class="response-column">
     825    "<?php echo $post_link ?>" <?php echo sprintf('(%s comments)', $post->comment_count); ?><br/>
     826    <?php echo get_the_time(__('Y/m/d \a\t g:ia')); ?>
     827    </td>
     828<?php endif; ?>
    823829  </tr>
    824830    <?php
     
    990996    $hour = '<input type="text" id="hh" name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off"  />';
    991997    $minute = '<input type="text" id="mn" name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off"  />';
    992     printf(_c('%1$s%2$s, %3$s <br />@ %4$s : %5$s|1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input'), $month, $day, $year, $hour, $minute);
     998    printf(_c('%1$s%2$s, %3$s @ %4$s : %5$s|1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input'), $month, $day, $year, $hour, $minute);
    993999    echo "\n\n";
    9941000    foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit )
     
    9971003
    9981004<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />
     1005
     1006<a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e('OK'); ?></a>
     1007<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><?php _e('Cancel'); ?></a>
    9991008<?php
    10001009}
     
    11731182    global $wp_meta_boxes;
    11741183
    1175 
    11761184    if  ( !isset($wp_meta_boxes) )
    11771185        $wp_meta_boxes = array();
     
    11811189        $wp_meta_boxes[$page][$context] = array();
    11821190
     1191    foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) {
    11831192    foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
    1184         if ( !isset($wp_meta_boxes[$page][$context][$a_priority][$id]) )
     1193        if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
    11851194            continue;
     1195
    11861196        // If a core box was previously added or removed by a plugin, don't add.
    11871197        if ( 'core' == $priority ) {
    11881198            // If core box previously deleted, don't add
    1189             if ( false === $wp_meta_boxes[$page][$context][$a_priority][$id] )
     1199            if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
    11901200                return;
    11911201            // If box was added with default priority, give it core priority to maintain sort order
    11921202            if ( 'default' == $a_priority ) {
    1193                 $wp_meta_boxes[$page][$context]['core'][$id] = $wp_meta_boxes[$page][$context]['default'][$id];
    1194                 unset($wp_meta_boxes[$page][$context]['default'][$id]);
     1203                $wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
     1204                unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
    11951205            }
    11961206            return;
    11971207        }
    11981208        // If no priority given and id already present, use existing priority
    1199         if ( empty($priority) )
     1209        if ( empty($priority) ) {
    12001210            $priority = $a_priority;
    1201         // An id can be in only one priority
    1202         if ( $priority != $a_priority )
    1203             unset($wp_meta_boxes[$page][$context][$a_priority][$id]);
     1211        // else if we're adding to the sorted priortiy, we don't know the title or callback.  Glab them from the previously added context/priority.
     1212        } elseif ( 'sorted' == $priority ) {
     1213            $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
     1214            $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
     1215        }
     1216        // An id can be in only one priority and one context
     1217        if ( $priority != $a_priority || $context != $a_context )
     1218            unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
     1219    }
    12041220    }
    12051221
    12061222    if ( empty($priority) )
    1207         $priority = low;
     1223        $priority = 'low';
    12081224
    12091225    if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
     
    12131229}
    12141230
     1231// crazyhorse - this can be made simpler
    12151232function do_meta_boxes($page, $context, $object) {
    12161233    global $wp_meta_boxes;
     1234    static $already_sorted = false;
    12171235
    12181236    do_action('do_meta_boxes', $page, $context, $object);
    12191237
    1220     if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
    1221         return;
    1222 
    1223     foreach ( array('high', 'core', 'default', 'low') as $priority ) {
    1224         if ( ! isset( $wp_meta_boxes[$page][$context][$priority] ) )
    1225             continue;
    1226 
    1227         foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
    1228             if ( false === $box )
    1229                 continue;
    1230             echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n";
    1231             echo "<h3>{$box['title']}</h3>\n";
    1232             echo '<div class="inside">' . "\n";
    1233             call_user_func($box['callback'], $object, $box);
    1234             echo "</div>\n";
    1235             echo "</div>\n";
    1236         }
    1237     }
     1238    echo "<div id='$context-sortables' class='meta-box-sortables'>\n";
     1239
     1240    $i = 0;
     1241    do {
     1242        // Grab the ones the user has manually sorted.  Pull them out of their previous context/priority and into the one the user chose
     1243        if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) {
     1244            foreach ( $sorted as $box_context => $ids )
     1245                foreach ( explode(',', $ids) as $id )
     1246                    if ( $id )
     1247                        add_meta_box( $id, null, null, $page, $box_context, 'sorted' );
     1248        }
     1249        $already_sorted = true;
     1250
     1251        if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
     1252            break;
     1253
     1254
     1255        foreach ( array('high', 'sorted', 'core', 'default', 'low') as $priority ) {
     1256            foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
     1257                if ( false == $box || ! $box['title'] )
     1258                    continue;
     1259                $i++;
     1260                echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n";
     1261                echo "<h3><span class='hndle'>{$box['title']}</span></h3>\n";
     1262                echo '<div class="inside">' . "\n";
     1263                call_user_func($box['callback'], $object, $box);
     1264                echo "</div>\n";
     1265                echo "</div>\n";
     1266            }
     1267        }
     1268    } while(0);
     1269
     1270    echo "</div>";
     1271
     1272    return $i;
     1273
    12381274}
    12391275
Note: See TracChangeset for help on using the changeset viewer.