Ticket #28946: 28946.2.patch
| File 28946.2.patch, 9.7 KB (added by , 12 years ago) |
|---|
-
src/wp-admin/includes/class-wp-media-list-table.php
43 43 ) ); 44 44 } 45 45 46 public function search_box( $text, $input_id ) { 47 if ( empty( $_REQUEST['s'] ) && !$this->has_items() ) 48 return; 49 50 $input_id = $input_id . '-search-input'; 51 52 if ( ! empty( $_REQUEST['orderby'] ) ) 53 echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; 54 if ( ! empty( $_REQUEST['order'] ) ) 55 echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; 56 if ( ! empty( $_REQUEST['post_mime_type'] ) ) 57 echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '" />'; 58 if ( ! empty( $_REQUEST['detached'] ) ) 59 echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />'; 60 ?> 61 <div class="media-toolbar-primary"> 62 <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> 63 <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> 64 <?php submit_button( $text, 'button', false, false, array('id' => 'search-submit') ); ?> 65 </div> 66 <?php 67 } 68 46 69 protected function get_views() { 47 70 global $wpdb, $post_mime_types, $avail_post_mime_types; 48 71 … … 85 108 return $actions; 86 109 } 87 110 88 protected function extra_tablenav( $which ) { 89 ?> 90 <div class="alignleft actions"> 91 <?php 92 if ( 'top' == $which && !is_singular() && !$this->detached && !$this->is_trash ) { 111 protected function display_tablenav( $which ) { 112 $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; 113 114 if ( 'bottom' === $which ) { 115 ?> 116 <div class="media-toolbar"> 117 <div class="media-toolbar-secondary"> 118 <?php $this->bulk_actions(); ?> 119 </div> 120 </div> 121 <?php 122 123 return; 124 } 125 126 $this->pagination( $which ); 127 ?> 128 <div class="media-toolbar"> 129 <div class="media-toolbar-secondary"> 130 <?php $this->view_switcher( $mode ); ?> 131 <?php $this->extra_tablenav(); ?> 132 <?php $this->bulk_actions(); ?> 133 </div> 134 135 <?php $this->search_box( __( 'Search Media' ), 'media' ); ?> 136 </div> 137 <?php 138 } 139 140 protected function extra_tablenav() { 141 142 echo '<div class="filters">'; 143 144 if ( !is_singular() && !$this->detached && !$this->is_trash ) { 93 145 $this->months_dropdown( 'attachment' ); 94 146 95 147 /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */ … … 101 153 submit_button( __( 'Scan for lost attachments' ), 'secondary', 'find_detached', false ); 102 154 } elseif ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) { 103 155 submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); 104 } ?> 105 </div> 106 <?php 156 } 157 158 echo '</div>'; 159 107 160 } 108 161 109 162 public function current_action() { … … 128 181 } 129 182 130 183 protected function pagination( $which ) { 131 global $mode; 184 if ( empty( $this->_pagination_args ) ) { 185 return; 186 } 132 187 133 parent::pagination( $which ); 188 $total_items = $this->_pagination_args['total_items']; 189 $total_pages = $this->_pagination_args['total_pages']; 190 $infinite_scroll = false; 191 if ( isset( $this->_pagination_args['infinite_scroll'] ) ) { 192 $infinite_scroll = $this->_pagination_args['infinite_scroll']; 193 } 134 194 135 $this->view_switcher( $mode ); 195 $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>'; 196 197 $current = $this->get_pagenum(); 198 199 $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); 200 201 $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url ); 202 203 $page_links = array(); 204 205 $disable_first = $disable_last = ''; 206 if ( $current == 1 ) { 207 $disable_first = ' disabled'; 208 } 209 if ( $current == $total_pages ) { 210 $disable_last = ' disabled'; 211 } 212 $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", 213 'first-page' . $disable_first, 214 esc_attr__( 'Go to the first page' ), 215 esc_url( remove_query_arg( 'paged', $current_url ) ), 216 '«' 217 ); 218 219 $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", 220 'prev-page' . $disable_first, 221 esc_attr__( 'Go to the previous page' ), 222 esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ), 223 '‹' 224 ); 225 226 if ( 'bottom' == $which ) { 227 $html_current_page = $current; 228 } else { 229 $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='paged' value='%s' size='%d' />", 230 esc_attr__( 'Current page' ), 231 $current, 232 strlen( $total_pages ) 233 ); 234 } 235 $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) ); 236 $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>'; 237 238 $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", 239 'next-page' . $disable_last, 240 esc_attr__( 'Go to the next page' ), 241 esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ), 242 '›' 243 ); 244 245 $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", 246 'last-page' . $disable_last, 247 esc_attr__( 'Go to the last page' ), 248 esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ), 249 '»' 250 ); 251 252 $pagination_links_class = 'pagination-links'; 253 if ( ! empty( $infinite_scroll ) ) { 254 $pagination_links_class = ' hide-if-js'; 255 } 256 $output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>'; 257 258 $this->_pagination = "<div class='alignright tablenav-pages'>$output</div>"; 259 260 echo $this->_pagination; 136 261 } 137 262 138 263 /** -
src/wp-admin/upload.php
200 200 $parent_file = 'upload.php'; 201 201 202 202 wp_enqueue_script( 'media' ); 203 wp_enqueue_style( 'media-views' ); 203 204 204 205 add_screen_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) ); 205 206 … … 288 289 289 290 <?php $wp_list_table->views(); ?> 290 291 291 <form id="posts-filter" action="" method="get">292 <form id="posts-filter" class="<?php echo $mode; ?>-view" action="" method="get"> 292 293 293 <?php $wp_list_table->search_box( __( 'Search Media' ), 'media' ); ?>294 295 294 <?php $wp_list_table->display(); ?> 296 295 297 296 <div id="ajax-response"></div> -
src/wp-includes/css/media-views.css
19 19 line-height: 16px; 20 20 } 21 21 22 .media-frame select,23 .wp-admin .media-frame select {24 line-height: 28px;25 margin-top: 3px;26 }27 28 22 .media-frame a { 29 23 border-bottom: none; 30 24 color: #21759b; … … 218 212 height: 100%; 219 213 } 220 214 215 .wp-admin .media-toolbar select { 216 height: 32px; 217 line-height: 30px; 218 margin-top: 1px; 219 } 220 221 .post-php .media-toolbar-secondary select { 222 margin-top: 10px; 223 } 224 221 225 .media-toolbar-primary > .media-button, 222 226 .media-toolbar-primary > .media-button-group { 223 227 margin-left: 10px; … … 628 632 max-height: 100%; 629 633 } 630 634 631 .media-frame-content .crop-content .upload-errors 632 { 635 .media-frame-content .crop-content .upload-errors { 633 636 position: absolute; 634 637 width: 300px; 635 638 top: 50%; … … 657 660 * Attachment Browser Filters 658 661 */ 659 662 .media-frame select.attachment-filters { 660 margin-top: 11px;661 663 margin-right: 10px; 662 664 } 663 665 … … 1009 1011 } 1010 1012 1011 1013 .attachments-browser .attachments, 1012 .attachments-browser .uploader-inline { 1014 .attachments-browser .uploader-inline, 1015 .post-php .attachments-browser .media-toolbar { 1013 1016 position: absolute; 1014 1017 top: 50px; 1015 1018 left: 0; … … 1019 1022 outline: none; 1020 1023 } 1021 1024 1025 .attachments-browser .attachments { 1026 margin-top: 10px; 1027 } 1028 1029 .post-php .attachments-browser .media-toolbar { 1030 top: 0; 1031 margin: 0; 1032 width: auto; 1033 } 1034 1022 1035 .attachments-browser .uploader-inline:not(.hidden) + .attachments { 1023 1036 top: 350px; 1024 1037 } … … 2625 2638 margin-top: 0; 2626 2639 } 2627 2640 2628 .media-grid-view .media-toolbar select { 2629 margin-top: 1px; 2630 font-size: inherit; 2631 } 2632 2633 .media-grid-view .attachments-browser .bulk-select { 2641 .media-toolbar .filters, 2642 .media-toolbar .bulk-select { 2634 2643 display: inline-block; 2635 2644 } 2636 2645 … … 2639 2648 * 2640 2649 * This should be OOCSS'd so both use a shared selector. 2641 2650 */ 2642 .media- grid-view .attachments-browser .media-toolbar {2651 .media-toolbar { 2643 2652 background: #fff; 2644 2653 -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); 2645 2654 box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); … … 2657 2666 border: none; 2658 2667 } 2659 2668 2660 .media-grid-view input[type="search"] { 2669 .list-view .media-toolbar { 2670 margin-top: 0; 2671 } 2672 2673 .list-view .media-toolbar-primary { 2674 padding-top: 10px; 2675 } 2676 2677 .media-toolbar input[type="search"] { 2661 2678 margin: 1px; 2662 2679 padding: 3px 5px; 2663 2680 position: absolute; … … 2667 2684 font-weight: 300; 2668 2685 line-height: 1.5; 2669 2686 width: 280px; 2687 -webkit-border-radius: 3px; 2688 -moz-border-radius: 3px; 2689 border-radius: 3px; 2670 2690 } 2671 2691 2672 .media-grid-view .view-switch { 2692 .wp-core-ui .media-toolbar .button { 2693 height: 32px; 2694 line-height: 30px; 2695 vertical-align: middle; 2696 } 2697 2698 .list-view .media-toolbar input[type="search"] { 2699 position: static; 2700 } 2701 2702 .media-toolbar .view-switch { 2673 2703 display: inline-block; 2674 2704 float: none; 2675 2705 vertical-align: middle; … … 2677 2707 margin: 0 20px 0 0; 2678 2708 } 2679 2709 2680 .media- grid-viewselect {2710 .media-toolbar select { 2681 2711 margin: 0 10px 0 0; 2712 font-size: inherit; 2682 2713 } 2683 2714 2684 2715 .media-grid-view .spinner {