Ignore:
Timestamp:
02/01/10 11:57:13 (10 years ago)
Author:
plg
Message:

feature 1412 added: link to bulk management after upload

Location:
extensions/upload_form
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/upload_form/language/en_UK/plugin.lang.php

    r4807 r4811  
    3535$lang['Privacy level set to "%s"'] = 'Privacy level set to "%s"'; 
    3636$lang['Category "%s" now contains %d photos'] = 'Category "%s" now contains %d photos'; 
     37$lang['Manage this set of %d photos'] = 'Manage this set of %d photos'; 
    3738?> 
  • extensions/upload_form/language/fr_FR/plugin.lang.php

    r4807 r4811  
    3535$lang['Privacy level set to "%s"'] = 'Niveau de confidentialité "%s"'; 
    3636$lang['Category "%s" now contains %d photos'] = 'La catégorie "%s" contient désormais %d photos'; 
     37$lang['Manage this set of %d photos'] = 'Gérer ce lot de %d photos'; 
    3738?> 
  • extensions/upload_form/upload.php

    r4807 r4811  
    3030 
    3131$admin_base_url = get_root_url().'admin.php?page=plugin&section=upload_form%2Fupload.php'; 
    32 $thumbnails = array(); 
    3332 
    3433// +-----------------------------------------------------------------------+ 
     
    3635// +-----------------------------------------------------------------------+ 
    3736check_status(ACCESS_ADMINISTRATOR); 
     37 
     38// +-----------------------------------------------------------------------+ 
     39// |                        batch management request                       | 
     40// +-----------------------------------------------------------------------+ 
     41 
     42if (isset($_GET['batch'])) 
     43{ 
     44  check_input_parameter('batch', $_GET['batch'], false, '/^\d+(,\d+)*$/'); 
     45 
     46  $query = ' 
     47DELETE FROM '.CADDIE_TABLE.' 
     48  WHERE user_id = '.$user['id'].' 
     49;'; 
     50  pwg_query($query); 
     51 
     52  $inserts = array(); 
     53  foreach (explode(',', $_GET['batch']) as $image_id) 
     54  { 
     55    array_push( 
     56      $inserts, 
     57      array( 
     58        'user_id' => $user['id'], 
     59        'element_id' => $image_id, 
     60        ) 
     61      ); 
     62  } 
     63  mass_inserts( 
     64    CADDIE_TABLE, 
     65    array_keys($inserts[0]), 
     66    $inserts 
     67    ); 
     68 
     69  redirect(get_root_url().'admin.php?page=element_set&cat=caddie'); 
     70} 
    3871 
    3972// +-----------------------------------------------------------------------+ 
     
    77110    } 
    78111  } 
    79    
     112 
     113  $image_ids = array(); 
     114  $page['thumbnails'] = array(); 
     115       
    80116  $starttime = get_moment(); 
    81117   
     
    93129        $_POST['level'] 
    94130        ); 
     131 
     132      array_push($image_ids, $image_id); 
    95133 
    96134      // TODO: if $image_id is not an integer, something went wrong 
     
    135173        ; 
    136174 
    137       array_push($thumbnails, $thumbnail); 
     175      array_push($page['thumbnails'], $thumbnail); 
    138176    } 
    139177  } 
     
    143181  // printf('%.2f ms', $elapsed); 
    144182 
    145   if (!empty($thumbnails)) 
     183  if (!empty($page['thumbnails'])) 
    146184  { 
    147185    array_push( 
     
    149187      sprintf( 
    150188        l10n('%d photos uploaded'), 
    151         count($thumbnails) 
     189        count($page['thumbnails']) 
    152190        ) 
    153191      ); 
     
    187225        ); 
    188226    } 
     227 
     228    $page['batch_link'] = $admin_base_url.'&batch='.implode(',', $image_ids); 
    189229  } 
    190230} 
     
    204244      'F_ADD_ACTION'=> $admin_base_url, 
    205245      'plugin_path' => UPLOAD_FORM_PATH, 
    206       'thumbnails' => $thumbnails, 
    207246    ) 
    208247  ); 
     248 
     249if (isset($page['thumbnails'])) 
     250{ 
     251  $template->assign( 
     252    array( 
     253      'thumbnails' => $page['thumbnails'], 
     254      ) 
     255    ); 
     256 
     257  // only display the batch link if we have more than 1 photo 
     258  if (count($page['thumbnails']) > 1) 
     259  { 
     260    $template->assign( 
     261      array( 
     262        'batch_link' => $page['batch_link'], 
     263        'batch_label' => sprintf( 
     264          l10n('Manage this set of %d photos'), 
     265          count($page['thumbnails']) 
     266          ), 
     267        ) 
     268      ); 
     269  } 
     270} 
    209271 
    210272$query = ' 
  • extensions/upload_form/upload.tpl

    r4807 r4811  
    2222  margin-bottom:2px; 
    2323  padding:0; 
     24} 
     25 
     26#batchLink { 
     27  text-align:center; 
    2428} 
    2529</style> 
     
    5054  {/foreach} 
    5155  </div> 
     56  <p id="batchLink"><a href="{$batch_link}">{$batch_label}</a></p> 
    5257</fieldset> 
    5358{/if} 
Note: See TracChangeset for help on using the changeset viewer.