Make WordPress Core

Changeset 18295


Ignore:
Timestamp:
06/13/2011 12:24:47 AM (13 years ago)
Author:
azaozz
Message:

Make sure the browser nag in shown first on the dashboard no matter what! See #17323

Location:
trunk
Files:
4 edited

Legend:

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

    r18247 r18295  
    944944        if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) {
    945945            foreach ( $sorted as $box_context => $ids )
    946                 foreach ( explode(',', $ids) as $id )
     946                $_ids = explode(',', $ids);
     947
     948                if ( $k = array_search('dashboard_browser_nag', $_ids, true) ) { // it's ok if this is the first value, i.e. $k == 0
     949                    unset($_ids[$k]);
     950                    array_unshift($_ids, 'dashboard_browser_nag');
     951                }
     952
     953                foreach ( $_ids as $id ) {
    947954                    if ( $id )
    948955                        add_meta_box( $id, null, null, $page, $box_context, 'sorted' );
     956                }
    949957        }
    950958        $already_sorted = true;
  • trunk/wp-admin/js/postbox.dev.js

    r18027 r18295  
    101101                helper: 'clone',
    102102                opacity: 0.65,
    103                 start: function(e,ui) {
    104                     $('body').css({
    105                         WebkitUserSelect: 'none',
    106                         KhtmlUserSelect: 'none'
    107                     });
    108                     /*
    109                     if ( $.browser.msie )
     103                stop: function(e,ui) {
     104                    if ( $(this).find('#dashboard_browser_nag').is(':visible') && 'dashboard_browser_nag' != this.firstChild.id ) {
     105                        $(this).sortable('cancel');
    110106                        return;
    111                     ui.item.addClass('noclick');
    112                     */
    113                 },
    114                 stop: function(e,ui) {
     107                    }
     108
    115109                    postboxes.save_order(page);
    116110                    ui.item.parent().removeClass('temp-border');
    117                     $('body').css({
    118                         WebkitUserSelect: '',
    119                         KhtmlUserSelect: ''
    120                     });
     111                },
     112                receive: function(e,ui) {
     113                    if ( 'dashboard_browser_nag' == ui.item[0].id )
     114                        $(ui.sender).sortable('cancel');
    121115                }
    122116            });
  • trunk/wp-admin/js/postbox.js

    r18027 r18295  
    1 var postboxes;(function(a){postboxes={add_postbox_toggles:function(c,b){this.init(c,b);a(".postbox h3, .postbox .handlediv").click(function(){var e=a(this).parent(".postbox"),f=e.attr("id");if("dashboard_browser_nag"==f){return}e.toggleClass("closed");postboxes.save_state(c);if(f){if(!e.hasClass("closed")&&a.isFunction(postboxes.pbshow)){postboxes.pbshow(f)}else{if(e.hasClass("closed")&&a.isFunction(postboxes.pbhide)){postboxes.pbhide(f)}}}});a(".postbox h3 a").click(function(f){f.stopPropagation()});a(".postbox a.dismiss").click(function(g){var f=a(this).parents(".postbox").attr("id")+"-hide";a("#"+f).prop("checked",false).triggerHandler("click");return false});a(".hide-postbox-tog").click(function(){var e=a(this).val();if(a(this).prop("checked")){a("#"+e).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(e)}}else{a("#"+e).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(e)}}postboxes.save_state(c)});a('.columns-prefs input[type="radio"]').click(function(){var e=a(this).val(),f,g,h=a("#poststuff");if(h.length){if(e==2){h.addClass("has-right-sidebar");a("#side-sortables").addClass("temp-border")}else{if(e==1){h.removeClass("has-right-sidebar");a("#normal-sortables").append(a("#side-sortables").children(".postbox"))}}}else{for(f=4;(f>e&&f>1);f--){g=a("#"+d(f)+"-sortables");a("#"+d(f-1)+"-sortables").append(g.children(".postbox"));g.parent().hide()}for(f=1;f<=e;f++){g=a("#"+d(f)+"-sortables");if(g.parent().is(":hidden")){g.addClass("temp-border").parent().show()}}a(".postbox-container:visible").css("width",98/e+"%")}postboxes.save_order(c)});function d(e){switch(e){case 1:return"normal";break;case 2:return"side";break;case 3:return"column3";break;case 4:return"column4";break;default:return""}}},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,start:function(f,d){a("body").css({WebkitUserSelect:"none",KhtmlUserSelect:"none"})},stop:function(f,d){postboxes.save_order(c);d.item.parent().removeClass("temp-border");a("body").css({WebkitUserSelect:"",KhtmlUserSelect:""})}})},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b)},pbshow:false,pbhide:false}}(jQuery));
     1var postboxes;(function(a){postboxes={add_postbox_toggles:function(c,b){this.init(c,b);a(".postbox h3, .postbox .handlediv").click(function(){var e=a(this).parent(".postbox"),f=e.attr("id");if("dashboard_browser_nag"==f){return}e.toggleClass("closed");postboxes.save_state(c);if(f){if(!e.hasClass("closed")&&a.isFunction(postboxes.pbshow)){postboxes.pbshow(f)}else{if(e.hasClass("closed")&&a.isFunction(postboxes.pbhide)){postboxes.pbhide(f)}}}});a(".postbox h3 a").click(function(f){f.stopPropagation()});a(".postbox a.dismiss").click(function(g){var f=a(this).parents(".postbox").attr("id")+"-hide";a("#"+f).prop("checked",false).triggerHandler("click");return false});a(".hide-postbox-tog").click(function(){var e=a(this).val();if(a(this).prop("checked")){a("#"+e).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(e)}}else{a("#"+e).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(e)}}postboxes.save_state(c)});a('.columns-prefs input[type="radio"]').click(function(){var e=a(this).val(),f,g,h=a("#poststuff");if(h.length){if(e==2){h.addClass("has-right-sidebar");a("#side-sortables").addClass("temp-border")}else{if(e==1){h.removeClass("has-right-sidebar");a("#normal-sortables").append(a("#side-sortables").children(".postbox"))}}}else{for(f=4;(f>e&&f>1);f--){g=a("#"+d(f)+"-sortables");a("#"+d(f-1)+"-sortables").append(g.children(".postbox"));g.parent().hide()}for(f=1;f<=e;f++){g=a("#"+d(f)+"-sortables");if(g.parent().is(":hidden")){g.addClass("temp-border").parent().show()}}a(".postbox-container:visible").css("width",98/e+"%")}postboxes.save_order(c)});function d(e){switch(e){case 1:return"normal";break;case 2:return"side";break;case 3:return"column3";break;case 4:return"column4";break;default:return""}}},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,stop:function(f,d){if(a(this).find("#dashboard_browser_nag").is(":visible")&&"dashboard_browser_nag"!=this.firstChild.id){a(this).sortable("cancel");return}postboxes.save_order(c);d.item.parent().removeClass("temp-border")},receive:function(f,d){if("dashboard_browser_nag"==d.item[0].id){a(d.sender).sortable("cancel")}}})},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b)},pbshow:false,pbhide:false}}(jQuery));
  • trunk/wp-includes/script-loader.php

    r18282 r18295  
    325325        $scripts->add_data( 'xfn', 'group', 1 );
    326326
    327         $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20110524' );
     327        $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20110612' );
    328328        $scripts->add_data( 'postbox', 'group', 1 );
    329329
Note: See TracChangeset for help on using the changeset viewer.