Changeset 25931


Ignore:
Timestamp:
Dec 12, 2013, 2:12:13 PM (10 years ago)
Author:
mistic100
Message:

allow to configure only one downloadable size

Location:
extensions/BatchDownloader
Files:
9 edited

Legend:

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

    r23383 r25931  
    1111    'what'            => isset($_POST['what']) ? array_keys($_POST['what']) : array(),
    1212    'photo_size'      => $_POST['photo_size'],
     13    'multisize'       => $_POST['multisize'] == 'true',
    1314    'archive_prefix'  => trim($_POST['archive_prefix']),
    1415    'archive_timeout' => intval($_POST['archive_timeout']),
  • extensions/BatchDownloader/admin/template/config.tpl

    r23383 r25931  
    3131  }
    3232});
    33 {literal}
     33
    3434$("input[name='max_elements']").change(function() {
    3535  $("#max_elements").slider("value", $(this).val());
     
    4848  $(".advanced").slideDown();
    4949});
    50 {/literal}{/footer_script}
     50
     51$('input[name="multisize"]').on('change', function() {
     52  if ($(this).val() == 'true') {
     53    $('#multisize_title').text('{'Maximum photo size'|@translate|escape:javascript}');
     54  }
     55  else {
     56    $('#multisize_title').text('{'Photo size'|@translate|escape:javascript}');
     57  }
     58})
     59.filter(':checked').trigger('change');
     60{/footer_script}
     61
    5162
    5263<div class="titrePage">
     
    5970 
    6071  <ul>
     72    <li>
     73      <i>{'Warning: Only registered users can use Batch Downloader.'|@translate}</i>
     74    </li>
    6175    <li>
    6276      <label>
     
    8094    </li>
    8195    <li>
    82       <i>{'Warning: Only registered users can use Batch Downloader.'|@translate}</i>
    83     </li>
    84     <li>
    8596      <b>{'What can be downloaded?'|@translate}</b>
    8697      <label><input type="checkbox" name="what[categories]" {if in_array('categories',$batch_download.what)}checked="checked"{/if}/> {'Albums'|@translate}</label>
    8798      {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}
    8899      <label><input type="checkbox" name="what[specials]" {if in_array('specials',$batch_download.what)}checked="checked"{/if}/> {'Specials'|@translate}</label>
    89       <a class="showInfo" title="{'Most visited'|@translate}, {'Random photos'|@translate}, {'Best rated'|@translate}...">i</a>
    90     </li>
    91     <li>
    92       <label>
    93         <b>{'Maximum photo size'|@translate}</b>
     100      <a class="icon-info-circled-1 showInfo" title="{'Most visited'|@translate}, {'Random photos'|@translate}, {'Best rated'|@translate}..."></a>
     101    </li>
     102    <li>
     103      <b>{'Photo size choices'|translate}</b>
     104      <label><input type="radio" name="multisize" value="true" {if $batch_download.multisize}checked{/if}> {'Any size'|translate}</label>
     105      <label><input type="radio" name="multisize" value="false" {if !$batch_download.multisize}checked{/if}> {'One size'|translate}</label>
     106
     107      <label>
     108        <b id="multisize_title">{'Maximum photo size'|@translate}</b>
    94109        <select name="photo_size">
    95110          {html_options options=$sizes_options selected=$batch_download.photo_size}
     
    135150        <b>{'Delete previous archive when starting to download another one'|@translate}</b>
    136151      </label>
    137       <a class="showInfo" title="{'It saves space on the server but doesn\'t allow to restart failed downloads.'|@translate}">i</a>
     152      <a class="icon-info-circled-1 showInfo" title="{'It saves space on the server but doesn\'t allow to restart failed downloads.'|@translate}"></a>
    138153    </li>
    139154    <li>
     
    142157        <b>{'Force the usage of PclZip instead of ZipArchive as ZIP library'|@translate}</b>
    143158      </label>
    144       <a class="showInfo" title="{'Only check if you are experiencing corrupted archives with ZipArchive.'|@translate}">i</a>
     159      <a class="icon-info-circled-1 showInfo" title="{'Only check if you are experiencing corrupted archives with ZipArchive.'|@translate}"></a>
    145160    </li>
    146161    <li>
     
    149164        <b>{'Don\'t download archives through PHP'|@translate}</b>
    150165      </label>
    151       <a class="showInfo" title="{'Only check if your host complains about high PHP usage.'|@translate}">i</a>
     166      <a class="icon-info-circled-1 showInfo" title="{'Only check if your host complains about high PHP usage.'|@translate}"></a>
    152167    </li>
    153168  {if $use_ziparchive}
  • extensions/BatchDownloader/admin/template/style.css

    r23383 r25931  
    4747}
    4848
    49 .showInfo {
    50   position:static;
    51   display:inline-block;
    52   padding:1px 6px;
    53   width:4px;
    54   height:14px;
    55   line-height:14px;
    56   font-size:0.8em;
    57 }
    58 
    5949.advanced span {
    6050  font-family: 'Courrier New',monospace;
  • extensions/BatchDownloader/include/events.inc.php

    r23771 r25931  
    145145    ));
    146146 
    147   foreach (ImageStdParams::get_defined_type_map() as $params)
    148   {
    149     $template->append(
    150       'BATCH_DOWNLOAD_SIZES',
    151       array(
    152         'TYPE' => $params->type,
    153         'DISPLAY' => l10n($params->type),
    154         'SIZE' => $params->sizing->ideal_size[0].' x '.$params->sizing->ideal_size[1],
    155         )
    156       );
    157       if ($params->type == $conf['batch_download']['photo_size']) break;
    158   }
    159   if ($conf['batch_download']['photo_size'] == 'original')
    160   {
    161     $template->append(
    162       'BATCH_DOWNLOAD_SIZES',
    163       array(
    164         'TYPE' => 'original',
    165         'DISPLAY' => l10n('Original'),
    166         'SIZE' => null,
    167         )
    168       );
     147  if ($conf['batch_download']['multisize'])
     148  {
     149    foreach (ImageStdParams::get_defined_type_map() as $params)
     150    {
     151      $template->append(
     152        'BATCH_DWN_SIZES',
     153        array(
     154          'TYPE' => $params->type,
     155          'DISPLAY' => l10n($params->type),
     156          'SIZE' => $params->sizing->ideal_size[0].' x '.$params->sizing->ideal_size[1],
     157          )
     158        );
     159        if ($params->type == $conf['batch_download']['photo_size']) break;
     160    }
     161    if ($conf['batch_download']['photo_size'] == 'original')
     162    {
     163      $template->append(
     164        'BATCH_DWN_SIZES',
     165        array(
     166          'TYPE' => 'original',
     167          'DISPLAY' => l10n('Original'),
     168          'SIZE' => null,
     169          )
     170        );
     171    }
     172  }
     173  else
     174  {
     175    $template->assign('BATCH_DWN_SIZE', $conf['batch_download']['photo_size']);
    169176  }
    170177   
  • extensions/BatchDownloader/include/functions.inc.php

    r23804 r25931  
    88function get_set_info_from_page()
    99{
    10   global $page;
     10  global $page, $conf;
    1111 
    1212  switch ($page['section'])
     
    7070    );
    7171   
    72   return trigger_event('batchdownload_get_set_info', $set);
     72  // check size
     73  if (!$conf['batch_download']['multisize'])
     74  {
     75    $set['size'] = $conf['batch_download']['photo_size'];
     76  }
     77  else
     78  {
     79    $avail_sizes = array();
     80    foreach (ImageStdParams::get_defined_type_map() as $params)
     81    {
     82      $avail_sizes[] = $params->type;
     83      if ($params->type == $conf['batch_download']['photo_size']) break;
     84    }
     85    if ($conf['batch_download']['photo_size'] == 'original')
     86    {
     87      $avail_sizes[] = 'original';
     88    }
     89   
     90    if (!in_array($set['size'], $avail_sizes))
     91    {
     92      $set['size'] = $conf['batch_download']['photo_size'];
     93    }
     94  }
     95
     96  return trigger_change('batchdownload_get_set_info', $set);
    7397}
    7498
  • extensions/BatchDownloader/include/install.inc.php

    r23383 r25931  
    1414      'what'            => array('categories','specials','collections'),
    1515      'photo_size'      => 'original',
     16      'multisize'       => true,
    1617      'archive_prefix'  => 'piwigo',
    1718      'archive_timeout' => 48, /* hours */
     
    4344      $new_conf['force_pclzip'] = isset($conf['batch_download_force_pclzip']) && $conf['batch_download_force_pclzip'];
    4445      $new_conf['direct'] = isset($conf['batch_download_direct']) && $conf['batch_download_direct'];
     46    }
     47    if (!isset($new_conf['multisize']))
     48    {
     49      $new_conf['multisize'] = true;
    4550    }
    4651   
  • extensions/BatchDownloader/language/en_UK/plugin.lang.php

    r23383 r25931  
    6363$lang['Don\'t download archives through PHP'] = 'Don\'t download archives through PHP';
    6464$lang['Only check if your host complains about high PHP usage.'] = 'Only check if your host complains about high PHP usage.';
     65$lang['Any size'] = 'Any size';
     66$lang['One size'] = 'One size';
     67$lang['Photo size choices'] = 'Photo size choices';
     68$lang['Photo size'] = 'Photo size';
    6569
    6670?>
  • extensions/BatchDownloader/language/fr_FR/plugin.lang.php

    r23383 r25931  
    4242$lang['Unable to find ZipArchive PHP extension, Batch Downloader will use PclZip instead, but with degraded performance.'] = 'Impossible de trouver l\'extension PHP ZipArchive, Batch Downloader va utiliser PclZip à la place, mais avec des performances dégradées.';
    4343$lang['Remove from download set'] = 'Supprimer du lot';
    44 $lang['Confirm the download of %d pictures?'] = 'Confirmer le téléchargementde %d photos ?';
     44$lang['Confirm the download of %d pictures?'] = 'Confirmer le téléchargement de %d photos ?';
    4545$lang['Remove all finished downloads'] = 'Supprimer tous les téléchargements terminés';
    4646$lang['hours'] = 'heures';
     
    6363$lang['Don\'t download archives through PHP'] = 'Ne pas télécharger les archives via PHP';
    6464$lang['Only check if your host complains about high PHP usage.'] = 'Ne cochez uniquement que si votre hébergeur se plaint d\'une activité abusive de PHP.';
     65$lang['Any size'] = 'N\'importe quelle taille';
     66$lang['One size'] = 'Une seule taille';
     67$lang['Photo size choices'] = 'Choix de la taille des photos';
     68$lang['Photo size'] = 'Taille des photos';
    6569
    6670?>
  • extensions/BatchDownloader/template/download_button.tpl

    r23359 r25931  
    1 {footer_script require='jquery'}
    2 var batchdown_count = {$BATCH_DWN_COUNT};
    3 var batchdown_string = "{'Confirm the download of %d pictures?'|@translate}";
    4 {literal}
    5 jQuery().ready(function() {
    6   jQuery("#batchDownloadLink").click(function() {
    7           var elt = jQuery("#batchDownloadBox");
     1<a href="{$BATCH_DWN_URL}{$BATCH_DWN_SIZE}" id="batchDownloadLink" title="{'Download all pictures of this selection'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
     2  <span class="pwg-icon batch-downloader-icon" style="background:url('{$ROOT_URL}{$BATCH_DOWNLOAD_PATH}template/images/zip.png') center center no-repeat;">&nbsp;</span><span class="pwg-button-text">{'Download'|@translate}</span>
     3</a>
    84
    9     elt.css("left", Math.min( jQuery(this).offset().left, jQuery(window).width() - elt.outerWidth(true) - 5))
    10       .css("top", jQuery(this).offset().top + jQuery(this).outerHeight(true))
    11       .toggle();
    12 
    13     return false;
    14   });
    15 
    16   jQuery("#batchDownloadBox").on("mouseleave click", function() {
    17     jQuery(this).hide();
    18   });
    19  
    20   jQuery("#batchDownloadBox a").click(function() {
    21     return confirm(batchdown_string.replace('%d', batchdown_count));
    22   });
    23 });
    24 {/literal}{/footer_script}
    25 
    26 {html_style}{literal}
    27 .downloadSizeDetails {font-style:italic; font-size:80%;}
    28 {/literal}{/html_style}
    29 
    30 <li><a href="{$BATCH_DWN_URL}" id="batchDownloadLink" title="{'Download all pictures of this selection'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
    31   <span class="pwg-icon batch-downloader-icon" style="background:url('{$ROOT_URL}{$BATCH_DOWNLOAD_PATH}template/images/zip.png') center center no-repeat;">&nbsp;</span><span class="pwg-button-text">{'Download'|@translate}</span>
    32 </a></li>
     5{if isset($BATCH_DWN_SIZES)}
     6{combine_script id='core.switchbox' load='async' require='jquery' path='themes/default/js/switchbox.js'}
    337
    348<div id="batchDownloadBox" class="switchBox" style="display:none">
    359  <div class="switchBoxTitle">{'Download'|@translate} - {'Photo sizes'|@translate}</div>
    36   {foreach from=$BATCH_DOWNLOAD_SIZES item=size name=loop}{if !$smarty.foreach.loop.first}<br>{/if}
     10  {foreach from=$BATCH_DWN_SIZES item=size name=loop}{if !$smarty.foreach.loop.first}<br>{/if}
    3711  <a href="{$BATCH_DWN_URL}{$size.TYPE}" rel="nofollow">
    3812    {$size.DISPLAY} {if $size.SIZE}<span class="downloadSizeDetails">({$size.SIZE})</span>{/if}
     
    4014  {/foreach}
    4115</div>
     16{/if}
     17
     18{footer_script require='jquery'}
     19var batchdown_count = {$BATCH_DWN_COUNT};
     20var batchdown_string = "{'Confirm the download of %d pictures?'|@translate}";
     21
     22{if isset($BATCH_DWN_SIZES)}
     23  (SwitchBox=window.SwitchBox||[]).push("#batchDownloadLink", "#batchDownloadBox");
     24 
     25  jQuery("#batchDownloadBox a").click(function() {
     26    return confirm(batchdown_string.replace('%d', batchdown_count));
     27  });
     28{else}
     29  jQuery("#batchDownloadLink").click(function() {
     30    return confirm(batchdown_string.replace('%d', batchdown_count));
     31  });
     32{/if}
     33{/footer_script}
     34
     35{html_style}{literal}
     36.downloadSizeDetails {font-style:italic; font-size:80%;}
     37{/literal}{/html_style}
Note: See TracChangeset for help on using the changeset viewer.