source: trunk/admin/themes/default/template/photos_add_direct.tpl @ 28552

Last change on this file since 28552 was 28552, checked in by plg, 10 years ago

feature 2616, customizations for plupload

  • bug fixed, remove debug inserts in table "plupload"
  • display photo title as tooltip on thumbnail
  • hide useless .plupload_header
  • hide any other form fieldset until an album is selected
File size: 7.7 KB
Line 
1{combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js'}
2{combine_script id='jquery.plupload' load='footer' require='jquery' path='themes/default/js/plugins/plupload/plupload.full.min.js'}
3{combine_script id='jquery.plupload.queue' load='footer' require='jquery' path='themes/default/js/plugins/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js'}
4{combine_script id='jquery.ui.progressbar' load='footer'}
5
6{combine_css path="themes/default/js/plugins/jquery.jgrowl.css"}
7{combine_css path="themes/default/js/plugins/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css"}
8
9{include file='include/colorbox.inc.tpl'}
10{include file='include/add_album.inc.tpl'}
11
12{combine_script id='LocalStorageCache' load='footer' path='admin/themes/default/js/LocalStorageCache.js'}
13
14{combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'}
15{combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.default.css"}
16
17{footer_script}
18{* <!-- CATEGORIES --> *}
19var categoriesCache = new CategoriesCache({
20  serverKey: '{$CACHE_KEYS.categories}',
21  serverId: '{$CACHE_KEYS._hash}',
22  rootUrl: '{$ROOT_URL}'
23});
24
25categoriesCache.selectize(jQuery('[data-selectize=categories]'), {
26  filter: function(categories, options) {
27    if (categories.length > 0) {
28      jQuery("#albumSelection, .selectFiles, .showFieldset").show();
29      options.default = categories[0].id;
30    }
31   
32    return categories;
33  }
34});
35
36jQuery('[data-add-album]').pwgAddAlbum({ cache: categoriesCache });
37
38var uploadify_path = '{$uploadify_path}';
39var upload_id = '{$upload_id}';
40var session_id = '{$session_id}';
41var pwg_token = '{$pwg_token}';
42var buttonText = "{'Select files'|@translate}";
43var sizeLimit = Math.round({$upload_max_filesize} / 1024); /* in KBytes */
44
45var noAlbum_message = "{'Select an album'|translate}";
46
47{literal}
48jQuery(document).ready(function(){
49  jQuery("#uploadWarningsSummary a.showInfo").click(function() {
50    jQuery("#uploadWarningsSummary").hide();
51    jQuery("#uploadWarnings").show();
52    return false;
53  });
54
55  jQuery("#showPermissions").click(function() {
56    jQuery(this).parent(".showFieldset").hide();
57    jQuery("#permissions").show();
58    return false;
59  });
60
61        jQuery("#uploader").pluploadQueue({
62                // General settings
63                // runtimes : 'html5,flash,silverlight,html4',
64                runtimes : 'html5',
65
66                // url : '../upload.php',
67                url : 'ws.php?method=pwg.images.upload&format=json',
68
69                // User can upload no more then 20 files in one go (sets multiple_queues to false)
70                max_file_count: 100,
71               
72                chunk_size: '500kb',
73               
74                filters : {
75                        // Maximum file size
76                        max_file_size : '1000mb',
77                        // Specify what files to browse for
78                        mime_types: [
79                                {title : "Image files", extensions : "jpeg,jpg,gif,png"},
80                                {title : "Zip files", extensions : "zip"}
81                        ]
82                },
83
84                // Rename files by clicking on their titles
85                // rename: true,
86               
87                // Sort files
88                sortable: true,
89
90                // Enable ability to drag'n'drop files onto the widget (currently only HTML5 supports that)
91                dragdrop: true,
92
93    init : {
94      BeforeUpload: function(up, file) {
95        console.log('[BeforeUpload]', file);
96
97        // You can override settings before the file is uploaded
98        // up.setOption('url', 'upload.php?id=' + file.id);
99        up.setOption(
100          'multipart_params',
101          {
102            category : jQuery("select[name=category] option:selected").val(),
103            level : jQuery("select[name=level] option:selected").val(),
104            pwg_token : pwg_token
105            // name : file.name
106          }
107        );
108      },
109
110      FileUploaded: function(up, file, info) {
111        // Called when file has finished uploading
112        console.log('[FileUploaded] File:', file, "Info:", info);
113     
114        var data = jQuery.parseJSON(info.response);
115     
116        jQuery("#uploadedPhotos").parent("fieldset").show();
117     
118        html = '<a href="admin.php?page=photo-'+data.result.image_id+'" target="_blank">';
119        html += '<img src="'+data.result.src+'" class="thumbnail" title="'+data.result.name+'">';
120        html += '</a> ';
121     
122        jQuery("#uploadedPhotos").prepend(html);
123
124        up.removeFile(file);
125      }
126    }
127        });
128
129{/literal}
130});
131{/footer_script}
132
133<div class="titrePage">
134  <h2>{'Upload Photos'|@translate} {$TABSHEET_TITLE}</h2>
135</div>
136
137<div id="photosAddContent">
138
139{*
140<div class="infos">
141  <ul>
142    <li>%d photos added..</li>
143  </ul>
144</div>
145*}
146
147{if count($setup_errors) > 0}
148<div class="errors">
149  <ul>
150  {foreach from=$setup_errors item=error}
151    <li>{$error}</li>
152  {/foreach}
153  </ul>
154</div>
155{else}
156
157  {if count($setup_warnings) > 0}
158<div class="warnings">
159  <ul>
160    {foreach from=$setup_warnings item=warning}
161    <li>{$warning}</li>
162    {/foreach}
163  </ul>
164  <div class="hideButton" style="text-align:center"><a href="{$hide_warnings_link}">{'Hide'|@translate}</a></div>
165</div>
166  {/if}
167
168
169{if !empty($thumbnails)}
170<fieldset>
171  <legend>{'Uploaded Photos'|@translate}</legend>
172  <div>
173  {foreach from=$thumbnails item=thumbnail}
174    <a href="{$thumbnail.link}" class="externalLink">
175      <img src="{$thumbnail.src}" alt="{$thumbnail.file}" title="{$thumbnail.title}" class="thumbnail">
176    </a>
177  {/foreach}
178  </div>
179  <p id="batchLink"><a href="{$batch_link}">{$batch_label}</a></p>
180</fieldset>
181<p style="margin:10px"><a href="{$another_upload_link}">{'Add another set of photos'|@translate}</a></p>
182{else}
183
184<form id="uploadForm" enctype="multipart/form-data" method="post" action="{$form_action}">
185{if $upload_mode eq 'multiple'}
186    <input name="upload_id" value="{$upload_id}" type="hidden">
187{/if}
188
189    <fieldset>
190      <legend>{'Drop into album'|@translate}</legend>
191
192      <span id="albumSelection" style="display:none">
193      <select data-selectize="categories" data-value="{$selected_category|@json_encode|escape:html}"
194        name="category" style="width:400px"></select>
195      <br>{'... or '|@translate}</span>
196      <a href="#" data-add-album="category" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
197    </fieldset>
198
199    <p class="showFieldset" style="display:none"><a id="showPermissions" href="#">{'Manage Permissions'|@translate}</a></p>
200
201    <fieldset id="permissions" style="display:none">
202      <legend>{'Who can see these photos?'|@translate}</legend>
203
204      <select name="level" size="1">
205        {html_options options=$level_options selected=$level_options_selected}
206      </select>
207    </fieldset>
208
209    <fieldset class="selectFiles" style="display:none">
210      <legend>{'Select files'|@translate}</legend>
211 
212    {if isset($original_resize_maxheight)}<p class="uploadInfo">{'The picture dimensions will be reduced to %dx%d pixels.'|@translate:$original_resize_maxwidth:$original_resize_maxheight}</p>{/if}
213
214    <p id="uploadWarningsSummary">{$upload_max_filesize_shorthand}B. {$upload_file_types}. {if isset($max_upload_resolution)}{$max_upload_resolution}Mpx{/if} <a class="icon-info-circled-1 showInfo" title="{'Learn more'|@translate}"></a></p>
215
216    <p id="uploadWarnings">
217{'Maximum file size: %sB.'|@translate:$upload_max_filesize_shorthand}
218{'Allowed file types: %s.'|@translate:$upload_file_types}
219  {if isset($max_upload_resolution)}
220{'Approximate maximum resolution: %dM pixels (that\'s %dx%d pixels).'|@translate:$max_upload_resolution:$max_upload_width:$max_upload_height}
221  {/if}
222    </p>
223
224
225        <div id="uploader">
226                <p>Your browser doesn't have HTML5 support.</p>
227        </div>
228
229    </fieldset>
230
231</form>
232
233<div id="uploadProgress" style="display:none">
234{'Photo %s of %s'|@translate:'<span id="progressCurrent">1</span>':'<span id="progressMax">10</span>'}
235<br>
236<div id="progressbar"></div>
237</div>
238
239<fieldset style="display:none">
240  <legend>{'Uploaded Photos'|@translate}</legend>
241  <div id="uploadedPhotos"></div>
242</fieldset>
243
244{/if} {* empty($thumbnails) *}
245{/if} {* $setup_errors *}
246
247</div> <!-- photosAddContent -->
Note: See TracBrowser for help on using the repository browser.