mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Bug Fix for SF# 2013921 - Movement in Submission Workflow Causes Skipped Steps
THIS PATCH WAS ONLY TESTED ON 1.5.x BRANCH. However, I've updated it for Trunk to hopefully support the new "resource/*" in the URL of the XMLUI submission process. It's untested, as I couldn't get Trunk's XMLUI to work. This changes the Submission workflow to use URLs of the form resource/$/submit/*.continue (where the final part is the continuation id). In addition, the submission process also makes use of Cocoon's Page Local functionality to save the state of individual pages in the submission process. This ensures that if the user clicks the browser "back button", previous state information can be reloaded (so the flow no longer gets confused as to the current state). git-svn-id: http://scm.dspace.org/svn/repo/trunk@3021 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -113,7 +113,7 @@ public class CCLicenseStep extends AbstractSubmissionStep
|
||||
// Build the url to and from creative commons
|
||||
Item item = submission.getItem();
|
||||
Collection collection = submission.getCollection();
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit";
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit/" + knot.getId() + ".continue";
|
||||
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
boolean https = request.isSecure();
|
||||
@@ -177,7 +177,6 @@ public class CCLicenseStep extends AbstractSubmissionStep
|
||||
// add standard control/paging buttons
|
||||
addControlButtons(form);
|
||||
|
||||
onsiteDiv.addHidden("submission-continue").setValue(knot.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -176,7 +176,7 @@ public class DescribeStep extends AbstractSubmissionStep
|
||||
// Obtain the inputs (i.e. metadata fields we are going to display)
|
||||
Item item = submission.getItem();
|
||||
Collection collection = submission.getCollection();
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit";
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit/" + knot.getId() + ".continue";
|
||||
|
||||
DCInputSet inputSet = null;
|
||||
DCInput[] inputs = {};
|
||||
@@ -274,9 +274,6 @@ public class DescribeStep extends AbstractSubmissionStep
|
||||
}
|
||||
}
|
||||
|
||||
div.addHidden("submission-continue").setValue(knot.getId());
|
||||
|
||||
|
||||
// add standard control/paging buttons
|
||||
addControlButtons(form);
|
||||
}
|
||||
|
@@ -140,7 +140,7 @@ public class EditFileStep extends AbstractStep
|
||||
UIException, SQLException, IOException, AuthorizeException
|
||||
{
|
||||
Collection collection = submission.getCollection();
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit";
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit/" + knot.getId() + ".continue";
|
||||
|
||||
// Get the bitstream and all the various formats
|
||||
BitstreamFormat currentFormat = bitstream.getFormat();
|
||||
@@ -220,8 +220,6 @@ public class EditFileStep extends AbstractStep
|
||||
actions.addButton("submit_save").setValue(T_submit_save);
|
||||
actions.addButton("submit_edit_cancel").setValue(T_submit_cancel);
|
||||
|
||||
div.addHidden("submission-continue").setValue(knot.getId());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -124,7 +124,7 @@ public class InitialQuestionsStep extends AbstractSubmissionStep
|
||||
// Get any metadata that may be removed by unselecting one of these options.
|
||||
Item item = submission.getItem();
|
||||
Collection collection = submission.getCollection();
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit";
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit/" + knot.getId() + ".continue";
|
||||
|
||||
DCValue[] titles = item.getDC("title", "alternative", Item.ANY);
|
||||
|
||||
@@ -254,7 +254,6 @@ public class InitialQuestionsStep extends AbstractSubmissionStep
|
||||
//add standard control/paging buttons
|
||||
addControlButtons(form);
|
||||
|
||||
div.addHidden("submission-continue").setValue(knot.getId());
|
||||
//Since we already warn users about the metadata pruning to happen
|
||||
//if they uncheck an already checked box, then
|
||||
//we can let the prune process occur immediately!
|
||||
|
@@ -147,7 +147,7 @@ public class LicenseStep extends AbstractSubmissionStep
|
||||
|
||||
// Get the full text for the actuial licese
|
||||
Collection collection = submission.getCollection();
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit";
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit/" + knot.getId() + ".continue";
|
||||
String licenseText = collection.getLicense();
|
||||
|
||||
Division div = body.addInteractiveDivision("submit-license",actionURL, Division.METHOD_POST,"primary submission");
|
||||
@@ -180,8 +180,6 @@ public class LicenseStep extends AbstractSubmissionStep
|
||||
|
||||
//add standard control/paging buttons
|
||||
addControlButtons(controls);
|
||||
|
||||
div.addHidden("submission-continue").setValue(knot.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -95,7 +95,7 @@ public class ResumeStep extends AbstractStep
|
||||
// Get any metadata that may be removed by unselecting one of these options.
|
||||
Item item = submission.getItem();
|
||||
Collection collection = submission.getCollection();
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit";
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit/" + knot.getId() + ".continue";
|
||||
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
String showfull = request.getParameter("showfull");
|
||||
@@ -129,7 +129,5 @@ public class ResumeStep extends AbstractStep
|
||||
org.dspace.app.xmlui.wing.element.Item actions = form.addItem();
|
||||
actions.addButton("submit_resume").setValue(T_submit_resume);
|
||||
actions.addButton("submit_cancel").setValue(T_submit_cancel);
|
||||
|
||||
div.addHidden("submission-continue").setValue(knot.getId());
|
||||
}
|
||||
}
|
||||
|
@@ -138,7 +138,7 @@ public class ReviewStep extends AbstractSubmissionStep
|
||||
{
|
||||
// Get actionable URL
|
||||
Collection collection = submission.getCollection();
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit";
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit/" + knot.getId() + ".continue";
|
||||
|
||||
SubmissionConfig subConfig = submissionInfo.getSubmissionConfig();
|
||||
|
||||
@@ -217,8 +217,6 @@ public class ReviewStep extends AbstractSubmissionStep
|
||||
// Part C:
|
||||
// add standard control/paging buttons
|
||||
addControlButtons(review);
|
||||
|
||||
div.addHidden("submission-continue").setValue(knot.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -96,7 +96,7 @@ public class SaveOrRemoveStep extends AbstractStep
|
||||
UIException, SQLException, IOException, AuthorizeException
|
||||
{
|
||||
Collection collection = submission.getCollection();
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit";
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit/" + knot.getId() + ".continue";
|
||||
|
||||
Division div = body.addInteractiveDivision("submit-save-or-cancel",actionURL, Division.METHOD_POST,"primary submission");
|
||||
div.setHead(T_submission_head);
|
||||
@@ -112,8 +112,5 @@ public class SaveOrRemoveStep extends AbstractStep
|
||||
org.dspace.app.xmlui.wing.element.Item actions = saveOrCancel.addItem();
|
||||
actions.addButton("submit_save").setValue(T_submit_save);
|
||||
actions.addButton("submit_remove").setValue(T_submit_remove);
|
||||
|
||||
div.addHidden("submission-continue").setValue(knot.getId());
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -107,7 +107,8 @@ public class SelectCollectionStep extends AbstractSubmissionStep
|
||||
try
|
||||
{
|
||||
Collection[] collections; // List of possible collections.
|
||||
ResolvableIdentifier eid = IdentifierService.resolve(context, handle);
|
||||
String actionURL = contextPath + "/submit/" + knot.getId() + ".continue";
|
||||
ResolvableIdentifier eid = IdentifierService.resolve(context, handle);
|
||||
|
||||
DSpaceObject dso = null;
|
||||
if (eid != null)
|
||||
@@ -126,7 +127,7 @@ public class SelectCollectionStep extends AbstractSubmissionStep
|
||||
|
||||
// Basic form with a drop down list of all the collections
|
||||
// you can submit too.
|
||||
Division div = body.addInteractiveDivision("select-collection",contextPath+"/submit",Division.METHOD_POST,"primary submission");
|
||||
Division div = body.addInteractiveDivision("select-collection",actionURL,Division.METHOD_POST,"primary submission");
|
||||
div.setHead(T_submission_head);
|
||||
|
||||
List list = div.addList("select-collection", List.TYPE_FORM);
|
||||
@@ -146,8 +147,6 @@ public class SelectCollectionStep extends AbstractSubmissionStep
|
||||
|
||||
Button submit = list.addItem().addButton("submit");
|
||||
submit.setValue(T_submit_next);
|
||||
|
||||
div.addHidden("submission-continue").setValue(knot.getId());
|
||||
}
|
||||
catch (IdentifierException e)
|
||||
{
|
||||
|
@@ -186,7 +186,7 @@ public class UploadStep extends AbstractSubmissionStep
|
||||
// Get a list of all files in the original bundle
|
||||
Item item = submission.getItem();
|
||||
Collection collection = submission.getCollection();
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit";
|
||||
String actionURL = IdentifierService.getURL(collection).toString() + "/submit/" + knot.getId() + ".continue";
|
||||
boolean workflow = submission instanceof WorkflowItem;
|
||||
Bundle[] bundles = item.getBundles("ORIGINAL");
|
||||
Bitstream[] bitstreams = new Bitstream[0];
|
||||
@@ -324,9 +324,6 @@ public class UploadStep extends AbstractSubmissionStep
|
||||
// Part C:
|
||||
// add standard control/paging buttons
|
||||
addControlButtons(upload);
|
||||
|
||||
div.addHidden("submission-continue").setValue(knot.getId());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -109,22 +109,26 @@
|
||||
|
||||
<!-- Start a new submission, unscoped -->
|
||||
<map:match pattern="submit">
|
||||
<map:match type="request" pattern="submission-continue">
|
||||
<map:call continuation="{1}"/>
|
||||
</map:match>
|
||||
<map:call function="doSubmission"/>
|
||||
</map:match>
|
||||
|
||||
<!-- New Submission's flow -->
|
||||
<!-- Continue creating a new submission, unscoped -->
|
||||
<map:match pattern="submit/*.continue">
|
||||
<map:call continuation="{1}"/>
|
||||
</map:match>
|
||||
|
||||
<!-- Start a new submission to specific collection -->
|
||||
<map:match pattern="resource/$/submit" type="IdentifierMatcher">
|
||||
<map:match type="request" pattern="submission-continue">
|
||||
<map:call continuation="{1}"/>
|
||||
</map:match>
|
||||
<map:call function="doSubmission">
|
||||
<map:parameter name="handle" value="{1}"/>
|
||||
</map:call>
|
||||
</map:match>
|
||||
|
||||
<!-- Continue an existing submission-->
|
||||
<map:match pattern="resource/$/submit/*.continue" type="IdentifierMatcher">
|
||||
<map:call continuation="{2}"/>
|
||||
</map:match>
|
||||
|
||||
<!-- Workflow task "flow" -->
|
||||
<map:match pattern="resource/$/workflow" type="IdentifierMatcher">
|
||||
<map:match type="request" pattern="submission-continue">
|
||||
|
@@ -273,20 +273,26 @@ function doSubmission()
|
||||
* workspaceID - the in progress submission's Workspace ID
|
||||
* stepAndPage - the Step and Page number to start on (e.g. "1.1")
|
||||
*/
|
||||
function submissionControl(collectionHandle, workspaceID, stepAndPage)
|
||||
function submissionControl(collectionHandle, workspaceID, initStepAndPage)
|
||||
{
|
||||
//load initial submission information
|
||||
var submissionInfo = getSubmissionInfo(workspaceID);
|
||||
|
||||
var progressIterator = 0;
|
||||
//Initialize a Cocoon Local Page to save current state information
|
||||
//(This lets us handle when users click the browser "back button"
|
||||
// by caching the state of that previous page, etc.)
|
||||
var state = cocoon.createPageLocal();
|
||||
state.progressIterator = 0; //initialize our progress indicator
|
||||
|
||||
//this is array of all the steps/pages in current submission process
|
||||
//it's used to step back and forth between pages!
|
||||
var stepsInSubmission = getSubmissionSteps(submissionInfo);
|
||||
|
||||
//if we didn't have a page passed in, go to first page in process
|
||||
if(stepAndPage==null)
|
||||
stepAndPage = stepsInSubmission[0];
|
||||
if(initStepAndPage==null)
|
||||
state.stepAndPage = stepsInSubmission[0];
|
||||
else
|
||||
state.stepAndPage = initStepAndPage;
|
||||
|
||||
var response_flag = 0;
|
||||
|
||||
@@ -294,14 +300,14 @@ function submissionControl(collectionHandle, workspaceID, stepAndPage)
|
||||
// Loop forever, exit cases such as save, remove, or completed
|
||||
// will call cocoon.exit() stopping execution.
|
||||
|
||||
cocoon.log.debug("Current step & page=" + stepAndPage, null);
|
||||
cocoon.log.debug("Current step & page=" + state.stepAndPage, null);
|
||||
cocoon.log.debug("Current ERROR Fields=" + getErrorFields(), null);
|
||||
|
||||
//----------------------------------------------------------
|
||||
// #1: Actually load the next page in the process
|
||||
//-----------------------------------------------------------
|
||||
//split out step and page (e.g. 1.2 is page 2 of step 1)
|
||||
var fields = String(stepAndPage).split(".");
|
||||
var fields = String(state.stepAndPage).split(".");
|
||||
var step = fields[0];
|
||||
var page = fields[1];
|
||||
|
||||
@@ -313,7 +319,7 @@ function submissionControl(collectionHandle, workspaceID, stepAndPage)
|
||||
|
||||
//Pass it all the info it needs, including any response/error flags
|
||||
//in case an error occurred
|
||||
response_flag = doNextPage(collectionHandle, workspaceID, stepConfig, stepAndPage, response_flag);
|
||||
response_flag = doNextPage(collectionHandle, workspaceID, stepConfig, state.stepAndPage, response_flag);
|
||||
|
||||
//----------------------------------------------------------
|
||||
// #2: Determine which page/step the user should be sent to next
|
||||
@@ -322,13 +328,13 @@ function submissionControl(collectionHandle, workspaceID, stepAndPage)
|
||||
// Only step forward to next page if no errors on this page
|
||||
if ((cocoon.request.get(AbstractProcessingStep.NEXT_BUTTON) || !stepHasUI(stepConfig)) && (response_flag==AbstractProcessingStep.STATUS_COMPLETE))
|
||||
{
|
||||
progressIterator++;
|
||||
state.progressIterator++;
|
||||
|
||||
var totalSteps = stepsInSubmission.length;
|
||||
var inWorkflow = submissionInfo.isInWorkflow();
|
||||
|
||||
//check if we've completed the submission
|
||||
if(progressIterator >= totalSteps)
|
||||
if(state.progressIterator >= totalSteps)
|
||||
{
|
||||
if(inWorkflow==false)
|
||||
{
|
||||
@@ -344,8 +350,8 @@ function submissionControl(collectionHandle, workspaceID, stepAndPage)
|
||||
}
|
||||
else
|
||||
{
|
||||
stepAndPage = stepsInSubmission[progressIterator];
|
||||
cocoon.log.debug("Next Step & Page=" + stepAndPage);
|
||||
state.stepAndPage = stepsInSubmission[state.progressIterator];
|
||||
cocoon.log.debug("Next Step & Page=" + state.stepAndPage);
|
||||
}
|
||||
}//User clicked "<- Previous" button
|
||||
else if (cocoon.request.get(AbstractProcessingStep.PREVIOUS_BUTTON))
|
||||
@@ -355,13 +361,13 @@ function submissionControl(collectionHandle, workspaceID, stepAndPage)
|
||||
//Need to find the previous step which HAS a user interface.
|
||||
while(stepBack)
|
||||
{
|
||||
progressIterator--;
|
||||
if(progressIterator<0)
|
||||
state.progressIterator--;
|
||||
if(state.progressIterator<0)
|
||||
stepBack = false;
|
||||
|
||||
stepAndPage = stepsInSubmission[progressIterator];
|
||||
state.stepAndPage = stepsInSubmission[state.progressIterator];
|
||||
|
||||
var prevStep = String(stepAndPage).split(".")[0];
|
||||
var prevStep = String(state.stepAndPage).split(".")[0];
|
||||
var prevStepConfig = submissionInfo.getSubmissionConfig().getStep(prevStep);
|
||||
|
||||
if(!stepHasUI(prevStepConfig))
|
||||
@@ -370,7 +376,7 @@ function submissionControl(collectionHandle, workspaceID, stepAndPage)
|
||||
stepBack = false;
|
||||
}
|
||||
|
||||
cocoon.log.debug("Previous Step & Page=" + stepAndPage);
|
||||
cocoon.log.debug("Previous Step & Page=" + state.stepAndPage);
|
||||
}
|
||||
// User clicked "Save/Cancel" Button
|
||||
else if (cocoon.request.get(AbstractProcessingStep.CANCEL_BUTTON))
|
||||
@@ -399,16 +405,16 @@ function submissionControl(collectionHandle, workspaceID, stepAndPage)
|
||||
//only allow a jump to a page user has already been to
|
||||
if (newStepAndPage >= 0 && newStepAndPage <= maxStepAndPage)
|
||||
{
|
||||
stepAndPage = newStepAndPage;
|
||||
state.stepAndPage = newStepAndPage;
|
||||
|
||||
cocoon.log.debug("Jump To Step & Page=" + stepAndPage);
|
||||
cocoon.log.debug("Jump To Step & Page=" + state.stepAndPage);
|
||||
|
||||
//reset progress iterator
|
||||
for(var i=0; i<stepsInSubmission.length; i++)
|
||||
{
|
||||
if(stepAndPage==stepsInSubmission[i])
|
||||
if(state.stepAndPage==stepsInSubmission[i])
|
||||
{
|
||||
progressIterator = i;
|
||||
state.progressIterator = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user