Ticket #22608: 22608.diff
File 22608.diff, 5.5 KB (added by , 12 years ago) |
---|
-
wp-includes/js/media-editor.js
157 157 icontag: 'dt', 158 158 captiontag: 'dd', 159 159 columns: 3, 160 size: 'thumbnail' 160 size: 'thumbnail', 161 orderby: 'menu_order ID' 161 162 }, 162 163 163 164 attachments: function( shortcode ) { … … 170 171 if ( result ) 171 172 return result; 172 173 173 attrs = shortcode.attrs.named; 174 // Fill the default shortcode attributes. 175 attrs = _.defaults( shortcode.attrs.named, wp.media.gallery.defaults ); 174 176 args = _.pick( attrs, 'orderby', 'order' ); 175 177 176 178 args.type = 'image'; 177 179 args.perPage = -1; 178 180 181 // Map the `orderby` attribute to the corresponding model property. 182 if ( ! attrs.orderby || /^menu_order(?: ID)?$/i.test( attrs.orderby ) ) 183 args.orderby = 'menuOrder'; 184 179 185 // Map the `ids` param to the correct query args. 180 186 if ( attrs.ids ) { 181 187 args.post__in = attrs.ids.split(','); … … 204 210 205 211 shortcode: function( attachments ) { 206 212 var props = attachments.props.toJSON(), 207 attrs = _.pick( props, ' include', 'exclude', 'orderby', 'order' ),213 attrs = _.pick( props, 'orderby', 'order' ), 208 214 shortcode, clone; 209 215 210 216 if ( attachments.gallery ) 211 217 _.extend( attrs, attachments.gallery.toJSON() ); 212 218 219 // Convert all gallery shortcodes to use the `ids` property. 220 // Ignore `post__in` and `post__not_in`; the attachments in 221 // the collection will already reflect those properties. 213 222 attrs.ids = attachments.pluck('id'); 214 223 224 // Copy the `parent` post ID. 225 if ( props.parent ) 226 attrs.id = props.parent; 227 215 228 // If the `ids` attribute is set and `orderby` attribute 216 229 // is the default value, clear it for cleaner output. 217 230 if ( attrs.ids && 'post__in' === attrs.orderby ) … … 272 285 selection.props.unset('orderby'); 273 286 }); 274 287 275 return wp.media({ 288 // Destroy the previous gallery frame. 289 if ( this.frame ) 290 this.frame.dispose(); 291 292 // Store the current gallery frame. 293 this.frame = wp.media({ 276 294 frame: 'post', 277 295 state: 'gallery-edit', 278 296 title: wp.media.view.l10n.editGalleryTitle, … … 280 298 multiple: true, 281 299 selection: selection 282 300 }); 301 302 return this.frame; 283 303 } 284 304 }; 285 305 }()); -
wp-includes/js/media-models.js
659 659 }, 660 660 661 661 orderby: { 662 allowed: [ 'name', 'author', 'date', 'title', 'modified', 'uploadedTo', 'id', 'post__in' ],662 allowed: [ 'name', 'author', 'date', 'title', 'modified', 'uploadedTo', 'id', 'post__in', 'menuOrder' ], 663 663 valuemap: { 664 664 'id': 'ID', 665 'uploadedTo': 'parent' 665 'uploadedTo': 'parent', 666 'menuOrder': 'menu_order ID' 666 667 } 667 668 }, 668 669 669 670 propmap: { 670 'search': 's', 671 'type': 'post_mime_type', 672 'parent': 'post_parent', 673 'perPage': 'posts_per_page' 671 'search': 's', 672 'type': 'post_mime_type', 673 'parent': 'post_parent', 674 'perPage': 'posts_per_page', 675 'menuOrder': 'menu_order' 674 676 }, 675 677 676 678 // Caches query objects so queries can be easily reused. -
wp-includes/js/media-views.js
2898 2898 all: { 2899 2899 text: l10n.allMediaItems, 2900 2900 props: { 2901 parent: null 2901 parent: null, 2902 orderby: 'date', 2903 order: 'DESC' 2902 2904 }, 2903 2905 priority: 10 2904 2906 }, … … 2906 2908 uploaded: { 2907 2909 text: l10n.uploadedToThisPost, 2908 2910 props: { 2909 parent: media.view.settings.postId 2911 parent: media.view.settings.postId, 2912 orderby: 'menuOrder', 2913 order: 'ASC' 2910 2914 }, 2911 2915 priority: 20 2912 2916 } … … 2921 2925 filters[ key ] = { 2922 2926 text: text, 2923 2927 props: { 2924 type: key, 2925 parent: null 2928 type: key, 2929 parent: null, 2930 orderby: 'date', 2931 order: 'DESC' 2926 2932 } 2927 2933 }; 2928 2934 }); … … 2930 2936 filters.all = { 2931 2937 text: l10n.allMediaItems, 2932 2938 props: { 2933 type: null, 2934 parent: null 2939 type: null, 2940 parent: null, 2941 orderby: 'date', 2942 order: 'DESC' 2935 2943 }, 2936 2944 priority: 10 2937 2945 }; … … 2939 2947 filters.uploaded = { 2940 2948 text: l10n.uploadedToThisPost, 2941 2949 props: { 2942 type: null, 2943 parent: media.view.settings.postId 2950 type: null, 2951 parent: media.view.settings.postId, 2952 orderby: 'menuOrder', 2953 order: 'ASC' 2944 2954 }, 2945 2955 priority: 20 2946 2956 }; -
wp-includes/media.php
1254 1254 'multipart' => true, 1255 1255 'urlstream_upload' => true, 1256 1256 ); 1257 1257 1258 1258 // Multi-file uploading doesn't currently work in iOS Safari, 1259 1259 // single-file allows the built-in camera to be used as source for images 1260 1260 if ( wp_is_mobile() ) … … 1327 1327 'uploadedTo' => $attachment->post_parent, 1328 1328 'date' => strtotime( $attachment->post_date_gmt ) * 1000, 1329 1329 'modified' => strtotime( $attachment->post_modified_gmt ) * 1000, 1330 'menuOrder' => $attachment->menu_order, 1330 1331 'mime' => $attachment->post_mime_type, 1331 1332 'type' => $type, 1332 1333 'subtype' => $subtype,