updating edit request dispatch controller to utilize edit configuration generator from session if it exists
This commit is contained in:
parent
1d880ea29d
commit
4c4334d6f4
1 changed files with 19 additions and 6 deletions
|
@ -155,13 +155,26 @@ public class EditRequestDispatchController extends FreemarkerHttpServlet {
|
||||||
private EditConfigurationVTwo setupEditConfiguration(String editConfGeneratorName,
|
private EditConfigurationVTwo setupEditConfiguration(String editConfGeneratorName,
|
||||||
VitroRequest vreq) throws Exception {
|
VitroRequest vreq) throws Exception {
|
||||||
HttpSession session = vreq.getSession();
|
HttpSession session = vreq.getSession();
|
||||||
EditConfigurationVTwo editConfig =
|
//Originally, this code called makeEditConfiguration before checking for/setting the edit key
|
||||||
makeEditConfigurationVTwo( editConfGeneratorName, vreq, session);
|
//which meant that in the case of page reload on an error, you would recreate an edit configuration
|
||||||
|
//using the generator
|
||||||
|
//Given recent updates enabling modification of edit configuration dynamically through AJAX,
|
||||||
|
//we will first check whether the edit key exists and if there is already an edit configuration
|
||||||
|
//in the session - and then will utilize the edit configuration that already exists
|
||||||
//edit key is set here, NOT in the generator class
|
//edit key is set here, NOT in the generator class
|
||||||
|
EditConfigurationVTwo editConfig = null;
|
||||||
|
EditConfigurationVTwo existingConfig = EditConfigurationVTwo.getConfigFromSession(session, vreq);
|
||||||
|
if(existingConfig != null) {
|
||||||
|
editConfig = existingConfig;
|
||||||
|
} else {
|
||||||
|
editConfig =
|
||||||
|
makeEditConfigurationVTwo( editConfGeneratorName, vreq, session);
|
||||||
|
}
|
||||||
|
|
||||||
String editKey = EditConfigurationUtils.getEditKey(vreq);
|
String editKey = EditConfigurationUtils.getEditKey(vreq);
|
||||||
editConfig.setEditKey(editKey);
|
editConfig.setEditKey(editKey);
|
||||||
|
|
||||||
|
|
||||||
//put edit configuration in session so it can be accessed on form submit.
|
//put edit configuration in session so it can be accessed on form submit.
|
||||||
EditConfigurationVTwo.putConfigInSession(editConfig, session);
|
EditConfigurationVTwo.putConfigInSession(editConfig, session);
|
||||||
return editConfig;
|
return editConfig;
|
||||||
|
|
Loading…
Add table
Reference in a new issue