Ticket #20164: 22099.diff
File 22099.diff, 8.4 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();1426 1427 1424 if ( !empty($_POST['post_type']) && in_array( $_POST['post_type'], get_post_types() ) ) 1428 1425 $what = $_POST['post_type']; 1429 1426 else … … 1442 1439 $term = esc_sql( like_escape( $s ) ); 1443 1440 if ( count($search_terms) > 1 && $search_terms[0] != $s ) 1444 1441 $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')"; 1442 1443 if ( empty($_POST['ps']) ) 1444 $search = ''; 1445 else 1446 $search = 'AND (' . $search . ')'; 1445 1447 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" );1448 $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" ); 1447 1449 1448 1450 if ( ! $posts ) { 1449 1451 $posttype = get_post_type_object($what); -
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" /> 1283 <span class="find-posts-options"> 1284 <?php 1285 $post_types = get_post_types( array('public' => true), 'objects' ); 1286 foreach ( $post_types as $post ) { 1287 if ( 'attachment' == $post->name ) 1288 continue; 1289 ?> 1290 <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'); ?> /> 1291 <label for="find-posts-<?php echo esc_attr($post->name); ?>"><?php echo $post->label; ?></label> 1292 <?php 1293 } ?> 1294 </span> 1293 1295 </div> 1294 1296 <div id="find-posts-response"></div> 1295 1297 </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' ); 8 9 if ( overlay.length == 0 ) { 10 $( 'body' ).append( '<div class="ui-find-overlay"></div>' ); 11 findPosts.overlay(); 12 } 13 14 overlay.show() 7 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 }); 26 27 // Pull some results up by default 28 findPosts.send(); 18 29 19 30 return false; 20 31 }, … … 22 33 close : function() { 23 34 $('#find-posts-response').html(''); 24 35 $('#find-posts').draggable('destroy').hide(); 36 $( '.ui-find-overlay' ).hide(); 25 37 }, 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 }, 26 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 post_type: $('input[name="find-posts-what"]:checked').val() 53 }, 54 spinner = $( '.find-box-search .spinner' ); 55 56 spinner.show(); 34 57 35 58 $.ajax({ 36 59 type : 'POST', 37 60 url : ajaxurl, 38 61 data : post, 39 success : function(x) { findPosts.show(x); },40 error : function(r) { findPosts.error(r); }62 success : function(x) { findPosts.show(x); spinner.hide(); }, 63 error : function(r) { findPosts.error(r); spinner.hide(); } 41 64 }); 42 65 }, 43 66 … … 55 78 } 56 79 r = r.responses[0]; 57 80 $('#find-posts-response').html(r.data); 81 82 // Enable whole row to be clicked 83 $( '.found-posts td' ).on( 'click', function () { 84 $( this ).parent().find( '.found-radio input' ).prop( 'checked', true ); 85 }); 58 86 }, 59 87 60 88 error : function(r) { … … 91 119 }); 92 120 }); 93 121 }); 122 $(window).resize(function() { 123 findPosts.overlay(); 124 }); 94 125 })(jQuery); -
wp-admin/css/colors-fresh.css
76 76 } 77 77 78 78 .find-box-search { 79 border-color: #dfdfdf; 80 background-color: #f1f1f1; 79 background-color: #f7f7f7; 81 80 } 82 81 83 82 .find-box { 83 background-color: #444; 84 } 85 86 .find-box-buttons { 84 87 background-color: #f1f1f1; 85 88 } 86 89 90 .find-box-head { 91 color: #eee; 92 } 93 87 94 .find-box-inside { 88 95 background-color: #fff; 89 96 } … … 191 198 h3.dashboard-widget-title, 192 199 h3.dashboard-widget-title span, 193 200 h3.dashboard-widget-title small, 194 .find-box-head,195 201 .sidebar-name, 196 202 #nav-menu-header, 197 203 #nav-menu-footer, … … 683 689 .widefat tfoot tr th, 684 690 h3.dashboard-widget-title, 685 691 h3.dashboard-widget-title span, 686 h3.dashboard-widget-title small, 687 .find-box-head { 692 h3.dashboard-widget-title small { 688 693 color: #333; 689 694 } 690 695 -
wp-admin/css/wp-admin.css
3851 3851 ------------------------------------------------------------------------------*/ 3852 3852 3853 3853 .find-box { 3854 width: 500px;3854 width: 600px; 3855 3855 height: 300px; 3856 3856 overflow: hidden; 3857 padding: 33px 5px 40px;3857 padding: 33px 0 51px; 3858 3858 position: absolute; 3859 3859 z-index: 1000; 3860 3860 } … … 3872 3872 3873 3873 .find-box-inside { 3874 3874 overflow: auto; 3875 width: 100%;3875 padding: 6px; 3876 3876 height: 100%; 3877 3877 } 3878 3878 3879 .find-posts-options { 3880 margin-left: 9px; 3881 overflow: hidden; 3882 } 3883 3884 .find-posts-options input { 3885 float: left; 3886 margin: 7px 4px 0 7px; 3887 } 3888 3889 .find-posts-options label { 3890 float: left; 3891 margin-top: 6px; 3892 } 3893 3879 3894 .find-box-search { 3880 padding: 12px;3881 border-width: 1px;3882 border-style: none none solid;3895 overflow: hidden; 3896 padding: 9px; 3897 position: relative; 3883 3898 } 3884 3899 3900 .find-box-search .spinner { 3901 float: none; 3902 left: 126px; 3903 position: absolute; 3904 top: 9px; 3905 } 3906 3907 #find-posts-input { 3908 float: left; 3909 height: 24px; 3910 } 3911 3912 #find-posts-search { 3913 float: left; 3914 margin: 1px 4px 0 3px; 3915 } 3916 3885 3917 #find-posts-response { 3886 3918 margin: 8px 0; 3887 3919 padding: 0 1px; … … 3892 3924 } 3893 3925 3894 3926 #find-posts-response .found-radio { 3895 padding: 5px 0 0 8px;3927 padding: 3px 0 0 8px; 3896 3928 width: 15px; 3897 3929 } 3898 3930 3899 3931 .find-box-buttons { 3900 width: 480px;3901 margin: 8px;3932 padding: 8px; 3933 overflow: hidden; 3902 3934 } 3903 3935 3904 .find-box-search label {3905 padding-right: 6px;3906 }3907 3908 3936 .find-box #resize-se { 3909 3937 position: absolute; 3910 3938 right: 1px; 3911 3939 bottom: 1px; 3912 3940 } 3913 3941 3942 .ui-find-overlay { 3943 position: absolute; 3944 top: 0; 3945 left: 0; 3946 background-color: #000; 3947 opacity: 0.6; 3948 filter: alpha(opacity=60); 3949 } 3950 3914 3951 ul#dismissed-updates { 3915 3952 display: none; 3916 3953 }