Skip to content

Commit

Permalink
check for html5
Browse files Browse the repository at this point in the history
  • Loading branch information
scottkf committed May 10, 2011
1 parent 0ca350c commit 296678a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 8 additions & 5 deletions assets/massuploadutility.js
Expand Up @@ -2,6 +2,12 @@

$(document).ready(function() {

// check for html5 input multiple support first
html5Support = ("multiple" in document.createElement("input"));
if(!html5Support){
alert("Sorry, your browser doesn't support HTML5!");
return false;
}
Symphony.Language.add({
'Successfully added a whole slew of entries, {$total} to be exact.': false,
'But {$total} entries were successfully added.': false,
Expand All @@ -24,7 +30,7 @@
urlAssets = urlBase + '/extensions/massuploadutility/assets';
source = window.location.pathname.replace(/.*\/symphony\/publish\/(.*)\/new\//i,'$1');

// if there's more than one upload field, we have no idea what to do
// if there's more than one upload field, I have no idea what to do and it's not terribly important
if (fileField.size() == 1) {
label = fileField.parent().parent();
label.html(label.html().replace(/^([a-z]+[\s]+)(\<[a-z]+)/i, '$1 ('+Symphony.Language.get("multiple files can be selected")+') $2'));
Expand All @@ -51,11 +57,8 @@
method: "post",
sendBoundary: window.FormData || $.browser.mozilla,
onStart: function(event, total) {
// should never even get here, but just incase!
if (total <= 0) {
if ($("#error").length == 0) {
fileField.parent().parent().wrap("<div id=\"error\" class=\"invalid\"></div>");
fileField.parent().parent().append("<p>No files selected.</p>");
}
return false;
}
return true;
Expand Down
3 changes: 2 additions & 1 deletion readme.txt
Expand Up @@ -22,6 +22,8 @@ CHANGELOG

v0.9.2
* Added ability to exclude sections and users (I stole this from Craig's tracker extension)
* Forgot to localise a couple strings
* A quick blurb to let the user know they can upload multiple files

v0.9.1
* Should work with every upload field and custom field
Expand All @@ -48,7 +50,6 @@ TODO
Currently just skipping and highlighting
-- Repopulate the upload list (or don't delete) if a file fails to upload for whatever reason
-- Add {#} variables or something so a field can change dynamically
-- Notify the user that it's possible to select multiple files
-- Check for html5 support before doing anything
-- Add options for which sections can be mass uploaded

Expand Down

0 comments on commit 296678a

Please sign in to comment.