Ticket #20164: 20164.5.diff
File 20164.5.diff, 11.2 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/ajax-actions.php
1421 1421 1422 1422 check_ajax_referer( 'find-posts' ); 1423 1423 1424 if ( empty($_POST['ps']) )1425 wp_die();1424 $post_types = get_post_types( array( 'public' => true ), 'objects' ); 1425 unset( $post_types['attachment'] ); 1426 1426 1427 if ( !empty($_POST['post_type']) && in_array( $_POST['post_type'], get_post_types() ) ) 1428 $what = $_POST['post_type']; 1429 else 1430 $what = 'post'; 1427 $what = array_keys( $post_types ); 1428 $what = "'" . implode( "', '", $what ) . "'"; 1431 1429 1432 1430 $s = stripslashes($_POST['ps']); 1433 1431 preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); … … 1443 1441 if ( count($search_terms) > 1 && $search_terms[0] != $s ) 1444 1442 $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')"; 1445 1443 1446 $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" ); 1444 if ( empty($_POST['ps']) ) 1445 $search = ''; 1446 else 1447 $search = 'AND (' . $search . ')'; 1447 1448 1449 $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" ); 1450 1448 1451 if ( ! $posts ) { 1449 $posttype = get_post_type_object($what); 1450 wp_die( $posttype->labels->not_found ); 1452 wp_die( __('No items found.') ); 1451 1453 } 1452 1454 1453 $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>';1455 $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>'; 1454 1456 foreach ( $posts as $post ) { 1455 1457 1456 1458 switch ( $post->post_status ) { … … 1477 1479 } 1478 1480 1479 1481 $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>'; 1480 $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";1482 $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"; 1481 1483 } 1484 1482 1485 $html .= '</tbody></table>'; 1483 1486 1484 1487 $x = new WP_Ajax_Response(); 1485 1488 $x->add( array( 1486 'what' => $what,1487 1489 'data' => $html 1488 1490 )); 1489 1491 $x->send(); 1490 1491 1492 } 1492 1493 1493 1494 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: #f1f1f1; 23 .find-box-search, 24 .find-box-buttons { 25 background-color: #f7f7f7; 26 border-top: 1px solid #ddd; 26 27 } 27 28 28 29 .find-box { 29 background-color: # f1f1f1;30 background-color: #444; 30 31 } 31 32 33 .find-box-head { 34 color: #eee; 35 } 36 32 37 .find-box-inside { 33 38 background-color: #fff; 34 39 } … … 170 175 h3.dashboard-widget-title, 171 176 h3.dashboard-widget-title span, 172 177 h3.dashboard-widget-title small, 173 .find-box-head,174 178 .sidebar-name, 175 179 #nav-menu-header, 176 180 #nav-menu-footer, … … 477 481 .widefat tfoot tr th, 478 482 h3.dashboard-widget-title, 479 483 h3.dashboard-widget-title span, 480 h3.dashboard-widget-title small, 481 .find-box-head { 484 h3.dashboard-widget-title small { 482 485 color: #333; 483 486 } 484 487 -
wp-admin/css/wp-admin-rtl.css
1083 1083 14.1 - Media Uploader 1084 1084 ------------------------------------------------------------------------------*/ 1085 1085 1086 #find-posts-input { 1087 float: right; 1088 } 1089 1090 #find-posts-search { 1091 float: right; 1092 margin-right: 3px; 1093 margin-left: 4px; 1094 } 1095 1096 .find-box-search .spinner { 1097 left: auto; 1098 right: 115px; 1099 } 1100 1086 1101 #find-posts-response .found-radio { 1087 1102 padding: 5px 8px 0 0; 1088 1103 } -
wp-admin/css/wp-admin.css
3955 3955 ------------------------------------------------------------------------------*/ 3956 3956 3957 3957 .find-box { 3958 width: 500px;3958 width: 600px; 3959 3959 height: 300px; 3960 3960 overflow: hidden; 3961 padding: 33px 5px 40px;3961 padding: 33px 0 51px; 3962 3962 position: absolute; 3963 3963 z-index: 1000; 3964 3964 } … … 3976 3976 3977 3977 .find-box-inside { 3978 3978 overflow: auto; 3979 width: 100%;3979 padding: 6px; 3980 3980 height: 100%; 3981 3981 } 3982 3982 3983 3983 .find-box-search { 3984 padding: 12px;3985 border-width: 1px;3986 border-style: none none solid;3984 overflow: hidden; 3985 padding: 9px; 3986 position: relative; 3987 3987 } 3988 3988 3989 .find-box-search .spinner { 3990 float: none; 3991 left: 125px; 3992 position: absolute; 3993 top: 9px; 3994 } 3995 3996 #find-posts-input { 3997 float: left; 3998 width: 140px; 3999 height: 24px; 4000 } 4001 4002 #find-posts-search { 4003 float: left; 4004 margin: 1px 4px 0 3px; 4005 } 4006 3989 4007 #find-posts-response { 3990 4008 margin: 8px 0; 3991 padding: 0 1px ;4009 padding: 0 1px 6px; 3992 4010 } 3993 4011 3994 4012 #find-posts-response table { … … 3996 4014 } 3997 4015 3998 4016 #find-posts-response .found-radio { 3999 padding: 5px 0 0 8px;4017 padding: 3px 0 0 8px; 4000 4018 width: 15px; 4001 4019 } 4002 4020 4003 4021 .find-box-buttons { 4004 width: 480px;4005 margin: 8px;4022 padding: 8px; 4023 overflow: hidden; 4006 4024 } 4007 4025 4008 .find-box-search label {4009 padding-right: 6px;4010 }4011 4012 4026 .find-box #resize-se { 4013 4027 position: absolute; 4014 4028 right: 1px; 4015 4029 bottom: 1px; 4016 4030 } 4017 4031 4032 .ui-find-overlay { 4033 position: absolute; 4034 top: 0; 4035 left: 0; 4036 background-color: #000; 4037 opacity: 0.6; 4038 filter: alpha(opacity=60); 4039 } 4040 4018 4041 ul#dismissed-updates { 4019 4042 display: none; 4020 4043 } -
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 border-top: 1px solid #dce6f8; 26 27 } 27 28 28 29 .find-box { 29 background-color: # f1f1f1;30 background-color: #5589aa; 30 31 } 31 32 33 .find-box-head { 34 color: #fff; 35 } 36 32 37 .find-box-inside { 33 38 background-color: #fff; 34 39 } … … 167 172 h3.dashboard-widget-title, 168 173 h3.dashboard-widget-title span, 169 174 h3.dashboard-widget-title small, 170 .find-box-head,171 175 .sidebar-name, 172 176 #nav-menu-header, 173 177 #nav-menu-footer, … … 475 479 .widefat tfoot tr th, 476 480 h3.dashboard-widget-title, 477 481 h3.dashboard-widget-title span, 478 h3.dashboard-widget-title small, 479 .find-box-head { 482 h3.dashboard-widget-title small { 480 483 color: #333; 481 484 } 482 485