Ticket #20164: 20164.4.diff
File 20164.4.diff, 11.1 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/ajax-actions.php
1422 1422 1423 1423 check_ajax_referer( 'find-posts' ); 1424 1424 1425 if ( empty($_POST['ps']) )1426 wp_die();1425 $post_types = get_post_types( array( 'public' => true ), 'objects' ); 1426 unset( $post_types['attachment'] ); 1427 1427 1428 if ( !empty($_POST['post_type']) && in_array( $_POST['post_type'], get_post_types() ) ) 1429 $what = $_POST['post_type']; 1430 else 1431 $what = 'post'; 1428 $what = array_keys( $post_types ); 1429 $what = "'" . implode( "', '", $what ) . "'"; 1432 1430 1433 1431 $s = stripslashes($_POST['ps']); 1434 1432 preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); … … 1444 1442 if ( count($search_terms) > 1 && $search_terms[0] != $s ) 1445 1443 $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')"; 1446 1444 1447 $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" ); 1445 if ( empty($_POST['ps']) ) 1446 $search = ''; 1447 else 1448 $search = 'AND (' . $search . ')'; 1448 1449 1450 $posts = $wpdb->get_results( "SELECT ID, post_title, post_type, post_status, post_date FROM $wpdb->posts WHERE post_type IN ($what) AND post_status IN ('draft', 'publish') $search ORDER BY post_date_gmt DESC LIMIT 50" ); 1451 1449 1452 if ( ! $posts ) { 1450 $posttype = get_post_type_object($what); 1451 wp_die( $posttype->labels->not_found ); 1453 wp_die( __('No items found.') ); 1452 1454 } 1453 1455 1454 $html = '<table class="widefat" cellspacing="0"><thead><tr><th class="found-radio"><br /></th><th>'.__('Title').'</th><th >'.__('Date').'</th><th>'.__('Status').'</th></tr></thead><tbody>';1456 $html = '<table class="widefat" cellspacing="0"><thead><tr><th class="found-radio"><br /></th><th>'.__('Title').'</th><th class="no-break">'.__('Type').'</th><th class="no-break">'.__('Date').'</th><th class="no-break">'.__('Status').'</th></tr></thead><tbody>'; 1455 1457 foreach ( $posts as $post ) { 1456 1458 1457 1459 switch ( $post->post_status ) { … … 1478 1480 } 1479 1481 1480 1482 $html .= '<tr class="found-posts"><td class="found-radio"><input type="radio" id="found-'.$post->ID.'" name="found_post_id" value="' . esc_attr($post->ID) . '"></td>'; 1481 $html .= '<td><label for="found-'.$post->ID.'">' .esc_html( $post->post_title ).'</label></td><td>'.esc_html( $time ).'</td><td>'.esc_html( $stat ).'</td></tr>'."\n\n";1483 $html .= '<td><label for="found-'.$post->ID.'">' . esc_html( $post->post_title ) . '</label></td><td class="no-break">' . esc_html( $post_types[$post->post_type]->labels->singular_name ) . '</td><td class="no-break">'.esc_html( $time ) . '</td><td class="no-break">' . esc_html( $stat ). ' </td></tr>' . "\n\n"; 1482 1484 } 1485 1483 1486 $html .= '</tbody></table>'; 1484 1487 1485 1488 $x = new WP_Ajax_Response(); 1486 1489 $x->add( array( 1487 'what' => $what,1488 1490 'data' => $html 1489 1491 )); 1490 1492 $x->send(); 1491 1492 1493 } 1493 1494 1494 1495 function wp_ajax_widgets_order() { -
wp-admin/includes/template.php
1278 1278 <?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?> 1279 1279 <label class="screen-reader-text" for="find-posts-input"><?php _e( 'Search' ); ?></label> 1280 1280 <input type="text" id="find-posts-input" name="ps" value="" /> 1281 <input type="button" id="find-posts-search" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /><br /> 1282 1283 <?php 1284 $post_types = get_post_types( array('public' => true), 'objects' ); 1285 foreach ( $post_types as $post ) { 1286 if ( 'attachment' == $post->name ) 1287 continue; 1288 ?> 1289 <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'); ?> /> 1290 <label for="find-posts-<?php echo esc_attr($post->name); ?>"><?php echo $post->label; ?></label> 1291 <?php 1292 } ?> 1281 <span class="spinner"></span> 1282 <input type="button" id="find-posts-search" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /> 1293 1283 </div> 1294 1284 <div id="find-posts-response"></div> 1295 1285 </div> -
wp-admin/js/media.js
3 3 (function($){ 4 4 findPosts = { 5 5 open : function(af_name, af_val) { 6 var st = document.documentElement.scrollTop || $(document).scrollTop(); 6 var st = document.documentElement.scrollTop || $(document).scrollTop(), 7 overlay = $( '.ui-find-overlay' ); 7 8 9 if ( overlay.length == 0 ) { 10 $( 'body' ).append( '<div class="ui-find-overlay"></div>' ); 11 findPosts.overlay(); 12 } 13 14 overlay.show(); 15 8 16 if ( af_name && af_val ) { 9 17 $('#affected').attr('name', af_name).val(af_val); 10 18 } 11 19 $('#find-posts').show().draggable({ 12 20 handle: '#find-posts-head' 13 }).css({'top':st + 50 + 'px','left':'50%','marginLeft':'- 250px'});21 }).css({'top':st + 50 + 'px','left':'50%','marginLeft':'-328px'}); 14 22 15 23 $('#find-posts-input').focus().keyup(function(e){ 16 24 if (e.which == 27) { findPosts.close(); } // close on Escape 17 25 }); 18 26 27 // Pull some results up by default 28 findPosts.send(); 29 19 30 return false; 20 31 }, 21 32 22 33 close : function() { 23 34 $('#find-posts-response').html(''); 24 35 $('#find-posts').draggable('destroy').hide(); 36 $( '.ui-find-overlay' ).hide(); 25 37 }, 26 38 39 overlay : function() { 40 $( '.ui-find-overlay' ).css( 41 { 'z-index': '999', 'width': $( document ).width() + 'px', 'height': $( document ).height() + 'px' } 42 ).on('click', function () { 43 findPosts.close(); 44 }); 45 }, 46 27 47 send : function() { 28 48 var post = { 29 ps: $('#find-posts-input').val(),30 action: 'find_posts',31 _ajax_nonce: $('#_ajax_nonce').val(),32 post_type: $('input[name="find-posts-what"]:checked').val()33 };49 ps: $('#find-posts-input').val(), 50 action: 'find_posts', 51 _ajax_nonce: $('#_ajax_nonce').val() 52 }, 53 spinner = $( '.find-box-search .spinner' ); 34 54 55 spinner.show(); 56 35 57 $.ajax({ 36 58 type : 'POST', 37 59 url : ajaxurl, 38 60 data : post, 39 success : function(x) { findPosts.show(x); },40 error : function(r) { findPosts.error(r); }61 success : function(x) { findPosts.show(x); spinner.hide(); }, 62 error : function(r) { findPosts.error(r); spinner.hide(); } 41 63 }); 42 64 }, 43 65 … … 55 77 } 56 78 r = r.responses[0]; 57 79 $('#find-posts-response').html(r.data); 80 81 // Enable whole row to be clicked 82 $( '.found-posts td' ).on( 'click', function () { 83 $( this ).parent().find( '.found-radio input' ).prop( 'checked', true ); 84 }); 58 85 }, 59 86 60 87 error : function(r) { … … 91 118 }); 92 119 }); 93 120 }); 121 $(window).resize(function() { 122 findPosts.overlay(); 123 }); 94 124 })(jQuery); -
wp-admin/css/colors-fresh.css
20 20 1.0 - Left to Right Styles 21 21 ------------------------------------------------------------------------------*/ 22 22 23 .find-box-search {24 border-color: #dfdfdf; 25 background-color: #f 1f1f1;23 .find-box-search, 24 .find-box-buttons { 25 background-color: #f7f7f7; 26 26 } 27 27 28 28 .find-box { 29 background-color: # f1f1f1;29 background-color: #444; 30 30 } 31 31 32 .find-box-head { 33 color: #eee; 34 } 35 32 36 .find-box-inside { 33 37 background-color: #fff; 34 38 } … … 139 143 h3.dashboard-widget-title, 140 144 h3.dashboard-widget-title span, 141 145 h3.dashboard-widget-title small, 142 .find-box-head,143 146 .sidebar-name, 144 147 #nav-menu-header, 145 148 #nav-menu-footer, … … 436 439 .widefat tfoot tr th, 437 440 h3.dashboard-widget-title, 438 441 h3.dashboard-widget-title span, 439 h3.dashboard-widget-title small, 440 .find-box-head { 442 h3.dashboard-widget-title small { 441 443 color: #333; 442 444 } 443 445 -
wp-admin/css/wp-admin-rtl.css
1020 1020 14.1 - Media Uploader 1021 1021 ------------------------------------------------------------------------------*/ 1022 1022 1023 #find-posts-input { 1024 float: right; 1025 } 1026 1027 #find-posts-search { 1028 float: right; 1029 margin-right: 3px; 1030 margin-left: 4px; 1031 } 1032 1033 .find-box-search .spinner { 1034 left: auto; 1035 right: 115px; 1036 } 1037 1023 1038 #find-posts-response .found-radio { 1024 1039 padding: 5px 8px 0 0; 1025 1040 } -
wp-admin/css/wp-admin.css
4004 4004 ------------------------------------------------------------------------------*/ 4005 4005 4006 4006 .find-box { 4007 width: 500px;4007 width: 600px; 4008 4008 height: 300px; 4009 4009 overflow: hidden; 4010 padding: 33px 5px 40px;4010 padding: 33px 0 51px; 4011 4011 position: absolute; 4012 4012 z-index: 1000; 4013 4013 } … … 4025 4025 4026 4026 .find-box-inside { 4027 4027 overflow: auto; 4028 width: 100%;4028 padding: 6px; 4029 4029 height: 100%; 4030 4030 } 4031 4031 4032 4032 .find-box-search { 4033 padding: 12px;4034 border-width: 1px;4035 border-style: none none solid;4033 overflow: hidden; 4034 padding: 9px; 4035 position: relative; 4036 4036 } 4037 4037 4038 .find-box-search .spinner { 4039 float: none; 4040 left: 125px; 4041 position: absolute; 4042 top: 9px; 4043 } 4044 4045 #find-posts-input { 4046 float: left; 4047 width: 140px; 4048 height: 24px; 4049 } 4050 4051 #find-posts-search { 4052 float: left; 4053 margin: 1px 4px 0 3px; 4054 } 4055 4038 4056 #find-posts-response { 4039 4057 margin: 8px 0; 4040 4058 padding: 0 1px; … … 4045 4063 } 4046 4064 4047 4065 #find-posts-response .found-radio { 4048 padding: 5px 0 0 8px;4066 padding: 3px 0 0 8px; 4049 4067 width: 15px; 4050 4068 } 4051 4069 4052 4070 .find-box-buttons { 4053 width: 480px;4054 margin: 8px;4071 padding: 8px; 4072 overflow: hidden; 4055 4073 } 4056 4074 4057 .find-box-search label {4058 padding-right: 6px;4059 }4060 4061 4075 .find-box #resize-se { 4062 4076 position: absolute; 4063 4077 right: 1px; 4064 4078 bottom: 1px; 4065 4079 } 4066 4080 4081 .ui-find-overlay { 4082 position: absolute; 4083 top: 0; 4084 left: 0; 4085 background-color: #000; 4086 opacity: 0.6; 4087 filter: alpha(opacity=60); 4088 } 4089 4067 4090 ul#dismissed-updates { 4068 4091 display: none; 4069 4092 } -
wp-admin/css/colors-classic.css
20 20 1.0 - Left to Right Styles 21 21 ------------------------------------------------------------------------------*/ 22 22 23 .find-box-search {24 border-color: #dfdfdf; 25 background-color: # f1f1f1;23 .find-box-search, 24 .find-box-buttons { 25 background-color: #eff8ff; 26 26 } 27 27 28 28 .find-box { 29 background-color: # f1f1f1;29 background-color: #5589aa; 30 30 } 31 31 32 .find-box-head { 33 color: #fff; 34 } 35 32 36 .find-box-inside { 33 37 background-color: #fff; 34 38 } … … 142 146 h3.dashboard-widget-title, 143 147 h3.dashboard-widget-title span, 144 148 h3.dashboard-widget-title small, 145 .find-box-head,146 149 .sidebar-name, 147 150 #nav-menu-header, 148 151 #nav-menu-footer, … … 440 443 .widefat tfoot tr th, 441 444 h3.dashboard-widget-title, 442 445 h3.dashboard-widget-title span, 443 h3.dashboard-widget-title small, 444 .find-box-head { 446 h3.dashboard-widget-title small { 445 447 color: #333; 446 448 } 447 449