Changeset 10171 for extensions
- Timestamp:
- Apr 9, 2011, 12:44:01 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/community/add_photos.tpl
r9372 r10171 1 {combine_script id='jquery' path='themes/default/js/jquery.min.js'}2 1 {combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js' } 3 2 … … 15 14 function checkUploadStart() { 16 15 var nbErrors = 0; 17 $("#formErrors").hide();18 $("#formErrors li").hide();19 20 if ( $("input[name=category_type]:checked").val() == "new" && $("input[name=category_name]").val() == "") {21 $("#formErrors #emptyCategoryName").show();16 jQuery("#formErrors").hide(); 17 jQuery("#formErrors li").hide(); 18 19 if (jQuery("input[name=category_type]:checked").val() == "new" && jQuery("input[name=category_name]").val() == "") { 20 jQuery("#formErrors #emptyCategoryName").show(); 22 21 nbErrors++; 23 22 } 24 23 25 24 var nbFiles = 0; 26 if ( $("#uploadBoxes").size() == 1) {27 $("input[name^=image_upload]").each(function() {28 if ( $(this).val() != "") {25 if (jQuery("#uploadBoxes").size() == 1) { 26 jQuery("input[name^=image_upload]").each(function() { 27 if (jQuery(this).val() != "") { 29 28 nbFiles++; 30 29 } … … 32 31 } 33 32 else { 34 nbFiles = $(".uploadifyQueueItem").size();33 nbFiles = jQuery(".uploadifyQueueItem").size(); 35 34 } 36 35 37 36 if (nbFiles == 0) { 38 $("#formErrors #noPhoto").show();37 jQuery("#formErrors #noPhoto").show(); 39 38 nbErrors++; 40 39 } 41 40 42 41 if (nbErrors != 0) { 43 $("#formErrors").show();42 jQuery("#formErrors").show(); 44 43 return false; 45 44 } … … 70 69 } 71 70 72 if ( $("select[name=category] option").length == 0) {73 $('input[name=category_type][value=existing]').attr('disabled', true);74 $('input[name=category_type]').attr('checked', false);75 $('input[name=category_type][value=new]').attr('checked', true);71 if (jQuery("select[name=category] option").length == 0) { 72 jQuery('input[name=category_type][value=existing]').attr('disabled', true); 73 jQuery('input[name=category_type]').attr('checked', false); 74 jQuery('input[name=category_type][value=new]').attr('checked', true); 76 75 } 77 76 78 $("input[name=category_type]").click(function () {79 $("[id^=category_type_]").hide();80 $("#category_type_"+$(this).attr("value")).show();81 }); 82 83 $("#hideErrors").click(function() {84 $("#formErrors").hide();77 jQuery("input[name=category_type]").click(function () { 78 jQuery("[id^=category_type_]").hide(); 79 jQuery("#category_type_"+jQuery(this).attr("value")).show(); 80 }); 81 82 jQuery("#hideErrors").click(function() { 83 jQuery("#formErrors").hide(); 85 84 return false; 86 85 }); 87 86 88 $("a.externalLink").click(function() {89 window.open( $(this).attr("href"));87 jQuery("a.externalLink").click(function() { 88 window.open(jQuery(this).attr("href")); 90 89 return false; 91 90 }); … … 96 95 function addUploadBox() { 97 96 var uploadBox = '<p class="file"><input type="file" size="60" name="image_upload[]"></p>'; 98 $(uploadBox).appendTo("#uploadBoxes");97 jQuery(uploadBox).appendTo("#uploadBoxes"); 99 98 } 100 99 101 100 addUploadBox(); 102 101 103 $("#addUploadBox A").click(function () {102 jQuery("#addUploadBox A").click(function () { 104 103 addUploadBox(); 105 104 }); 106 105 107 $("#uploadForm").submit(function() {106 jQuery("#uploadForm").submit(function() { 108 107 return checkUploadStart(); 109 108 }); … … 141 140 } 142 141 else { 143 $("input[name=submit_upload]").click();142 jQuery("input[name=submit_upload]").click(); 144 143 } 145 144 }, … … 165 164 } 166 165 167 $.jGrowl(166 jQuery.jGrowl( 168 167 '<p></p>'+msg, 169 168 { … … 174 173 ); 175 174 176 $("#fileUploadgrowl" + queueID).fadeOut(175 jQuery("#fileUploadgrowl" + queueID).fadeOut( 177 176 250, 178 177 function() { 179 $("#fileUploadgrowl" + queueID).remove()178 jQuery("#fileUploadgrowl" + queueID).remove() 180 179 } 181 180 ); … … 184 183 onCancel: function (a, b, c, d) { 185 184 var msg = "Cancelled uploading: "+c.name; 186 $.jGrowl(185 jQuery.jGrowl( 187 186 '<p></p>'+msg, 188 187 { … … 196 195 onClearQueue: function (a, b) { 197 196 var msg = "Cleared "+b.fileCount+" files from queue"; 198 $.jGrowl(197 jQuery.jGrowl( 199 198 '<p></p>'+msg, 200 199 { … … 208 207 onComplete: function (a, b ,c, d, e) { 209 208 var size = Math.round(c.size/1024); 210 $.jGrowl(209 jQuery.jGrowl( 211 210 '<p></p>'+c.name+' - '+size+'KB', 212 211 { … … 220 219 }); 221 220 222 $("input[type=button]").click(function() {221 jQuery("input[type=button]").click(function() { 223 222 if (!checkUploadStart()) { 224 223 return false; 225 224 } 226 225 227 $("#uploadify").uploadifyUpload();226 jQuery("#uploadify").uploadifyUpload(); 228 227 }); 229 228
Note: See TracChangeset
for help on using the changeset viewer.