String submitButton = Util.getSubmitButton(request, "submit_cancel");
//Check if our user has pressed cancel
if(submitButton.equals("submit_cancel")){
//Send us back to the submissions page
return new ActionResult(ActionResult.TYPE.TYPE_CANCEL);
}else
if(submitButton.equals("submit_search")){
//Perform the search
String query = request.getParameter("query");
int page = Util.getIntParameter(request, "result-page");
if(page == -1){
page = 0;
}
int resultCount = EPerson.searchResultCount(c, query);
EPerson[] epeople = EPerson.search(c, query, page*RESULTS_PER_PAGE, RESULTS_PER_PAGE);
request.setAttribute("eperson-result-count", resultCount);
request.setAttribute("eperson-results", epeople);
request.setAttribute("result-page", page);
request.setAttribute("page", SEARCH_RESULTS_PAGE);
return new ActionResult(ActionResult.TYPE.TYPE_PAGE, SEARCH_RESULTS_PAGE);
}else
if(submitButton.startsWith("submit_select_reviewer_")){
//Retrieve the identifier of the eperson which will do the reviewing
int reviewerId = Integer.parseInt(submitButton.substring(submitButton.lastIndexOf("_") + 1));
EPerson reviewer = EPerson.find(c, reviewerId);
//We have a reviewer, assign him, the workflowitemrole will be translated into a task in the autoassign
WorkflowItemRole workflowItemRole = WorkflowItemRole.create(c);
workflowItemRole.setEPerson(reviewer);
workflowItemRole.setRoleId(getRoleId());
workflowItemRole.setWorkflowItemId(wfi.getID());
workflowItemRole.update();
return new ActionResult(ActionResult.TYPE.TYPE_OUTCOME, ActionResult.OUTCOME_COMPLETE);
}
//There are only 2 active buttons on this page, so if anything else happens just return an error
return new ActionResult(ActionResult.TYPE.TYPE_ERROR);
}