From 2eb6d18edf6e04fe696e0c35e287b83f15c9f060 Mon Sep 17 00:00:00 2001 From: rkv Date: Mon, 14 Jan 2013 08:01:07 +0000 Subject: [PATCH] Fix for mantis #0022067: Drop-down list of the type of imported document not conform to specification (SC09): The user being not supposed creating new document types on the fly, the Document type drop-down list should only include the existing types. --- .../Siman/WebContent/study/importDocument.jsp | 209 ++++++++---------- .../org/splat/simer/ApplicationSettings.java | 46 ++-- .../org/splat/simer/ImportDocumentAction.java | 29 ++- 3 files changed, 140 insertions(+), 144 deletions(-) diff --git a/Workspace/Siman/WebContent/study/importDocument.jsp b/Workspace/Siman/WebContent/study/importDocument.jsp index f310622..957a23b 100644 --- a/Workspace/Siman/WebContent/study/importDocument.jsp +++ b/Workspace/Siman/WebContent/study/importDocument.jsp @@ -1,122 +1,99 @@ <%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1" -%> -<%@ - taglib prefix="s" uri="/struts-tags" -%> - - - - - rel="stylesheet" type="text/css"> - - - + pageEncoding="ISO-8859-1"%> +<%@ taglib prefix="s" uri="/struts-tags"%> + -
-
-
- - - - - -
- - - -
+
+
+
+ + + + + + + +
+ + + +
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   
- - - - - -   - - - - - - " /> -
:
" checked>
- "/>  - - "/> - -
- -
-
- - \ No newline at end of file +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
   
+ +   + + " + />
:
" checked>
" /> " />
+ +
+
diff --git a/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java b/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java index 7f9e308..d2bbd28 100644 --- a/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java +++ b/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java @@ -394,59 +394,59 @@ public class ApplicationSettings { /** * Accept the document. */ - accept, + accept, /** * Approve the document. */ - approve, + approve, /** * Promote the document. */ - promote, + promote, /** * Demote the docuemnt. */ - demote, + demote, /** * Undo the last operation. */ - undo, + undo, /** * Rename the document. */ - rename, + rename, /** * Attach a file to the document. */ - attach, + attach, /** * Edit the document. */ - edit, + edit, /** * script */ - script, + script, /** * Version the document. */ - version, + version, /** * replace */ - replace, + replace, /** * export */ - export, + export, /** * Remove the document. */ - remove, + remove, /** * purge */ - purge, + purge, /** * Mark the study as reference. */ @@ -459,9 +459,9 @@ public class ApplicationSettings { private EditableStudyPopup() { super(); - addItem(MNU_MARK_AS_REFERENCE, new PopupItem(MNU_NAME_MARK_AS_REFERENCE) - .action(ACT_NOT_YET_IMPLEMENTED).confirmation( - "message.markasreference.study")); + addItem(MNU_MARK_AS_REFERENCE, new PopupItem( + MNU_NAME_MARK_AS_REFERENCE).action(ACT_NOT_YET_IMPLEMENTED) + .confirmation("message.markasreference.study")); addItem(MNU_PUBLISH, new PopupItem(MNU_NAME_PUBLISH).icon( "image.publish.png").action("edit-study?action=publish") .confirmation("message.publish.study")); @@ -484,8 +484,9 @@ public class ApplicationSettings { "message.delete.study")); } - /** + /** * {@inheritDoc} + * * @see org.splat.wapp.ContextualMenu#isEnabled(java.lang.String) */ @Override @@ -1095,6 +1096,15 @@ public class ApplicationSettings { return convertmap.get(format + type.getName()); // May be null; } + /** + * Get default document type for the given format on the given study step. + * + * @param step + * the study step + * @param format + * the file format + * @return default document type or null if not defined in the configuration + */ public DocumentType getDefaultDocumentType(final Step step, final String format) { return getProjectSettings().getDefaultDocumentType(step.getStep(), diff --git a/Workspace/Siman/src/org/splat/simer/ImportDocumentAction.java b/Workspace/Siman/src/org/splat/simer/ImportDocumentAction.java index c5db79e..faf4dfe 100644 --- a/Workspace/Siman/src/org/splat/simer/ImportDocumentAction.java +++ b/Workspace/Siman/src/org/splat/simer/ImportDocumentAction.java @@ -93,8 +93,9 @@ public class ImportDocumentAction extends UploadBaseNextAction { } else { setToolProperty(Constants.NONE); } - initializationFullScreenContext(Constants.STUDY_MENU, Constants.STUDY_MENU, - Constants.FALSE, getToolProperty(), Constants.STUDY_MENU); + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.FALSE, getToolProperty(), + Constants.STUDY_MENU); User user = getConnectedUser(); File updir = getRepositoryService().getDownloadDirectory(user); @@ -105,7 +106,11 @@ public class ImportDocumentAction extends UploadBaseNextAction { mystudy = getOpenStudy(); Step step = mystudy.getSelectedStep(); _documentTypes = getStepService().getValidDocumentTypes(step); + // Set the document type by default deftype = getApplicationSettings().getDefaultDocumentType(step, filext); + if (deftype != null) { + setDefaultDocumentType(Long.toString(deftype.getIndex())); + } defuses = new ArrayList(); state = ProgressState.inWORK; @@ -241,8 +246,9 @@ public class ImportDocumentAction extends UploadBaseNextAction { private void setError(final String errorCode) { setErrorCode(errorCode); - initializationFullScreenContext(Constants.STUDY_MENU, Constants.STUDY_MENU, - Constants.FALSE, Constants.NONE, Constants.STUDY_MENU); + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.FALSE, Constants.NONE, + Constants.STUDY_MENU); } /** @@ -261,8 +267,9 @@ public class ImportDocumentAction extends UploadBaseNextAction { if (_documentType == 0) { setErrorCode("message.error.import.type"); - initializationFullScreenContext(Constants.STUDY_MENU, Constants.STUDY_MENU, - Constants.TRUE, Constants.NONE, Constants.STUDY_MENU); + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, Constants.NONE, + Constants.STUDY_MENU); return ERROR; } @@ -288,8 +295,9 @@ public class ImportDocumentAction extends UploadBaseNextAction { } } if (LOG.isDebugEnabled()) { - LOG.debug("Document to be imported uses documents with following ids:"); - for (Long usesId: uses) { + LOG + .debug("Document to be imported uses documents with following ids:"); + for (Long usesId : uses) { LOG.debug("#" + usesId); } } @@ -318,8 +326,9 @@ public class ImportDocumentAction extends UploadBaseNextAction { setErrorCode("message.error.internal"); } - initializationFullScreenContext(Constants.STUDY_MENU, Constants.STUDY_MENU, - Constants.TRUE, Constants.NONE, Constants.STUDY_MENU); + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, Constants.NONE, + Constants.STUDY_MENU); return ERROR; } -- 2.30.2