Changeset 21422


Ignore:
Timestamp:
03/09/13 23:06:35 (6 years ago)
Author:
mistic100
Message:

add option too allow/disallow download of categories/collections/specials

Location:
extensions/BatchDownloader
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • extensions/BatchDownloader/admin/config.php

    r17880 r21422  
    44if (isset($_POST['save_config'])) 
    55{ 
     6  if (!defined('USER_COLLEC_ID')) $_POST['what']['collections'] = 'on'; 
     7   
    68  $conf['batch_download'] = array( 
    79    'groups'          => isset($_POST['groups']) ? $_POST['groups'] : array(), 
    810    'level'           => $_POST['level'], 
     11    'what'            => isset($_POST['what']) ? array_keys($_POST['what']) : array(), 
    912    'photo_size'      => $_POST['photo_size'], 
    1013    'archive_prefix'  => trim($_POST['archive_prefix']), 
     
    1922  conf_update_param('batch_download_comment', $conf['batch_download_comment']); 
    2023} 
     24 
    2125 
    2226// groups 
     
    4448// max values 
    4549$conf['batch_download']['max_elements_value'] = isset($conf['batch_download_max_elements']) ? $conf['batch_download_max_elements'] : 1000; 
    46 $conf['batch_download']['max_size_value'] = isset($conf['batch_download_max_size']) ? $conf['batch_download_max_size'] : 500; 
     50$conf['batch_download']['max_size_value'] =     isset($conf['batch_download_max_size']) ?     $conf['batch_download_max_size'] :     500; 
     51 
    4752 
    4853$template->assign(array( 
     
    5055  'level_options' => $level_options, 
    5156  'sizes_options' => $sizes_options, 
     57  'USER_COLLEC_LOADED' => defined('USER_COLLEC_ID'), 
    5258  'batch_download' => $conf['batch_download'], 
    5359  'batch_download_comment' => stripslashes($conf['batch_download_comment']), 
  • extensions/BatchDownloader/admin/template/config.tpl

    r20372 r21422  
    3434  $("#max_elements").slider("value", $(this).val()); 
    3535}); 
     36 
     37jQuery(".showInfo").tipTip({ldelim} 
     38  delay: 0, 
     39  fadeIn: 200, 
     40  fadeOut: 200, 
     41  maxWidth: '300px', 
     42  defaultPosition: 'bottom' 
     43}); 
    3644{/footer_script} 
    3745 
     
    6472        </select> 
    6573      </label> 
     74    </li> 
     75    <li> 
     76      <span class="property">{'What can be downloaded?'|@translate}</span> 
     77      <label><input type="checkbox" name="what[categories]" {if in_array('categories',$batch_download.what)}checked="checked"{/if}/> {'Albums'|@translate}</label> 
     78      {if $USER_COLLEC_LOADED}<label><input type="checkbox" name="what[collections]" {if in_array('collections',$batch_download.what)}checked="checked"{/if}/> {'Collections'|@translate}</label>{/if} 
     79      <label><input type="checkbox" name="what[specials]" {if in_array('specials',$batch_download.what)}checked="checked"{/if}/> {'Specials'|@translate}</label> 
     80          <a class="showInfo" title="{'Most visited'|@translate}, {'Random photos'|@translate}, {'Best rated'|@translate}...">i</a> 
    6681    </li> 
    6782    <li> 
  • extensions/BatchDownloader/admin/template/style.css

    r20138 r21422  
    4747  width:120px; 
    4848} 
     49 
     50.showInfo { 
     51  position:static; 
     52  display:inline-block; 
     53  padding:1px 6px; 
     54  width:4px; 
     55  height:14px; 
     56  line-height:14px; 
     57  font-size:0.8em; 
     58} 
  • extensions/BatchDownloader/include/events.inc.php

    r21206 r21422  
    5858  global $page, $template, $user, $conf; 
    5959   
     60  // check accesses 
    6061  if ( !count($page['items']) or !isset($page['section']) ) return; 
    6162   
    6263  if (check_download_access() === false) return; 
     64   
     65  switch ($page['section']) 
     66  { 
     67  case 'categories': 
     68    if (!isset($page['category'])) return; // don't download the full gallery in flat mode ! 
     69     
     70    if (!in_array('categories', $conf['batch_download']['what'])) return; 
     71    break; 
     72     
     73  case 'collections': 
     74    if (!in_array('collections', $conf['batch_download']['what'])) return; 
     75    break; 
     76     
     77  default: 
     78    if (!in_array('specials', $conf['batch_download']['what'])) return; 
     79  } 
     80   
    6381   
    6482  // download the set 
  • extensions/BatchDownloader/include/install.inc.php

    r19837 r21422  
    99  if (empty($conf['batch_download'])) 
    1010  { 
    11     $batch_download_default_config = serialize(array( 
     11    $batch_download_default_config = array( 
    1212      'groups'          => array(), 
    1313      'level'           => 0, 
     14      'what'            => array('categories','specials','collections'), 
    1415      'photo_size'      => 'original', 
    1516      'archive_prefix'  => 'piwigo', 
     
    1819      'max_size'        => 100, /* MB */ 
    1920      'last_clean'      => time(), 
    20       )); 
     21      ); 
     22       
     23    $conf['batch_download'] = serialize($batch_download_default_config); 
     24    $conf['batch_download_comment'] = null; 
    2125     
    22     conf_update_param('batch_download', $batch_download_default_config); 
    23     conf_update_param('batch_download_comment', null); 
     26    conf_update_param('batch_download', $conf['batch_download']); 
     27    conf_update_param('batch_download_comment', $conf['batch_download_comment']); 
     28  } 
     29  else 
     30  { 
     31    $new_conf = is_string($conf['batch_download']) ? unserialize($conf['batch_download']) : $conf['batch_download']; 
    2432     
    25     $conf['batch_download'] = $batch_download_default_config; 
    26     $conf['batch_download_comment'] = null; 
     33    if (empty($new_conf['what'])) 
     34    { 
     35      $new_conf['what'] = array('categories','specials','collections'); 
     36       
     37      $conf['batch_download'] = serialize($new_conf); 
     38      conf_update_param('batch_download', $conf['batch_download']); 
     39    } 
    2740  } 
    2841 
  • extensions/BatchDownloader/language/en_UK/plugin.lang.php

    r20372 r21422  
    4747$lang['Starting download Archive #%d will destroy Archive #%d, be sure you finish the download. Continue ?'] = 'Starting download Archive #%d will destroy Archive #%d, be sure you finish the download. Continue ?'; 
    4848$lang['Warning: Only registered users can use Batch Downloader.'] = 'Warning: Only registered users can use Batch Downloader.'; 
     49$lang['What can be downloaded?'] = 'What can be downloaded?'; 
    4950 
    5051?> 
  • extensions/BatchDownloader/language/fr_FR/plugin.lang.php

    r20372 r21422  
    4747$lang['Starting download Archive #%d will destroy Archive #%d, be sure you finish the download. Continue ?'] = 'Le démarrage du téléchargement de l\'archive #%d détruira l\'archive #%d, soyez sûr de terminer le téléchargement avant de continuer.'; 
    4848$lang['Warning: Only registered users can use Batch Downloader.'] = 'Attention: seuls les utilisateurs enregistrés peuvent utiliser Batch Downloader.'; 
     49$lang['What can be downloaded?'] = 'Qu\'est-ce qui peut être téléchargé ?'; 
    4950 
    5051?> 
Note: See TracChangeset for help on using the changeset viewer.