| 1 | Index: wp-admin/includes/ajax-actions.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/includes/ajax-actions.php (revision 22106) |
|---|
| 4 | +++ wp-admin/includes/ajax-actions.php (working copy) |
|---|
| 5 | @@ -1421,9 +1421,6 @@ |
|---|
| 6 | |
|---|
| 7 | check_ajax_referer( 'find-posts' ); |
|---|
| 8 | |
|---|
| 9 | - if ( empty($_POST['ps']) ) |
|---|
| 10 | - wp_die(); |
|---|
| 11 | - |
|---|
| 12 | if ( !empty($_POST['post_type']) && in_array( $_POST['post_type'], get_post_types() ) ) |
|---|
| 13 | $what = $_POST['post_type']; |
|---|
| 14 | else |
|---|
| 15 | @@ -1442,8 +1439,13 @@ |
|---|
| 16 | $term = esc_sql( like_escape( $s ) ); |
|---|
| 17 | if ( count($search_terms) > 1 && $search_terms[0] != $s ) |
|---|
| 18 | $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')"; |
|---|
| 19 | + |
|---|
| 20 | + if ( empty($_POST['ps']) ) |
|---|
| 21 | + $search = ''; |
|---|
| 22 | + else |
|---|
| 23 | + $search = 'AND (' . $search . ')'; |
|---|
| 24 | |
|---|
| 25 | - $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND post_status IN ('draft', 'publish') AND ($search) ORDER BY post_date_gmt DESC LIMIT 50" ); |
|---|
| 26 | + $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND post_status IN ('draft', 'publish') $search ORDER BY post_date_gmt DESC LIMIT 50" ); |
|---|
| 27 | |
|---|
| 28 | if ( ! $posts ) { |
|---|
| 29 | $posttype = get_post_type_object($what); |
|---|
| 30 | Index: wp-admin/includes/template.php |
|---|
| 31 | =================================================================== |
|---|
| 32 | --- wp-admin/includes/template.php (revision 22106) |
|---|
| 33 | +++ wp-admin/includes/template.php (working copy) |
|---|
| 34 | @@ -1278,18 +1278,20 @@ |
|---|
| 35 | <?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?> |
|---|
| 36 | <label class="screen-reader-text" for="find-posts-input"><?php _e( 'Search' ); ?></label> |
|---|
| 37 | <input type="text" id="find-posts-input" name="ps" value="" /> |
|---|
| 38 | - <input type="button" id="find-posts-search" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /><br /> |
|---|
| 39 | - |
|---|
| 40 | - <?php |
|---|
| 41 | - $post_types = get_post_types( array('public' => true), 'objects' ); |
|---|
| 42 | - foreach ( $post_types as $post ) { |
|---|
| 43 | - if ( 'attachment' == $post->name ) |
|---|
| 44 | - continue; |
|---|
| 45 | - ?> |
|---|
| 46 | - <input type="radio" name="find-posts-what" id="find-posts-<?php echo esc_attr($post->name); ?>" value="<?php echo esc_attr($post->name); ?>" <?php checked($post->name, 'post'); ?> /> |
|---|
| 47 | - <label for="find-posts-<?php echo esc_attr($post->name); ?>"><?php echo $post->label; ?></label> |
|---|
| 48 | - <?php |
|---|
| 49 | - } ?> |
|---|
| 50 | + <span class="spinner"></span> |
|---|
| 51 | + <input type="button" id="find-posts-search" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /> |
|---|
| 52 | + <span class="find-posts-options"> |
|---|
| 53 | + <?php |
|---|
| 54 | + $post_types = get_post_types( array('public' => true), 'objects' ); |
|---|
| 55 | + foreach ( $post_types as $post ) { |
|---|
| 56 | + if ( 'attachment' == $post->name ) |
|---|
| 57 | + continue; |
|---|
| 58 | + ?> |
|---|
| 59 | + <input type="radio" name="find-posts-what" id="find-posts-<?php echo esc_attr($post->name); ?>" value="<?php echo esc_attr($post->name); ?>" <?php checked($post->name, 'post'); ?> /> |
|---|
| 60 | + <label for="find-posts-<?php echo esc_attr($post->name); ?>"><?php echo $post->label; ?></label> |
|---|
| 61 | + <?php |
|---|
| 62 | + } ?> |
|---|
| 63 | + </span> |
|---|
| 64 | </div> |
|---|
| 65 | <div id="find-posts-response"></div> |
|---|
| 66 | </div> |
|---|
| 67 | Index: wp-admin/js/media.js |
|---|
| 68 | =================================================================== |
|---|
| 69 | --- wp-admin/js/media.js (revision 22106) |
|---|
| 70 | +++ wp-admin/js/media.js (working copy) |
|---|
| 71 | @@ -3,18 +3,29 @@ |
|---|
| 72 | (function($){ |
|---|
| 73 | findPosts = { |
|---|
| 74 | open : function(af_name, af_val) { |
|---|
| 75 | - var st = document.documentElement.scrollTop || $(document).scrollTop(); |
|---|
| 76 | + var st = document.documentElement.scrollTop || $(document).scrollTop(), |
|---|
| 77 | + overlay = $( '.ui-find-overlay' ); |
|---|
| 78 | + |
|---|
| 79 | + if ( overlay.length == 0 ) { |
|---|
| 80 | + $( 'body' ).append( '<div class="ui-find-overlay"></div>' ); |
|---|
| 81 | + findPosts.overlay(); |
|---|
| 82 | + } |
|---|
| 83 | + |
|---|
| 84 | + overlay.show() |
|---|
| 85 | |
|---|
| 86 | if ( af_name && af_val ) { |
|---|
| 87 | $('#affected').attr('name', af_name).val(af_val); |
|---|
| 88 | } |
|---|
| 89 | $('#find-posts').show().draggable({ |
|---|
| 90 | handle: '#find-posts-head' |
|---|
| 91 | - }).css({'top':st + 50 + 'px','left':'50%','marginLeft':'-250px'}); |
|---|
| 92 | + }).css({'top':st + 50 + 'px','left':'50%','marginLeft':'-328px'}); |
|---|
| 93 | |
|---|
| 94 | $('#find-posts-input').focus().keyup(function(e){ |
|---|
| 95 | if (e.which == 27) { findPosts.close(); } // close on Escape |
|---|
| 96 | }); |
|---|
| 97 | + |
|---|
| 98 | + // Pull some results up by default |
|---|
| 99 | + findPosts.send(); |
|---|
| 100 | |
|---|
| 101 | return false; |
|---|
| 102 | }, |
|---|
| 103 | @@ -22,22 +33,34 @@ |
|---|
| 104 | close : function() { |
|---|
| 105 | $('#find-posts-response').html(''); |
|---|
| 106 | $('#find-posts').draggable('destroy').hide(); |
|---|
| 107 | + $( '.ui-find-overlay' ).hide(); |
|---|
| 108 | }, |
|---|
| 109 | + |
|---|
| 110 | + overlay : function() { |
|---|
| 111 | + $( '.ui-find-overlay' ).css( |
|---|
| 112 | + { 'z-index': '999', 'width': $( document ).width() + 'px', 'height': $( document ).height() + 'px' } |
|---|
| 113 | + ).on('click', function () { |
|---|
| 114 | + findPosts.close(); |
|---|
| 115 | + }); |
|---|
| 116 | + }, |
|---|
| 117 | |
|---|
| 118 | send : function() { |
|---|
| 119 | var post = { |
|---|
| 120 | - ps: $('#find-posts-input').val(), |
|---|
| 121 | - action: 'find_posts', |
|---|
| 122 | - _ajax_nonce: $('#_ajax_nonce').val(), |
|---|
| 123 | - post_type: $('input[name="find-posts-what"]:checked').val() |
|---|
| 124 | - }; |
|---|
| 125 | + ps: $('#find-posts-input').val(), |
|---|
| 126 | + action: 'find_posts', |
|---|
| 127 | + _ajax_nonce: $('#_ajax_nonce').val(), |
|---|
| 128 | + post_type: $('input[name="find-posts-what"]:checked').val() |
|---|
| 129 | + }, |
|---|
| 130 | + spinner = $( '.find-box-search .spinner' ); |
|---|
| 131 | + |
|---|
| 132 | + spinner.show(); |
|---|
| 133 | |
|---|
| 134 | $.ajax({ |
|---|
| 135 | type : 'POST', |
|---|
| 136 | url : ajaxurl, |
|---|
| 137 | data : post, |
|---|
| 138 | - success : function(x) { findPosts.show(x); }, |
|---|
| 139 | - error : function(r) { findPosts.error(r); } |
|---|
| 140 | + success : function(x) { findPosts.show(x); spinner.hide(); }, |
|---|
| 141 | + error : function(r) { findPosts.error(r); spinner.hide(); } |
|---|
| 142 | }); |
|---|
| 143 | }, |
|---|
| 144 | |
|---|
| 145 | @@ -55,6 +78,11 @@ |
|---|
| 146 | } |
|---|
| 147 | r = r.responses[0]; |
|---|
| 148 | $('#find-posts-response').html(r.data); |
|---|
| 149 | + |
|---|
| 150 | + // Enable whole row to be clicked |
|---|
| 151 | + $( '.found-posts td' ).on( 'click', function () { |
|---|
| 152 | + $( this ).parent().find( '.found-radio input' ).prop( 'checked', true ); |
|---|
| 153 | + }); |
|---|
| 154 | }, |
|---|
| 155 | |
|---|
| 156 | error : function(r) { |
|---|
| 157 | @@ -91,4 +119,7 @@ |
|---|
| 158 | }); |
|---|
| 159 | }); |
|---|
| 160 | }); |
|---|
| 161 | + $(window).resize(function() { |
|---|
| 162 | + findPosts.overlay(); |
|---|
| 163 | + }); |
|---|
| 164 | })(jQuery); |
|---|
| 165 | Index: wp-admin/css/colors-fresh.css |
|---|
| 166 | =================================================================== |
|---|
| 167 | --- wp-admin/css/colors-fresh.css (revision 22106) |
|---|
| 168 | +++ wp-admin/css/colors-fresh.css (working copy) |
|---|
| 169 | @@ -76,14 +76,21 @@ |
|---|
| 170 | } |
|---|
| 171 | |
|---|
| 172 | .find-box-search { |
|---|
| 173 | - border-color: #dfdfdf; |
|---|
| 174 | - background-color: #f1f1f1; |
|---|
| 175 | + background-color: #f7f7f7; |
|---|
| 176 | } |
|---|
| 177 | |
|---|
| 178 | .find-box { |
|---|
| 179 | + background-color: #444; |
|---|
| 180 | +} |
|---|
| 181 | + |
|---|
| 182 | +.find-box-buttons { |
|---|
| 183 | background-color: #f1f1f1; |
|---|
| 184 | } |
|---|
| 185 | |
|---|
| 186 | +.find-box-head { |
|---|
| 187 | + color: #eee; |
|---|
| 188 | +} |
|---|
| 189 | + |
|---|
| 190 | .find-box-inside { |
|---|
| 191 | background-color: #fff; |
|---|
| 192 | } |
|---|
| 193 | @@ -191,7 +198,6 @@ |
|---|
| 194 | h3.dashboard-widget-title, |
|---|
| 195 | h3.dashboard-widget-title span, |
|---|
| 196 | h3.dashboard-widget-title small, |
|---|
| 197 | -.find-box-head, |
|---|
| 198 | .sidebar-name, |
|---|
| 199 | #nav-menu-header, |
|---|
| 200 | #nav-menu-footer, |
|---|
| 201 | @@ -683,8 +689,7 @@ |
|---|
| 202 | .widefat tfoot tr th, |
|---|
| 203 | h3.dashboard-widget-title, |
|---|
| 204 | h3.dashboard-widget-title span, |
|---|
| 205 | -h3.dashboard-widget-title small, |
|---|
| 206 | -.find-box-head { |
|---|
| 207 | +h3.dashboard-widget-title small { |
|---|
| 208 | color: #333; |
|---|
| 209 | } |
|---|
| 210 | |
|---|
| 211 | Index: wp-admin/css/wp-admin.css |
|---|
| 212 | =================================================================== |
|---|
| 213 | --- wp-admin/css/wp-admin.css (revision 22106) |
|---|
| 214 | +++ wp-admin/css/wp-admin.css (working copy) |
|---|
| 215 | @@ -3851,10 +3851,10 @@ |
|---|
| 216 | ------------------------------------------------------------------------------*/ |
|---|
| 217 | |
|---|
| 218 | .find-box { |
|---|
| 219 | - width: 500px; |
|---|
| 220 | + width: 600px; |
|---|
| 221 | height: 300px; |
|---|
| 222 | overflow: hidden; |
|---|
| 223 | - padding: 33px 5px 40px; |
|---|
| 224 | + padding: 33px 0 51px; |
|---|
| 225 | position: absolute; |
|---|
| 226 | z-index: 1000; |
|---|
| 227 | } |
|---|
| 228 | @@ -3872,16 +3872,48 @@ |
|---|
| 229 | |
|---|
| 230 | .find-box-inside { |
|---|
| 231 | overflow: auto; |
|---|
| 232 | - width: 100%; |
|---|
| 233 | + padding: 6px; |
|---|
| 234 | height: 100%; |
|---|
| 235 | } |
|---|
| 236 | |
|---|
| 237 | +.find-posts-options { |
|---|
| 238 | + margin-left: 9px; |
|---|
| 239 | + overflow: hidden; |
|---|
| 240 | +} |
|---|
| 241 | + |
|---|
| 242 | +.find-posts-options input { |
|---|
| 243 | + float: left; |
|---|
| 244 | + margin: 7px 4px 0 7px; |
|---|
| 245 | +} |
|---|
| 246 | + |
|---|
| 247 | +.find-posts-options label { |
|---|
| 248 | + float: left; |
|---|
| 249 | + margin-top: 6px; |
|---|
| 250 | +} |
|---|
| 251 | + |
|---|
| 252 | .find-box-search { |
|---|
| 253 | - padding: 12px; |
|---|
| 254 | - border-width: 1px; |
|---|
| 255 | - border-style: none none solid; |
|---|
| 256 | + overflow: hidden; |
|---|
| 257 | + padding: 9px; |
|---|
| 258 | + position: relative; |
|---|
| 259 | } |
|---|
| 260 | |
|---|
| 261 | +.find-box-search .spinner { |
|---|
| 262 | + float: none; |
|---|
| 263 | + left: 126px; |
|---|
| 264 | + position: absolute; |
|---|
| 265 | + top: 9px; |
|---|
| 266 | +} |
|---|
| 267 | + |
|---|
| 268 | +#find-posts-input { |
|---|
| 269 | + float: left; |
|---|
| 270 | + height: 24px; |
|---|
| 271 | +} |
|---|
| 272 | + |
|---|
| 273 | +#find-posts-search { |
|---|
| 274 | + float: left; |
|---|
| 275 | + margin: 1px 4px 0 3px; |
|---|
| 276 | +} |
|---|
| 277 | + |
|---|
| 278 | #find-posts-response { |
|---|
| 279 | margin: 8px 0; |
|---|
| 280 | padding: 0 1px; |
|---|
| 281 | @@ -3892,25 +3924,30 @@ |
|---|
| 282 | } |
|---|
| 283 | |
|---|
| 284 | #find-posts-response .found-radio { |
|---|
| 285 | - padding: 5px 0 0 8px; |
|---|
| 286 | + padding: 3px 0 0 8px; |
|---|
| 287 | width: 15px; |
|---|
| 288 | } |
|---|
| 289 | |
|---|
| 290 | .find-box-buttons { |
|---|
| 291 | - width: 480px; |
|---|
| 292 | - margin: 8px; |
|---|
| 293 | + padding: 8px; |
|---|
| 294 | + overflow: hidden; |
|---|
| 295 | } |
|---|
| 296 | |
|---|
| 297 | -.find-box-search label { |
|---|
| 298 | - padding-right: 6px; |
|---|
| 299 | -} |
|---|
| 300 | - |
|---|
| 301 | .find-box #resize-se { |
|---|
| 302 | position: absolute; |
|---|
| 303 | right: 1px; |
|---|
| 304 | bottom: 1px; |
|---|
| 305 | } |
|---|
| 306 | |
|---|
| 307 | +.ui-find-overlay { |
|---|
| 308 | + position: absolute; |
|---|
| 309 | + top: 0; |
|---|
| 310 | + left: 0; |
|---|
| 311 | + background-color: #000; |
|---|
| 312 | + opacity: 0.6; |
|---|
| 313 | + filter: alpha(opacity=60); |
|---|
| 314 | +} |
|---|
| 315 | + |
|---|
| 316 | ul#dismissed-updates { |
|---|
| 317 | display: none; |
|---|
| 318 | } |
|---|