Changeset 8901 for trunk/wp-admin/includes/template.php
- Timestamp:
- 09/16/2008 04:24:28 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/template.php
r8895 r8901 2008 2008 } 2009 2009 2010 function find_posts_div($found_action = '') { 2010 2011 ?> 2012 <div id="find-posts" class="find-box" style="display:none;"> 2013 <div id="find-posts-head" class="find-box-head"><?php _e('Find Posts or Pages'); ?></div> 2014 <div class="find-box-inside"> 2015 <div class="find-box-search"> 2016 <?php if ( $found_action ) { ?> 2017 <input type="hidden" name="found_action" value="<?php echo $found_action; ?>" /> 2018 <?php } ?> 2019 2020 <input type="hidden" name="affected" id="affected" value="" /> 2021 <?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?> 2022 <label class="hidden" for="find-posts-input"><?php _e( 'Search' ); ?></label> 2023 <input type="text" id="find-posts-input" class="search-input" name="ps" value="" /> 2024 <input type="button" onclick="findPosts.send();" value="<?php _e( 'Search' ); ?>" class="button" /><br /> 2025 2026 <input type="radio" name="find-posts-what" id="find-posts-posts" checked="checked" value="posts" /> 2027 <label for="find-posts-posts"><?php _e( 'Posts' ); ?></label> 2028 <input type="radio" name="find-posts-what" id="find-posts-pages" value="pages" /> 2029 <label for="find-posts-pages"><?php _e( 'Pages' ); ?></label> 2030 </div> 2031 <div id="find-posts-response"></div> 2032 </div> 2033 <div class="find-box-buttons"> 2034 <input type="button" class="button" onclick="findPosts.close();" value="<?php _e('Close'); ?>" /> 2035 <input id="find-posts-submit" type="submit" class="button" value="<?php _e('Select'); ?>" /> 2036 </div> 2037 </div> 2038 <script type="text/javascript"> 2039 (function($){ 2040 findPosts = { 2041 open : function(af_name, af_val) { 2042 var st = document.documentElement.scrollTop || $(document).scrollTop(); 2043 2044 if ( af_name && af_val ) 2045 $('#affected').attr('name', af_name).val(af_val); 2046 2047 $('#find-posts').show().draggable({ 2048 handle: '#find-posts-head' 2049 }).resizable({ 2050 handles: 'all', 2051 minHeight: 150, 2052 minWidth: 280 2053 }).css({'top':st+'px','left':'50%','marginLeft':'-200px'}); 2054 2055 $('.ui-resizable-handle').css({ 2056 'backgroundColor': '#e5e5e5' 2057 }); 2058 2059 $('.ui-resizable-se').css({ 2060 'border': '0 none', 2061 'width': '15px', 2062 'height': '16px', 2063 'background': 'transparent url(images/se.png) no-repeat scroll 0 0' 2064 }); 2065 2066 $('#find-posts-input').focus().keyup(function(e){ 2067 if (e.which == 27) findPosts.close(); // close on Escape 2068 }); 2069 2070 return false; 2071 }, 2072 2073 close : function() { 2074 $('#find-posts-response').html(''); 2075 $('#find-posts').draggable('destroy').resizable('destroy').hide(); 2076 }, 2077 2078 send : function() { 2079 var post = {}; 2080 2081 post['ps'] = $('#find-posts-input').val(); 2082 post['action'] = 'find_posts'; 2083 post['_ajax_nonce'] = $('#_ajax_nonce').val(); 2084 2085 if ( $('#find-posts-pages:checked').val() ) 2086 post['pages'] = 1; 2087 else 2088 post['posts'] = 1; 2089 2090 $.ajax({ 2091 type : 'POST', 2092 url : '<?php echo admin_url('admin-ajax.php'); ?>', 2093 data : post, 2094 success : function(x) { findPosts.show(x); }, 2095 error : function(r) { findPosts.error(r); } 2096 }); 2097 }, 2098 2099 show : function(x) { 2100 2101 if ( typeof(x) == 'string' ) { 2102 this.error({'responseText': x}); 2103 return; 2104 } 2105 2106 var r = wpAjax.parseAjaxResponse(x); 2107 2108 if ( r.errors ) 2109 this.error({'responseText': wpAjax.broken}); 2110 2111 r = r.responses[0]; 2112 $('#find-posts-response').html(r.data); 2113 }, 2114 2115 error : function(r) { 2116 var er = r.statusText; 2117 2118 if ( r.responseText ) 2119 er = r.responseText.replace( /<.[^<>]*?>/g, '' ); 2120 2121 if ( er ) 2122 $('#find-posts-response').html(er); 2123 } 2124 }; 2125 2126 $(document).ready(function(){ 2127 $('#find-posts-submit').click(function(e) { 2128 if ( '' == $('#find-posts-response').html() ) 2129 e.preventDefault(); 2130 }); 2131 }); 2132 })(jQuery); 2133 </script> 2134 <?php 2135 } 2136 2137 ?>
Note: See TracChangeset
for help on using the changeset viewer.