Changeset 28554
- Timestamp:
- May 28, 2014, 6:41:56 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/themes/default/template/photos_add_direct.tpl
r28552 r28554 1 {combine_script id='common' load='footer' path='admin/themes/default/js/common.js'} 1 2 {combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js'} 2 3 {combine_script id='jquery.plupload' load='footer' require='jquery' path='themes/default/js/plugins/plupload/plupload.full.min.js'} … … 36 37 jQuery('[data-add-album]').pwgAddAlbum({ cache: categoriesCache }); 37 38 38 var uploadify_path = '{$uploadify_path}';39 var upload_id = '{$upload_id}';40 var session_id = '{$session_id}';41 39 var pwg_token = '{$pwg_token}'; 42 var buttonText = "{'Select files'|@translate}"; 43 var sizeLimit = Math.round({$upload_max_filesize} / 1024); /* in KBytes */ 44 45 var noAlbum_message = "{'Select an album'|translate}"; 40 var photosUploaded_label = "{'%d photos uploaded'|translate}"; 41 var batch_Label = "{'Manage this set of %d photos'|translate}"; 42 var albumSummary_label = "{'Album "%s" now contains %d photos'|translate|escape}"; 43 var uploadedPhotos = []; 44 var uploadCategory = null; 46 45 47 46 {literal} … … 95 94 console.log('[BeforeUpload]', file); 96 95 96 // no more change on category/level 97 jQuery("select[name=level]").attr("disabled", "disabled"); 98 97 99 // You can override settings before the file is uploaded 98 100 // up.setOption('url', 'upload.php?id=' + file.id); … … 122 124 jQuery("#uploadedPhotos").prepend(html); 123 125 124 up.removeFile(file); 126 // do not remove file, or it will reset the progress bar :-/ 127 // up.removeFile(file); 128 uploadedPhotos.push(parseInt(data.result.image_id)); 129 uploadCategory = data.result.category; 130 }, 131 132 UploadComplete: function(up, files) { 133 // Called when all files are either uploaded or failed 134 console.log('[UploadComplete]'); 135 136 jQuery(".selectAlbum, .selectFiles, #permissions, .showFieldset").hide(); 137 138 jQuery(".infos").append('<ul><li>'+sprintf(photosUploaded_label, uploadedPhotos.length)+'</li></ul>'); 139 140 html = sprintf( 141 albumSummary_label, 142 '<a href="admin.php?page=album-'+uploadCategory.id+'">'+uploadCategory.label+'</a>', 143 parseInt(uploadCategory.nb_photos) 144 ); 145 146 jQuery(".infos ul").append('<li>'+html+'</li>'); 147 148 jQuery(".infos").show(); 149 150 // TODO: use a new method pwg.caddie.empty + 151 // pwg.caddie.add(uploadedPhotos) instead of relying on huge GET parameter 152 // (and remove useless code from admin/photos_add_direct.php) 153 154 jQuery(".batchLink").attr("href", "admin.php?page=photos_add§ion=direct&batch="+uploadedPhotos.join(",")); 155 jQuery(".batchLink").html(sprintf(batch_Label, uploadedPhotos.length)); 156 157 jQuery(".afterUploadActions").show(); 125 158 } 126 159 } … … 137 170 <div id="photosAddContent"> 138 171 139 {* 140 <div class="infos"> 141 <ul> 142 <li>%d photos added..</li> 143 </ul> 144 </div> 145 *} 172 <div class="infos" style="display:none"></div> 173 174 <p class="afterUploadActions" style="margin:10px; display:none;"><a class="batchLink"></a> | <a href="">{'Add another set of photos'|@translate}</a></p> 146 175 147 176 {if count($setup_errors) > 0} … … 167 196 168 197 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 198 <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> 199 <fieldset class="selectAlbum"> 190 200 <legend>{'Drop into album'|@translate}</legend> 191 201 … … 231 241 </form> 232 242 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 243 <fieldset style="display:none"> 240 244 <legend>{'Uploaded Photos'|@translate}</legend> … … 242 246 </fieldset> 243 247 244 {/if} {* empty($thumbnails) *}245 248 {/if} {* $setup_errors *} 246 249 -
trunk/include/ws_functions/pwg.images.php
r28552 r28554 1366 1366 $image_infos = pwg_db_fetch_assoc(pwg_query($query)); 1367 1367 1368 $query = ' 1369 SELECT 1370 COUNT(*) AS nb_photos 1371 FROM '.IMAGE_CATEGORY_TABLE.' 1372 WHERE category_id = '.$params['category'][0].' 1373 ;'; 1374 $category_infos = pwg_db_fetch_assoc(pwg_query($query)); 1375 1376 $category_name = get_cat_display_name_from_id($params['category'][0], null); 1377 1368 1378 return array( 1369 1379 'image_id' => $image_id, 1370 1380 'src' => DerivativeImage::thumb_url($image_infos), 1371 1381 'name' => $image_infos['name'], 1382 'category' => array( 1383 'id' => $params['category'][0], 1384 'nb_photos' => $category_infos['nb_photos'], 1385 'label' => $category_name, 1386 ) 1372 1387 ); 1373 1388 }
Note: See TracChangeset
for help on using the changeset viewer.