diff --git a/src/main/webapp/scripts/uploaders/AutomationBasedUploader.js b/src/main/webapp/scripts/uploaders/AutomationBasedUploader.js index 77b4dd7cb1a981747ba8fa801891aaddf6900e2c..8e593ec50c7af1d4515eff3da2637891a6987875 100644 --- a/src/main/webapp/scripts/uploaders/AutomationBasedUploader.js +++ b/src/main/webapp/scripts/uploaders/AutomationBasedUploader.js @@ -270,8 +270,12 @@ XNAT.app.abu.eventHandlerChange = function(){ var eventHandler = $('#eventHandlerSelect').val(); if (typeof eventHandler === 'undefined' || eventHandler == null || eventHandler.length<1 && ($("#handlerDefaultOption").html() == 'NONE DEFINED' || $("#handlerDefaultOption").html() == 'SELECT')) { $("#abu-process-button").addClass("abu-button-disabled"); + //$("#abu-process-button-text").html(" "); + $("#abu-process-button").css("visibility","hidden"); } else if ((XNAT.app.abu.usageSelect=='Launch') || (abu._fileUploader._uploadStarted && abu._fileUploader._filesInProgress<1)) { $("#abu-process-button").removeClass("abu-button-disabled"); + //$("#abu-process-button-text").html(" "); + $("#abu-process-button").css("visibility","visible"); } XNAT.app.abu.filesProcessed = false; } @@ -411,7 +415,7 @@ XNAT.app.abu.populateEventHandlerSelect = function(){ if ($('#eventHandlerSelect').find('option').length==1) { $('#handlerDefaultOption').html('NONE DEFINED'); } else if ($('#eventHandlerSelect').find('option').length==2) { - $('#eventHandlerSelect').find('option').get(0).remove(); + $($('#eventHandlerSelect').find('option').get(0)).remove(); } } else { $('#eventHandlerSelect').append('<option value="">NONE DEFINED</option>'); @@ -591,6 +595,8 @@ XNAT.app.abu.initializeAbuUploader = function(usageType){ var eventHandler = $('#eventHandlerSelect').val(); if (typeof eventHandler !== 'undefined' && eventHandler != null && eventHandler.length>0) { $("#abu-process-button").removeClass("abu-button-disabled"); + $("#abu-process-button-text").html("Process Files"); + $("#abu-process-button").css("visibility","visible"); } else { $("#abu-done-button-text").html("Done"); $("#abu-done-button").removeClass("abu-button-disabled"); @@ -615,6 +621,7 @@ XNAT.app.abu.initializeAbuUploader = function(usageType){ var eventHandler = $('#eventHandlerSelect').val(); if (eventHandler != undefined && eventHandler != null && eventHandler.length>0) { $("#abu-process-button").removeClass("abu-button-disabled"); + $("#abu-process-button").css("visibility","visible"); } else { $("#abu-done-button").removeClass("abu-button-disabled"); $("#abu-done-button-text").html("Done"); @@ -628,6 +635,8 @@ XNAT.app.abu.initializeAbuUploader = function(usageType){ $("#abu-done-button-text").html("Cancel"); if ($('#eventHandlerSelect option').size()>1 && $('#eventHandlerSelect').val()=="") { $("#abu-process-button").addClass("abu-button-disabled"); + //$("#abu-process-button-text").html(" "); + $("#abu-process-button").css("visibility","hidden"); } $("#file-uploader-instructions-sel").css("display","none"); } else { @@ -637,6 +646,8 @@ XNAT.app.abu.initializeAbuUploader = function(usageType){ abu._fileUploader.DRAG_AND_DROP_ON = false; } $("#abu-process-button").addClass("abu-button-disabled"); + //$("#abu-process-button-text").html(" "); + $("#abu-process-button").css("visibility","hidden"); $(".upload-area").css("display","none"); $(".eventhandler-area").css("display","none"); } @@ -662,8 +673,9 @@ XNAT.app.abu.usageSelectAction = function(){ $("#abu-upload-button").removeClass("abu-button-disabled"); abu._fileUploader.DRAG_AND_DROP_ON = true; $("#abu-process-button").addClass("abu-button-disabled"); + //$("#abu-process-button-text").html(" "); + $("#abu-process-button").css("visibility","hidden"); $("#script-select-text").html("Post-upload processing script:"); - $("#abu-process-button-text").html("Process files"); $("#resourceSelect").prop('disabled',false); $(".response_text").html(''); } else if (XNAT.app.abu.usageSelect=='Launch') { @@ -674,6 +686,7 @@ XNAT.app.abu.usageSelectAction = function(){ var eventHandler = $('#eventHandlerSelect').val(); if (eventHandler != undefined && eventHandler != null && eventHandler.length>0) { $("#abu-process-button").removeClass("abu-button-disabled"); + $("#abu-process-button").css("visibility","visible"); } $("#script-select-text").html("Script to launch:"); $("#abu-process-button-text").html("Run script"); @@ -716,6 +729,8 @@ XNAT.app.abu.whatToDoChange = function(){ $('#eventHandlerSelect').val(launchSelect); if (typeof abu !== 'undefined' && abu._fileUploader.uploadsStarted>0 && abu._fileUploader.uploadsInProgress==0) { $("#abu-process-button").removeClass("abu-button-disabled"); + $("#abu-process-button-text").html("Process files"); + $("#abu-process-button").css("visibility","visible"); } if (XNAT.app.abu.usageSelect == 'Upload' && $('#whatToDoSelect option').size()>1 && $('#whatToDoSelect').val()=="") { $("#abu-upload-button").addClass("abu-button-disabled"); @@ -903,9 +918,9 @@ XNAT.app.abu.processFiles=function() { ((this.paramsToPass.length>0) ? "Please supply values for the following parameters:" : "Please supply a value for the following parameter:") + ' </h3><div style="width:100px"><table>' + paramText + "</table>"); // Not sure why the setTimeout seems necessary. - $(".passParamInput").get(0).focus(); + $($(".passParamInput").get(0)).focus(); setTimeout(function(){ - $(".passParamInput").get(0).focus(); + $($(".passParamInput").get(0)).focus(); },100); } else { diff --git a/src/main/webapp/scripts/uploaders/fileuploader.js b/src/main/webapp/scripts/uploaders/fileuploader.js index e47a44d348a4c7b90d5d5d876c0db24978673f2e..c00698bc354151bc9f30a0f83551af2c6e58f928 100644 --- a/src/main/webapp/scripts/uploaders/fileuploader.js +++ b/src/main/webapp/scripts/uploaders/fileuploader.js @@ -27,7 +27,7 @@ abu.FileUploader = function(o){ $(this._options.element).append( '<div class="abu-uploader">' + '<div id="abu-files-processing" class="abu-files-processing"> Processing...... </div>' + - '<a id="file-uploader-instructions-sel" class="abu-uploader-instructions-sel" onclick="abu._fileUploader.uploaderHelp()">Click here for help.</a>' + + '<a id="file-uploader-instructions-sel" class="abu-uploader-instructions-sel" onclick="abu._fileUploader.uploaderHelp()">?</a>' + '<div class="abu-upload-drop-area" style="display: none;"><span>Drop files here to upload</span></div>' + '<div class="abu-xnat-interactivity-area">' + '</div>' + @@ -96,14 +96,35 @@ abu.FileUploader = function(o){ }); if (this.ALLOW_DRAG_AND_DROP) { + $(".abu-upload-drop-area").on('dragleave',function(e) { + if (this.DRAG_AND_DROP_ON) { + this.showDrag = false; + if (typeof this.timeout !== "undefined") { + clearTimeout( this.timeout ); + } + this.timeout = setTimeout( function(){ + if( !this.showDrag ){ + $(".abu-upload-drop-area").css('display','none'); + $(".abu-upload-drop-area").removeClass('abu-upload-drop-area-active'); + try { + e.preventDefault(); + e.stopPropogation(); + } catch(e) { /* Do nothing */ } + } + }.bind(this), 200 ).bind(this); + } + }.bind(this) + ); $(".abu-upload-drop-area").on('dragover',function(e) { if (this.DRAG_AND_DROP_ON) { + this.showDrag = true; this.activateUploadArea(e); } }.bind(this) ); $(".abu-upload-drop-area").on('dragenter',function(e) { if (this.DRAG_AND_DROP_ON) { + this.showDrag = true; this.activateUploadArea(e); } }.bind(this) @@ -120,14 +141,35 @@ abu.FileUploader = function(o){ } }.bind(this) ); + $(this._options.element).on('dragleave',function(e) { + if (this.DRAG_AND_DROP_ON) { + this.showDrag = false; + if (typeof this.timeout !== "undefined") { + clearTimeout( this.timeout ); + } + this.timeout = setTimeout( function(){ + if( !this.showDrag ){ + $(".abu-upload-drop-area").css('display','none'); + $(".abu-upload-drop-area").removeClass('abu-upload-drop-area-active'); + try { + e.preventDefault(); + e.stopPropogation(); + } catch(e) { /* Do nothing */ } + } + }.bind(this), 200 ).bind(this); + } + }.bind(this) + ).bind(this); $(this._options.element).on('dragover',function(e) { if (this.DRAG_AND_DROP_ON) { + this.showDrag = true; this.activateUploadArea(e); } }.bind(this) ).bind(this); $(this._options.element).on('dragenter',function(e) { if (this.DRAG_AND_DROP_ON) { + this.showDrag = true; this.activateUploadArea(e); } }.bind(this) @@ -145,9 +187,10 @@ abu.FileUploader = function(o){ this.processingComplete = function() { $("#abu-done-button-text").html("Done"); - //$("#abu-process-button").css("display","None"); //$("#abu-upload-button").css("display","None"); $("#abu-process-button").addClass("abu-button-disabled"); + //$("#abu-process-button-text").html(" "); + $("#abu-process-button").css("visibility","hidden"); $("#abu-upload-button").addClass("abu-button-disabled"); $("#abu-files-processing").css("display","None"); } @@ -292,14 +335,16 @@ abu.FileUploader = function(o){ '<div id="file-uploader-instructions" class="abu-uploader-instructions">' + '<h3>Instructions</h3>' + '<ul>' + - '<li>To upload, click the <b>Upload Files</b> button or drag files into the space below the buttons. (Drag-and-drop is supported in FF, Chrome.)</li>' + + ((this.ALLOW_DRAG_AND_DROP) ? + '<li>To upload, click the <b>Upload Files</b> button or drag files into the space below the buttons. (Drag-and-drop is supported in FF, Chrome.)</li>' : + '<li>To upload, click the <b>Upload Files</b> to begin selection of files for upload.</li>') + ((this._options.maxFiles == 1) ? '<li>This uploader supports only a single file upload</li>' : '<li>Multiple files may be selected</li>' ) + '<li>Uploads will begin automatically</li>' + '<li>Upload of directories is not supported</li>' + - '<li>When finished uploading, press <b>Process Files</b> to process the uploaded files</li>' + + '<li>When finished uploading, press <b>Done</b> to close the modal, or, if an automation script is to be launched by this upload process, press <b>Process Files</b> to process the uploaded files.</li>' + '</ul>' + '</div>'; xmodal.message("Uploader Instructions",templateV, undefined, {height:"400px",width:"800px"}); diff --git a/src/main/webapp/style/uploaders/fileuploader.css b/src/main/webapp/style/uploaders/fileuploader.css index 9d74966143518c36c510c409035f0160c92ecf98..fe323e24d1c0f126c3b975e2cfaea3ff59b3d952 100644 --- a/src/main/webapp/style/uploaders/fileuploader.css +++ b/src/main/webapp/style/uploaders/fileuploader.css @@ -85,13 +85,14 @@ div.abu-xnat-interactivity-area-sub { .abu-upload-duplicate {display:inline;color:#008800} .abu-upload-duplicate.abu-upload-duplicate-text {display:inline;color:#008800} -.abu-uploader-instructions-sel {margin-bottom:0px; margin-right:10px; display:inline; width:100%; float:right; background-color:#CCCCCC; border-color:#1A75BB; color:#1A75BB; border-style:solid; border-width:1px; border-color:#1A75BB; font-size:14px; font-weight: bold; padding:2px; } +.abu-uploader-instructions-sel {margin-bottom:0px; margin-right:10px; display:inline; float:right; background-color:#CCCCCC; border-style:solid; border-width:1px; width:auto; font-size:14px; font-weight: bold; padding:2px; } + .abu-uploader-instructions {margin-bottom:10px; display:inline} .abu-return-floatmessage {position:absolute;z-index:10001;width:auto;cursor:pointer;background-color:#FFFFCC; } .abu-return-message {width:auto;cursor:pointer;background-color:#FFFFCC; } -.abu-options-div { position: relative; float: left; width: 430px; margin-left: 10px; } +.abu-options-div { position: relative; float: left; width: 420px; margin-left: 10px; } .abu-options-cb { display:block; /* or inline-block */ width: auto; padding: 7px 0; text-align:center; margin-left:10px; float:left; padding-top: 0px; padding-bottom: 0px;