source: extensions/BatchDownloader/template/init_zip.tpl @ 29532

Last change on this file since 29532 was 25932, checked in by mistic100, 11 years ago

update for Piwigo 2.6 + code cleaning + fix unable to cancel set during generation

File size: 3.4 KB
Line 
1{combine_css path=$BATCH_DOWNLOAD_PATH|cat:"template/style.css"}
2
3{if $set.U_DOWNLOAD}
4{footer_script}
5setTimeout(function() {
6  document.location.href = '{$set.U_DOWNLOAD}';
7}, 1000);
8{/footer_script}
9{/if}
10
11{if $missing_derivatives}
12{combine_script id='jquery.progressBar' load='footer' path='themes/default/js/plugins/jquery.progressbar.min.js'}
13{combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'}
14
15{footer_script}
16var derivatives = {
17  elements: ["{'","'|@implode:$missing_derivatives}"],
18  done: 0,
19  total: {$missing_derivatives|@count},
20
21  finished: function() {
22    return derivatives.done == derivatives.total;
23  }
24};
25
26function progress() {
27  jQuery('#progressBar').progressBar(derivatives.done/derivatives.total*100, {
28    width: 300,
29    height: 24,
30    boxImage: '{$ROOT_URL}{$BATCH_DOWNLOAD_PATH}template/images/progress_box.png',
31    barImage: '{$ROOT_URL}{$BATCH_DOWNLOAD_PATH}template/images/progress_bar.png'
32  });
33}
34
35var queuedManager = jQuery.manageAjax.create('queued', {
36  queue: true,
37  cacheResponse: false,
38  maxRequests: 1
39});
40
41function next_derivative() {
42  if (derivatives.finished()) {
43    setTimeout(function() {
44      location.reload(true);
45    }, 1000);
46    return;
47  }
48
49  queuedManager.add({
50    type: 'GET',
51    url: derivatives.elements[ derivatives.done ],
52    dataType: 'json',
53    data: {
54      ajaxload: 'true'
55    },
56    success: function() {
57      derivatives.done++;
58      progress();
59      next_derivative();
60    },
61    error: function() {
62      derivatives.done++;
63      progress();
64      next_derivative();
65    }
66  });
67}
68
69progress();
70setTimeout(next_derivative, 1000);
71{/footer_script}
72
73{/if}
74
75
76{if $set}
77<fieldset>
78  <legend>{'Download info'|translate}</legend>
79  <h2>{$set.NAME}</h2>
80  {if $set.COMMENT}<blockquote class="comment">{$set.COMMENT}</blockquote>{/if}
81
82  <ul class="set-infos">
83    <li class="error">{$elements_error}</li>
84    <li><b>{'%d photos'|translate:$set.NB_IMAGES}</b>{if $set.U_EDIT_SET}, <a href="{$set.U_EDIT_SET}" rel="nofollow">{'Edit the set'|translate}</a>{/if}</li>
85    <li><b>{'Photo sizes'|translate}:</b> {if $set.SIZE=='original'}{'Original'|translate}{else}{$set.SIZE|translate}{/if} {if $set.SIZE_INFO}<span class="downloadSizeDetails">({$set.SIZE_INFO})</span>{/if}</li>
86    <li><b>{'Estimated size'|translate}:</b> {$set.TOTAL_SIZE}</li>
87    <li><b>{'Estimated number of archives'|translate}:</b> {$set.NB_ARCHIVES} <i>({'real number of archives can differ'|translate})</i></li>
88    <li><b>{'Created on'|translate}:</b> {$set.DATE_CREATION}</li>
89  </ul>
90</fieldset>
91
92{if $missing_derivatives}
93<fieldset>
94  <legend>{'Preparation'|translate}</legend>
95
96  <p>{'Please wait, your download is being prepared. This page will automatically refresh when it is ready.'|translate}</p>
97
98  <div id="progressBar"></div>
99
100  <a href="{$set.U_CANCEL}" class="cancel-down" onClick="return confirm('{'Are you sure?'|translate}');">{'Cancel this download'|translate}</a>
101</fieldset>
102
103{elseif $zip_links}
104<fieldset>
105  <legend>{'Download links'|translate}</legend>
106
107  <ul class="download-links">
108    {$zip_links}
109    <li class="warning">{'<b>Warning:</b> all files will be deleted within %d hours'|translate:$archive_timeout}</li>
110  </ul>
111
112  {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}
113</fieldset>
114{/if}
115{/if}
Note: See TracBrowser for help on using the repository browser.