Ticket #2076: inline-uploading.diff
| File inline-uploading.diff, 7.3 KB (added by , 21 years ago) |
|---|
-
wp-admin/inline-uploading.php
29 29 case 'delete': 30 30 31 31 if ( !current_user_can('edit_post', (int) $attachment) ) 32 die(__('You are not allowed to delete this attachment.').' <a href="'.basename(__FILE__)."?post=$post&all=$all&action=upload\">".__('Go back').'</a>');32 die(__('You are not allowed to delete this attachment.').' <a href="'.basename(__FILE__)."?post=$post&all=$all&action=upload\">".__('Go back').'</a>'); 33 33 34 34 wp_delete_attachment($attachment); 35 35 … … 43 43 $file = wp_handle_upload($_FILES['image'], $overrides); 44 44 45 45 if ( isset($file['error']) ) 46 die($file['error'] . '< a href="' . basename(__FILE__) . '?action=upload&post="' . $post . '">'.__('Back to Image Uploading').'</a>');46 die($file['error'] . '<br /><a href="' . basename(__FILE__) . '?action=upload&post=' . $post . '">'.__('Back to Image Uploading').'</a>'); 47 47 48 48 $url = $file['url']; 49 49 $type = $file['type']; … … 92 92 add_post_meta($id, '_wp_attachment_metadata', array()); 93 93 } 94 94 95 header("Location: ".basename(__FILE__)."?post=$post&all=$all&action=view& last=true");95 header("Location: ".basename(__FILE__)."?post=$post&all=$all&action=view&start=0"); 96 96 die(); 97 97 98 98 case 'upload': … … 107 107 $num = 5; 108 108 $double = $num * 2; 109 109 110 if ( $post && empty($all) ) {110 if ( $post && (empty($all) || $all == 'false') ) { 111 111 $and_post = "AND post_parent = '$post'"; 112 112 $current_2 = ' class="current"'; 113 113 } else { … … 201 201 } 202 202 $attachment = array_merge($attachment, $meta); 203 203 $send_delete_cancel = "<a onclick=\"sendToEditor({$ID});return false;\" href=\"javascript:void()\">$__send_to_editor</a> 204 < !--<a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&attachment={$ID}&all=$all&start=$start&post=$post\">$__delete</a>-->204 <a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&attachment={$ID}&all=$all&start=$start&post=$post\">$__delete</a> 205 205 <a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a> 206 206 "; 207 207 $uwidth_sum += 128; … … 244 244 } else { 245 245 $title = $attachment['post_title']; 246 246 $filename = basename($attachment['guid']); 247 if ( $icon = get_attachment_icon($ID) )248 $toggle_icon = "<a id=\"I{$ID}\" onclick=\"toggleOtherIcon({$ID});return false;\" href=\"javascript:void()\">$__using_title</a>";247 $icon = get_attachment_icon($ID); 248 $toggle_icon = "<a id=\"I{$ID}\" onclick=\"toggleOtherIcon({$ID});return false;\" href=\"javascript:void()\">$__using_title</a>"; 249 249 $script .= "aa[{$ID}] = '<a id=\"{$ID}\" rel=\"attachment\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">{$attachment['post_title']}</a>'; 250 250 ab[{$ID}] = '<a id=\"{$ID}\" href=\"{$filename}\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">{$attachment['post_title']}</a>'; 251 251 title[{$ID}] = '{$attachment['post_title']}'; … … 366 366 if ( oi.innerHTML == usingtitle ) { 367 367 o.innerHTML = filename[n]; 368 368 oi.innerHTML = usingfilename; 369 } else if ( oi.innerHTML == usingfilename ) {369 } else if ( oi.innerHTML == usingfilename && icon[n] != '' ) { 370 370 o.innerHTML = icon[n]; 371 371 oi.innerHTML = usingicon; 372 372 } else { … … 376 376 if ( oi.innerHTML == usingicon ) 377 377 od.className = 'otherwrap usingicon'; 378 378 else 379 od.class name = 'otherwrap usingtext';379 od.className = 'otherwrap usingtext'; 380 380 } 381 381 382 382 var win = window.opener ? window.opener : window.dialogArguments; … … 440 440 } 441 441 .otherwrap { 442 442 margin-right: 5px; 443 overflow: hidden; 443 /* overflow: hidden;*/ 444 444 background-color: #f9fcfe; 445 445 float: left; 446 446 } … … 529 529 margin-left: 40px; 530 530 } 531 531 #title, #descr { 532 width: 100%;532 width: 99%; 533 533 margin-top: 1px; 534 534 } 535 th { 536 width: 4.5em; 537 } 535 538 #descr { 536 539 height: 36px; 537 540 } … … 541 544 } 542 545 .popup { 543 546 margin: 4px 4px; 544 padding: 3px;547 padding: 1px; 545 548 position: absolute; 546 549 width: 114px; 547 height: 82px; 550 /* height: 92px;*/ 548 551 display: none; 549 background-color: rgb(223, 232, 241); 552 background-color: rgb(240, 240, 238); 553 border-top: 2px solid #fff; 554 border-right: 2px solid #ddd; 555 border-bottom: 2px solid #ddd; 556 border-left: 2px solid #fff; 550 557 text-align: center; 551 558 } 552 559 .imagewrap .popup { … … 567 574 background-color: #fff; 568 575 color: #000; 569 576 } 577 #submit { 578 margin: 1px; 579 width: 99%; 580 } 581 #submit input, #submit input:focus { 582 background: url( images/fade-butt.png ); 583 border: 3px double #999; 584 border-left-color: #ccc; 585 border-top-color: #ccc; 586 color: #333; 587 padding: 0.25em; 588 } 589 590 #submit input:active { 591 background: #f4f4f4; 592 border: 3px double #ccc; 593 border-left-color: #999; 594 border-top-color: #999; 595 } 570 596 </style> 571 597 </head> 572 598 <body> 573 599 <ul id="upload-menu"> 574 <li<?php echo $current_1; ?>><a href="<?php echo basename(__FILE__); ?>?action=upload&post=<?php echo $post; ?>&all=<?php echo $all; ?> "><?php _e('Upload'); ?></a></li>600 <li<?php echo $current_1; ?>><a href="<?php echo basename(__FILE__); ?>?action=upload&post=<?php echo $post; ?>&all=<?php echo $all; ?>&start=<?php echo $start; ?>"><?php _e('Upload'); ?></a></li> 575 601 <?php if ( $attachments = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post'") ) { ?> 576 <li<?php echo $current_2; ?>><a href="<?php echo basename(__FILE__); ?>?action=view&post=<?php echo $post; ?> "><?php _e('Browse'); ?></a></li>602 <li<?php echo $current_2; ?>><a href="<?php echo basename(__FILE__); ?>?action=view&post=<?php echo $post; ?>&all=false"><?php _e('Browse'); ?></a></li> 577 603 <?php } ?> 578 604 <?php if ($wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'attachment'")) { ?> 579 605 <li<?php echo $current_3; ?>><a href="<?php echo basename(__FILE__); ?>?action=view&post=<?php echo $post; ?>&all=true"><?php _e('Browse All'); ?></a></li> … … 609 635 <form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo basename(__FILE__); ?>"> 610 636 <table style="width:99%;"> 611 637 <tr> 612 <th scope="row" style="width: 4.5em;text-align: right;"><label for="upload"><?php _e('File:'); ?></label></th>638 <th scope="row" align="right"><label for="upload"><?php _e('File:'); ?></label></th> 613 639 <td><input type="file" id="upload" name="image" /></td> 614 640 </tr> 615 641 <tr> 616 <th scope="row" style="text-align: right;"><label for="title"><?php _e('Title:'); ?></label></th>642 <th scope="row" align="right"><label for="title"><?php _e('Title:'); ?></label></th> 617 643 <td><input type="text" id="title" name="imgtitle" /></td> 618 644 </tr> 619 645 <tr> 620 <th scope="row" style="text-align: right;"><label for="descr"><?php _e('Description:'); ?></label></th>646 <th scope="row" align="right"><label for="descr"><?php _e('Description:'); ?></label></th> 621 647 <td><input type="textarea" name="descr" id="descr" value="" /></td> 622 648 </tr> 623 649 <tr id="buttons"> … … 626 652 <input type="hidden" name="action" value="save" /> 627 653 <input type="hidden" name="post" value="<?php echo $post; ?>" /> 628 654 <input type="hidden" name="all" value="<?php echo $all; ?>" /> 655 <input type="hidden" name="start" value="<?php echo $start; ?>" /> 656 <div id="submit"> 629 657 <input type="submit" value="<?php _e('Upload'); ?>" /> 658 <?php if ( !empty($all) ) : ?> 630 659 <input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" /> 660 <?php endif; ?> 661 </div> 631 662 </td> 632 663 </tr> 633 664 </table>
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)