Design update for link categories management.

git-svn-id: https://develop.svn.wordpress.org/trunk@6804 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-02-13 07:32:50 +00:00
parent 0e810ef327
commit de1ec72949
5 changed files with 80 additions and 18 deletions

View File

@ -126,6 +126,12 @@ cat_rows();
</tbody>
</table>
<br style="clear:both;" />
<div class="tablenav">
<br style="clear:both;" />
</div>
</div>
<?php if ( current_user_can('manage_categories') ) : ?>

View File

@ -19,24 +19,68 @@ if (isset($_GET['message'])) : ?>
<?php endif; ?>
<div class="wrap">
<form id="posts-filter" action="" method="get">
<?php if ( current_user_can('manage_categories') ) : ?>
<h2><?php printf(__('Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2>
<h2><?php printf(__('Manage Link Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2>
<?php else : ?>
<h2><?php _e('Categories') ?> </h2>
<h2><?php _e('Manage Link Categories') ?> </h2>
<?php endif; ?>
<p id="post-search">
<input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="submit" value="<?php _e( 'Search Categories' ); ?>" />
</p>
<br style="clear:both;" />
<div class="tablenav">
<?php
$pagenum = absint( $_GET['pagenum'] );
if ( empty($pagenum) )
$pagenum = 1;
if( !$catsperpage || $catsperpage < 0 )
$catsperpage = 3;
$page_links = paginate_links( array(
'base' => add_query_arg( 'pagenum', '%#%' ),
'format' => '',
'total' => ceil(wp_count_terms('link_category') / $catsperpage),
'current' => $pagenum
));
if ( $page_links )
echo "<div class='tablenav-pages'>$page_links</div>";
?>
<div style="float: left">
<input type="button" value="<?php _e('Delete'); ?>" name="deleteit" />
</div>
<br style="clear:both;" />
</div>
</form>
<br style="clear:both;" />
<table class="widefat">
<thead>
<tr>
<th scope="col" style="text-align: center"><?php _e('ID') ?></th>
<th scope="col" style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById('deletetags'));" /></th>
<th scope="col"><?php _e('Name') ?></th>
<th scope="col"><?php _e('Description') ?></th>
<th scope="col" width="90" style="text-align: center"><?php _e('Links') ?></th>
<th colspan="2" style="text-align: center"><?php _e('Action') ?></th>
</tr>
</thead>
<tbody id="the-list" class="list:link-cat">
<?php
$categories = get_terms( 'link_category', 'hide_empty=0' );
$start = ($pagenum - 1) * $catsperpage;
$args = array('offset' => $start, 'number' => $catsperpage, 'hide_empty' => 0);
if ( !empty( $_GET['s'] ) )
$args['search'] = $_GET['s'];
$categories = get_terms( 'link_category', $args );
if ( $categories ) {
$output = '';
foreach ( $categories as $category ) {
@ -52,6 +96,17 @@ if ( $categories ) {
</tbody>
</table>
<br style="clear:both;" />
<div class="tablenav">
<?php
if ( $page_links )
echo "<div class='tablenav-pages'>$page_links</div>";
?>
<br style="clear:both;" />
</div>
</div>
<?php if ( current_user_can('manage_categories') ) : ?>

View File

@ -117,6 +117,10 @@ if ($posts) {
} // end if ($posts)
?>
<div class="tablenav">
<br style="clear:both;" />
</div>
</div>
<?php include('admin-footer.php'); ?>

View File

@ -70,28 +70,21 @@ function link_cat_row( $category ) {
return $category;
if ( current_user_can( 'manage_categories' ) ) {
$edit = "<a href='link-category.php?action=edit&amp;cat_ID=$category->term_id' class='edit'>".__( 'Edit' )."</a></td>";
$edit = "<a href='link-category.php?action=edit&amp;cat_ID=$category->term_id' class='edit'>". ( $name_override ? $name_override : $category->name ) ."</a>";
$default_cat_id = (int) get_option( 'default_link_category' );
$delete_url = wp_nonce_url( "link-category.php?action=delete&amp;cat_ID=$category->term_id", "delete-link-category_$category->term_id" );
if ( $category->term_id != $default_cat_id )
$edit .= "<td><a href='$delete_url' class='delete:the-list:link-cat-$category->term_id delete'>" . __( 'Delete' ) . "</a>";
else
$edit .= "<td style='text-align:center'>" . __( "Default" );
} else {
$edit = '';
$edit = ( $name_override ? $name_override : $category->name );
}
$class = " class='alternate'" == $class ? '' : " class='alternate'";
$category->count = number_format_i18n( $category->count );
$count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
$output = "<tr id='link-cat-$category->term_id'$class>
<th scope='row' style='text-align: center'>$category->term_id</th>
<td>" . ( $name_override ? $name_override : $category->name ) . "</td>
$output = "<tr id='link-cat-$category->term_id'$class>" .
'<td style="text-align: center"> <input type="checkbox" name="delete_tags[]" value="' . $category->term_id . '" /></td>' .
"<td>$edit</td>
<td>$category->description</td>
<td align='center'>$count</td>
<td>$edit</td>\n\t</tr>\n";
<td align='center'>$count</td>";
return apply_filters( 'link_cat_row', $output );
}

View File

@ -203,6 +203,10 @@ if ( $links ) {
<div id="ajax-response"></div>
<div class="tablenav">
<br style="clear:both;" />
</div>
</form>
<?php } ?>