Changeset 23291 for extensions
- Timestamp:
- Jun 17, 2013, 8:03:39 PM (11 years ago)
- Location:
- extensions/BatchDownloader
- Files:
-
- 5 added
- 11 edited
- 1 copied
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
extensions/BatchDownloader/admin/template/sets.tpl
r21607 r23291 62 62 <td>{$set.NAME}</td> 63 63 <td style="text-align:center;">{$set.DATE_CREATION}</td> 64 <td>{$set.TOTAL_SIZE} MB</td>64 <td>{$set.TOTAL_SIZE}</td> 65 65 <td>{$set.NB_IMAGES}</td> 66 66 <td>{$set.NB_ARCHIVES}</td> -
extensions/BatchDownloader/download.php
r23167 r23291 8 8 $BatchDownloader = new BatchDownloader($_GET['set_id']); 9 9 $file = $BatchDownloader->getArchivePath(); 10 11 if (!file_exists($file)) 12 { 13 throw new Exception('Unable to locate file.'); 14 } 10 15 11 16 if (isset($conf['batch_download_direct']) and $conf['batch_download_direct']) -
extensions/BatchDownloader/include/BatchDownloader.class.php
r23290 r23291 298 298 299 299 $query = ' 300 SELECT id, path, representative_ext,width, height, rotation300 SELECT id, path, width, height, rotation 301 301 FROM '.IMAGES_TABLE.' 302 302 WHERE id IN('.implode(',', $image_ids).') … … 307 307 while ($row = pwg_db_fetch_assoc($result)) 308 308 { 309 $src_image = new SrcImage($row); 310 if ($src_image->is_mimetype()) continue; 311 312 $derivative = new DerivativeImage($this->data['size'], $src_image); 313 // if ($this->data['size'] != $derivative->get_type()) continue; 314 315 $filemtime = @filemtime($derivative->get_path()); 316 317 if ($filemtime===false || $filemtime<$last_mod_time) 318 { 319 $urls[] = $root_url.$derivative->get_url().$uid; 320 } 321 else if ($update && in_array($row['id'], $to_update)) 322 { 323 $imagesize = getimagesize($derivative->get_path()); 324 325 $inserts[ $row['id'] ] = array( 326 'image_id' => $row['id'], 327 'type' => $this->data['size'], 328 'width' => $imagesize[0], 329 'height' => $imagesize[1], 330 'filesize' => filesize($derivative->get_path())/1024, 331 'filemtime' => $filemtime, 332 ); 309 $src_image = new SrcImage($row); // don't give representive_ext 310 311 // no-image files 312 if ($src_image->is_mimetype()) 313 { 314 if ($update && in_array($row['id'], $to_update)) 315 { 316 $inserts[ $row['id'] ] = array( 317 'image_id' => $row['id'], 318 'type' => $this->data['size'], 319 'width' => 0, 320 'height' => 0, 321 'filesize' => filesize(PHPWG_ROOT_PATH.$row['path'])/1024, 322 'filemtime' => filemtime(PHPWG_ROOT_PATH.$row['path']), 323 ); 324 } 325 } 326 // images files 327 else 328 { 329 $derivative = new DerivativeImage($this->data['size'], $src_image); 330 // if ($this->data['size'] != $derivative->get_type()) continue; 331 332 $filemtime = @filemtime($derivative->get_path()); 333 $src_mtime = @filemtime(PHPWG_ROOT_PATH.$row['path']); 334 if ($src_mtime===false) continue; 335 336 if ($filemtime===false || $filemtime<$last_mod_time || $filemtime<$src_mtime) 337 { 338 $urls[] = $root_url.$derivative->get_url().$uid; 339 } 340 else if ($update && in_array($row['id'], $to_update)) 341 { 342 $imagesize = getimagesize($derivative->get_path()); 343 344 $inserts[ $row['id'] ] = array( 345 'image_id' => $row['id'], 346 'type' => $this->data['size'], 347 'width' => $imagesize[0], 348 'height' => $imagesize[1], 349 'filesize' => filesize($derivative->get_path())/1024, 350 'filemtime' => $filemtime, 351 ); 352 } 333 353 } 334 354 } … … 344 364 mass_inserts( 345 365 IMAGE_SIZES_TABLE, 346 array('image_id','type','width','height','filesize' ),366 array('image_id','type','width','height','filesize','filemtime'), 347 367 $inserts 348 368 ); … … 410 430 SELECT 411 431 id, name, file, path, 412 representative_ext, rotation, 413 filesize, width, height 432 rotation, filesize, width, height 414 433 FROM '.IMAGES_TABLE.' 415 434 WHERE id IN ('.implode(',', $images_to_add).') … … 438 457 foreach ($images_to_add as $row) 439 458 { 459 if (!file_exists(PHPWG_ROOT_PATH.$row['path'])) 460 { 461 $this->removeImages(array($row['id'])); 462 continue; 463 } 464 440 465 if ($this->data['size'] == 'original') 441 466 { 442 $zip->addFile(PHPWG_ROOT_PATH .$row['path'], $row['id'].'_'.stripslashes(get_filename_wo_extension($row['file'])).'.'.get_extension($row['path']));467 $zip->addFile(PHPWG_ROOT_PATH.$row['path'], $row['id'].'_'.stripslashes(get_filename_wo_extension($row['file'])).'.'.get_extension($row['path'])); 443 468 $total_size+= $row['filesize']; 444 469 } 445 470 else 446 471 { 447 $src_image = new SrcImage($row); 448 $derivative = new DerivativeImage($this->data['size'], $src_image); 449 $path = $derivative->get_path(); 450 451 $zip->addFile($path, $row['id'].'_'.stripslashes(get_filename_wo_extension(basename($path))).'.'.get_extension($path)); 452 $total_size+= $filesizes[ $row['id'] ]; 472 $src_image = new SrcImage($row); // don't give representive_ext 473 474 // no-image files 475 if ($src_image->is_mimetype()) 476 { 477 $zip->addFile(PHPWG_ROOT_PATH.$row['path'], $row['id'].'_'.stripslashes(get_filename_wo_extension($row['file'])).'.'.get_extension($row['path'])); 478 $total_size+= $row['filesize']; 479 } 480 // images files 481 else 482 { 483 $derivative = new DerivativeImage($this->data['size'], $src_image); 484 $path = $derivative->get_path(); 485 486 $zip->addFile($path, $row['id'].'_'.stripslashes(get_filename_wo_extension(basename($path))).'.'.get_extension($path)); 487 $total_size+= $filesizes[ $row['id'] ]; 488 } 453 489 } 454 490 … … 572 608 if ($this->data['status'] == 'done' or $i < $this->data['last_zip']+1) 573 609 { 574 $out.= '<img src="'.$root_url.BATCH_DOWNLOAD_PATH.'template/ drive.png"> Archive #'.$i.' (already downloaded)';610 $out.= '<img src="'.$root_url.BATCH_DOWNLOAD_PATH.'template/images/drive_error.png"> Archive #'.$i.' (already downloaded)'; 575 611 } 576 612 else if ($i == $this->data['last_zip']+1) … … 578 614 $out.= '<a href="'.add_url_params($url, array('set_id'=>$this->data['id'],'zip'=>$i)).'" rel="nofollow" style="font-weight:bold;"' 579 615 .($i!=1 ? ' onClick="return confirm(\''.addslashes(sprintf(l10n('Starting download Archive #%d will destroy Archive #%d, be sure you finish the download. Continue ?'), $i, $i-1)).'\');"' : null). 580 '><img src="'.$root_url.BATCH_DOWNLOAD_PATH.'template/ drive_go.png"> Archive #'.$i.' (ready)</a>';616 '><img src="'.$root_url.BATCH_DOWNLOAD_PATH.'template/images/drive_go.png"> Archive #'.$i.' (ready)</a>'; 581 617 } 582 618 else 583 619 { 584 $out.= '<img src="'.$root_url.BATCH_DOWNLOAD_PATH.'template/ drive.png"> Archive #'.$i.' (pending)';620 $out.= '<img src="'.$root_url.BATCH_DOWNLOAD_PATH.'template/images/drive.png"> Archive #'.$i.' (pending)'; 585 621 } 586 622 … … 613 649 $path.= $set['BASENAME'] . '_'; 614 650 $path.= $this->data['user_id'] . $this->data['id']; 615 $path.= $this->getEstimatedArchiveNumber()!=1 ? '_part' . $i : null;651 $path.= '_part' . $i; 616 652 $path.= '.zip'; 617 653 … … 811 847 $set = array( 812 848 'NB_IMAGES' => $this->data['nb_images'], 813 'NB_ARCHIVES' => $this->data['status']=='new' ? l10n(' unknown') : $this->getEstimatedArchiveNumber(),849 'NB_ARCHIVES' => $this->data['status']=='new' ? l10n('Unknown') : $this->getEstimatedArchiveNumber(), 814 850 'STATUS' => $this->data['status'], 815 851 'LAST_ZIP' => $this->data['last_zip'], 816 'TOTAL_SIZE' => $this->data['status']=='new' ? l10n('unknown') : ceil($this->getEstimatedTotalSize()/1024), 817 // 'LINKS' => $this->getDownloadList(BATCH_DOWNLOAD_PUBLIC . 'init_zip'), 852 'TOTAL_SIZE' => $this->data['status']=='new' ? l10n('Unknown') : sprintf(l10n('%d MB'), ceil($this->getEstimatedTotalSize()/1024)), 818 853 'DATE_CREATION' => format_date($this->data['date_creation'], true), 819 854 'SIZE_ID' => $this->data['size'], 820 'SIZE' => l10n($this->data['size']),855 'SIZE' => $this->data['size']=='original' ? l10n('Original') : l10n($this->data['size']), 821 856 ); 822 857 -
extensions/BatchDownloader/include/download.inc.php
r23290 r23291 11 11 case 'init_zip': 12 12 { 13 $template->set_filename('index', dirname(__FILE__) . '/../template/init_zip.tpl');13 $template->set_filename('index', realpath(BATCH_DOWNLOAD_PATH . 'template/init_zip.tpl')); 14 14 15 15 try … … 55 55 $template->assign('missing_derivatives', $missing_derivatives); 56 56 } 57 // set ready57 // set is ready 58 58 else 59 59 { … … 108 108 $self_url = add_url_params(BATCH_DOWNLOAD_PUBLIC . 'view', array('set_id'=>$_GET['set_id'])); 109 109 110 $template->set_filename('index', dirname(__FILE__).'/../template/view.tpl');110 $template->set_filename('index', realpath(BATCH_DOWNLOAD_PATH . 'template/view.tpl')); 111 111 $template->assign(array( 112 112 'BATCH_DOWNLOAD_PATH' => BATCH_DOWNLOAD_PATH, … … 120 120 $BatchDownloader = new BatchDownloader($_GET['set_id']); 121 121 122 if ($BatchDownloader->getParam('status') != 'new' )122 if ($BatchDownloader->getParam('status') != 'new' && $BatchDownloader->getParam('status') != 'ready') 123 123 { 124 124 array_push($page['errors'], l10n('You can not edit this set')); -
extensions/BatchDownloader/include/functions.inc.php
r23290 r23291 67 67 'type' => $batch_type, 68 68 'id' => $batch_id, 69 'size' => isset($_GET['down_size']) ? $_GET['down_size'] : 'original',69 'size' => !empty($_GET['down_size']) ? $_GET['down_size'] : 'original', 70 70 ); 71 71 } -
extensions/BatchDownloader/language/en_UK/plugin.lang.php
r23280 r23291 50 50 $lang['No result'] = 'No result'; 51 51 $lang['Sorry, there is nothing to download. Some files may have been excluded because of <i title="Authorized types are : %s">filetype restrictions</i>.'] = 'Sorry, there is nothing to download. Some files may have been excluded because of <i title="Authorized types are : %s">filetype restrictions</i>.'; 52 $lang['Unknown'] = 'Unknown'; 53 $lang['Preparation'] = 'Preparation'; 54 $lang['Please wait, your download is being prepared. This page will refresh automatically refresh when it is ready.'] = 'Please wait, your download is being prepared. This page will refresh automatically refresh when it is ready.'; 55 $lang['%d MB'] = '%d MB'; 52 56 53 57 ?> -
extensions/BatchDownloader/language/fr_FR/plugin.lang.php
r23280 r23291 50 50 $lang['No result'] = 'Aucun résultat'; 51 51 $lang['Sorry, there is nothing to download. Some files may have been excluded because of <i title="Authorized types are : %s">filetype restrictions</i>.'] = 'Désolé, il n\'y a rien à télécharger. Certains fichiers ont peut-être été exclu à cause de <i title="Les types autorisés sont : %s">leur type</i>.'; 52 $lang['Unknown'] = 'Inconnu'; 53 $lang['Preparation'] = 'Préparation'; 54 $lang['Please wait, your download is being prepared. This page will refresh automatically refresh when it is ready.'] = 'Veuillez patienter, votre téléchargement est en cours de préparation. La page se refraîchira automatiquement une fois terminé.'; 55 $lang['%d MB'] = '%d Mio'; 52 56 53 57 ?> -
extensions/BatchDownloader/template/download_button.tpl
r23290 r23291 30 30 <script type="text/javascript"></script> 31 31 <li><a href="{$BATCH_DWN_URL}" id="batchDownloadLink" title="{'Download all pictures of this selection'|@translate}" class="pwg-state-default pwg-button" rel="nofollow"> 32 <span class="pwg-icon batch-downloader-icon" style="background:url('{$ROOT_PATH}{$BATCH_DOWNLOAD_PATH}template/ zip.png') center center no-repeat;"> </span><span class="pwg-button-text">{'Download'|@translate}</span>32 <span class="pwg-icon batch-downloader-icon" style="background:url('{$ROOT_PATH}{$BATCH_DOWNLOAD_PATH}template/images/zip.png') center center no-repeat;"> </span><span class="pwg-button-text">{'Download'|@translate}</span> 33 33 </a></li> 34 34 -
extensions/BatchDownloader/template/init_zip.tpl
r23290 r23291 13 13 {footer_script} 14 14 var derivatives = {ldelim} 15 16 17 18 19 20 21 15 elements: ["{'","'|@implode:$missing_derivatives}"], 16 done: 0, 17 total: {$missing_derivatives|@count}, 18 19 finished: function() {ldelim} 20 return derivatives.done == derivatives.total; 21 } 22 22 }; 23 23 24 function progress( success) {ldelim}25 jQuery('#progressBar').progressBar(derivatives.done , {ldelim}26 max: derivatives.total,27 textFormat: 'fraction',28 boxImage: '{$ROOT_PATH} themes/default/images/progressbar.gif',29 barImage: '{$ROOT_PATH} themes/default/images/progressbg_red.gif'24 function progress() {ldelim} 25 jQuery('#progressBar').progressBar(derivatives.done/derivatives.total*100, {ldelim} 26 width: 300, 27 height: 24, 28 boxImage: '{$ROOT_PATH}{$BATCH_DOWNLOAD_PATH}template/images/progress_box.png', 29 barImage: '{$ROOT_PATH}{$BATCH_DOWNLOAD_PATH}template/images/progress_bar.png' 30 30 }); 31 if (success !== undefined) {ldelim}32 var type = success ? '.regenerateSuccess': '.regenerateError',33 s = parseInt(jQuery(type).html());34 jQuery(type).html(++s);35 }36 31 } 37 32 … … 45 40 function next_derivative() { 46 41 if (derivatives.finished()) { 47 alert("finish");42 setTimeout("location.reload(true)", 1000); 48 43 return; 49 } 50 51 $("#damn").append(derivatives.elements[ derivatives.done ]+"<br>"); 44 } 52 45 53 46 jQuery.manageAjax.add("queued", { … … 57 50 success: function(data) { 58 51 derivatives.done++; 59 progress( true);52 progress(); 60 53 next_derivative(); 61 54 }, 62 55 error: function(data) { 63 56 derivatives.done++; 64 progress( false);57 progress(); 65 58 next_derivative(); 66 59 } … … 68 61 } 69 62 70 $("#begin").click(function() { 71 progress(); 72 next_derivative(); 73 }); 63 progress(); 64 setTimeout("next_derivative()", 1000); 74 65 {/literal}{/footer_script} 75 66 … … 103 94 <li><b>{'%d photos'|@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> 104 95 <li><b>{'Size'|@translate}:</b> {$set.SIZE} {if $set.SIZE_INFO}<span class="downloadSizeDetails">({$set.SIZE_INFO})</span>{/if}</li> 105 <li><b>{'Estimated size'|@translate}:</b> {$set.TOTAL_SIZE} MB</li>96 <li><b>{'Estimated size'|@translate}:</b> {$set.TOTAL_SIZE}</li> 106 97 <li><b>{'Estimated number of archives'|@translate}:</b> {$set.NB_ARCHIVES} <i>({'real number of archives can differ'|@translate})</i></li> 107 98 <li><b>{'Created on'|@translate}:</b> {$set.DATE_CREATION}</li> … … 111 102 {if $missing_derivatives} 112 103 <fieldset> 113 <legend> Stuff happening</legend>104 <legend>{'Preparation'|@translate}</legend> 114 105 115 < a id="begin">GO</a>106 <p>{'Please wait, your download is being prepared. This page will refresh automatically refresh when it is ready.'|@translate}</p> 116 107 117 <div id="regenerationMsg" class="bulkAction"> 118 <span class="progressBar" id="progressBar"></span> 119 </div> 108 <div id="progressBar"></div> 120 109 121 <span class="regenerateSuccess">0</span> - 122 <span class="regenerateError">0</span> 123 124 <div id="damn"> 125 </div> 110 <a href="{$set.U_CANCEL}" class="cancel-down" onClick="return confirm('{'Are you sure?'|@translate}');">{'Cancel this download'|@translate}</a> 126 111 </fieldset> 127 {/if}128 112 129 { if $zip_links}113 {elseif $zip_links} 130 114 <fieldset> 131 115 <legend>{'Download links'|@translate}</legend> -
extensions/BatchDownloader/template/style.css
r23290 r23291 4 4 5 5 ul.set-infos { 6 margin-top: 30px;6 margin-top:20px; 7 7 } 8 8 … … 28 28 a.cancel-down { 29 29 display:inline-block; 30 margin-top: 20px;30 margin-top:10px; 31 31 padding:2px 5px; 32 32 font-weight:bold; … … 39 39 } 40 40 41 .downloadSizeDetails {font-style:italic; font-size:80%;} 41 .downloadSizeDetails { 42 font-style:italic; 43 font-size:80%; 44 } 45 46 #progressBar { 47 width:300px; 48 position:relative; 49 } 50 #progressBar_pbImage { 51 border-radius:12px; 52 } 53 #progressBar_pbText { 54 color:white; 55 font-weight:bold; 56 font-size:16px; 57 line-height:16px; 58 position:absolute; 59 right:5px; 60 top:50%; 61 margin-top:-9px; 62 text-shadow:0 0 3px #000; 63 } -
extensions/BatchDownloader/template/thumbnails_css_js.tpl
r21206 r23291 18 18 $trigger.parent("li").hide("fast", function() {ldelim} $trigger.remove() }); 19 19 jQuery(".nbImagesSet").html(parseInt(jQuery(".nbImagesSet").html()) -1); 20 21 if (typeof GThumb == "object") GThumb.build(); 20 22 } else {ldelim} 21 23 $trigger.html('{'Un unknown error occured'|@translate}');
Note: See TracChangeset
for help on using the changeset viewer.