Changeset 16392 for extensions/BatchDownloader/include
- Timestamp:
- Jul 6, 2012, 1:03:39 PM (12 years ago)
- Location:
- extensions/BatchDownloader/include
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/BatchDownloader/include/BatchDownloader.class.php
r16379 r16392 260 260 * createNextArchive 261 261 */ 262 function createNextArchive( )262 function createNextArchive($force_one_archive=false) 263 263 { 264 264 // set already downloaded … … 329 329 330 330 $total_size+= $row['filesize']; 331 if ($total_size >= $this->conf['max_size']*1024 ) break;331 if ($total_size >= $this->conf['max_size']*1024 and !$force_one_archive) break; 332 332 } 333 333 … … 358 358 { 359 359 $this->updateParam('status', 'done'); 360 $this->clear(false); 360 361 } 361 362 … … 417 418 $nb_archives = $this->getEstimatedArchiveNumber(); 418 419 419 $out = ' <ul id="download_list">';420 if ($this->data['status'] == 'done')420 $out = ''; 421 /*if ($this->data['status'] == 'done') 421 422 { 422 423 $out.= '<li id="zip-1">Already downloaded</li>'; 423 } 424 else424 }*/ 425 if (true) 425 426 { 426 427 for ($i=1; $i<=$this->data['nb_zip']; $i++) … … 430 431 if ($i < $this->data['last_zip']+1) 431 432 { 432 $out.= ' Archive #'.$i.' (already downloaded)';433 $out.= '<img src="'.BATCH_DOWNLOAD_PATH.'template/drive.png"> Archive #'.$i.' (already downloaded)'; 433 434 } 434 435 else if ($i == $this->data['last_zip']+1) 435 436 { 436 $out.= '<a href="'.add_url_params($url, array('set_id'=>$this->data['set_id'],'zip'=>$i)).'" rel="nofollow" '437 $out.= '<a href="'.add_url_params($url, array('set_id'=>$this->data['set_id'],'zip'=>$i)).'" rel="nofollow" style="font-weight:bold;"' 437 438 .($i!=1 ? 'onClick="return confirm(\'Starting download Archive #'.$i.' will destroy Archive #'.($i-1).', be sure you finish the download. Continue ?\');"' : null). 438 '> Archive #'.$i.' (ready)</a>';439 '><img src="'.BATCH_DOWNLOAD_PATH.'template/drive_go.png"> Archive #'.$i.' (ready)</a>'; 439 440 } 440 441 else 441 442 { 442 $out.= ' Archive #'.$i.' (pending)';443 $out.= '<img src="'.BATCH_DOWNLOAD_PATH.'template/drive.png"> Archive #'.$i.' (pending)'; 443 444 } 444 445 … … 446 447 } 447 448 } 448 $out.= '</ul>';449 449 450 450 return $out; … … 472 472 $this->data['type'] .'-'. $this->data['type_id'] .'_'. 473 473 $this->data['user_id'] . $this->data['set_id'] .'_'. 474 'part'. $i .'.zip'; 474 ($this->data['nb_zip']!=1 ? 'part'. $i : null). 475 '.zip'; 475 476 } 476 477 … … 505 506 { 506 507 $category = get_cat_info($this->data['type_id']); 507 $set['NAME'] = get_cat_display_name($category['upper_names']);508 $set['sNAME'] = $category['name'];509 $set['COMMENT'] = trigger_ action('render_category_description', $category['comment']);508 $set['NAME'] = l10n('Album').': '.get_cat_display_name($category['upper_names']); 509 $set['sNAME'] = l10n('Album').': '.trigger_event('render_category_name', $category['name']); 510 $set['COMMENT'] = trigger_event('render_category_description', $category['comment']); 510 511 break; 511 512 } … … 532 533 .'</a>'; 533 534 } 535 536 $set['sNAME'] = l10n('Tags').': '.strip_tags($set['COMMENT']); 534 537 break; 535 538 } -
extensions/BatchDownloader/include/download.inc.php
r16379 r16392 15 15 $BatchDownloader = new BatchDownloader($_GET['set_id']); 16 16 17 if ( $BatchDownloader->getParam('status') != 'done')17 if ( isset($_GET['cancel']) ) 18 18 { 19 if (isset($_GET['zip'])) 20 { 21 $BatchDownloader->deleteLastArchive(); 22 $next_file = $BatchDownloader->createNextArchive(); 23 } 24 else 25 { 26 $BatchDownloader->getEstimatedArchiveNumber(); 27 } 19 $BatchDownloader->deleteLastArchive(); 20 $BatchDownloader->clear(); 21 pwg_query('DELETE FROM '.BATCH_DOWNLOAD_TSETS.' WHERE id = '.$_GET['set_id'].';'); 22 $_SESSION['page_infos'][] = l10n('Download set deleted'); 23 redirect('index.php'); 24 } 25 26 if ( isset($_GET['zip']) and $BatchDownloader->getParam('status') != 'done' and $_GET['zip'] > $BatchDownloader->getParam('last_zip') ) 27 { 28 $BatchDownloader->deleteLastArchive(); 29 $next_file = $BatchDownloader->createNextArchive(); 28 30 } 29 31 … … 33 35 { 34 36 $set['U_DOWNLOAD'] = BATCH_DOWNLOAD_PATH . 'download.php?set_id='.$_GET['set_id'].'&zip='.$_GET['zip']; 35 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']));37 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'])); 36 38 } 37 39 38 40 if ($BatchDownloader->getParam('nb_images') > $conf['batch_download']['max_elements']) 39 41 { 40 array_push($page['errors'], sprintf(42 $template->assign('elements_error', sprintf( 41 43 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.'), 42 44 $BatchDownloader->getParam('nb_images'), … … 44 46 $BatchDownloader->getParam('nb_images') - $conf['batch_download']['max_elements'] 45 47 )); 48 } 49 50 if ($BatchDownloader->getParam('status') == 'new') 51 { 52 $set['U_CANCEL'] = BATCH_DOWNLOAD_PUBLIC . 'init_zip&set_id='.$_GET['set_id'].'&cancel'; 46 53 } 47 54 … … 102 109 } 103 110 111 $template->assign('BATCH_DOWNLOAD_PATH', BATCH_DOWNLOAD_PATH); 112 104 113 105 114 function batch_download_thumbnails_list_prefilter($content, &$smarty) -
extensions/BatchDownloader/include/events.inc.php
r16379 r16392 24 24 25 25 $page['section'] = 'download'; 26 $page['title'] = l10n(' AdvancedDownloader').$conf['level_separator'].' ';26 $page['title'] = l10n('Batch Downloader').$conf['level_separator'].' '; 27 27 28 28 switch (@$tokens[1]) … … 57 57 function batch_download_index_button() 58 58 { 59 global $page, $template, $user ;59 global $page, $template, $user, $conf; 60 60 61 61 if ( !count($page['items']) or !isset($page['section']) ) return; … … 71 71 { 72 72 $BatchDownloader = new BatchDownloader('new', $page['items'], $set['type'], $set['id']); 73 redirect(BATCH_DOWNLOAD_PUBLIC . 'init_zip&set_id='.$BatchDownloader->getParam('set_id')); 73 $BatchDownloader->getEstimatedArchiveNumber(); 74 75 if ( 76 $BatchDownloader->getParam('nb_images') <= $conf['batch_download']['max_elements'] 77 and $BatchDownloader->getParam('nb_zip') == 1 78 ) 79 { 80 $BatchDownloader->createNextArchive(true); 81 82 $u_download = BATCH_DOWNLOAD_PATH . 'download.php?set_id='.$BatchDownloader->getParam('set_id').'&zip=1'; 83 84 $null = null; 85 $template->block_footer_script(null, 'setTimeout("document.location.href = \''.$u_download.'\';", 1000);', $null, $null); 86 87 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)); 88 } 89 else 90 { 91 redirect(BATCH_DOWNLOAD_PUBLIC . 'init_zip&set_id='.$BatchDownloader->getParam('set_id')); 92 } 74 93 } 75 94 }
Note: See TracChangeset
for help on using the changeset viewer.