Changeset 22723
- Timestamp:
- 11/20/2012 06:50:15 PM (12 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/css/colors-classic.css
r22647 r22723 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; 31 } 32 33 .find-box-head { 34 color: #fff; 30 35 } 31 36 … … 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, … … 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 } -
trunk/wp-admin/css/colors-fresh.css
r22647 r22723 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; 31 } 32 33 .find-box-head { 34 color: #eee; 30 35 } 31 36 … … 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, … … 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 } -
trunk/wp-admin/css/wp-admin-rtl.css
r22719 r22723 1083 1083 14.1 - Media Uploader 1084 1084 ------------------------------------------------------------------------------*/ 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 } 1085 1100 1086 1101 #find-posts-response .found-radio { -
trunk/wp-admin/css/wp-admin.css
r22719 r22723 3964 3964 3965 3965 .find-box { 3966 width: 500px;3966 width: 600px; 3967 3967 height: 300px; 3968 3968 overflow: hidden; 3969 padding: 33px 5px 40px;3969 padding: 33px 0 51px; 3970 3970 position: absolute; 3971 3971 z-index: 1000; … … 3985 3985 .find-box-inside { 3986 3986 overflow: auto; 3987 width: 100%;3987 padding: 6px; 3988 3988 height: 100%; 3989 3989 } 3990 3990 3991 3991 .find-box-search { 3992 padding: 12px; 3993 border-width: 1px; 3994 border-style: none none solid; 3992 overflow: hidden; 3993 padding: 9px; 3994 position: relative; 3995 } 3996 3997 .find-box-search .spinner { 3998 float: none; 3999 left: 125px; 4000 position: absolute; 4001 top: 9px; 4002 } 4003 4004 #find-posts-input { 4005 float: left; 4006 width: 140px; 4007 height: 24px; 4008 } 4009 4010 #find-posts-search { 4011 float: left; 4012 margin: 1px 4px 0 3px; 3995 4013 } 3996 4014 3997 4015 #find-posts-response { 3998 4016 margin: 8px 0; 3999 padding: 0 1px ;4017 padding: 0 1px 6px; 4000 4018 } 4001 4019 … … 4005 4023 4006 4024 #find-posts-response .found-radio { 4007 padding: 5px 0 0 8px;4025 padding: 3px 0 0 8px; 4008 4026 width: 15px; 4009 4027 } 4010 4028 4011 4029 .find-box-buttons { 4012 width: 480px; 4013 margin: 8px; 4014 } 4015 4016 .find-box-search label { 4017 padding-right: 6px; 4030 padding: 8px; 4031 overflow: hidden; 4018 4032 } 4019 4033 … … 4022 4036 right: 1px; 4023 4037 bottom: 1px; 4038 } 4039 4040 .ui-find-overlay { 4041 position: absolute; 4042 top: 0; 4043 left: 0; 4044 background-color: #000; 4045 opacity: 0.6; 4046 filter: alpha(opacity=60); 4024 4047 } 4025 4048 -
trunk/wp-admin/includes/ajax-actions.php
r22653 r22723 1422 1422 check_ajax_referer( 'find-posts' ); 1423 1423 1424 if ( empty($_POST['ps']) ) 1425 wp_die(); 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'; 1431 1432 $s = stripslashes($_POST['ps']); 1433 preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); 1434 $search_terms = array_map('_search_terms_tidy', $matches[0]); 1435 1424 $post_types = get_post_types( array( 'public' => true ), 'objects' ); 1425 unset( $post_types['attachment'] ); 1426 1427 $s = stripslashes( $_POST['ps'] ); 1436 1428 $searchand = $search = ''; 1437 foreach ( (array) $search_terms as $term ) { 1438 $term = esc_sql( like_escape( $term ) ); 1439 $search .= "{$searchand}(($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%'))"; 1440 $searchand = ' AND '; 1441 } 1442 $term = esc_sql( like_escape( $s ) ); 1443 if ( count($search_terms) > 1 && $search_terms[0] != $s ) 1444 $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')"; 1445 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" ); 1447 1448 if ( ! $posts ) { 1449 $posttype = get_post_type_object($what); 1450 wp_die( $posttype->labels->not_found ); 1451 } 1452 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>'; 1429 $args = array( 1430 'post_type' => array_keys( $post_types ), 1431 'post_status' => 'any', 1432 'posts_per_page' => 50, 1433 ); 1434 if ( '' !== $s ) 1435 $args['s'] = $s; 1436 1437 $posts = get_posts( $args ); 1438 1439 if ( ! $posts ) 1440 wp_die( __('No items found.') ); 1441 1442 $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 1443 foreach ( $posts as $post ) { 1444 $title = trim( $post->post_title ) ? $post->post_title : __( '(no title)' ); 1455 1445 1456 1446 switch ( $post->post_status ) { … … 1478 1468 1479 1469 $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"; 1481 } 1470 $html .= '<td><label for="found-'.$post->ID.'">' . esc_html( $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"; 1471 } 1472 1482 1473 $html .= '</tbody></table>'; 1483 1474 1484 1475 $x = new WP_Ajax_Response(); 1485 1476 $x->add( array( 1486 'what' => $what,1487 1477 'data' => $html 1488 1478 )); 1489 1479 $x->send(); 1490 1491 1480 } 1492 1481 -
trunk/wp-admin/includes/template.php
r22459 r22723 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> -
trunk/wp-admin/js/media.js
r21592 r22723 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 ) { … … 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; … … 23 34 $('#find-posts-response').html(''); 24 35 $('#find-posts').draggable('destroy').hide(); 36 $( '.ui-find-overlay' ).hide(); 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 }); 25 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 }, 53 spinner = $( '.find-box-search .spinner' ); 54 55 spinner.show(); 34 56 35 57 $.ajax({ … … 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 }, … … 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 … … 92 119 }); 93 120 }); 121 $(window).resize(function() { 122 findPosts.overlay(); 123 }); 94 124 })(jQuery);
Note: See TracChangeset
for help on using the changeset viewer.