- Timestamp:
- Oct 9, 2012, 6:58:57 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/batch_manager_global.php
r18459 r18573 75 75 } 76 76 77 // $page['category'] is a shortcut to test if the current filter contains a78 // given category. The idea is the same as for prefilter79 $page['category'] = -1;80 if (isset($_SESSION['bulk_manager_filter']['category']))81 {82 $page['category'] = $_SESSION['bulk_manager_filter']['category'];83 }84 85 77 $redirect_url = get_root_url().'admin.php?page='.$_GET['page']; 86 78 … … 106 98 pwg_query($query); 107 99 108 if ('caddie' == $page['prefilter']) 109 { 110 redirect($redirect_url); 111 } 112 113 // if we are here in the code, it means that the user is currently 114 // displaying the caddie content, so we have to remove the current 115 // selection from the current set 116 $page['cat_elements_id'] = array_diff($page['cat_elements_id'], $collection); 100 // remove from caddie action available only in caddie so reload content 101 redirect($redirect_url); 117 102 } 118 103 … … 130 115 if ('with no tag' == $page['prefilter']) 131 116 { 132 redirect( get_root_url().'admin.php?page='.$_GET['page']);117 redirect($redirect_url); 133 118 } 134 119 } … … 446 431 $base_url = get_root_url().'admin.php'; 447 432 448 $prefilters = array(); 449 450 array_push($prefilters, 433 $prefilters = array( 451 434 array('ID' => 'caddie', 'NAME' => l10n('Caddie')), 452 435 array('ID' => 'last import', 'NAME' => l10n('Last import')), … … 482 465 // | caddie options | 483 466 // +-----------------------------------------------------------------------+ 484 485 $in_caddie = false; 486 if (isset($_SESSION['bulk_manager_filter']['prefilter']) 487 and 'caddie' == $_SESSION['bulk_manager_filter']['prefilter']) 488 { 489 $in_caddie = true; 490 } 491 $template->assign('IN_CADDIE', $in_caddie); 492 493 // +-----------------------------------------------------------------------+ 494 // | deletion form | 495 // +-----------------------------------------------------------------------+ 496 497 // we can only remove photos that have no storage_category_id, in other 498 // word, it currently (Butterfly) means that the photo was added with 499 // pLoader 500 if (count($page['cat_elements_id']) > 0) 501 { 502 $query = ' 503 SELECT 504 id 505 FROM '.IMAGES_TABLE.' 506 WHERE id IN ('.implode(',', $page['cat_elements_id']).') 507 AND file NOT LIKE \'http%\' 508 LIMIT 1 509 ;'; 510 ; 511 512 if ( pwg_db_fetch_row(pwg_query($query)) ) 513 { 514 $template->assign('show_delete_form', true); 515 } 516 } 467 $template->assign('IN_CADDIE', 'caddie' == $page['prefilter']); 468 517 469 518 470 // +-----------------------------------------------------------------------+ … … 557 509 FROM '.CATEGORIES_TABLE.' 558 510 ;'; 559 display_select_cat_wrapper($query, array(), 'associate_options', true); 560 display_select_cat_wrapper($query, array(), 'move_options', true); 511 $categories = array_from_query($query); 512 usort($categories, 'global_rank_compare'); 513 display_select_categories($categories, array(), 'category_full_name_options', true); 514 561 515 display_select_cat_wrapper($query, array(), 'category_parent_options'); 562 516 … … 571 525 { 572 526 // we need to know the category in which the last photo was added 573 $selected_category = array();574 575 527 $query = ' 576 528 SELECT … … 587 539 { 588 540 $row = pwg_db_fetch_assoc($result); 589 590 541 $selected_category = array($row['category_id']); 591 542 } 592 543 } 593 544 594 $query = ' 595 SELECT id,name,uppercats,global_rank 596 FROM '.CATEGORIES_TABLE.' 597 ;'; 598 display_select_cat_wrapper($query, $selected_category, 'filter_category_options', true); 545 $template->assign( 'filter_category_selected', $selected_category); 599 546 600 547 // Dissociate from a category : categories listed for dissociation can only -
trunk/admin/themes/default/template/batch_manager_global.tpl
r18484 r18573 16 16 var inputs = []; 17 17 var count=0; 18 var This=$(this);19 18 this.find('input[type=checkbox]').each(function() { 20 19 var pos=count; … … 523 522 {'Album'|@translate} 524 523 <select style="width:400px" name="filter_category" size="1"> 525 {html_options options=$ filter_category_options selected=$filter_category_options_selected}524 {html_options options=$category_full_name_options selected=$filter_category_selected} 526 525 </select> 527 526 <label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label> … … 676 675 <option value="-1">{'Choose an action'|@translate}</option> 677 676 <option disabled="disabled">------------------</option> 678 {if isset($show_delete_form) }679 677 <option value="delete">{'Delete selected photos'|@translate}</option> 680 {/if}681 678 <option value="associate">{'Associate to album'|@translate}</option> 682 679 <option value="move">{'Move to album'|@translate}</option> … … 715 712 <div id="action_associate" class="bulkAction"> 716 713 <select style="width:400px" name="associate" size="1"> 717 {html_options options=$ associate_options}714 {html_options options=$category_full_name_options} 718 715 </select> 719 716 <br>{'... or '|@translate} <a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> … … 723 720 <div id="action_move" class="bulkAction"> 724 721 <select style="width:400px" name="move" size="1"> 725 {html_options options=$ move_options}722 {html_options options=$category_full_name_options} 726 723 </select> 727 724 <br>{'... or '|@translate} <a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> -
trunk/include/dblayer/functions_mysql.inc.php
r13843 r18573 190 190 * 191 191 * @param string $query 192 * @param string $fieldname 192 * @param string $fieldname optional 193 193 * @return array 194 194 */ 195 function array_from_query($query, $fieldname )195 function array_from_query($query, $fieldname=false) 196 196 { 197 197 $array = array(); 198 198 199 199 $result = pwg_query($query); 200 while ($row = mysql_fetch_assoc($result)) 201 { 202 $array[] = $row[$fieldname]; 203 } 204 200 if (false === $fieldname) 201 { 202 while ($row = mysql_fetch_assoc($result)) 203 { 204 $array[] = $row; 205 } 206 } 207 else 208 { 209 while ($row = mysql_fetch_assoc($result)) 210 { 211 $array[] = $row[$fieldname]; 212 } 213 } 205 214 return $array; 206 215 }
Note: See TracChangeset
for help on using the changeset viewer.