aboutsummaryrefslogtreecommitdiffstats
path: root/admin/themes/default
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-09-08 14:04:25 +0000
committerplegall <plg@piwigo.org>2011-09-08 14:04:25 +0000
commit251a9a797465f0b3f6cecc9b6141ee97f7ece261 (patch)
tree29e9101fe876e8ffc791674e9ef7af40ac6c9442 /admin/themes/default
parent79df57b96faeba32fe9648315442e129f1f570c1 (diff)
bug 2435 fixed: on the upload form, when no album available, hide the album
selection listbox and if no album is selected, trigger an error before starting any upload. git-svn-id: http://piwigo.org/svn/trunk@12106 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/themes/default/template/photos_add_direct.tpl20
1 files changed, 18 insertions, 2 deletions
diff --git a/admin/themes/default/template/photos_add_direct.tpl b/admin/themes/default/template/photos_add_direct.tpl
index 510556146..981868339 100644
--- a/admin/themes/default/template/photos_add_direct.tpl
+++ b/admin/themes/default/template/photos_add_direct.tpl
@@ -15,6 +15,11 @@ jQuery(document).ready(function(){
jQuery("#formErrors").hide();
jQuery("#formErrors li").hide();
+ if (jQuery("#albumSelect option:selected").length == 0) {
+ jQuery("#formErrors #noAlbum").show();
+ nbErrors++;
+ }
+
var nbFiles = 0;
if (jQuery("#uploadBoxes").size() == 1) {
jQuery("input[name^=image_upload]").each(function() {
@@ -96,7 +101,7 @@ jQuery(document).ready(function(){
fillCategoryListbox("albumSelect");
fillCategoryListbox("category_parent");
*/
-
+
jQuery(".addAlbumOpen").colorbox({inline:true, href:"#addAlbumForm"});
jQuery("#addAlbumForm form").submit(function(){
@@ -122,10 +127,19 @@ jQuery(document).ready(function(){
/* we refresh the album creation form, in case the user wants to create another album */
jQuery("#category_parent").find("option").remove();
+
+ jQuery("<option/>")
+ .attr("value", 0)
+ .text("------------")
+ .appendTo("#category_parent")
+ ;
+
fillCategoryListbox("category_parent", newAlbum);
jQuery("#addAlbumForm form input[name=category_name]").val('');
+ jQuery("#albumSelection").show();
+
return true;
},
error:function(XMLHttpRequest, textStatus, errorThrows) {
@@ -330,6 +344,7 @@ var sizeLimit = Math.round({$upload_max_filesize} / 1024); /* in KBytes */
<div id="formErrors" class="errors" style="display:none">
<ul>
+ <li id="noAlbum">{'Select an album'|@translate}</li>
<li id="noPhoto">{'Select at least one photo'|@translate}</li>
</ul>
<div class="hideButton" style="text-align:center"><a href="#" id="hideErrors">{'Hide'|@translate}</a></div>
@@ -358,10 +373,11 @@ var sizeLimit = Math.round({$upload_max_filesize} / 1024); /* in KBytes */
<fieldset>
<legend>{'Drop into album'|@translate}</legend>
+ <span id="albumSelection"{if count($category_options) == 0} style="display:none"{/if}>
<select id="albumSelect" name="category">
{html_options options=$category_options selected=$category_options_selected}
</select>
- <br>{'... or '|@translate}<a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
+ <br>{'... or '|@translate}</span><a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
</fieldset>