Index: /extensions/BatchDownloader/admin.php
===================================================================
--- /extensions/BatchDownloader/admin.php	(revision 16391)
+++ /extensions/BatchDownloader/admin.php	(revision 16392)
@@ -19,5 +19,5 @@
 // template
 $template->assign(array(
-  'BATCH_DOWNLOAD_PATH'=> BATCH_DOWNLOAD_PATH,
+  'BATCH_DOWNLOAD_PATH' => BATCH_DOWNLOAD_PATH,
   'BATCH_DOWNLOAD_ADMIN' => BATCH_DOWNLOAD_ADMIN,
   ));
Index: /extensions/BatchDownloader/admin/config.php
===================================================================
--- /extensions/BatchDownloader/admin/config.php	(revision 16391)
+++ /extensions/BatchDownloader/admin/config.php	(revision 16392)
@@ -41,4 +41,8 @@
 $sizes_options['original'] = l10n('Original');
 
+// max values
+$conf['batch_download']['max_elements_value'] = isset($conf['batch_download_max_elements']) ? $conf['batch_download_max_elements'] : 1000;
+$conf['batch_download']['max_size_value'] = isset($conf['batch_download_max_size']) ? $conf['batch_download_max_size'] : 1000;
+
 $template->assign(array(
   'group_options' => $group_options,
Index: /extensions/BatchDownloader/admin/template/config.tpl
===================================================================
--- /extensions/BatchDownloader/admin/template/config.tpl	(revision 16391)
+++ /extensions/BatchDownloader/admin/template/config.tpl	(revision 16392)
@@ -1,28 +1,58 @@
 {combine_css path=$BATCH_DOWNLOAD_PATH|@cat:"admin/template/style.css"}
 
+{combine_script id='jquery.ui.slider' require='jquery.ui' load='footer' path='themes/default/js/ui/jquery.ui.slider.js'}
+{combine_css path="themes/default/js/ui/theme/jquery.ui.slider.css"}
 {combine_script id='jquery.chosen' load='footer' path='themes/default/js/plugins/chosen.jquery.min.js'}
 {combine_css path="themes/default/js/plugins/chosen.css"}
 
-{footer_script}{literal}
-jQuery(document).ready(function() {
-  jQuery(".chzn-select").chosen();
+{footer_script}
+jQuery(".chzn-select").chosen();
+
+$("#max_size").slider({ldelim}
+  range: "min",
+  value: {$batch_download.max_size},
+  min: 10,
+  max: {$batch_download.max_size_value},
+  slide: function(event, ui) {ldelim}
+    $("input[name='max_size']").val(ui.value);
+  }
 });
-{/literal}{/footer_script}
+$("input[name='max_size']").change(function() {ldelim}
+  $("#max_size").slider("value", $(this).val());
+});
+
+$("#max_elements").slider({ldelim}
+  range: "min",
+  value: {$batch_download.max_elements},
+  min: 10,
+  max: {$batch_download.max_elements_value},
+  slide: function(event, ui) {ldelim}
+    $("input[name='max_elements']").val(ui.value);
+  }
+});
+$("input[name='max_elements']").change(function() {ldelim}
+  $("#max_elements").slider("value", $(this).val());
+});
+{/footer_script}
 
 <div class="titrePage">
-	<h2>Advanced Downloader</h2>
+	<h2>Batch Downloader</h2>
 </div>
 
 <form method="post" action="" class="properties">
 <fieldset>
-  <legend>{'Download access'|@translate}</legend>
+  <legend>{'Download permissions'|@translate}</legend>
   
   <ul>
     <li>
       <label>
+      {if $group_options}
         <span class="property">{'User groups'|@translate}</span>
         <select name="groups[]" data-placeholder="{'Everybody'|@translate}" class="chzn-select" multiple="multiple" style="width:370px;">
           {html_options options=$group_options selected=$batch_download.groups}
         </select>
+      {else}
+        {'There is no group in this gallery.'|@translate} <a href="admin.php?page=group_list">{'Groups management'|@translate}</a>
+      {/if}
       </label>
     </li>
@@ -39,5 +69,5 @@
 
 <fieldset>
-  <legend>{'Archives configuration'|@translate}</legend>
+  <legend>{'Archives'|@translate}</legend>
   
   <ul>
@@ -53,4 +83,24 @@
     <li>
       <label>
+        <span class="property">{'Delete unterminated downloads after'|@translate}</span>
+        <input type="text" name="archive_timeout" value="{$batch_download.archive_timeout}" size="3"> {'hours'|@translate}
+      </label>
+    </li>
+    <li>
+      <label>
+        <span class="property">{'Maximum number of photos per download set'|@translate}</span>
+        <div id="max_elements""></div>
+        <input type="text" name="max_elements" value="{$batch_download.max_elements}" size="5">
+      </label>
+    </li>
+    <li>
+      <label>
+        <span class="property">{'Maximum size of each archive (in Megabytes)'|@translate}</span>
+        <div id="max_size"></div>
+        <input type="text" name="max_size" value="{$batch_download.max_size}" size="5">
+      </label>
+    </li>
+    <li>
+      <label>
         <span class="property">{'Archive prefix'|@translate}</span>
         <input type="text" name="archive_prefix" value="{$batch_download.archive_prefix}">
@@ -59,24 +109,6 @@
     <li>
       <label>
-        <span class="property">{'Archive comment'|@translate}</span>
-        <input type="text" name="archive_comment" value="{$batch_download.archive_comment}" size="80">
-      </label>
-    </li>
-    <li>
-      <label>
-        <span class="property">{'Delete unterminated downloads after'|@translate}</span>
-        <input type="text" name="archive_timeout" value="{$batch_download.archive_timeout}" size="3">{'hours'|@translate}
-      </label>
-    </li>
-    <li>
-      <label>
-        <span class="property">{'Maximum number if photos in each set'|@translate}</span>
-        <input type="text" name="max_elements" value="{$batch_download.max_elements}" size="3">
-      </label>
-    </li>
-    <li>
-      <label>
-        <span class="property">{'Maximum size of each archive'|@translate}</span>
-        <input type="text" name="max_size" value="{$batch_download.max_size}" size="4">MB
+        <span class="property">{'Archive comment'|@translate} :</span><br>
+        <textarea name="archive_comment" rows="5" style="width:450px;">{$batch_download.archive_comment}</textarea>
       </label>
     </li>
@@ -84,4 +116,4 @@
 </fieldset>
 
-<p><input type="submit" name="save_config" value="{'Save Settings'|@translate}"></p>  
+<p class="formButtons"><input type="submit" name="save_config" value="{'Save Settings'|@translate}"></p>  
 </form>
Index: /extensions/BatchDownloader/admin/template/sets.tpl
===================================================================
--- /extensions/BatchDownloader/admin/template/sets.tpl	(revision 16391)
+++ /extensions/BatchDownloader/admin/template/sets.tpl	(revision 16392)
@@ -2,5 +2,5 @@
 
 <div class="titrePage">
-	<h2>Advanced Downloader</h2>
+	<h2>Batch Downloader</h2>
 </div>
 
Index: /extensions/BatchDownloader/admin/template/style.css
===================================================================
--- /extensions/BatchDownloader/admin/template/style.css	(revision 16391)
+++ /extensions/BatchDownloader/admin/template/style.css	(revision 16392)
@@ -2,2 +2,18 @@
   clear:none !important;
 }
+
+.property {
+  width:auto !important;
+}
+
+input[name='max_size'], input[name='max_elements'] {
+  border:none;
+  background:none;
+  font-weight:bold;
+  margin-left:5px;
+}
+
+#max_size, #max_elements {
+  display:inline-block;
+  width:300px;
+}
Index: /extensions/BatchDownloader/include/BatchDownloader.class.php
===================================================================
--- /extensions/BatchDownloader/include/BatchDownloader.class.php	(revision 16391)
+++ /extensions/BatchDownloader/include/BatchDownloader.class.php	(revision 16392)
@@ -260,5 +260,5 @@
    * createNextArchive
    */
-  function createNextArchive()
+  function createNextArchive($force_one_archive=false)
   {
     // set already downloaded
@@ -329,5 +329,5 @@
         
         $total_size+= $row['filesize'];
-        if ($total_size >= $this->conf['max_size']*1024) break;
+        if ($total_size >= $this->conf['max_size']*1024 and !$force_one_archive) break;
       }
       
@@ -358,4 +358,5 @@
       {
         $this->updateParam('status', 'done');
+        $this->clear(false);
       }
       
@@ -417,10 +418,10 @@
     $nb_archives = $this->getEstimatedArchiveNumber();
     
-    $out = '<ul id="download_list">';
-    if ($this->data['status'] == 'done')
+    $out = '';
+    /*if ($this->data['status'] == 'done')
     {
       $out.= '<li id="zip-1">Already downloaded</li>';
-    }
-    else
+    }*/
+    if (true)
     {
       for ($i=1; $i<=$this->data['nb_zip']; $i++)
@@ -430,15 +431,15 @@
         if ($i < $this->data['last_zip']+1)
         {
-          $out.= 'Archive #'.$i.' (already downloaded)';
+          $out.= '<img src="'.BATCH_DOWNLOAD_PATH.'template/drive.png"> Archive #'.$i.' (already downloaded)';
         }
         else if ($i == $this->data['last_zip']+1)
         {
-            $out.= '<a href="'.add_url_params($url, array('set_id'=>$this->data['set_id'],'zip'=>$i)).'" rel="nofollow"' 
+            $out.= '<a href="'.add_url_params($url, array('set_id'=>$this->data['set_id'],'zip'=>$i)).'" rel="nofollow" style="font-weight:bold;"' 
               .($i!=1 ? 'onClick="return confirm(\'Starting download Archive #'.$i.' will destroy Archive #'.($i-1).', be sure you finish the download. Continue ?\');"' : null).
-              '>Archive #'.$i.' (ready)</a>';
+              '><img src="'.BATCH_DOWNLOAD_PATH.'template/drive_go.png"> Archive #'.$i.' (ready)</a>';
         }
         else
         {
-          $out.= 'Archive #'.$i.' (pending)';
+          $out.= '<img src="'.BATCH_DOWNLOAD_PATH.'template/drive.png"> Archive #'.$i.' (pending)';
         }
         
@@ -446,5 +447,4 @@
       }
     }
-    $out.= '</ul>';
     
     return $out;
@@ -472,5 +472,6 @@
           $this->data['type'] .'-'. $this->data['type_id'] .'_'.
           $this->data['user_id'] . $this->data['set_id'] .'_'.
-          'part'. $i .'.zip';
+          ($this->data['nb_zip']!=1 ? 'part'. $i : null).
+          '.zip';
   }
   
@@ -505,7 +506,7 @@
       {
         $category = get_cat_info($this->data['type_id']);
-        $set['NAME'] = get_cat_display_name($category['upper_names']);
-        $set['sNAME'] = $category['name'];
-        $set['COMMENT'] = trigger_action('render_category_description', $category['comment']);
+        $set['NAME'] = l10n('Album').': '.get_cat_display_name($category['upper_names']);
+        $set['sNAME'] = l10n('Album').': '.trigger_event('render_category_name', $category['name']);
+        $set['COMMENT'] = trigger_event('render_category_description', $category['comment']);
         break;
       }
@@ -532,4 +533,6 @@
             .'</a>';
         }
+        
+        $set['sNAME'] = l10n('Tags').': '.strip_tags($set['COMMENT']);
         break;
       }
Index: /extensions/BatchDownloader/include/download.inc.php
===================================================================
--- /extensions/BatchDownloader/include/download.inc.php	(revision 16391)
+++ /extensions/BatchDownloader/include/download.inc.php	(revision 16392)
@@ -15,15 +15,17 @@
     $BatchDownloader = new BatchDownloader($_GET['set_id']);
     
-    if ($BatchDownloader->getParam('status') != 'done')
+    if ( isset($_GET['cancel']) )
     {
-      if (isset($_GET['zip']))
-      {
-        $BatchDownloader->deleteLastArchive();
-        $next_file = $BatchDownloader->createNextArchive();
-      }
-      else
-      {
-        $BatchDownloader->getEstimatedArchiveNumber();
-      }
+      $BatchDownloader->deleteLastArchive();
+      $BatchDownloader->clear();
+      pwg_query('DELETE FROM '.BATCH_DOWNLOAD_TSETS.' WHERE id = '.$_GET['set_id'].';');
+      $_SESSION['page_infos'][] = l10n('Download set deleted');
+      redirect('index.php');
+    }
+    
+    if ( isset($_GET['zip']) and $BatchDownloader->getParam('status') != 'done' and $_GET['zip'] > $BatchDownloader->getParam('last_zip') )
+    {
+      $BatchDownloader->deleteLastArchive();
+      $next_file = $BatchDownloader->createNextArchive();
     }
 
@@ -33,10 +35,10 @@
     {
       $set['U_DOWNLOAD'] = BATCH_DOWNLOAD_PATH . 'download.php?set_id='.$_GET['set_id'].'&amp;zip='.$_GET['zip'];
-      array_push($page['infos'], sprintf(l10n('Archive #%d is downloading, if the download doesn\'t start automatically please <a href="%s">click here</a>'), $_GET['zip'], $set['U_DOWNLOAD']));
+      array_push($page['infos'], sprintf(l10n('The archive is downloading, if the download doesn\'t start automatically please <a href="%s">click here</a>'), $set['U_DOWNLOAD']));
     }
     
     if ($BatchDownloader->getParam('nb_images') > $conf['batch_download']['max_elements'])
     {
-      array_push($page['errors'], sprintf(
+      $template->assign('elements_error', sprintf(
         l10n('You choose to download %d pictures, but the system is limited to %d. You can edit the set, or the last %d pictures will not be downloaded.'),
         $BatchDownloader->getParam('nb_images'),
@@ -44,4 +46,9 @@
         $BatchDownloader->getParam('nb_images') - $conf['batch_download']['max_elements']
         ));
+    }
+    
+    if ($BatchDownloader->getParam('status') == 'new')
+    {
+      $set['U_CANCEL'] = BATCH_DOWNLOAD_PUBLIC . 'init_zip&amp;set_id='.$_GET['set_id'].'&amp;cancel';
     }
     
@@ -102,4 +109,6 @@
 }
 
+$template->assign('BATCH_DOWNLOAD_PATH', BATCH_DOWNLOAD_PATH);
+
 
 function batch_download_thumbnails_list_prefilter($content, &$smarty)
Index: /extensions/BatchDownloader/include/events.inc.php
===================================================================
--- /extensions/BatchDownloader/include/events.inc.php	(revision 16391)
+++ /extensions/BatchDownloader/include/events.inc.php	(revision 16392)
@@ -24,5 +24,5 @@
     
     $page['section'] = 'download';
-    $page['title'] = l10n('Advanced Downloader').$conf['level_separator'].' ';
+    $page['title'] = l10n('Batch Downloader').$conf['level_separator'].' ';
     
     switch (@$tokens[1])
@@ -57,5 +57,5 @@
 function batch_download_index_button()
 {
-  global $page, $template, $user;
+  global $page, $template, $user, $conf;
   
   if ( !count($page['items']) or !isset($page['section']) ) return;
@@ -71,5 +71,24 @@
     {
       $BatchDownloader = new BatchDownloader('new', $page['items'], $set['type'], $set['id']);
-      redirect(BATCH_DOWNLOAD_PUBLIC . 'init_zip&amp;set_id='.$BatchDownloader->getParam('set_id'));
+      $BatchDownloader->getEstimatedArchiveNumber();
+      
+      if (
+        $BatchDownloader->getParam('nb_images') <= $conf['batch_download']['max_elements']
+        and $BatchDownloader->getParam('nb_zip') == 1
+      )
+      {
+        $BatchDownloader->createNextArchive(true);
+        
+        $u_download = BATCH_DOWNLOAD_PATH . 'download.php?set_id='.$BatchDownloader->getParam('set_id').'&amp;zip=1';
+        
+        $null = null;
+        $template->block_footer_script(null, 'setTimeout("document.location.href = \''.$u_download.'\';", 1000);', $null, $null);
+        
+        array_push($page['infos'], sprintf(l10n('The archive is downloading, if the download doesn\'t start automatically please <a href="%s">click here</a>'), $u_download));
+      }
+      else
+      {
+        redirect(BATCH_DOWNLOAD_PUBLIC . 'init_zip&amp;set_id='.$BatchDownloader->getParam('set_id'));
+      }
     }
   }
Index: /extensions/BatchDownloader/template/init_zip.tpl
===================================================================
--- /extensions/BatchDownloader/template/init_zip.tpl	(revision 16391)
+++ /extensions/BatchDownloader/template/init_zip.tpl	(revision 16392)
@@ -1,2 +1,4 @@
+{combine_css path=$BATCH_DOWNLOAD_PATH|@cat:"template/style.css"}
+
 {$MENUBAR}
 
@@ -18,24 +20,30 @@
 
 
-<p>
-  <h3>{$set.NAME}</h3>
-  {if $set.COMMENT}<blockquote>{$set.COMMENT}</blockquote>{/if}
-  <span>{'%d images'|@translate|@sprintf:$set.NB_IMAGES}{if $set.U_EDIT_SET}, <a href="{$set.U_EDIT_SET}" rel="nofollow">{'Edit the set'|@translate}</a>{/if}</span>
-</p>
+<fieldset>
+  <legend>{'Download info'|@translate}</legend>
+  <h2>{$set.NAME}</h2>
+  {if $set.COMMENT}<blockquote class="comment">{$set.COMMENT}</blockquote>{/if}
+  
+  <ul class="set-infos">
+    <li class="error">{$elements_error}</li>
+    <li><b>{'%d images'|@translate|@sprintf:$set.NB_IMAGES}</b>{if $set.U_EDIT_SET}, <a href="{$set.U_EDIT_SET}" rel="nofollow">{'Edit the set'|@translate}</a>{/if}</li>
+    <li><b>{'Estimated size'|@translate}:</b> {$set.TOTAL_SIZE} MB</li>
+    <li><b>{'Estimated number of archives'|@translate}:</b> {$set.NB_ARCHIVES} <i>({'real number of archives can differ'|@translate})</i></li>
+  </ul>
+  
+  
+</fieldset>
 
-<p>
-  <b>{'Estimated size'|@translate}:</b> {$set.TOTAL_SIZE} MB<br>
-  <b>{'Estimated number of archives'|@translate}:</b> {$set.NB_ARCHIVES}<br>
-  <i>{'These datas are an estimation, real specs can differ'|@translate}</i>
-</p>
 
-<p>
-<b>Download links:</b>
-{$set.LINKS}
-</p>
-
-<p class="infos">
-{'<b>Warning:</b> all files will be deleted within %d hours'|@translate|@sprintf:$archive_timeout}
-</p>
+<fieldset>
+  <legend>{'Download links'|@translate}</legend>
+  
+  <ul class="download-links">
+    {$set.LINKS}
+    <li class="warning">{'<b>Warning:</b> all files will be deleted within %d hours'|@translate|@sprintf:$archive_timeout}</li>
+  </ul>
+  
+  {if $set.U_CANCEL}<a href="{$set.U_CANCEL}" class="cancel-down" onClick="return confirm('{'Are you sure?'|@translate}');">{'Cancel this download'|@translate}</a>{/if}
+</fieldset>
 
 </div>{* <!-- content --> *}
Index: /extensions/BatchDownloader/template/style.css
===================================================================
--- /extensions/BatchDownloader/template/style.css	(revision 16392)
+++ /extensions/BatchDownloader/template/style.css	(revision 16392)
@@ -0,0 +1,39 @@
+blockquote.comment {
+  margin:0 20px 0 20px;
+}
+
+ul.set-infos {
+  margin-top:30px;
+}
+
+ul.set-infos .error {
+  color:#f00;
+  font-weight:bold;
+  margin-bottom:10px;
+  list-style:none;
+}
+
+ul.download-links {
+  list-style:none;
+  padding-left:25px;
+}
+
+ul.download-links .warning {
+  color:#FF7F00;
+  font-weight:bold;
+  margin-top:10px;
+  margin-left:20px;
+}
+
+a.cancel-down {
+  display:inline-block;
+  margin-top:20px;
+  padding:2px 5px;
+  font-weight:bold;
+  color:#a11;
+  border:1px solid #a11;
+}
+  a.cancel-down:hover {
+    color:#f00;
+    border-color:#f00;
+  }
