Changeset 8422
- Timestamp:
- 07/23/2008 09:20:53 PM (18 years ago)
- Location:
- branches/crazyhorse
- Files:
-
- 1 added
- 10 edited
-
wp-admin/css/colors-fresh.css (modified) (2 diffs)
-
wp-admin/css/media.css (modified) (10 diffs)
-
wp-admin/includes/media.php (modified) (22 diffs)
-
wp-admin/js/media-upload.js (modified) (3 diffs)
-
wp-admin/media-upload.php (modified) (1 diff)
-
wp-admin/wp-admin.css (modified) (1 diff)
-
wp-includes/js/tinymce/plugins/wpeditimage/css/media26.css (added)
-
wp-includes/js/tinymce/plugins/wpeditimage/editimage.html (modified) (1 diff)
-
wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js (modified) (2 diffs)
-
wp-includes/js/tinymce/tiny_mce_config.php (modified) (1 diff)
-
wp-includes/script-loader.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/crazyhorse/wp-admin/css/colors-fresh.css
r8379 r8422 712 712 713 713 714 #adminmenu { 714 #adminmenu, 715 #html-upload-ui, 716 #att-info { 715 717 background-color: #E4F2FD; 716 718 } … … 723 725 } 724 726 727 #html-upload-help { 728 color: #328AB2; 729 } 730 725 731 #fixedbar #last-edit { 726 732 -
branches/crazyhorse/wp-admin/css/media.css
r8335 r8422 23 23 24 24 form { 25 margin: 1em;25 margin: 2px; 26 26 } 27 27 … … 32 32 .media-upload-form label, .media-upload-form legend { 33 33 display:block; 34 font-weight: bold; 35 font-size: 13px; 34 font-size: 10px; 36 35 margin-bottom: 0.5em; 37 36 margin: 0 0 0.5em 0; … … 60 59 /* specific to the image upload form */ 61 60 .align .field label { 62 display: inline; 63 padding: 0 0 0 28px; 64 margin: 0 1em 0 0; 65 } 66 .image-align-none-label { 67 background: url(../images/align-none.png) no-repeat center left; 68 } 69 70 .image-align-left-label { 71 background: url(../images/align-left.png) no-repeat center left; 72 } 73 74 .image-align-center-label { 75 background: url(../images/align-center.png) no-repeat center left; 76 } 77 78 .image-align-right-label { 79 background: url(../images/align-right.png) no-repeat center left; 61 display:inline; 62 margin:0pt 8px 0pt -2px; 63 vertical-align:top; 64 } 65 66 .image-align-none-label input { 67 background: url(../images/align-none.png) no-repeat center -5px; 68 } 69 70 .image-align-left-label input { 71 background: url(../images/align-left.png) no-repeat center -5px; 72 } 73 74 .image-align-center-label input { 75 background: url(../images/align-center.png) no-repeat center -5px; 76 } 77 78 .image-align-right-label input { 79 background: url(../images/align-right.png) no-repeat center -5px; 80 80 } 81 81 … … 171 171 } 172 172 .describe input[type="text"], .describe textarea { 173 width: 460px; 173 font-size:10px; 174 width:245px; 175 padding:2px; 176 margin:0pt 0pt 10px; 174 177 } 175 178 .describe-toggle-on, .describe-toggle-off { … … 200 203 201 204 #media-upload .media-upload-form p.ml-submit { 202 padding: 1em 0; 205 font-size:11px; 206 margin:0pt; 207 padding:1em 0pt 1em 68px; 203 208 } 204 209 205 210 #media-upload p.help { 206 font-style: italic; 207 font-weight: normal; 211 font-size:10px; 212 font-style:italic; 213 font-weight:normal; 214 margin-top:-8px; 208 215 } 209 216 #media-upload tr.image-size td.field { … … 211 218 } 212 219 #media-upload #media-items { 213 border-width: 1px; 214 border-style: solid; 215 border-bottom: none; 216 width: 623px; 220 border-style:solid; 221 border-width:1px; 222 margin:0pt auto; 223 width:315px; 224 217 225 } 218 226 … … 237 245 } 238 246 #media-upload .describe { 239 border-top-width: 1px;240 border-top-style: solid;241 247 padding: 5px; 242 248 width: 100%; … … 245 251 } 246 252 #media-upload .describe th.label { 247 padding-top: .5em; 248 text-align: left; 253 font-size:10px; 254 padding-top:4px; 255 text-align:left; 256 width:57px; 249 257 } 250 258 #media-upload tr.align td.field { … … 271 279 } 272 280 273 #media-upload a.delete,274 #media-upload a.del-link {275 padding: 0 3px 1px;276 }277 278 281 #media-upload .del-attachment { 279 282 display: none; … … 314 317 z-index: -1; 315 318 } 319 320 #media-single-form .filename { 321 float: none; 322 } 323 324 .filelink { 325 float:left; 326 max-width:65px; 327 padding:7px; 328 text-align:center; 329 } 330 331 .filelink img.thumbnail { 332 width: 45px; 333 max-height: 45px; 334 } 335 336 #media-upload .filelink p.filelink-caption { 337 cursor:default; 338 font-size:10px; 339 height:13px; 340 margin:0pt 3px 4px; 341 overflow:hidden; 342 } 343 344 body#media-upload { 345 height: auto; 346 } 347 348 #media-upload .tablenav, 349 #media-upload .page-numbers { 350 background-color: #fff; 351 border: 0 none; 352 color: #328AB2; 353 font-weight:normal; 354 } 355 356 #media-upload .page-numbers { 357 padding: 0; 358 } 359 360 #media-upload .tablenav { 361 margin: 0; 362 height:1em; 363 text-align:right; 364 padding: 4px 10px; 365 } 366 367 #media-upload .tablenav .tablenav-pages { 368 float: none; 369 height: 12px; 370 padding: 0; 371 } 372 373 #html-upload-ui { 374 margin:10px 5px; 375 padding:5px 0 5px 8px; 376 } 377 378 #html-upload-help { 379 font-size:10px; 380 font-weight:bold; 381 padding:4px 0 0 15px; 382 } 383 384 #async-upload { 385 font-size: 10px; 386 } 387 388 #html-upload-ui input { 389 padding: 1px; 390 font-size:10px; 391 } 392 393 #html-upload-ui a { 394 padding: 1px; 395 font-size:10px; 396 } 397 398 #att-info { 399 margin:10px 5px; 400 padding:4px; 401 } 402 403 #att-info a, 404 #att-info p { 405 font-size: 11px; 406 text-decoration: none; 407 } 408 409 .button-link { 410 font-size: 11px; 411 padding: 2px; 412 border: 0; 413 background: transparent; 414 } 415 416 #media-upload #att-info p { 417 margin:3px 6px 4px 2px; 418 padding:0pt 0pt 0pt 17px; 419 height:16px; 420 } 421 422 #media-upload #att-info p.type-image { 423 background: url(../images/media-button-image.gif) no-repeat center left; 424 } 425 426 #media-upload #att-info p.type-audio { 427 background: url(../images/media-button-music.gif) no-repeat center left; 428 } 429 430 #media-upload #att-info p.type-video { 431 background: url(../images/media-button-video.gif) no-repeat center left; 432 } 433 434 #media-upload #att-info p.type-file { 435 background: url(../images/media-button-other.gif) no-repeat center left; 436 } 437 438 .ml-submit .button { 439 font-size: 11px; 440 padding: 1px 2px 2px; 441 } -
branches/crazyhorse/wp-admin/includes/media.php
r8335 r8422 68 68 function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) { 69 69 70 // CAPTIONS_OFF is temporary. Do not use it. 71 if ( empty($alt) || ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) ) return $html; 70 if ( empty($alt) ) return $html; 72 71 $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; 73 72 … … 179 178 return $id; 180 179 } 181 182 180 183 181 // wrap iframe content (produced by $content_func) in a doctype, html head/body etc … … 250 248 check_admin_referer('media-form'); 251 249 252 if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { 253 $post = $_post = get_post($attachment_id, ARRAY_A); 254 if ( isset($attachment['post_content']) ) 255 $post['post_content'] = $attachment['post_content']; 256 if ( isset($attachment['post_title']) ) 257 $post['post_title'] = $attachment['post_title']; 258 if ( isset($attachment['post_excerpt']) ) 259 $post['post_excerpt'] = $attachment['post_excerpt']; 260 if ( isset($attachment['menu_order']) ) 261 $post['menu_order'] = $attachment['menu_order']; 262 263 $post = apply_filters('attachment_fields_to_save', $post, $attachment); 264 265 if ( isset($post['errors']) ) { 266 $errors[$attachment_id] = $post['errors']; 267 unset($post['errors']); 268 } 269 270 if ( $post != $_post ) 271 wp_update_post($post); 272 273 foreach ( get_attachment_taxonomies($post) as $t ) 274 if ( isset($attachment[$t]) ) 275 wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false); 276 } 250 if ( !empty($_POST['attachments']) ) 251 foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { 252 $post = $_post = get_post($attachment_id, ARRAY_A); 253 if ( isset($attachment['post_content']) ) 254 $post['post_content'] = $attachment['post_content']; 255 if ( isset($attachment['post_title']) ) 256 $post['post_title'] = $attachment['post_title']; 257 if ( isset($attachment['post_excerpt']) ) 258 $post['post_excerpt'] = $attachment['post_excerpt']; 259 if ( isset($attachment['menu_order']) ) 260 $post['menu_order'] = $attachment['menu_order']; 261 262 $post = apply_filters('attachment_fields_to_save', $post, $attachment); 263 264 if ( isset($post['errors']) ) { 265 $errors[$attachment_id] = $post['errors']; 266 unset($post['errors']); 267 } 268 269 if ( $post != $_post ) 270 wp_update_post($post); 271 272 foreach ( get_attachment_taxonomies($post) as $t ) 273 if ( isset($attachment[$t]) ) 274 wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false); 275 } 277 276 278 277 if ( isset($_POST['insert-gallery']) ) … … 296 295 } 297 296 297 // crazyhorse 298 298 function media_upload_image() { 299 299 300 if ( isset($_POST['html-upload']) && !empty($_FILES) ) { 300 301 // Upload File button was clicked 302 if ( $_FILES['async-upload']['name'] == '' ) 303 return wp_iframe( 'media_error_nofile' ); 304 301 305 $id = media_handle_upload('async-upload', $_REQUEST['post_id']); 302 306 unset($_FILES); … … 335 339 } 336 340 337 return wp_iframe( 'media_ upload_type_form', 'image', $errors, $id );341 return wp_iframe( 'media_edit_single_form', $id ); 338 342 } 339 343 … … 507 511 } 508 512 513 // crazyhorse 509 514 function image_attachment_fields_to_edit($form_fields, $post) { 510 515 if ( substr($post->post_mime_type, 0, 5) == 'image' ) { 511 516 $form_fields['post_title']['required'] = true; 512 517 513 // CAPTIONS_OFF is temporary. Do not use it. 514 if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) { 515 $form_fields['post_excerpt']['label'] = __('Alternate Text'); 516 $form_fields['post_excerpt']['helps'][] = __('Alt text for the image, e.g. "The Mona Lisa"'); 517 } else { 518 $form_fields['post_excerpt']['label'] = __('Caption'); 519 $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image'); 520 } 521 522 $form_fields['post_content']['label'] = __('Description'); 523 524 $thumb = wp_get_attachment_thumb_url($post->ID); 518 $form_fields['post_excerpt']['label'] = __('Caption'); 519 $form_fields['post_excerpt']['helps'][] = __('Alternate text (e.g. Blue skies)'); 520 521 // $form_fields['post_content']['label'] = __('Description'); 522 523 // $thumb = wp_get_attachment_thumb_url($post->ID); 525 524 526 525 $form_fields['align'] = array( … … 537 536 <label for='image-align-right-$post->ID' class='align image-align-right-label'>" . __('Right') . "</label>\n", 538 537 ); 538 /* 539 539 $form_fields['image-size'] = array( 540 540 'label' => __('Size'), … … 548 548 <label for='image-size-full-$post->ID'>" . __('Full size') . "</label>", 549 549 ); 550 */ 550 551 } 551 552 return $form_fields; … … 597 598 add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3); 598 599 600 // crazyhorse 599 601 function get_attachment_fields_to_edit($post, $errors = null) { 600 602 if ( is_int($post) ) … … 605 607 $edit_post = sanitize_post($post, 'edit'); 606 608 $file = wp_get_attachment_url($post->ID); 607 $link = get_attachment_link($post->ID); 608 609 // CAPTIONS_OFF is temporary. Do not use it. 610 if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) 611 $alt = __('Alternate Text'); 612 else 613 $alt = __('Caption'); 609 // $link = get_attachment_link($post->ID); 614 610 615 611 $form_fields = array( 616 612 'post_title' => array( 617 613 'label' => __('Title'), 618 'value' => $edit_post->post_title ,614 'value' => $edit_post->post_title 619 615 ), 620 616 'post_excerpt' => array( 621 'label' => $alt,622 'value' => $edit_post->post_excerpt ,617 'label' => __('Caption'), 618 'value' => $edit_post->post_excerpt 623 619 ), 620 /* 624 621 'post_content' => array( 625 622 'label' => __('Description'), … … 627 624 'input' => 'textarea', 628 625 ), 626 */ 629 627 'url' => array( 630 'label' => __('Link URL'), 631 'input' => 'html', 632 'html' => " 633 <input type='text' name='attachments[$post->ID][url]' value='" . attribute_escape($file) . "' /><br /> 634 <button type='button' class='button url-$post->ID' value=''>" . __('None') . "</button> 635 <button type='button' class='button url-$post->ID' value='" . attribute_escape($file) . "'>" . __('File URL') . "</button> 636 <button type='button' class='button url-$post->ID' value='" . attribute_escape($link) . "'>" . __('Post URL') . "</button> 637 <script type='text/javascript'> 638 jQuery('button.url-$post->ID').bind('click', function(){jQuery(this).siblings('input').val(this.value);}); 639 </script>\n", 640 'helps' => __('Enter a link URL or click above for presets.'), 641 ), 628 'label' => __('Path'), 629 'value' => attribute_escape($file) 630 ) 631 /* 642 632 'menu_order' => array( 643 633 'label' => __('Order'), 644 634 'value' => $edit_post->menu_order 645 ), 635 ),*/ 646 636 ); 647 637 /* 648 638 foreach ( get_attachment_taxonomies($post) as $taxonomy ) { 649 639 $t = (array) get_taxonomy($taxonomy); … … 665 655 $form_fields[$taxonomy] = $t; 666 656 } 667 657 */ 668 658 // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default 669 659 // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing ) … … 675 665 } 676 666 677 function get_media_items( $post_id, $errors ) { 667 // crazyhorse 668 function get_media_items( $post_id ) { 678 669 if ( $post_id ) { 679 670 $post = get_post($post_id); … … 691 682 return ''; 692 683 684 $ins = isset($_REQUEST['ins']) ? 1 : 0; 685 693 686 foreach ( $attachments as $id => $attachment ) 694 if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) ) 695 $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress'><div class='bar'></div></div><div id='media-upload-error-$id'></div><div class='filename'></div>$item\n</div>"; 687 if ( $item = get_media_item_link( $id, $ins ) ) 688 $output .= $item; 689 690 // $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent'><div class='progress'><div class='bar'></div></div><div id='media-upload-error-$id'></div>$item\n</div>"; 696 691 697 692 return $output; 693 } 694 695 // crazyhorse 696 function get_media_item_link( $attachment_id, $ins ) { 697 698 if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) ) 699 $thumb_url = $thumb_url[0]; 700 else 701 return false; 702 703 $post = get_post($attachment_id); 704 $mime = $post->post_mime_type; 705 706 if ( false !== strpos($mime, 'image') ) $type = 'image'; 707 elseif ( false !== strpos($mime, 'audio') ) $type = 'audio'; 708 elseif ( false !== strpos($mime, 'video') ) $type = 'video'; 709 else $type = 'file'; 710 711 $ins = $ins ? '&ins=1' : ''; 712 $filename = basename($post->guid); 713 $title = attribute_escape($post->post_title); 714 $link = 'media-upload.php?att_id='.$attachment_id.'&tab=single&type='.$type.$ins; 715 716 $item = '<div class="filelink"> 717 <a href="'.$link.'"> 718 <img class="thumbnail" src="'.$thumb_url.'" alt="'.$title.'" title="'.$title.'" /></a> 719 <p class="filelink-caption">'.$filename.'</p></div>'."\n"; 720 721 722 return $item; 723 } 724 725 // crazyhorse 726 function media_edit_single_form($attachment_id = 0) { 727 global $redir_tab; 728 729 $redir_tab = 'gallery'; 730 $ins = isset($_REQUEST['ins']) ? true : false; 731 732 if ( ! $attachment_id ) 733 $attachment_id = (int) $_REQUEST['att_id']; 734 735 $class = ''; 736 if ( isset($_REQUEST['type']) ) 737 $class = ' class="type-'.$_REQUEST['type'].'"'; 738 739 $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0; 740 $form_action_url = admin_url("media-upload.php?type=single&tab=gallery&post_id=$post_id"); 741 742 $post = get_post($attachment_id); 743 $filename = basename($post->guid); 744 745 media_upload_header(); 746 ?> 747 748 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="gallery-form"> 749 <?php wp_nonce_field('media-form'); ?> 750 751 <div id="att-info"><p<?php echo $class; ?>> 752 <?php echo $filename; ?> 753 (<a href="<?php echo wp_nonce_url("post.php?action=delete-post&post=$attachment_id", 'delete-post_' . $attachment_id); ?>" class="del-link" onclick="return confirm('<?php echo js_escape( __("You are about to delete this file\n 'Cancel' to stop, 'OK' to delete.")); ?>');"><?php _e('Remove'); ?></a> | <a href="media-upload.php?tab=gallery<?php if ( $ins ) echo '&ins=1'; ?>"><?php _e('Change'); ?></a>) 754 </p></div> 755 756 <?php echo media_edit_single($attachment_id); ?> 757 758 <p class="ml-submit"> 759 <?php if ( $ins ) { ?> 760 <input type="submit" class="button" name="send[<?php echo $attachment_id; ?>]" value="<?php echo attribute_escape( __( 'Insert into Post' ) ) ?>" /> 761 <input type="hidden" name="ins" value="1" /> 762 <?php } ?> 763 764 <input type="submit" class="button-link button" name="save" value="<?php echo attribute_escape( __( 'Save and Add Another' ) ); ?>" /> 765 766 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 767 <input type="hidden" name="type" value="<?php echo attribute_escape( $GLOBALS['type'] ); ?>" /> 768 <input type="hidden" name="tab" value="<?php echo attribute_escape( $GLOBALS['tab'] ); ?>" /> 769 </p> 770 </form> 771 <?php 772 } 773 774 // crazyhorse 775 function media_edit_single($attachment_id = null) { 776 global $post_mime_types; 777 778 $post = get_post($attachment_id); 779 780 $filename = basename($post->guid); 781 $title_label = __('Title'); 782 $title = attribute_escape($post->post_title); 783 784 if ( isset($post_mime_types) ) { 785 $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type)); 786 $type = array_shift($keys); 787 $type = "<input type='hidden' id='type-of-$attachment_id' value='" . attribute_escape( $type ) . "' />"; 788 } 789 790 $form_fields = get_attachment_fields_to_edit($post); 791 792 $defaults = array( 793 'input' => 'text', 794 'required' => false, 795 'value' => '', 796 'extra_rows' => array(), 797 ); 798 799 $hidden_fields = array(); 800 801 $item = "<table class='slidetoggle describe $class'> 802 <thead class='media-item-info'>"; 803 804 foreach ( $form_fields as $id => $field ) { 805 if ( $id{0} == '_' ) 806 continue; 807 808 if ( !empty($field['tr']) ) { 809 $item .= $field['tr']; 810 continue; 811 } 812 813 $field = array_merge($defaults, $field); 814 $name = "attachments[$attachment_id][$id]"; 815 816 if ( $field['input'] == 'hidden' ) { 817 $hidden_fields[$name] = $field['value']; 818 continue; 819 } 820 821 $required = $field['required'] ? '<abbr title="required" class="required">*</abbr>' : ''; 822 $aria_required = $field['required'] ? " aria-required='true' " : ''; 823 $class = $id; 824 $class .= $field['required'] ? ' form-required' : ''; 825 826 $item .= "\t\t<tr class='$class'>\n\t\t\t<th valign='top' scope='row' class='label'><label for='$name'><span class='alignleft'>{$field['label']}</span><span class='alignright'>$required</span><br class='clear' /></label></th>\n\t\t\t<td class='field'>"; 827 if ( !empty($field[$field['input']]) ) 828 $item .= $field[$field['input']]; 829 elseif ( $field['input'] == 'textarea' ) { 830 $item .= "<textarea type='text' id='$name' name='$name'>" . attribute_escape( $field['value'] ) . $aria_required . "</textarea>"; 831 } else { 832 $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "'" . $aria_required . "/>"; 833 } 834 if ( !empty($field['helps']) ) 835 $item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique((array) $field['helps']) ) . '</p>'; 836 $item .= "</td>\n\t\t</tr>\n"; 837 838 $extra_rows = array(); 839 840 if ( !empty($field['errors']) ) 841 foreach ( array_unique((array) $field['errors']) as $error ) 842 $extra_rows['error'][] = $error; 843 844 if ( !empty($field['extra_rows']) ) 845 foreach ( $field['extra_rows'] as $class => $rows ) 846 foreach ( (array) $rows as $html ) 847 $extra_rows[$class][] = $html; 848 849 foreach ( $extra_rows as $class => $rows ) 850 foreach ( $rows as $html ) 851 $item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n"; 852 } 853 854 if ( !empty($form_fields['_final']) ) 855 $item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n"; 856 $item .= "\t</tbody>\n"; 857 $item .= "\t</table>\n"; 858 859 foreach ( $hidden_fields as $name => $value ) 860 $item .= "\t<input type='hidden' name='$name' id='$name' value='" . attribute_escape( $value ) . "' />\n"; 861 862 return $item; 863 698 864 } 699 865 … … 865 1031 ?> 866 1032 <script type="text/javascript">post_id = <?php echo intval($_REQUEST['post_id']); ?>;</script> 867 <div id="media-upload-header">868 <?php the_media_upload_tabs(); ?>869 </div>870 1033 <?php 871 1034 } … … 1022 1185 if ( f.alt.value ) { 1023 1186 alt = f.alt.value.replace(/['"<>]+/g, ''); 1024 <?php if ( ! defined('CAPTIONS_OFF') || true != CAPTIONS_OFF ) { // CAPTIONS_OFF is temporary. Do not use it. ?>1025 1187 caption = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); 1026 <?php } ?>1027 1188 } 1028 1189 … … 1132 1293 } 1133 1294 1295 // crazyhorse 1134 1296 function media_upload_library_form($errors) { 1135 1297 global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types; … … 1137 1299 media_upload_header(); 1138 1300 1139 $post_id = i ntval($_REQUEST['post_id']);1140 1141 $form_action_url = admin_url("media-upload.php?type= {$GLOBALS['type']}&tab=library&post_id=$post_id");1301 $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0; 1302 1303 $form_action_url = admin_url("media-upload.php?type=single&tab=library&post_id=$post_id"); 1142 1304 1143 1305 $_GET['paged'] = intval($_GET['paged']); … … 1147 1309 if ( $start < 1 ) 1148 1310 $start = 0; 1149 add_filter( 'post_limits', $limit_filter = create_function( '$a', "return 'LIMIT $start, 10';" ) );1311 add_filter( 'post_limits', $limit_filter = create_function( '$a', "return 'LIMIT $start, 8';" ) ); 1150 1312 1151 1313 list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); 1152 1314 $ins = isset($_REQUEST['ins']) ? '<input type="hidden" name="ins" value="1" />' : ''; 1153 1315 ?> 1154 1316 1155 <form id="filter" action="" method="get"> 1156 <input type="hidden" name="type" value="<?php echo attribute_escape( $type ); ?>" /> 1157 <input type="hidden" name="tab" value="<?php echo attribute_escape( $tab ); ?>" /> 1158 <input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" /> 1159 <input type="hidden" name="post_mime_type" value="<?php echo attribute_escape( $_GET['post_mime_type'] ); ?>" /> 1160 1161 <div id="search-filter"> 1162 <label class="hidden" for="post-search-input"><?php _e('Search Media');?>:</label> 1163 <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" /> 1164 <input type="submit" value="<?php echo attribute_escape( __( 'Search Media' ) ); ?>" class="button" /> 1317 <div id="html-upload-ui"> 1318 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate"> 1319 <input type="file" name="async-upload" id="async-upload" /> 1320 <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> 1321 1322 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 1323 <?php echo $ins; ?> 1324 <?php wp_nonce_field('media-form'); ?> 1325 </form> 1165 1326 </div> 1166 1327 1167 <ul class="subsubsub"> 1168 <?php 1169 $type_links = array(); 1170 $_num_posts = (array) wp_count_attachments(); 1171 $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts)); 1172 foreach ( $matches as $_type => $reals ) 1173 foreach ( $reals as $real ) 1174 $num_posts[$_type] += $_num_posts[$real]; 1175 // If available type specified by media button clicked, filter by that type 1176 if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) { 1177 $_GET['post_mime_type'] = $type; 1178 list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); 1179 } 1180 if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' ) 1181 $class = ' class="current"'; 1182 $type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))) . "'$class>".__('All Types')."</a>"; 1183 foreach ( $post_mime_types as $mime_type => $label ) { 1184 $class = ''; 1185 1186 if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) ) 1187 continue; 1188 1189 if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) 1190 $class = ' class="current"'; 1191 1192 $type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . "'$class>" . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>'; 1193 } 1194 echo implode(' | </li>', $type_links) . '</li>'; 1195 unset($type_links); 1196 ?> 1197 </ul> 1328 <div id="html-upload-help"><?php _e('Or select from your Media Library'); ?></div> 1198 1329 1199 1330 <div class="tablenav"> 1200 1201 1331 <?php 1202 1332 $page_links = paginate_links( array( … … 1210 1340 echo "<div class='tablenav-pages'>$page_links</div>"; 1211 1341 ?> 1212 1213 <div class="alignleft">1214 <?php1215 1216 $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";1217 1218 $arc_result = $wpdb->get_results( $arc_query );1219 1220 $month_count = count($arc_result);1221 1222 if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>1223 <select name='m'>1224 <option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>1225 <?php1226 foreach ($arc_result as $arc_row) {1227 if ( $arc_row->yyear == 0 )1228 continue;1229 $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );1230 1231 if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )1232 $default = ' selected="selected"';1233 else1234 $default = '';1235 1236 echo "<option$default value='" . attribute_escape( $arc_row->yyear . $arc_row->mmonth ) . "'>";1237 echo wp_specialchars( $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear" );1238 echo "</option>\n";1239 }1240 ?>1241 </select>1242 <?php } ?>1243 1244 <input type="submit" id="post-query-submit" value="<?php echo attribute_escape( __( 'Filter »' ) ); ?>" class="button-secondary" />1245 1246 1342 </div> 1247 1343 1344 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="library-form"> 1345 1346 <?php wp_nonce_field('media-form'); ?> 1347 1348 <div id="media-items"> 1349 <?php echo get_media_items(null, $errors); ?> 1248 1350 <br class="clear" /> 1249 1351 </div> 1250 1352 </form> 1251 1252 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="library-form">1253 1254 <?php wp_nonce_field('media-form'); ?>1255 <?php //media_upload_form( $errors ); ?>1256 1257 <script type="text/javascript">1258 <!--1259 jQuery(function($){1260 var preloaded = $(".media-item.preloaded");1261 if ( preloaded.length > 0 ) {1262 preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});1263 updateMediaForm();1264 }1265 });1266 -->1267 </script>1268 1269 <div id="media-items">1270 <?php echo get_media_items(null, $errors); ?>1271 </div>1272 <p class="ml-submit">1273 <input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />1274 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />1275 </p>1276 </form>1277 1353 <?php 1278 1354 } 1355 1356 function media_error_nofile() { ?> 1357 <div style="text-align:center;"><h3>Please choose a file to upload</h3> 1358 <p><button onclick="history.back();" class="button">Go Back</button></p></div> 1359 <?php } 1279 1360 1280 1361 function type_form_image() { … … 1296 1377 <td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td> 1297 1378 </tr> 1298 '; 1299 // CAPTIONS_OFF is temporary. Do not use it. 1300 if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) { 1301 $form .= ' 1302 <tr> 1303 <th valign="top" scope="row" class="label"> 1304 <span class="alignleft"><label for="alt">' . __('Alternate Text') . '</label></span> 1305 </th> 1306 <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" /> 1307 <p class="help">' . __('Alt text for the image, e.g. "The Mona Lisa"') . '</p></td> 1308 </tr> 1309 '; 1310 1311 } else { 1312 $form .= ' 1379 1313 1380 <tr> 1314 1381 <th valign="top" scope="row" class="label"> … … 1318 1385 <p class="help">' . __('Also used as alternate text for the image') . '</p></td> 1319 1386 </tr> 1320 '; 1321 } 1322 $form .= ' 1387 1323 1388 <tr class="align"> 1324 1389 <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th> -
branches/crazyhorse/wp-admin/js/media-upload.js
r8335 r8422 20 20 tb_position = function() { 21 21 var tbWindow = $('#TB_window'); 22 var width = $(window).width(); 23 var H = $(window).height(); 24 var W = ( 720 < width ) ? 720 : width; 22 var w = $(window).width(); 23 var h = $(window).height(); 24 var H = ( 340 < h ) ? 340 : h; 25 var W = ( 385 < w ) ? 385 : w; 25 26 26 27 if ( tbWindow.size() ) { … … 29 30 tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'}); 30 31 if ( typeof document.body.style.maxWidth != 'undefined' ) 31 tbWindow.css({' top':'20px','margin-top':'0'});32 tbWindow.css({'margin-top': '-' + parseInt((( H - 10 ) / 2),10) + 'px'}); 32 33 $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'}); 34 $('#TB_ajaxWindowTitle').text('Add Media').css({'fontSize':'16px','fontWeight':'bold','paddingTop':'3px'}); 33 35 }; 34 36 … … 49 51 }); 50 52 51 $(window).resize( function() { tb_position() } );53 // $(window).resize( function() { tb_position() } ); 52 54 }); 53 55 -
branches/crazyhorse/wp-admin/media-upload.php
r7213 r8422 29 29 $tab = strval($_GET['tab']); 30 30 else 31 $tab = apply_filters('media_upload_default_tab', ' type');31 $tab = apply_filters('media_upload_default_tab', 'library'); 32 32 33 33 $body_id = 'media-upload'; 34 34 35 35 // let the action code decide how to handle the request 36 if ( $tab == 'type')37 do_action("media_upload_ $type");36 if ( isset($_POST['html-upload']) || 'single' == $tab ) 37 do_action("media_upload_image"); 38 38 else 39 do_action("media_upload_ $tab");39 do_action("media_upload_library"); 40 40 41 41 ?> -
branches/crazyhorse/wp-admin/wp-admin.css
r8379 r8422 1755 1755 width: 2.7em; 1756 1756 } 1757 1758 1759 1760 1761 1762 1763 -
branches/crazyhorse/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html
r8335 r8422 9 9 10 10 <link rel="stylesheet" href="css/editimage.css?ver=311d" type="text/css" media="all" /> 11 <link rel="stylesheet" href=" ../../../../../wp-admin/css/media.css?ver=2.6-beta3" type="text/css" media="all" />11 <link rel="stylesheet" href="css/media26.css?ver=2.6" type="text/css" media="all" /> 12 12 <script type="text/javascript"> 13 13 if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') ) -
branches/crazyhorse/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js
r8335 r8422 11 11 // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...'); 12 12 ed.addCommand('WP_EditImage', function() { 13 var el = ed.selection.getNode() ;13 var el = ed.selection.getNode(), vp = tinymce.DOM.getViewPort(), H = vp.h, W = ( 720 < vp.w ) ? 720 : vp.w; 14 14 15 15 if ( ed.dom.getAttrib(el, 'class').indexOf('mceItem') != -1 || el.nodeName != 'IMG' ) … … 17 17 18 18 tb_show('', url + '/editimage.html?ver=311c&TB_iframe=true'); 19 tinymce.DOM.setStyles('TB_window', { 20 'top':'20px', 21 'marginTop':'0', 22 'width':( W - 50 )+'px', 23 'height':( H - 45 )+'px', 24 'margin-left':'-'+parseInt((( W - 50 ) / 2),10) + 'px' 25 }); 26 tinymce.DOM.setStyles('TB_iframeContent', { 27 'width':( W - 50 )+'px', 28 'height':( H - 75 )+'px' 29 }); 19 30 tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); 20 31 }); -
branches/crazyhorse/wp-includes/js/tinymce/tiny_mce_config.php
r8335 r8422 226 226 if ( $disk_cache ) { 227 227 228 $cacheKey = apply_filters('tiny_mce_version', '200807 10');228 $cacheKey = apply_filters('tiny_mce_version', '20080723'); 229 229 230 230 foreach ( $initArray as $v ) -
branches/crazyhorse/wp-includes/script-loader.php
r8335 r8422 38 38 39 39 // Modify this version when tinyMCE plugins are changed. 40 $mce_version = apply_filters('tiny_mce_version', '200807 10');40 $mce_version = apply_filters('tiny_mce_version', '20080723'); 41 41 $scripts->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version ); 42 42 … … 160 160 ) ); 161 161 $scripts->add( 'admin-gallery', '/wp-admin/js/gallery.js', array( 'jquery-ui-sortable' ), '20080709' ); 162 $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '200807 10' );162 $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20080723' ); 163 163 $scripts->localize( 'upload', 'uploadL10n', array( 164 164 'browseTitle' => attribute_escape(__('Browse your files')),
Note: See TracChangeset
for help on using the changeset viewer.