Changeset 3153:942a906c0986
- Timestamp:
- 01/05/16 06:57:46 (10 years ago)
- Branch:
- default
- Children:
- 3154:5a75530f30db, 3155:c27a63c514e9
- Location:
- admin
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/_media.js
r3116 r3153 138 138 }); 139 139 140 $('#form-medias').submit(function() { 141 var count_checked = $('input[name="medias[]"]:checked', $(this)).length; 142 if (count_checked==0) { 140 $('#form-medias #delete_medias').click(function(e) { 141 var count_checked = $('input[name="medias[]"]:checked', $('#form-medias')).length; 142 if (count_checked == 0) { 143 e.preventDefault(); 143 144 return false; 144 145 } 145 146 146 return window.confirm(dotclear.msg.confirm_delete_medias.replace('%d',count_checked)); 147 147 }); -
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 = -
admin/media_item.php
r3138 r3153 29 29 $file = null; 30 30 $popup = (integer) !empty($_REQUEST['popup']); 31 $select = !empty($_REQUEST['select']) ? (integer)$_REQUEST['select'] : 0; // 0 : none, 1 : single media, >1 : multiple medias 31 32 $plugin_id = isset($_REQUEST['plugin_id']) ? html::sanitizeURL($_REQUEST['plugin_id']) : ''; 32 $page_url_params = array('popup' => $popup,' post_id' => $post_id);33 $media_page_url_params = array('popup' => $popup,' post_id' => $post_id);33 $page_url_params = array('popup' => $popup,'select' => $select,'post_id' => $post_id); 34 $media_page_url_params = array('popup' => $popup,'select' => $select,'post_id' => $post_id); 34 35 35 36 if ($plugin_id != '') { … … 280 281 $file_type = explode('/',$file->type); 281 282 283 # Selection mode 284 if ($select) { 285 // Let user choose thumbnail size if image 286 $media_desc = $file->media_title; 287 288 echo 289 '<div id="media-select" class="multi-part" title="'.__('Select media item').'">'. 290 '<h3>'.__('Select media item').'</h3>'. 291 '<form id="media-select-form" action="" method="get">'; 292 293 $media_img_default_size = $core->blog->settings->system->media_img_default_size; 294 if ($media_img_default_size == '') { 295 $media_img_default_size = 'm'; 296 } 297 $media_img_default_alignment = $core->blog->settings->system->media_img_default_alignment; 298 if ($media_img_default_alignment == '') { 299 $media_img_default_alignment = 'none'; 300 } 301 $media_img_default_link = (boolean)$core->blog->settings->system->media_img_default_link; 302 303 if ($file->media_type == 'image') 304 { 305 $media_type = 'image'; 306 $media_desc = dcGetImageTitle($file, 307 $core->blog->settings->system->media_img_title_pattern, 308 $core->blog->settings->system->media_img_use_dto_first, 309 $core->blog->settings->system->media_img_no_date_alone); 310 if ($media_desc == $file->basename) { 311 $media_desc = ''; 312 } 313 314 echo 315 '<h3>'.__('Image size:').'</h3> '; 316 317 $s_checked = false; 318 echo '<p>'; 319 foreach (array_reverse($file->media_thumb) as $s => $v) { 320 $s_checked = ($s == $media_img_default_size); 321 echo '<label class="classic">'. 322 form::radio(array('src'),html::escapeHTML($v),$s_checked).' '. 323 $core->media->thumb_sizes[$s][2].'</label><br /> '; 324 } 325 $s_checked = (!isset($file->media_thumb[$media_img_default_size])); 326 echo '<label class="classic">'. 327 form::radio(array('src'),$file->file_url,$s_checked).' '.__('original').'</label><br /> '; 328 echo '</p>'; 329 330 } elseif ($file_type[0] == 'audio') { 331 $media_type = 'mp3'; 332 } elseif ($file_type[0] == 'video') { 333 $media_type = 'flv'; 334 } else { 335 $media_type = 'default'; 336 } 337 338 echo 339 '<p>'. 340 '<a id="media-select-ok" class="button submit" href="#">'.__('Select').'</a> '. 341 '<a id="media-select-cancel" class="button" href="#">'.__('Cancel').'</a>'. 342 form::hidden(array('type'),html::escapeHTML($media_type)). 343 form::hidden(array('title'),html::escapeHTML($file->media_title)). 344 form::hidden(array('description'),html::escapeHTML($media_desc)). 345 form::hidden(array('url'),$file->file_url). 346 '</p>'; 347 348 echo '</form>'; 349 echo '</div>'; 350 } 351 282 352 # Insertion popup 283 if ($popup )353 if ($popup && !$select) 284 354 { 285 355 $media_desc = $file->media_title; … … 459 529 } 460 530 461 if ($popup ) {531 if ($popup || $select) { 462 532 echo 463 533 '<div class="multi-part" title="'.__('Media details').'" id="media-details-tab">'; … … 728 798 echo 729 799 '</div>'; 730 if ($popup ) {800 if ($popup || $select) { 731 801 echo 732 802 '</div>'; -
admin/style/default.css
r3136 r3153 1956 1956 border-bottom: none; 1957 1957 } 1958 .medias-delete {1958 .medias-delete, .medias-select { 1959 1959 text-align: right; 1960 1960 }
Note: See TracChangeset
for help on using the changeset viewer.