<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[18624] trunk: Disable js moving of dashboard postboxes, add all of them in the first column on 'auto', see #18198</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/18624">18624</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2011-08-30 22:29:37 +0000 (Tue, 30 Aug 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Disable js moving of dashboard postboxes, add all of them in the first column on 'auto', see <a href="http://core.trac.wordpress.org/ticket/18198">#18198</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminjspostboxdevjs">trunk/wp-admin/js/postbox.dev.js</a></li>
<li><a href="#trunkwpadminjspostboxjs">trunk/wp-admin/js/postbox.js</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminjspostboxdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/postbox.dev.js (18623 => 18624)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/postbox.dev.js        2011-08-30 17:50:12 UTC (rev 18623)
+++ trunk/wp-admin/js/postbox.dev.js        2011-08-30 22:29:37 UTC (rev 18624)
</span><span class="lines">@@ -44,20 +44,29 @@
</span><span class="cx">                                 var num = $(this).val(), i, el, ps = $('#poststuff'), wrap = $('.wrap');
</span><span class="cx">
</span><span class="cx">                                 if ( num == 'auto' ) {
</span><del>-                                        wrap.removeClass('columns-1').removeClass('columns-2').addClass('columns-auto');
-                                        ps.addClass('has-right-sidebar')
</del><span class="cx">
</span><del>-                                        if ( !$('#side-info-column #side-sortables').length )
-                                                $('#side-info-column').append( $('#side-sortables') );
</del><ins>+                                        if ( ps.length ) {
+                                                wrap.removeClass('columns-1').removeClass('columns-2').addClass('columns-auto');
+                                                ps.addClass('has-right-sidebar')
</ins><span class="cx">
</span><del>-                                        if ( typeof(wp_auto_columns) == 'function' ) {
-                                                wpAutoColumns = true;
-                                                wp_auto_columns();
</del><ins>+                                                if ( !$('#side-info-column #side-sortables').length )
+                                                        $('#side-info-column').append( $('#side-sortables') );
+
+                                                if ( typeof(wp_auto_columns) == 'function' ) {
+                                                        wpAutoColumns = true;
+                                                        wp_auto_columns();
+                                                }
+                                        } else {
+                                                $('#normal-sortables').append( $('#side-sortables, #column3-sortables, #column4-sortables').children('.postbox') );
+                                                $('#postbox-container-2, #postbox-container-3, #postbox-container-4').hide();
+                                                $('#postbox-container-1').css('width', '100%');
</ins><span class="cx">                                         }
</span><ins>+
</ins><span class="cx">                                 } else {
</span><span class="cx">                                         wrap.removeClass('columns-auto');
</span><span class="cx">
</span><span class="cx">                                         if ( ps.length ) { // write pages
</span><ins>+
</ins><span class="cx">                                                 if ( num == 2 ) {
</span><span class="cx">                                                         wrap.removeClass('columns-1').addClass('columns-2');
</span><span class="cx">                                                         ps.addClass('has-right-sidebar');
</span><span class="lines">@@ -69,17 +78,21 @@
</span><span class="cx">                                                         ps.removeClass('has-right-sidebar');
</span><span class="cx">                                                         $('#normal-sortables').before( $('#side-sortables') );
</span><span class="cx">                                                 }
</span><ins>+
</ins><span class="cx">                                         } else { // dashboard
</span><ins>+
</ins><span class="cx">                                                 for ( i = 4; ( i > num && i > 1 ); i-- ) {
</span><span class="cx">                                                         el = $('#' + colname(i) + '-sortables');
</span><span class="cx">                                                         $('#' + colname(i-1) + '-sortables').append(el.children('.postbox'));
</span><span class="cx">                                                         el.parent().hide();
</span><span class="cx">                                                 }
</span><ins>+
</ins><span class="cx">                                                 for ( i = 1; i <= num; i++ ) {
</span><span class="cx">                                                         el = $('#' + colname(i) + '-sortables');
</span><span class="cx">                                                         if ( el.parent().is(':hidden') )
</span><span class="cx">                                                                 el.addClass('temp-border').parent().show();
</span><span class="cx">                                                 }
</span><ins>+
</ins><span class="cx">                                                 $('.postbox-container:visible').css('width', 100/num + '%');
</span><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="lines">@@ -205,7 +218,9 @@
</span><span class="cx">                                         $(document.body).addClass('wide-window');
</span><span class="cx">                                 }
</span><span class="cx">
</span><del>-                        } else if ( adminpage == 'index-php' ) {
</del><ins>+                        }
+/*
+                        else if ( adminpage == 'index-php' ) {
</ins><span class="cx">                                 dw = $('#dashboard-widgets').width();
</span><span class="cx">
</span><span class="cx">                                 if ( dw < 800 ) {
</span><span class="lines">@@ -235,6 +250,7 @@
</span><span class="cx">
</span><span class="cx">                                 $('.postbox-container:visible').css('width', 100/num + '%');
</span><span class="cx">                         }
</span><ins>+*/
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $(window).resize(function(){ wp_auto_columns(); });
</span></span></pre></div>
<a id="trunkwpadminjspostboxjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/postbox.js (18623 => 18624)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/postbox.js        2011-08-30 17:50:12 UTC (rev 18623)
+++ trunk/wp-admin/js/postbox.js        2011-08-30 22:29:37 UTC (rev 18624)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var postboxes,wp_auto_columns,wpAutoColumns=false;(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,h,j=a("#poststuff"),g=a(".wrap");if(e=="auto"){g.removeClass("columns-1").removeClass("columns-2").addClass("columns-auto");j.addClass("has-right-sidebar");if(!a("#side-info-column #side-sortables").length){a("#side-info-column").append(a("#side-sortables"))}if(typeof(wp_auto_columns)=="function"){wpAutoColumns=true;wp_auto_columns()}}else{g.removeClass("columns-auto");if(j.length){if(e==2){g.removeClass("columns-1").addClass("columns-2");j.addClass("has-right-sidebar");if(!a("#side-info-column #side-sortables").length){a("#side-i
nfo-column").append(a("#side-sortables"))}}else{if(e==1){g.removeClass("columns-2").addClass("columns-1");j.removeClass("has-right-sidebar");a("#normal-sortables").before(a("#side-sortables"))}}}else{for(f=4;(f>e&&f>1);f--){h=a("#"+d(f)+"-sortables");a("#"+d(f-1)+"-sortables").append(h.children(".postbox"));h.parent().hide()}for(f=1;f<=e;f++){h=a("#"+d(f)+"-sortables");if(h.parent().is(":hidden")){h.addClass("temp-border").parent().show()}}a(".postbox-container:visible").css("width",100/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(){re
turn 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};a(document).ready(function(){wpAutoColumns=a("#wp_auto_columns").prop("checked");wp_auto_columns=function(){var b=a(window).width(),e,d,c=1;if(!wpAutoColumns){return}if(b<=680){a(document.body).addClass("folded")}if(b>680&&getUserSetting("mfold")!="f"){a(document.body).removeClass("folded")}if(adminp
age=="post-php"){e=a("#post-body").width();if(e<800){a("#poststuff").removeClass("has-right-sidebar");a("#normal-sortables").before(a("#side-sortables"))}if(e>=800&&e<1150){a("#poststuff").addClass("has-right-sidebar");a("#side-info-column").append(a("#side-sortables"));a(document.body).removeClass("wide-window")}if(e>=1150){a(document.body).addClass("wide-window")}}else{if(adminpage=="index-php"){d=a("#dashboard-widgets").width();if(d<800){a("#postbox-container-2").hide();a("#normal-sortables").after(a("#side-sortables"));c=1}if(d>=800&&d<1200){a("#postbox-container-2").show().append(a("#side-sortables"));a("#postbox-container-3").hide();a("#side-sortables").after(a("#column3-sortables"));c=2}if(d>=1200&&d<1
600){a("#postbox-container-3").show().append(a("#column3-sortables"));a("#postbox-container-4").hide();a("#column3-sortables").after(a("#column4-sortables"));c=3}if(d>=1600){a("#postbox-container-4").show().append(a("#column4-sortables"));c=4}a(".postbox-container:visible").css("width",100/c+"%")}}};a(window).resize(function(){wp_auto_columns()});wp_auto_columns()})}(jQuery));
</del><span class="cx">\ No newline at end of file
</span><ins>+var postboxes,wp_auto_columns,wpAutoColumns=false;(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,h,j=a("#poststuff"),g=a(".wrap");if(e=="auto"){if(j.length){g.removeClass("columns-1").removeClass("columns-2").addClass("columns-auto");j.addClass("has-right-sidebar");if(!a("#side-info-column #side-sortables").length){a("#side-info-column").append(a("#side-sortables"))}if(typeof(wp_auto_columns)=="function"){wpAutoColumns=true;wp_auto_columns()}}else{a("#normal-sortables").append(a("#side-sortables, #column3-sortables, #column4-sortables").children(".postbox"));a("#postbox-container-2, #postbox-container-3, #postbox-container-4").hide();a(&quo
t;#postbox-container-1").css("width","100%")}}else{g.removeClass("columns-auto");if(j.length){if(e==2){g.removeClass("columns-1").addClass("columns-2");j.addClass("has-right-sidebar");if(!a("#side-info-column #side-sortables").length){a("#side-info-column").append(a("#side-sortables"))}}else{if(e==1){g.removeClass("columns-2").addClass("columns-1");j.removeClass("has-right-sidebar");a("#normal-sortables").before(a("#side-sortables"))}}}else{for(f=4;(f>e&&f>1);f--){h=a("#"+d(f)+"-sortables");a("#"+d(f-1)+"-sortables").append(h.children(".postbox"));h.parent().hide()}for(f=1;f<=e;f++){h=a("#"+d(f)+"-sortables");if(h.parent().is(":hidden")){h.addClass("temp-border").parent().show()}}a(".postbox-container:visible").css(&q
uot;width",100/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")},recei
ve: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};a(document).ready(function(){wpAutoColumns=a("
;#wp_auto_columns").prop("checked");wp_auto_columns=function(){var b=a(window).width(),e,d,c=1;if(!wpAutoColumns){return}if(b<=680){a(document.body).addClass("folded")}if(b>680&&getUserSetting("mfold")!="f"){a(document.body).removeClass("folded")}if(adminpage=="post-php"){e=a("#post-body").width();if(e<800){a("#poststuff").removeClass("has-right-sidebar");a("#normal-sortables").before(a("#side-sortables"))}if(e>=800&&e<1150){a("#poststuff").addClass("has-right-sidebar");a("#side-info-column").append(a("#side-sortables"));a(document.body).removeClass("wide-window")}if(e>=1150){a(document.body).addClass("wide-window")}}};a(window).resize(function(){wp_auto_columns()});wp_auto_columns()})}(jQuery));
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (18623 => 18624)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2011-08-30 17:50:12 UTC (rev 18623)
+++ trunk/wp-includes/script-loader.php        2011-08-30 22:29:37 UTC (rev 18624)
</span><span class="lines">@@ -279,7 +279,7 @@
</span><span class="cx">
</span><span class="cx">                 $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), '20110524', 1 );
</span><span class="cx">
</span><del>-                $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20110825', 1 );
</del><ins>+                $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20110830', 1 );
</ins><span class="cx">
</span><span class="cx">                 $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20110524', 1 );
</span><span class="cx">                 $scripts->add_script_data( 'post', 'postL10n', array(
</span></span></pre>
</div>
</div>
</body>
</html>