WordPress.org

Make WordPress Core

Changeset 10872


Ignore:
Timestamp:
04/05/09 08:25:10 (6 years ago)
Author:
azaozz
Message:

Styling and minor improvements for items per page option

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r10849 r10872  
    988988    break; 
    989989case 'hidden-columns' : 
    990     check_ajax_referer( 'hiddencolumns', 'hiddencolumnsnonce' ); 
     990    check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' ); 
    991991    $hidden = isset( $_POST['hidden'] ) ? $_POST['hidden'] : ''; 
    992992    $hidden = explode( ',', $_POST['hidden'] ); 
     
    10251025    break; 
    10261026case 'set-screen-option': 
     1027    check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' ); 
    10271028    if ( ! $user = wp_get_current_user() ) 
    10281029        die(-1); 
     
    10411042        case 'upload_per_page': 
    10421043            $value = (int) $value; 
     1044            if ( $value < 1 || $value > 999 ) 
     1045                die(-1); 
    10431046            break; 
    10441047        default: 
  • trunk/wp-admin/css/colors-classic.css

    r10845 r10872  
    215215.form-table textarea, 
    216216.search-input, 
     217.screen-per-page, 
    217218.form-field input, 
    218219.form-field textarea, 
  • trunk/wp-admin/css/colors-fresh.css

    r10845 r10872  
    215215.form-table textarea, 
    216216.search-input, 
     217.screen-per-page, 
    217218.form-field input, 
    218219.form-field textarea, 
  • trunk/wp-admin/includes/template.php

    r10859 r10872  
    33793379    if ( !meta_box_prefs($screen) && isset($column_screens) ) { 
    33803380        manage_columns_prefs($screen); 
    3381         wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false ); 
    33823381    } 
    33833382?> 
     
    33863385<?php echo screen_layout($screen); ?> 
    33873386<?php echo screen_options($screen); ?> 
     3387<div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div> 
    33883388</form> 
    33893389</div> 
     
    35243524    } 
    35253525 
    3526     $per_page = get_user_option("${screen}_per_page"); 
     3526    $option = str_replace('-', '_', "${screen}_per_page"); 
     3527    $per_page = get_user_option($option); 
    35273528    if ( empty($per_page) ) 
    35283529        $per_page = 20; 
     
    35313532    $return .= "<div class='screen-options'>\n"; 
    35323533    if ( !empty($per_page_label) ) 
    3533         $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"; 
     3534        $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"; 
    35343535    $return .= "</div>\n"; 
    35353536    return $return; 
  • trunk/wp-admin/js/common.dev.js

    r10869 r10872  
    109109            action: 'hidden-columns', 
    110110            hidden: hidden, 
    111             hiddencolumnsnonce: $('#hiddencolumnsnonce').val(), 
     111            screenoptionnonce: $('#screenoptionnonce').val(), 
    112112            page: pagenow 
    113113        }); 
     
    119119screenOptions = { 
    120120    init : function() { 
    121         $('.screen-option').change(function() { 
    122             var option = $(this).map(function() { return this.id; }).get(), value = $(this).val(); 
     121        $('.screen-per-page').change(function() { 
     122            var option = this.id, value = parseInt($(this).val()); 
     123            if ( isNaN(value) ) { 
     124                $(this).val(''); 
     125                return; 
     126            } 
    123127            screenOptions.save_screen_option(option, value); 
    124         }); 
    125         $('.screen-option').submit(function() { 
    126             var option = $(this).map(function() { return this.id; }).get(), value = $(this).val(); 
    127             screenOptions.save_screen_option(option, value); 
     128        }).parents('form').submit(function(e) { 
     129            e.preventDefault(); 
     130            return false; 
    128131        }); 
    129132    }, 
  • trunk/wp-admin/js/common.js

    r10869 r10872  
    1 var showNotice,adminMenu,columns;(function(a){adminMenu={init:function(){a("#adminmenu div.wp-menu-toggle").each(function(){if(a(this).siblings(".wp-submenu").length){a(this).click(function(){adminMenu.toggle(a(this).siblings(".wp-submenu"))})}else{a(this).hide()}});a("#adminmenu li.menu-top .wp-menu-image").click(function(){window.location=a(this).siblings("a.menu-top")[0].href});this.favorites();a(".wp-menu-separator").click(function(){if(a("body").hasClass("folded")){adminMenu.fold(1);setUserSetting("mfold","o")}else{adminMenu.fold();setUserSetting("mfold","f")}});if("f"!=getUserSetting("mfold")){this.restoreMenuState()}else{this.fold()}},restoreMenuState:function(){a("#adminmenu li.wp-has-submenu").each(function(c,d){var b=getUserSetting("m"+c);if(a(d).hasClass("wp-has-current-submenu")){return true}if("o"==b){a(d).addClass("wp-menu-open")}else{if("c"==b){a(d).removeClass("wp-menu-open")}}})},toggle:function(b){b.slideToggle(150,function(){b.css("display","")}).parent().toggleClass("wp-menu-open");a("#adminmenu li.wp-has-submenu").each(function(d,f){var c=a(f).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+d,c)});return false},fold:function(b){if(b){a("body").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("body").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(i){var c=a(this).find(".wp-submenu"),f=i.clientY,d=a(window).height(),g=c.height(),j;if((f+g+10)>d){j=(f+g+10)-d;c.css({marginTop:"-"+j+"px"})}else{if(c.css("marginTop")){c.css({marginTop:""})}}c.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open").css({marginTop:""})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)});a("#favorite-toggle, #favorite-inside").bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){a(".hide-column-tog").click(function(){var c=a(this).val(),b=a(this).attr("checked");if(b){a(".column-"+c).show()}else{a(".column-"+c).hide()}columns.save_manage_columns_state()})},save_manage_columns_state:function(){var b=a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"hidden-columns",hidden:b,hiddencolumnsnonce:a("#hiddencolumnsnonce").val(),page:pagenow})}};a(document).ready(function(){columns.init()});screenOptions={init:function(){a(".screen-option").change(function(){var b=a(this).map(function(){return this.id}).get(),c=a(this).val();screenOptions.save_screen_option(b,c)});a(".screen-option").submit(function(){var b=a(this).map(function(){return this.id}).get(),c=a(this).val();screenOptions.save_screen_option(b,c)})},save_screen_option:function(b,c){a.post(ajaxurl,{action:"set-screen-option",option:b,value:c,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})}};a(document).ready(function(){screenOptions.init()})})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||"";if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d(".fade").animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300).animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300);d("div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error").addClass("below-h2");d("div.updated, div.error").not(".below-h2").insertAfter("div.wrap h2:first");d("#doaction, #doaction2").click(function(){if(d('select[name^="action"]').val()=="delete"){return showNotice.warn()}});d("#show-settings-link").click(function(){if(!d("#screen-options-wrap").hasClass("screen-options-open")){d("#contextual-help-link-wrap").addClass("invisible")}d("#screen-options-wrap").slideToggle("fast",function(){if(d(this).hasClass("screen-options-open")){d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#contextual-help-link-wrap").removeClass("invisible");d(this).removeClass("screen-options-open")}else{d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("screen-options-open")}});return false});d("#contextual-help-link").click(function(){if(!d("#contextual-help-wrap").hasClass("contextual-help-open")){d("#screen-options-link-wrap").addClass("invisible")}d("#contextual-help-wrap").slideToggle("fast",function(){if(d(this).hasClass("contextual-help-open")){d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#screen-options-link-wrap").removeClass("invisible");d(this).removeClass("contextual-help-open")}else{d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("contextual-help-open")}});return false});d("#contextual-help-link-wrap, #screen-options-link-wrap").show();d("table:visible tbody .check-column :checkbox").click(function(g){if("undefined"==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).parents("form:first").find(":checkbox");e=a.index(f);c=a.index(this);b=d(this).attr("checked");if(0<e&&0<c&&e!=c){a.slice(e,c).attr("checked",function(){if(d(this).parents("tr").is(":visible")){return b?"checked":""}return""})}}f=this;return true});d("thead :checkbox, tfoot :checkbox").click(function(i){var j=d(this).attr("checked"),h="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).parents("form:first").find("table tbody:visible").find(".check-column :checkbox").attr("checked",function(){if(d(this).parents("tr").is(":hidden")){return""}if(g){return d(this).attr("checked")?"":"checked"}else{if(j){return"checked"}}return""});d(this).parents("form:first").find("table thead:visible, table tfoot:visible").find(".check-column :checkbox").attr("checked",function(){if(g){return""}else{if(j){return"checked"}}return""})})});(function(){if("undefined"!=typeof google&&google.gears){return}var a=false;if("undefined"!=typeof GearsFactory){a=new GearsFactory()}else{try{a=new ActiveXObject("Gears.Factory");if(factory.getBuildInfo().indexOf("ie_mobile")!=-1){a.privateSetGlobalObject(this)}}catch(b){if(("undefined"!=typeof navigator.mimeTypes)&&navigator.mimeTypes["application/x-googlegears"]){a=document.createElement("object");a.style.display="none";a.width=0;a.height=0;a.type="application/x-googlegears";document.documentElement.appendChild(a)}}}if(a&&a.hasPermission){return}jQuery(".turbo-nag").show()})(); 
     1var showNotice,adminMenu,columns;(function(a){adminMenu={init:function(){a("#adminmenu div.wp-menu-toggle").each(function(){if(a(this).siblings(".wp-submenu").length){a(this).click(function(){adminMenu.toggle(a(this).siblings(".wp-submenu"))})}else{a(this).hide()}});a("#adminmenu li.menu-top .wp-menu-image").click(function(){window.location=a(this).siblings("a.menu-top")[0].href});this.favorites();a(".wp-menu-separator").click(function(){if(a("body").hasClass("folded")){adminMenu.fold(1);setUserSetting("mfold","o")}else{adminMenu.fold();setUserSetting("mfold","f")}});if("f"!=getUserSetting("mfold")){this.restoreMenuState()}else{this.fold()}},restoreMenuState:function(){a("#adminmenu li.wp-has-submenu").each(function(c,d){var b=getUserSetting("m"+c);if(a(d).hasClass("wp-has-current-submenu")){return true}if("o"==b){a(d).addClass("wp-menu-open")}else{if("c"==b){a(d).removeClass("wp-menu-open")}}})},toggle:function(b){b.slideToggle(150,function(){b.css("display","")}).parent().toggleClass("wp-menu-open");a("#adminmenu li.wp-has-submenu").each(function(d,f){var c=a(f).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+d,c)});return false},fold:function(b){if(b){a("body").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("body").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(i){var c=a(this).find(".wp-submenu"),f=i.clientY,d=a(window).height(),g=c.height(),j;if((f+g+10)>d){j=(f+g+10)-d;c.css({marginTop:"-"+j+"px"})}else{if(c.css("marginTop")){c.css({marginTop:""})}}c.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open").css({marginTop:""})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)});a("#favorite-toggle, #favorite-inside").bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){a(".hide-column-tog").click(function(){var c=a(this).val(),b=a(this).attr("checked");if(b){a(".column-"+c).show()}else{a(".column-"+c).hide()}columns.save_manage_columns_state()})},save_manage_columns_state:function(){var b=a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})}};a(document).ready(function(){columns.init()});screenOptions={init:function(){a(".screen-per-page").change(function(){var b=this.id,c=parseInt(a(this).val());if(isNaN(c)){a(this).val("");return}screenOptions.save_screen_option(b,c)}).parents("form").submit(function(b){b.preventDefault();return false})},save_screen_option:function(b,c){a.post(ajaxurl,{action:"set-screen-option",option:b,value:c,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})}};a(document).ready(function(){screenOptions.init()})})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||"";if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d(".fade").animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300).animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300);d("div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error").addClass("below-h2");d("div.updated, div.error").not(".below-h2").insertAfter("div.wrap h2:first");d("#doaction, #doaction2").click(function(){if(d('select[name^="action"]').val()=="delete"){return showNotice.warn()}});d("#show-settings-link").click(function(){if(!d("#screen-options-wrap").hasClass("screen-options-open")){d("#contextual-help-link-wrap").addClass("invisible")}d("#screen-options-wrap").slideToggle("fast",function(){if(d(this).hasClass("screen-options-open")){d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#contextual-help-link-wrap").removeClass("invisible");d(this).removeClass("screen-options-open")}else{d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("screen-options-open")}});return false});d("#contextual-help-link").click(function(){if(!d("#contextual-help-wrap").hasClass("contextual-help-open")){d("#screen-options-link-wrap").addClass("invisible")}d("#contextual-help-wrap").slideToggle("fast",function(){if(d(this).hasClass("contextual-help-open")){d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#screen-options-link-wrap").removeClass("invisible");d(this).removeClass("contextual-help-open")}else{d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("contextual-help-open")}});return false});d("#contextual-help-link-wrap, #screen-options-link-wrap").show();d("table:visible tbody .check-column :checkbox").click(function(g){if("undefined"==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).parents("form:first").find(":checkbox");e=a.index(f);c=a.index(this);b=d(this).attr("checked");if(0<e&&0<c&&e!=c){a.slice(e,c).attr("checked",function(){if(d(this).parents("tr").is(":visible")){return b?"checked":""}return""})}}f=this;return true});d("thead :checkbox, tfoot :checkbox").click(function(i){var j=d(this).attr("checked"),h="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).parents("form:first").find("table tbody:visible").find(".check-column :checkbox").attr("checked",function(){if(d(this).parents("tr").is(":hidden")){return""}if(g){return d(this).attr("checked")?"":"checked"}else{if(j){return"checked"}}return""});d(this).parents("form:first").find("table thead:visible, table tfoot:visible").find(".check-column :checkbox").attr("checked",function(){if(g){return""}else{if(j){return"checked"}}return""})})});(function(){if("undefined"!=typeof google&&google.gears){return}var a=false;if("undefined"!=typeof GearsFactory){a=new GearsFactory()}else{try{a=new ActiveXObject("Gears.Factory");if(factory.getBuildInfo().indexOf("ie_mobile")!=-1){a.privateSetGlobalObject(this)}}catch(b){if(("undefined"!=typeof navigator.mimeTypes)&&navigator.mimeTypes["application/x-googlegears"]){a=document.createElement("object");a.style.display="none";a.width=0;a.height=0;a.type="application/x-googlegears";document.documentElement.appendChild(a)}}}if(a&&a.hasPermission){return}jQuery(".turbo-nag").show()})(); 
  • trunk/wp-admin/wp-admin.css

    r10869 r10872  
    19441944} 
    19451945 
    1946 .search-input { 
     1946.search-input, 
     1947.screen-per-page { 
    19471948    border-width: 1px; 
    19481949    border-style: solid; 
    19491950    padding: 2px; 
     1951} 
     1952 
     1953.screen-per-page { 
     1954    width: 3em; 
    19501955} 
    19511956 
  • trunk/wp-includes/script-loader.php

    r10869 r10872  
    6161    $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' ); 
    6262 
    63     $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090404' ); 
     63    $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090405' ); 
    6464    $scripts->add_data( 'common', 'group', 1 ); 
    6565    $scripts->localize( 'common', 'commonL10n', array( 
     
    426426    $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' ); 
    427427 
    428     $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090404' ); 
     428    $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090405' ); 
    429429    $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' ); 
    430430 
     
    432432    $styles->add_data( 'ie', 'conditional', 'lte IE 7' ); 
    433433 
    434     $styles->add( 'colors', true, array(), '20081210' ); // Register "meta" stylesheet for admin colors 
     434    $styles->add( 'colors', true, array(), '20090405' ); // Register "meta" stylesheet for admin colors 
    435435    $styles->add( 'colors-fresh', '/wp-admin/css/colors-fresh.css', array(), '20081210'); // for login.php.  Is there a better way? 
    436436    $styles->add_data( 'colors-fresh', 'rtl', true ); 
Note: See TracChangeset for help on using the changeset viewer.