Changeset 3153:942a906c0986 for admin/media.php
- Timestamp:
- 01/05/16 06:57:46 (10 years ago)
- Branch:
- default
- Children:
- 3154:5a75530f30db, 3155:c27a63c514e9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/media.php
r3152 r3153 56 56 } 57 57 58 # Get query i nany58 # Get query if any 59 59 $q = isset($_REQUEST['q']) ? $_REQUEST['q'] : null; 60 60 … … 83 83 84 84 $popup = (integer) !empty($_REQUEST['popup']); 85 86 $page_url_params = new ArrayObject(array('popup' => $popup,'post_id' => $post_id)); 85 $select = !empty($_REQUEST['select']) ? (integer)$_REQUEST['select'] : 0; // 0 : none, 1 : single media, >1 : multiple medias 86 87 $page_url_params = new ArrayObject(array('popup' => $popup,'select' => $select,'post_id' => $post_id)); 87 88 if ($d) { 88 89 $page_url_params['d'] = $d; … … 474 475 } 475 476 476 if ($post_id) { 477 echo '<div class="form-note info"><p>'.sprintf(__('Choose a file to attach to entry %s by clicking on %s'), 478 '<a href="'.$core->getPostAdminURL($post_type,$post_id).'">'.html::escapeHTML($post_title).'</a>', 479 '<img src="images/plus.png" alt="'.__('Attach this file to entry').'" />'); 477 if ($select) { 478 // Select mode (popup or not) 479 echo '<div class="'.($popup ? 'form-note ' : '').'info"><p>'; 480 if ($select == 1) { 481 echo sprintf(__('Select a file by clicking on %s'),'<img src="images/plus.png" alt="'.__('Select this file').'" />'); 482 } else { 483 echo sprintf(__('Select files and click on <strong>%s</strong> button'),__('Choose selected medias')); 484 } 480 485 if ($core_media_writable) { 481 486 echo ' '.__('or').' '.sprintf('<a href="#fileupload">%s</a>',__('upload a new file')); 482 487 } 483 488 echo '</p></div>'; 484 } 485 if ($popup) { 486 echo '<div class="info"><p>'.sprintf(__('Choose a file to insert into entry by clicking on %s'), 487 '<img src="images/plus.png" alt="'.__('Attach this file to entry').'" />'); 488 if ($core_media_writable) { 489 echo ' '.__('or').' '.sprintf('<a href="#fileupload">%s</a>',__('upload a new file')); 490 } 491 echo '</p></div>'; 489 } else { 490 if ($post_id) { 491 echo '<div class="form-note info"><p>'.sprintf(__('Choose a file to attach to entry %s by clicking on %s'), 492 '<a href="'.$core->getPostAdminURL($post_type,$post_id).'">'.html::escapeHTML($post_title).'</a>', 493 '<img src="images/plus.png" alt="'.__('Attach this file to entry').'" />'); 494 if ($core_media_writable) { 495 echo ' '.__('or').' '.sprintf('<a href="#fileupload">%s</a>',__('upload a new file')); 496 } 497 echo '</p></div>'; 498 } 499 if ($popup) { 500 echo '<div class="info"><p>'.sprintf(__('Choose a file to insert into entry by clicking on %s'), 501 '<img src="images/plus.png" alt="'.__('Attach this file to entry').'" />'); 502 if ($core_media_writable) { 503 echo ' '.__('or').' '.sprintf('<a href="#fileupload">%s</a>',__('upload a new file')); 504 } 505 echo '</p></div>'; 506 } 492 507 } 493 508 … … 512 527 '</p>'; 513 528 514 if (!$popup) { 529 if (!$popup || $select > 1) { 530 // Checkboxes and action 515 531 $fmt_form_media .= 516 '<div class=" medias-delete%s">'.532 '<div class="'.(!$popup ? 'medias-delete' : '').' '.($select > 1 ? 'medias-select' : '').'">'. 517 533 '<p class="checkboxes-helpers"></p>'. 518 '<p><input type="submit" class="delete" name="delete_medias" value="'.__('Remove selected medias').'"/></p>'. 534 '<p>'; 535 if ($select > 1) { 536 $fmt_form_media .= 537 '<input type="submit" class="select" id="select_medias" name="select_medias" value="'.__('Choose selected medias').'"/> '; 538 } 539 if (!$popup) { 540 $fmt_form_media .= 541 '<input type="submit" class="delete" id="delete_medias" name="delete_medias" value="'.__('Remove selected medias').'"/>'; 542 } 543 $fmt_form_media .= 544 '</p>'. 519 545 '</div>'; 520 546 } … … 531 557 '<span class="form-note">'.__('Will search into media filename (including path), title and description').'</span>'. 532 558 form::hidden(array('popup'),$popup). 559 form::hidden(array('select'),$select). 533 560 form::hidden(array('plugin_id'),$plugin_id). 534 561 form::hidden(array('post_id'),$post_id). … … 562 589 '<input type="submit" value="'.__('OK').'" />'. 563 590 form::hidden(array('popup'),$popup). 591 form::hidden(array('select'),$select). 564 592 form::hidden(array('plugin_id'),$plugin_id). 565 593 form::hidden(array('post_id'),$post_id). … … 746 774 function mediaItemLine($f,$i,$query,$table=false) 747 775 { 748 global $core, $page_url, $popup, $ post_id, $plugin_id,$page_url_params;776 global $core, $page_url, $popup, $select, $post_id, $plugin_id, $page_url_params; 749 777 750 778 $fname = $f->basename; … … 754 782 755 783 if ($f->d) { 756 784 // Folder 757 785 $link = $core->adminurl->get('admin.media',array_merge($page_url_params,array('d' => html::sanitizeURL($f->relname) ))); 758 786 if ($f->parent) { … … 763 791 } 764 792 } else { 793 // Item 765 794 $params = new ArrayObject( 766 795 array( … … 768 797 'plugin_id' => $plugin_id, 769 798 'popup' => $popup, 799 'select' => $select, 770 800 'post_id' => $post_id 771 801 ) … … 784 814 785 815 $act = ''; 786 if ($post_id && !$f->d) { 787 // Media attachment button 788 $act .= 789 '<a class="attach-media" title="'.__('Attach this file to entry').'" href="'. 790 $core->adminurl->get("admin.post.media", array('media_id' => $f->media_id, 'post_id' => $post_id,'attach' => 1)). 791 '">'. 792 '<img src="images/plus.png" alt="'.__('Attach this file to entry').'"/>'. 793 '</a>'; 794 } 795 if ($popup && !$f->d) { 796 // Media insertion button 797 $act .= '<a href="'.$link.'"><img src="images/plus.png" alt="'.__('Insert this file into entry').'" '. 798 'title="'.__('Insert this file into entry').'" /></a> '; 816 if (!$f->d) { 817 if ($select > 0) { 818 if ($select == 1) { 819 // Single media selection button 820 $act .= '<a href="'.$link.'"><img src="images/plus.png" alt="'.__('Select this file').'" '. 821 'title="'.__('Select this file').'" /></a> '; 822 } else { 823 // Multiple media selection checkbox 824 $act .= form::checkbox(array('medias[]', 'media_'.rawurlencode($file)),$file); 825 } 826 } else { 827 // Item 828 if ($post_id) { 829 // Media attachment button 830 $act .= 831 '<a class="attach-media" title="'.__('Attach this file to entry').'" href="'. 832 $core->adminurl->get("admin.post.media", array('media_id' => $f->media_id, 'post_id' => $post_id,'attach' => 1)). 833 '">'. 834 '<img src="images/plus.png" alt="'.__('Attach this file to entry').'"/>'. 835 '</a>'; 836 } 837 if ($popup) { 838 // Media insertion button 839 $act .= '<a href="'.$link.'"><img src="images/plus.png" alt="'.__('Insert this file into entry').'" '. 840 'title="'.__('Insert this file into entry').'" /></a> '; 841 } 842 } 799 843 } 800 844 if ($f->del) { 801 845 // Deletion button or checkbox 802 846 if (!$popup && !$f->d) { 803 $act .= form::checkbox(array('medias[]', 'media_'.rawurlencode($file)),$file); 847 if ($select < 2) { 848 // Already set for multiple media selection 849 $act .= form::checkbox(array('medias[]', 'media_'.rawurlencode($file)),$file); 850 } 804 851 } else { 805 852 $act .= '<a class="media-remove" '. … … 813 860 } 814 861 862 // Render markup 815 863 if (!$table) { 816 864 $res =
Note: See TracChangeset
for help on using the changeset viewer.