Fix misuse of previous button to avoid file upload when required (noted by lap82)

This commit is contained in:
Andrea Bollini
2013-11-25 14:38:00 +01:00
parent c4c5ff57c0
commit 4fafcdfb52
4 changed files with 12 additions and 22 deletions

View File

@@ -151,16 +151,10 @@ public class UploadStep extends AbstractProcessingStep
}
}
if (buttonPressed.startsWith(PREVIOUS_BUTTON)
|| buttonPressed.startsWith(CANCEL_BUTTON))
{
// always allow the user to go back or suspend the submission
return STATUS_COMPLETE;
}
// if user pressed jump-to button in process bar,
// return success (so that jump will occur)
if (buttonPressed.startsWith(PROGRESS_BAR_PREFIX))
if (buttonPressed.startsWith(PROGRESS_BAR_PREFIX) ||
buttonPressed.startsWith(PREVIOUS_BUTTON))
{
// check if a file is required to be uploaded
if (fileRequired && !item.hasUploadedFiles())

View File

@@ -19,7 +19,6 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.time.DateUtils;
import org.apache.log4j.Logger;
import org.dspace.app.util.SubmissionInfo;
import org.dspace.app.util.Util;
import org.dspace.authorize.AuthorizeException;
@@ -116,16 +115,10 @@ public class UploadWithEmbargoStep extends UploadStep
}
}
if (buttonPressed.startsWith(PREVIOUS_BUTTON)
|| buttonPressed.startsWith(CANCEL_BUTTON))
{
// always allow the user to go back or suspend the submission
return STATUS_COMPLETE;
}
// if user pressed jump-to button in process bar,
// return success (so that jump will occur)
if (buttonPressed.startsWith(PROGRESS_BAR_PREFIX))
if (buttonPressed.startsWith(PROGRESS_BAR_PREFIX) ||
buttonPressed.startsWith(PREVIOUS_BUTTON))
{
// check if a file is required to be uploaded
if (fileRequired && !item.hasUploadedFiles())

View File

@@ -531,7 +531,7 @@ public class SubmissionController extends DSpaceServlet
if (!subInfo.isInWorkflow())
{
stepAndPageReached = Float.parseFloat(getStepReached(subInfo)+"."+JSPStepManager.getPageReached(subInfo));
stepAndPageReached = Double.parseDouble(getStepReached(subInfo)+"."+JSPStepManager.getPageReached(subInfo));
}
if (result != AbstractProcessingStep.STATUS_COMPLETE && currStepAndPage != stepAndPageReached)
@@ -688,14 +688,13 @@ public class SubmissionController extends DSpaceServlet
int currStep = currentStepConfig.getStepNumber();
int currPage = AbstractProcessingStep.getCurrentPage(request);
double currStepAndPage = Float
.parseFloat(currStep + "." + currPage);
double currStepAndPage = Double.parseDouble(currStep + "." + currPage);
// default value if we are in workflow
double stepAndPageReached = -1;
if (!subInfo.isInWorkflow())
{
stepAndPageReached = Float.parseFloat(getStepReached(subInfo)+"."+JSPStepManager.getPageReached(subInfo));
stepAndPageReached = Double.parseDouble(getStepReached(subInfo)+"."+JSPStepManager.getPageReached(subInfo));
}
if (result != AbstractProcessingStep.STATUS_COMPLETE

View File

@@ -171,11 +171,15 @@
.on('click', function(e){
if ($('#tfile').val() != null && $('#tfile').val() != '') {
$('#uploadForm').attr('target','uploadFormIFrame');
initProgressBar($);
initProgressBar($);
setTimeout(function() {
monitorProgressJSON($);
}, 100);
}
else
{
$('#ajaxUpload').val(false);
}
$('#uploadFormIFrame').on('load',function(){
var resultFile = null;
try {