Styling and minor improvements for items per page option

git-svn-id: http://svn.automattic.com/wordpress/trunk@10872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-04-05 08:25:10 +00:00
parent 9c7ba66e64
commit d849a19db2
8 changed files with 30 additions and 16 deletions

View File

@ -987,7 +987,7 @@ case 'closed-postboxes' :
die('1');
break;
case 'hidden-columns' :
check_ajax_referer( 'hiddencolumns', 'hiddencolumnsnonce' );
check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
$hidden = isset( $_POST['hidden'] ) ? $_POST['hidden'] : '';
$hidden = explode( ',', $_POST['hidden'] );
$page = isset( $_POST['page'] ) ? $_POST['page'] : '';
@ -1024,6 +1024,7 @@ case 'meta-box-order':
die('1');
break;
case 'set-screen-option':
check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
if ( ! $user = wp_get_current_user() )
die(-1);
$option = $_POST['option'];
@ -1040,6 +1041,8 @@ case 'set-screen-option':
case 'edit_comments_per_page':
case 'upload_per_page':
$value = (int) $value;
if ( $value < 1 || $value > 999 )
die(-1);
break;
default:
$value = apply_filters('set-screen-option', false, $option, $value);

View File

@ -214,6 +214,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
.form-table input,
.form-table textarea,
.search-input,
.screen-per-page,
.form-field input,
.form-field textarea,
.submit {

View File

@ -214,6 +214,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
.form-table input,
.form-table textarea,
.search-input,
.screen-per-page,
.form-field input,
.form-field textarea,
.submit {

View File

@ -3378,13 +3378,13 @@ function screen_meta($screen) {
<?php
if ( !meta_box_prefs($screen) && isset($column_screens) ) {
manage_columns_prefs($screen);
wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false );
}
?>
<br class="clear" />
</div>
<?php echo screen_layout($screen); ?>
<?php echo screen_options($screen); ?>
<div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div>
</form>
</div>
@ -3523,14 +3523,15 @@ function screen_options($screen) {
return '';
}
$per_page = get_user_option("${screen}_per_page");
$option = str_replace('-', '_', "${screen}_per_page");
$per_page = get_user_option($option);
if ( empty($per_page) )
$per_page = 20;
$return = '<h5>' . __('Options') . "</h5>\n";
$return .= "<div class='screen-options'>\n";
if ( !empty($per_page_label) )
$return .= "<label for='${screen}-per-page'>$per_page_label</label> <input type='text' class='screen-option small-text' name='${screen}_per_page' id='${screen}-per-page' value='$per_page' />\n";
$return .= "<label for='$option'>$per_page_label</label> <input type='text' class='screen-per-page' name='$option' id='$option' maxlength='3' value='$per_page' />\n";
$return .= "</div>\n";
return $return;
}

View File

@ -108,7 +108,7 @@ columns = {
$.post(ajaxurl, {
action: 'hidden-columns',
hidden: hidden,
hiddencolumnsnonce: $('#hiddencolumnsnonce').val(),
screenoptionnonce: $('#screenoptionnonce').val(),
page: pagenow
});
}
@ -118,13 +118,16 @@ $(document).ready(function(){columns.init();});
screenOptions = {
init : function() {
$('.screen-option').change(function() {
var option = $(this).map(function() { return this.id; }).get(), value = $(this).val();
screenOptions.save_screen_option(option, value);
});
$('.screen-option').submit(function() {
var option = $(this).map(function() { return this.id; }).get(), value = $(this).val();
$('.screen-per-page').change(function() {
var option = this.id, value = parseInt($(this).val());
if ( isNaN(value) ) {
$(this).val('');
return;
}
screenOptions.save_screen_option(option, value);
}).parents('form').submit(function(e) {
e.preventDefault();
return false;
});
},

File diff suppressed because one or more lines are too long

View File

@ -1943,12 +1943,17 @@ p.search-box {
margin: -5px 0 0;
}
.search-input {
.search-input,
.screen-per-page {
border-width: 1px;
border-style: solid;
padding: 2px;
}
.screen-per-page {
width: 3em;
}
#posts-filter fieldset {
float: left;
margin: 0 1.5ex 1em 0;

View File

@ -60,7 +60,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090404' );
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090405' );
$scripts->add_data( 'common', 'group', 1 );
$scripts->localize( 'common', 'commonL10n', array(
'warnDelete' => __("You are about to delete the selected items.\n 'Cancel' to stop, 'OK' to delete."),
@ -425,13 +425,13 @@ function wp_default_styles( &$styles ) {
$rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
$styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090404' );
$styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090405' );
$styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
$styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090404' );
$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
$styles->add( 'colors', true, array(), '20081210' ); // Register "meta" stylesheet for admin colors
$styles->add( 'colors', true, array(), '20090405' ); // Register "meta" stylesheet for admin colors
$styles->add( 'colors-fresh', '/wp-admin/css/colors-fresh.css', array(), '20081210'); // for login.php. Is there a better way?
$styles->add_data( 'colors-fresh', 'rtl', true );
$styles->add( 'colors-classic', '/wp-admin/css/colors-classic.css', array(), '20081210');