]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Edit/Delete of the description/comments functionalities are implemented
authormka <mka@opencascade.com>
Tue, 5 Mar 2013 13:21:25 +0000 (13:21 +0000)
committermka <mka@opencascade.com>
Tue, 5 Mar 2013 13:21:25 +0000 (13:21 +0000)
25 files changed:
Workspace/Siman-Common/src/org/splat/dal/bo/kernel/Any.java
Workspace/Siman-Common/src/org/splat/log/AppLogger.java
Workspace/Siman-Common/src/org/splat/service/StepService.java
Workspace/Siman-Common/src/org/splat/service/StepServiceImpl.java
Workspace/Siman-Common/src/org/splat/service/StudyService.java
Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java
Workspace/Siman-Common/src/org/splat/service/dto/StepCommentDTO.java
Workspace/Siman-Common/src/test/splat/service/TestStepService.java
Workspace/Siman-Common/src/test/splat/service/TestStudyService.java
Workspace/Siman/WebContent/WEB-INF/tiles/tiles-defs.xml
Workspace/Siman/WebContent/js/action.js
Workspace/Siman/WebContent/jsp/commentPane.jsp
Workspace/Siman/WebContent/jsp/descriptionPane.jsp
Workspace/Siman/WebContent/jsp/menupopup.jsp
Workspace/Siman/WebContent/jsp/readComment.jsp
Workspace/Siman/WebContent/jsp/readDescription.jsp
Workspace/Siman/src/labels.properties
Workspace/Siman/src/labels_en.properties
Workspace/Siman/src/org/splat/simer/ApplicationSettings.java
Workspace/Siman/src/org/splat/simer/DisplayStudyStepAction.java
Workspace/Siman/src/org/splat/simer/EditStepCommentAction.java
Workspace/Siman/src/org/splat/simer/EditStudyDescriptionAction.java [new file with mode: 0644]
Workspace/Siman/src/org/splat/simer/ExceptionAction.java
Workspace/Siman/src/spring/applicationContext.xml
Workspace/Siman/src/struts.xml

index faba8598d35d2ff4a70ed0337aed0a965e0f29c1..c84935c09a2ef227b0d3e07d9174097d38acfeb4 100644 (file)
@@ -58,7 +58,7 @@ public abstract class Any extends Persistent {
 //  Protected services
 //  ==============================================================================================================================
 
-    protected boolean removeAttribute (Attribute field) {
+    public boolean removeAttribute (Attribute field) {
       for (Iterator<Attribute> i=getAttributes().iterator(); i.hasNext(); ) {
         if (!i.next().equals(field)) continue;
        i.remove();
index 7349f4a728c17846d31f3797a088085b017f1457..ec9bbd3887b5f9ed70092b77aed23fd5f087db8c 100644 (file)
@@ -225,7 +225,7 @@ public class AppLogger {
         * @param exception the exception which originated the message
         * @param message the message
         */
-       public void debug(final String message, final Exception exception) {
+       public void debug(final String message, final Throwable exception) {
                _logger.debug(message, exception);
        }
 
index 1576adb3a82dde7ab577c74acdf3022e5891d89c..c196d3da94f356122d68de2b0045275d161ecb11 100644 (file)
@@ -28,14 +28,14 @@ import org.splat.som.Step;
 
 /**
  * Step service interface.
- * 
+ *
  * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
  */
 public interface StepService {
 
        /**
         * Create a new document published in the given study step.
-        * 
+        *
         * @param aStep
         *            the target study step
         * @param dprop
@@ -56,7 +56,7 @@ public interface StepService {
 
        /**
         * Publish an existing document in the given study step.
-        * 
+        *
         * @param aStep
         *            the target study step
         * @param dprop
@@ -75,7 +75,7 @@ public interface StepService {
 
        /**
         * Create a new version of a document in the given study step.
-        * 
+        *
         * @param aStep
         *            the study step
         * @param base
@@ -101,7 +101,7 @@ public interface StepService {
 
        /**
         * Add simulation context to the study step.
-        * 
+        *
         * @param aStep
         *            the study step
         * @param dprop
@@ -120,7 +120,7 @@ public interface StepService {
 
        /**
         * Add simulation context to the study step.
-        * 
+        *
         * @param firstStep
         *            the study step
         * @param context
@@ -132,7 +132,7 @@ public interface StepService {
 
        /**
         * Remove a simulation context from the study step.
-        * 
+        *
         * @param aStep
         *            the study step
         * @param context
@@ -143,7 +143,7 @@ public interface StepService {
 
        /**
         * Add a document publication to the given step.
-        * 
+        *
         * @param aStep
         *            the target study step
         * @param newdoc
@@ -154,7 +154,7 @@ public interface StepService {
 
        /**
         * Remove a document publication from the given step.
-        * 
+        *
         * @param aStep
         *            the study step
         * @param oldoc
@@ -179,7 +179,7 @@ public interface StepService {
 
        /**
         * Get document types which are applicable for the given study step (activity).
-        * 
+        *
         * @param aStep
         *            the study step
         * @return the list of document types
@@ -210,4 +210,36 @@ public interface StepService {
         *                        if the owner of the step is not found in the database.
         */
        List<StepCommentDTO> getStepComments(final Step step) throws InvalidParameterException;
+       
+       /**
+        * Removes the comment with given id from the database.
+        *
+        * @param commentId
+        *            the comment id
+        * @throws InvalidParameterException
+        *                        if the comment is not found in the database.
+        */
+        void removeStepComment(final long commentId) throws InvalidParameterException;
+        
+
+       /**
+        * Checks if a given comment was made by a given user.
+        * @param commentId the comment id
+        * @param userId the user id
+        * @return if the comment was made by the user
+        * @throws InvalidParameterException if the comment with such id does not exist.
+        */
+       boolean isCommentMadeByUser(final long commentId, final long userId) throws InvalidParameterException;
+       
+       
+       /**
+        * Edit value and title of a comment.
+        * If value or title is null - no changes will be applied to this field.
+        * @param commentId the comment id
+        * @param newValue the new comment value
+        * @param newTitle the new comment title
+        * @throws InvalidParameterException if the comment with such id does not exist.
+        */
+       void editStepComment(final long commentId, final String newValue, final String newTitle)
+                       throws InvalidParameterException;
 }
index af8ffcb90112268733c14743203b04d3f23f9c81..9e94849f9ffb93169ff9266b9c90f2a3a089075c 100644 (file)
@@ -58,7 +58,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 /**
  * Step service implementation.
- * 
+ *
  * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
  */
 public class StepServiceImpl implements StepService {
@@ -126,11 +126,11 @@ public class StepServiceImpl implements StepService {
         * Injected user DAO.
         */
        private UserDAO _userDAO;
-       
-       
+
+
        /**
         * {@inheritDoc}
-        * 
+        *
         * @see org.splat.service.StepService#addSimulationContext(org.splat.som.Step, org.splat.dal.bo.som.SimulationContext.Properties)
         */
        @Override
@@ -145,7 +145,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * {@inheritDoc}
-        * 
+        *
         * @see org.splat.service.StepService#addSimulationContext(org.splat.som.Step, org.splat.dal.bo.som.SimulationContext)
         */
        @Override
@@ -178,7 +178,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Update lucene index of knowledge elements of a scenario or a study which the given step is related to.
-        * 
+        *
         * @param aStep
         *            the step (activity)
         */
@@ -208,7 +208,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Update lucene index for knowledge elements of the scenario.
-        * 
+        *
         * @param scene
         *            the scenario
         * @throws IOException
@@ -231,7 +231,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * {@inheritDoc}
-        * 
+        *
         * @see org.splat.service.StepService#removeSimulationContext(org.splat.som.Step, org.splat.dal.bo.som.SimulationContext)
         */
        @Override
@@ -258,7 +258,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * {@inheritDoc}
-        * 
+        *
         * @see org.splat.service.StepService#createDocument(org.splat.som.Step, org.splat.dal.bo.som.Document.Properties)
         */
        @Override
@@ -294,7 +294,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * {@inheritDoc}
-        * 
+        *
         * @see org.splat.service.StepService#assignDocument(org.splat.som.Step, org.splat.dal.bo.som.Document.Properties)
         */
        @Override
@@ -317,7 +317,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Create a new version of a document in the given study step.
-        * 
+        *
         * @param aStep
         *            the study step
         * @param base
@@ -342,7 +342,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Create a new version of a document in the given study step.
-        * 
+        *
         * @param aStep
         *            the study step
         * @param base
@@ -371,7 +371,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Create a new version of a document in the given study step.
-        * 
+        *
         * @param aStep
         *            the study step
         * @param base
@@ -445,7 +445,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Get document types which are applicable for the given study step (activity).
-        * 
+        *
         * @param aStep
         *            the study step
         * @return the list of document types
@@ -457,7 +457,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Add a document publication to the given step.
-        * 
+        *
         * @param aStep
         *            the target study step
         * @param newdoc
@@ -478,7 +478,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Remove a document publication from the given step.
-        * 
+        *
         * @param aStep
         *            the study step
         * @param oldoc
@@ -558,8 +558,10 @@ public class StepServiceImpl implements StepService {
                        }
                }
                return res;
+
+
        }
-       
+
        /**
         * {@inheritDoc}
         *
@@ -603,7 +605,7 @@ public class StepServiceImpl implements StepService {
                comment.setId(resultKey);
        }
 
-       /**
+       /** 
         * {@inheritDoc}
         * @see org.splat.service.StepService#getStepComments(org.splat.som.Step)
         */
@@ -628,10 +630,60 @@ public class StepServiceImpl implements StepService {
                }
                return commentDTOs;
        }
+       
+       /** 
+        * {@inheritDoc}
+        * @see org.splat.service.StepService#removeStepComment(long)
+        */
+       @Override
+       @Transactional
+       public void removeStepComment(final long commentId) throws InvalidParameterException {
+               StepCommentAttribute stepComment = _stepCommentAttributeDAO.get(Long.valueOf(commentId));
+               if(stepComment == null) {
+                       throw new InvalidParameterException("commentId",String.valueOf(commentId));
+               }
+               _stepCommentAttributeDAO.delete(stepComment);
+       }
 
+       /** 
+        * {@inheritDoc}
+        * @see org.splat.service.StepService#editStepComment(long, java.lang.String, java.lang.String)
+        */
+       @Override
+       @Transactional
+       public void editStepComment(final long commentId, final String newValue, final String newTitle)
+                       throws InvalidParameterException {
+               StepCommentAttribute comment = _stepCommentAttributeDAO.get(Long.valueOf(commentId));
+               if(comment == null) {
+                       throw new InvalidParameterException("commentId",String.valueOf(commentId));
+               }
+               if(newTitle != null) {
+                       comment.setTitle(newTitle);
+               }
+               if(newValue != null) {
+                       comment.setValue(newValue);
+               }
+               _stepCommentAttributeDAO.update(comment);
+       }
+
+       /** 
+        * {@inheritDoc}
+        * @see org.splat.service.StepService#isCommentMadeByUser(long, long)
+        */
+       @Override
+       @Transactional(readOnly = true)
+       public boolean isCommentMadeByUser(final long commentId, final long userId)
+                       throws InvalidParameterException {
+               StepCommentAttribute comment = _stepCommentAttributeDAO.get(Long.valueOf(commentId));
+               if(comment == null) {
+                       throw new InvalidParameterException("commentId", String.valueOf(commentId));
+               }
+               return comment.getUser().getIndex() == userId;
+       }
+       
        /**
         * Get the documentService.
-        * 
+        *
         * @return the documentService
         */
        public DocumentService getDocumentService() {
@@ -640,7 +692,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Set the documentService.
-        * 
+        *
         * @param documentService
         *            the documentService to set
         */
@@ -650,7 +702,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Get the simulationContextService.
-        * 
+        *
         * @return the simulationContextService
         */
        public SimulationContextService getSimulationContextService() {
@@ -659,7 +711,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Set the simulationContextService.
-        * 
+        *
         * @param simulationContextService
         *            the simulationContextService to set
         */
@@ -670,7 +722,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Get the documentDAO.
-        * 
+        *
         * @return the documentDAO
         */
        public DocumentDAO getDocumentDAO() {
@@ -679,7 +731,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Set the documentDAO.
-        * 
+        *
         * @param documentDAO
         *            the documentDAO to set
         */
@@ -689,7 +741,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Get the simulationContextDAO.
-        * 
+        *
         * @return the simulationContextDAO
         */
        public SimulationContextDAO getSimulationContextDAO() {
@@ -698,7 +750,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Set the simulationContextDAO.
-        * 
+        *
         * @param simulationContextDAO
         *            the simulationContextDAO to set
         */
@@ -709,7 +761,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Get the projectElementDAO.
-        * 
+        *
         * @return the projectElementDAO
         */
        public ProjectElementDAO getProjectElementDAO() {
@@ -718,7 +770,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Set the projectElementDAO.
-        * 
+        *
         * @param projectElementDAO
         *            the projectElementDAO to set
         */
@@ -728,7 +780,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Get the indexService.
-        * 
+        *
         * @return the indexService
         */
        public IndexService getIndexService() {
@@ -737,7 +789,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Set the indexService.
-        * 
+        *
         * @param indexService
         *            the indexService to set
         */
@@ -747,7 +799,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Get the fileDAO.
-        * 
+        *
         * @return the fileDAO
         */
        public FileDAO getFileDAO() {
@@ -756,7 +808,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Set the fileDAO.
-        * 
+        *
         * @param fileDAO
         *            the fileDAO to set
         */
@@ -766,7 +818,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Get the documentTypeService.
-        * 
+        *
         * @return the documentTypeService
         */
        public DocumentTypeService getDocumentTypeService() {
@@ -775,7 +827,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Set the documentTypeService.
-        * 
+        *
         * @param documentTypeService
         *            the documentTypeService to set
         */
@@ -786,7 +838,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Get the versionsRelationDAO.
-        * 
+        *
         * @return the versionsRelationDAO
         */
        public VersionsRelationDAO getVersionsRelationDAO() {
@@ -795,7 +847,7 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Set the versionsRelationDAO.
-        * 
+        *
         * @param versionsRelationDAO
         *            the versionsRelationDAO to set
         */
@@ -806,16 +858,16 @@ public class StepServiceImpl implements StepService {
 
        /**
         * Get project settings.
-        * 
+        *
         * @return Project settings service
         */
        private ProjectSettingsService getProjectSettings() {
                return _projectSettings;
        }
-       
+
        /**
         * Set project settings service.
-        * 
+        *
         * @param projectSettingsService
         *            project settings service
         */
@@ -823,7 +875,7 @@ public class StepServiceImpl implements StepService {
                        final ProjectSettingsService projectSettingsService) {
                _projectSettings = projectSettingsService;
        }
-       
+
        /**
         * Get the stepCommentAttributeDAO.
         * @return the stepCommentAttributeDAO
@@ -855,7 +907,7 @@ public class StepServiceImpl implements StepService {
        public void setUserDAO(final UserDAO userDAO) {
                _userDAO = userDAO;
        }
-
+       
        /**
         * Get the publicationDAO.
         * 
index 19fa71f8817076a8c84a8378fd47578bdbc1db2c..a7353d6a1740477c1669e3e1aa2ab205c66adecb 100644 (file)
@@ -9,6 +9,7 @@
 
 package org.splat.service;
 
+import java.util.Date;
 import java.util.List;
 
 import org.splat.dal.bo.kernel.User;
@@ -293,4 +294,13 @@ public interface StudyService {
         */
        void setDescription(Long studyId, String descriptionText) throws InvalidParameterException;
 
+       /**
+        * Remove a description attached to a study.
+        * 
+        * @param studyId the study id
+        * @throws InvalidParameterException
+        *              if no study with such Id has been found in the database.
+        * @return true if succeeded, false if study doesn't have a description.
+        */
+       boolean removeDescription(final Long studyId) throws InvalidParameterException;
 }
index b1f03057030d5f53d2242b8900963cb3dfc8ed35..1826adb0589108f978ac6bdd8c4238f60ee34d09 100644 (file)
@@ -59,6 +59,7 @@ import org.splat.service.technical.RepositoryService;
 import org.splat.som.Revision;
 import org.springframework.transaction.annotation.Transactional;
 
+
 /**
  * This class defines all methods for creation, modification the study.
  * 
@@ -122,7 +123,7 @@ public class StudyServiceImpl implements StudyService {
         * Injected user service.
         */
        private UserService _userService;
-       
+
        /**
         * Injected publication DAO.
         */
@@ -148,6 +149,7 @@ public class StudyServiceImpl implements StudyService {
         * 
         * @see org.splat.service.StudyService#selectStudy(long)
         */
+       @Override
        @Transactional
        public Study selectStudy(final long index) {
                Study result = getStudyDAO().get(index);
@@ -175,6 +177,7 @@ public class StudyServiceImpl implements StudyService {
         * 
         * @see org.splat.service.StudyService#createStudy(org.splat.dal.bo.som.Study.Properties)
         */
+       @Override
        @Transactional
        public Study createStudy(final Study.Properties sprop)
                        throws MissedPropertyException, InvalidPropertyException,
@@ -200,6 +203,7 @@ public class StudyServiceImpl implements StudyService {
         * 
         * @see org.splat.service.StudyService#addProjectContext(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.SimulationContext.Properties)
         */
+       @Override
        @Transactional
        public SimulationContext addProjectContext(final Study aStudy,
                        final SimulationContext.Properties cprop)
@@ -216,6 +220,7 @@ public class StudyServiceImpl implements StudyService {
         * 
         * @see org.splat.service.StudyService#addProjectContext(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.SimulationContext)
         */
+       @Override
        @Transactional
        public SimulationContext addProjectContext(final Study aStudy,
                        final SimulationContext context) {
@@ -230,6 +235,7 @@ public class StudyServiceImpl implements StudyService {
         * 
         * @see org.splat.service.StudyService#addContributor(org.splat.dal.bo.som.Study, org.splat.dal.bo.kernel.User)
         */
+       @Override
        public boolean addContributor(final Study aStudy, final User user) {
                List<User> contributor = getModifiableContributors(aStudy); // Initializes contributor
                for (Iterator<User> i = contributor.iterator(); i.hasNext();) {
@@ -259,6 +265,7 @@ public class StudyServiceImpl implements StudyService {
         * @see #isPublic()
         * @see Publication#approve(Date)
         */
+       @Override
        public boolean moveToReference(final Study aStudy) {
                if (aStudy.getProgressState() != ProgressState.APPROVED) {
                        return false;
@@ -279,6 +286,7 @@ public class StudyServiceImpl implements StudyService {
         * 
         * @see org.splat.service.StudyService#update(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.Study.Properties)
         */
+       @Override
        public boolean update(final Study aStudy, final Properties sprop)
                        throws InvalidPropertyException {
                if (sprop.getTitle() != null) {
@@ -318,6 +326,7 @@ public class StudyServiceImpl implements StudyService {
         * 
         * @see org.splat.service.StudyService#removeContributor(org.splat.dal.bo.som.Study, org.splat.dal.bo.kernel.User[])
         */
+       @Override
        public boolean removeContributor(final Study aStudy, final User... users) {
                List<User> contributor = getModifiableContributors(aStudy); // Initializes contributor
                Boolean done = false;
@@ -346,6 +355,7 @@ public class StudyServiceImpl implements StudyService {
         * 
         * @see org.splat.service.StudyService#removeProjectContext(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.SimulationContext)
         */
+       @Override
        public boolean removeProjectContext(final Study aStudy,
                        final SimulationContext context) {
                boolean done = getStepService().removeSimulationContext(
@@ -360,6 +370,7 @@ public class StudyServiceImpl implements StudyService {
         * @see org.splat.service.StudyService#setValidationCycle(org.splat.dal.bo.som.Study, org.splat.dal.bo.som.DocumentType,
         *      org.splat.dal.bo.som.ValidationCycle.Properties)
         */
+       @Override
        @Transactional
        public void setValidationCycle(final Study aStudyDTO, final DocumentType type,
                        final ValidationCycle.Properties vprop) {
@@ -404,6 +415,7 @@ public class StudyServiceImpl implements StudyService {
         *            a study to demote
         * @return true if the demotion succeeded.
         */
+       @Override
        public boolean demote(final Study aStudy) {
                if (aStudy.getProgressState() == ProgressState.inCHECK) {
                        aStudy.setProgressState(ProgressState.inDRAFT);
@@ -420,6 +432,7 @@ public class StudyServiceImpl implements StudyService {
         * 
         * @see org.splat.service.StudyService#generateLocalIndex(org.splat.dal.bo.som.Study)
         */
+       @Override
        @Transactional
        public int generateLocalIndex(final Study aStudy) {
                aStudy.setLastLocalIndex(aStudy.getLastLocalIndex() + 1);
@@ -434,6 +447,7 @@ public class StudyServiceImpl implements StudyService {
         *            a study to promote
         * @return true if the demotion succeeded.
         */
+       @Override
        @Transactional
        public boolean promote(final Study aStudy) {
                if (aStudy.getProgressState() == ProgressState.inWORK) {
@@ -462,6 +476,7 @@ public class StudyServiceImpl implements StudyService {
         * @return true if the move succeeded.
         * @see #isPublic()
         */
+       @Override
        @Transactional
        public boolean moveToPublic(final Study aStudy) {
                boolean isOk = false;
@@ -481,6 +496,7 @@ public class StudyServiceImpl implements StudyService {
         *            a study to move
         * @return true if the move succeeded.
         */
+       @Override
        @Transactional
        public boolean moveToPrivate(final Study aStudy) {
                boolean isOk = false;
@@ -856,6 +872,7 @@ public class StudyServiceImpl implements StudyService {
         *            the study
         * @return the unmodifiable not null transient list of contributors of this study
         */
+       @Override
        public List<User> getContributors(final Study aStudy) {
                if (aStudy.getContributor() == null) {
                        setShortCuts(aStudy);
@@ -886,6 +903,7 @@ public class StudyServiceImpl implements StudyService {
         *            the document type being subject of validation
         * @return the validation cycle of the document, or null if not defined.
         */
+       @Override
        public ValidationCycle getValidationCycleOf(final Study aStudy,
                        final DocumentType type) {
                if (aStudy.getValidationCycles() == null || aStudy.getValidationCycles().isEmpty()) {
@@ -914,6 +932,7 @@ public class StudyServiceImpl implements StudyService {
         * @return true if the given user is actor of this study.
         * @see #getActors()
         */
+       @Override
        public boolean hasActor(final Study aStudy, final User user) {
                if (user == null) {
                        return false;
@@ -937,6 +956,7 @@ public class StudyServiceImpl implements StudyService {
         * @return true if the given user is actor of this study.
         * @see #getContributors()
         */
+       @Override
        public boolean isStaffedBy(final Study aStudy, final User user) {
                if (user == null) {
                        return false;
@@ -964,6 +984,7 @@ public class StudyServiceImpl implements StudyService {
         * @param aStudy
         *            the study
         */
+       @Override
        public void loadWorkflow(final Study aStudy) {
                setShortCuts(aStudy);
        }
@@ -1053,6 +1074,7 @@ public class StudyServiceImpl implements StudyService {
                getStudyDAO().merge(aStudy);
        }
        
+       
        /** 
         * {@inheritDoc}
         * @see org.splat.service.StudyService#getDescription(java.lang.Long)
@@ -1088,6 +1110,23 @@ public class StudyServiceImpl implements StudyService {
                }
                study.setAttribute(new DescriptionAttribute(study, descriptionText));
        }
+       
+       /** 
+        * {@inheritDoc}
+        * @see org.splat.service.StudyService#removeStudyDescription(java.lang.Long)
+        */
+       @Override
+       @Transactional
+       public boolean removeDescription(final Long studyId) throws InvalidParameterException {
+               if(studyId == null) {
+                       throw new InvalidParameterException("studyId", String.valueOf(studyId));
+               }
+               Study study = _studyDAO.get(studyId);
+               if(study == null) {
+                       throw new InvalidParameterException("studyId", String.valueOf(studyId));
+               }
+               return study.removeAttribute(study.getAttribute(DescriptionAttribute.class));
+       }
 
        /**
         * Get project settings.
@@ -1282,7 +1321,7 @@ public class StudyServiceImpl implements StudyService {
        public void setUserService(final UserService userService) {
                _userService = userService;
        }
-
+       
        /**
         * Get the publicationDAO.
         * @return the publicationDAO
@@ -1347,5 +1386,4 @@ public class StudyServiceImpl implements StudyService {
                        final DescriptionAttributeDAO descriptionAttributeDAO) {
                _descriptionAttributeDAO = descriptionAttributeDAO;
        }
-
 }
index 41de0f29e395a6936e1170258f80fc3407135401..c9edebe83b9672cd3ed2925eca79d7d2a57d59af 100644 (file)
@@ -210,4 +210,12 @@ public class StepCommentDTO {
        public void setTitle(final String title) {
                _title = title;
        }
+       
+       /**
+        * Get the id. Used with this name in menupopup.jsp.
+        * @return the id
+        */
+       public Long getIndex() {
+               return _id;
+       }
 }
index f0e0bf86557f7ed471e841cab9c94782349dd020..9ead1345b23373d70ca665eb37b217a0774b01f6 100644 (file)
@@ -20,7 +20,6 @@ import java.util.Map;
 import org.splat.dal.bo.kernel.User;
 import org.splat.dal.bo.som.ConvertsRelation;
 import org.splat.dal.bo.som.Document;
-import org.splat.dal.bo.som.Document.Properties;
 import org.splat.dal.bo.som.DocumentType;
 import org.splat.dal.bo.som.File;
 import org.splat.dal.bo.som.ProjectElement;
@@ -30,6 +29,7 @@ import org.splat.dal.bo.som.StepCommentAttribute;
 import org.splat.dal.bo.som.Study;
 import org.splat.dal.bo.som.UsedByRelation;
 import org.splat.dal.bo.som.UsesRelation;
+import org.splat.dal.bo.som.Document.Properties;
 import org.splat.dal.dao.kernel.UserDAO;
 import org.splat.dal.dao.som.Database;
 import org.splat.dal.dao.som.FileDAO;
@@ -114,7 +114,7 @@ public class TestStepService extends BaseTest {
        @Autowired
        @Qualifier("projectSettings")
        private transient ProjectSettingsService _projectSettings;
-
+       
        /**
         * The injected by Spring StepCommentAttributeDAO.
         */
@@ -695,7 +695,7 @@ public class TestStepService extends BaseTest {
                        User badUser = TestEntitiesGenerator.getTestUser("badUser");
                        _userDAO.create(badUser);
                        getHibernateTemplate().evict(badUser);//so createStepCommentDTO will invoke an
-                                       //actual query to the base, not cache in order to check if the user already exists
+                                       //actual query to the base, not cache, in order to check if the user already exists
                        StepCommentDTO aBadDTO = createStepCommentDTO(badUser, goodStudy);
 
                        try{
@@ -786,6 +786,87 @@ public class TestStepService extends BaseTest {
                                "some of the needed fields of the retrieved comment doesn't match with original.");
        }
        
+       /**
+        * Test of retrieval of all comments corresponding to a step.
+        *
+        * @throws BusinessException if there is something wrong likely unrelated to the tested method
+        */
+       @Test
+       public void testEditStepComments() throws BusinessException {
+               LOG.debug(">>>>> BEGIN testEditStepComments()");
+               startNestedTransaction();
+               
+               User goodUser = TestEntitiesGenerator.getTestUser("goodUser");
+               _userDAO.create(goodUser);
+               Study goodStudy = TestEntitiesGenerator.getTestStudy(goodUser);
+               _studyDAO.create(goodStudy);
+               getHibernateTemplate().flush();
+
+               org.splat.som.Step step = new org.splat.som.Step(_projectSettings.getStep(1), goodStudy);
+               
+               StepCommentAttribute comment = new StepCommentAttribute(goodStudy, "commentValue",
+                               new Date(), Integer.valueOf(step.getNumber()), goodUser, "commentTitle");
+               _stepCommentAttributeDAO.saveOrUpdate(comment);
+
+               getHibernateTemplate().flush();
+               
+               //non-existing id
+               StepCommentAttribute tmpComment = new StepCommentAttribute(goodStudy,"tmpCommentValue",
+                               new Date(), Integer.valueOf(step.getNumber()), goodUser, "tmpCommentTitle");
+               _stepCommentAttributeDAO.create(tmpComment);
+               long nonExistingId = tmpComment.getIndex();
+               _stepCommentAttributeDAO.delete(tmpComment);
+               //getHibernateTemplate().evict(goodUser);
+               
+
+               try{
+                       _stepService.editStepComment(nonExistingId, "newValue", "newTitle");
+                       getHibernateTemplate().flush();
+                       Assert.fail("Creation with non-existing user must be failed.");
+               }
+               catch(InvalidParameterException e){
+                       LOG.debug("Expected exception is thrown: "
+                               + e.getClass().getSimpleName() + ": " + e.getMessage());
+               }
+
+               //different configurations with valid comment id
+               testEdit(comment, "newValue", null);
+               testEdit(comment, null, "newTitle");
+               testEdit(comment, "veryNewValue", "veryNewTitle");
+
+               rollbackNestedTransaction();
+               LOG.debug(">>>>> END testEditStepComments()");
+       }
+       
+       /**
+        * Test of comment editing.
+        * @param comment the comment
+        * @param value the value
+        * @param title the title
+        * @throws InvalidParameterException if there is something wrong likely unrelated to the tested method
+        */
+       private void testEdit(StepCommentAttribute comment, String value, String title)
+                       throws InvalidParameterException {
+               String oldValue = comment.getValue();
+               String oldTitle = comment.getTitle();
+               
+               _stepService.editStepComment(comment.getIndex(), value, title);
+               _stepCommentAttributeDAO.flush();
+               getHibernateTemplate().evict(comment);
+               _stepCommentAttributeDAO.refresh(comment);
+               if(value == null) {
+                       Assert.assertEquals(comment.getValue(), oldValue);
+               } else {
+                       Assert.assertEquals(comment.getValue(), value);
+               }
+               if(title == null) {
+                       Assert.assertEquals(comment.getTitle(), oldTitle);
+               } else {
+                       Assert.assertEquals(comment.getTitle(), title);
+               }
+       }
+       
+       
        /**
         * Create a transient StepCommentDTO.
         *
index 565cfea898d864d4a405973c71e991936a42e60a..d3a704b0399986bf31a248064f8d12881cb2890f 100644 (file)
@@ -512,4 +512,60 @@ public class TestStudyService extends BaseTest {
                rollbackNestedTransaction();
                LOG.debug(">>>>> END testSetDescription()");
        }
+       
+       /**
+        * Test of removal of a study description.
+        *
+        * @throws BusinessException if there is something wrong likely unrelated to the tested method
+        */
+       @Test
+       public void testRemoveDescription() throws BusinessException {
+               LOG.debug(">>>>> BEGIN testRemoveDescription()");
+               startNestedTransaction();
+               
+               User user = TestEntitiesGenerator.getTestUser("GoodUser");
+               _userDAO.create(user);
+               Study study = TestEntitiesGenerator.getTestStudy(user);
+               _studyDAO.create(study);
+               _studyDAO.flush();
+               Long studyId = Long.valueOf(study.getIndex());
+               
+               //Empty description:
+               Assert.assertFalse(_studyService.removeDescription(studyId), 
+                               "returned value for study without description must be null");
+               
+               //Not empty description:
+               study.setAttribute(new DescriptionAttribute(study, "description"));
+               _studyDAO.update(study);
+               _studyDAO.flush();
+               Assert.assertTrue(_studyService.removeDescription(studyId), "existing description removal must return true");
+               
+               
+               Assert.assertNull(_studyService.getDescription(studyId), "description hasn't been successfully removed");
+               
+               //null id
+               try {
+                       _studyService.removeDescription(null);
+                       Assert.fail("removal with null study id must fail");
+               } catch(InvalidParameterException e){
+                       LOG.debug("Expected exception is thrown: "
+                               + e.getClass().getSimpleName() + ": " + e.getMessage());
+               }
+               
+               //Non-existing id
+               Study tmpStudy = TestEntitiesGenerator.getTestStudy(user);
+               _studyDAO.create(tmpStudy);
+               Long nonExistingId = tmpStudy.getIndex();
+               _studyDAO.delete(tmpStudy);
+               try {
+                       _studyService.removeDescription(nonExistingId);
+                       Assert.fail("removal with non-existing study id must fail");
+               } catch(InvalidParameterException e){
+                       LOG.debug("Expected exception is thrown: "
+                               + e.getClass().getSimpleName() + ": " + e.getMessage());
+               }
+
+               rollbackNestedTransaction();
+               LOG.debug(">>>>> END testGetDescription()");
+       }
 }
index 435051c54479a3f4f7ffc7cfe6cac0bdca211c1f..9d138421c1b12f080678cb34f4b3d5f10f8bb35d 100644 (file)
@@ -71,9 +71,7 @@
 
 <definition name="zone.description"  template="/jsp/readDescription.jsp"/>
 
-<definition name="page.description" template="/jsp/descriptionPane.jsp">
-    <put-attribute name="display_description_pane" value="zone.description" />
-</definition>
+<definition name="page.description" template="/jsp/descriptionPane.jsp"/>
 
 <definition name="zone.displaystudy" template="/study/displayStudyStep.jsp">
     <put-attribute name="step_comments_pane" value="page.stepcomments" />
index 9c55f4398557465c5b16c7a493e12bf699cff35c..98e5b4201c367559d84990fc8e6535b99ede64c9 100644 (file)
@@ -22,6 +22,8 @@
 //          alert("Executing " + args[0] + " with " + args[1]);
                document.perform.launch(args[0], args[1]);
           }
+        } else {    //javascript function call
+            eval(action);
         }
       } else {
 //      Server side execution via a Struts action
index 2f16c623a9962a395301d0d1c71a9adbb8ee90be..63a063469e0d00a7f48ae7f11c5ecdce6c4f42af 100644 (file)
 <%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
 
 <div id="display_comments_div">
-  <tiles:insertAttribute name="display_comments_pane" ignore="true" />
+    <s:action name="display-comments" namespace="/study" executeResult="true" />
 </div>
 
+
+<!-- edit comment functionality -->
+<form name="edit_comment_form" id="edit_comment_form" action="edit-comment" method="post"
+    style="display: none; position: absolute; background: white;">
+  <input type="hidden" name="commentId" id="commentToEditId" value="0"/>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
+        <tr valign="top">
+          <td width="20" height="20" align="center">
+            <img id="cancel_edit_comment_button" src="<s:url value="/skin/icon.undo.png"/>"
+                title="<s:text name="tooltip.cancel"/>" />
+          </td>
+          <td>
+            <input type="text" name="commentTitle" id="commentToEditTitle">
+            <script language='JavaScript'>
+                displayTextEditor('commentToEditValue', '', 650, 150);
+            </script>   
+          </td>
+        </tr>
+  </table> 
+</form>
+
+<script>
+    $("#edit_comment_form").ajaxForm({
+        target: '#display_comments_div'
+    });
+    
+    var commentToEditId;
+    function redrawEditor() {
+        document.getElementById('edit_comment_form').style.top = 
+            $('#comment_'+commentToEditId+'_tbody').offset().top+'px';
+    }
+
+    function editComment(commentId) {
+        var comment = document.getElementById('comment_'+commentId+'_tbody');
+        var editor = document.getElementById('edit_comment_form');
+        editor.style.display = 'block';
+        
+        document.getElementById('commentToEditId').value = commentId;
+        document.getElementById('commentToEditTitle').value = 
+                trim(document.getElementById('comment_'+commentId+'_title').innerHTML);
+        document.getElementById('commentToEditValue').contentDocument.body.innerHTML = 
+                trim(document.getElementById('comment_'+commentId+'_body').innerHTML);
+
+        commentToEditId = commentId;
+        redrawEditor();
+        document.onchange = redrawEditor;
+    }
+
+    function hideEditCommentEditor() {
+        document.getElementById('edit_comment_form').style.display = 'none';
+    }
+    
+    // Bind the cancel button
+    $("#cancel_edit_comment_button").click(hideEditCommentEditor);
+    
+    // Bind the submit event
+    $('#edit_comment_form').on('submit', hideEditCommentEditor);
+</script>
+
+<!-- remove comment functionality -->
+<form name="remove_comment_form" id="remove_comment_form" action="remove-comment" method="post">
+    <input type="hidden" name="commentId" id="commentId" value="<s:property value="openStudy.index"/>"/>
+</form>
+
+<script>
+    function removeComment(commentId) {
+        document.getElementById("commentId").value=commentId;
+        $("#remove_comment_form").ajaxSubmit({
+                   target: '#display_comments_div'
+              });
+    }
+</script>
+
+<!-- add comment functionality -->
 <s:if test="%{writeAccess == 'true' && stepEnabled == 'true'}">
        <script type="text/javascript">
            $(document).ready(function(){
                $("#comments_form").ajaxForm({
                    target: '#display_comments_div'
                });
+               
+            function showCommentEditor(commentTitle, commentBody) {
+                document.getElementById('commentTitle').value=commentTitle;
+                document.getElementById(currentRTE).contentDocument.body.innerHTML=commentBody;
+                document.getElementById('add_comment_button_div').style.display = 'none';
+                document.getElementById('add_comment_div').style.display = 'block';
+            }
+
            
                // Bind the add button
-                   $("#add_button").click(function() {
-                     document.getElementById("add_button_div").style.display = 'none';
-                     document.getElementById("add_comments_div").style.display = 'block';
-                   });
+                   $("#add_comment_button").click(function() {showCommentEditor('','');});
                    
-                   function hideEditor() {
-                 document.getElementById("add_button_div").style.display = 'block';
-                 document.getElementById("add_comments_div").style.display = 'none';
-                 document.getElementById(currentRTE).contentDocument.body.innerHTML='';    //clean input area
-                 document.getElementById("commentTitle").value='';
+                   function hideCommentEditor() {
+                 document.getElementById("add_comment_button_div").style.display = 'block';
+                 document.getElementById("add_comment_div").style.display = 'none';
                }
                    
                    // Bind the cancel button
-                   $("#cancel_button").click(hideEditor);
+                   $("#cancel_add_comment_button").click(hideCommentEditor);
                    
-                   // Bind the submit button
-               $('#comments_form').on('submit', hideEditor);
+                   // Bind the submit event
+               $('#comments_form').on('submit', hideCommentEditor);
            });
        </script>
        
-       <div id="add_button_div">
+       <div id="add_comment_button_div">
          <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
            <tr>
              <td width="20" height="20" align="center">
-               <img id="add_button" src="<s:url value="/skin/icon.add.png"/>" onMouseOver=this.src="<s:url value="/skin/icon.addhot.png"/>"
+               <img id="add_comment_button" src="<s:url value="/skin/icon.add.png"/>" onMouseOver=this.src="<s:url value="/skin/icon.addhot.png"/>"
                    onMouseOut=this.src="<s:url value="/skin/icon.add.png"/>" title="<s:text name="tooltip.addcomment"/>"/>
               </td>
              <td>&nbsp;</td>
            </tr>
-         </table>  
+         </table>
        </div>
        
-       <div id="add_comments_div" style="display: none;">
+       <div id="add_comment_div" style="display: none;">
        <form name="comments_form" id="comments_form" action="create-stepComment" method="post">
          <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
            <tr valign="top">
              <td width="20" height="20" align="center">
-               <img id="cancel_button" src="<s:url value="/skin/icon.undo.png"/>"
+               <img id="cancel_add_comment_button" src="<s:url value="/skin/icon.undo.png"/>"
                    title="<s:text name="tooltip.cancel"/>" />
              </td>
              <td>
index a14d1f08e81a043e3d85dec172d0c44942514ec8..7ec7c31cf1355c018209cedf8697f6e482d99256 100644 (file)
@@ -4,67 +4,24 @@
 <%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
 
 <div id="display_description_div">
-    <tiles:insertAttribute name="display_description_pane" ignore="true" />
+    <s:action name="display-description" namespace="/study" executeResult="true" />
 </div>
 
-<s:if test="%{writeAccess == 'true' && stepEnabled == 'true'}">
-    <script type="text/javascript">
-        $(document).ready(function(){        
-            $("#description_form").ajaxForm({
-                target: '#display_description_div'
-            });
-        
-            // Bind the add button
-            $("#set_description_button").click(function() {
-              document.getElementById("display_description_div").style.display = 'none';
-              document.getElementById("set_description_button_div").style.display = 'none';
-              document.getElementById("description_editor_div").style.display = 'block';
-              document.getElementById("descriptionValue").contentDocument.body.innerHTML = 
-                    document.getElementById("display_description_div").innerHTML;
-            });
-            
-            function hideDescriptionEditor() {
-              document.getElementById("display_description_div").style.display = 'block';
-              document.getElementById("set_description_button_div").style.display = 'block';
-              document.getElementById("description_editor_div").style.display = 'none';
-              document.getElementById('descriptionValue').contentDocument.body.innerHTML = '';
-            }
-            
-            // Bind the cancel button
-            $("#cancel_set_description_button").click(hideDescriptionEditor);
-            
-            // Bind the submit event
-            $('#description_form').on('submit', hideDescriptionEditor);
-        });
-    </script>
-    
-    <div id="set_description_button_div">
-      <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
-        <tr>
-          <td width="20" height="20" align="center">
-            <img id="set_description_button" src="<s:url value="/skin/icon.add.png"/>" onMouseOver=this.src="<s:url value="/skin/icon.addhot.png"/>"
-                onMouseOut=this.src="<s:url value="/skin/icon.add.png"/>" title="<s:text name="tooltip.adddescription"/>"/>
-           </td>
-          <td>&nbsp;</td>
-        </tr>
-      </table>  
-    </div>
-    
-    <div id="description_editor_div" style="display: none;">
-    <form name="description_form" id="description_form" action="set-description" method="post">
-      <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
-        <tr valign="top">
-          <td width="20" height="20" align="center">
-            <img id="cancel_set_description_button" src="<s:url value="/skin/icon.undo.png"/>"
-                title="<s:text name="tooltip.cancel"/>" />
-          </td>
-          <td>
-            <script language='JavaScript'>
-                displayTextEditor('descriptionValue', '', 300, 150);
-            </script>   
-          </td>
-        </tr>
-      </table> 
-    </form>
-    </div>
-</s:if>
\ No newline at end of file
+<div id="description_editor_div" style="display: none;">
+  <form name="description_form" id="description_form" action="set-description" method="post">
+    <input type="hidden" name="studyId" value="<s:property value="openStudy.index"/>"/>
+    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
+      <tr valign="top">
+        <td width="20" height="20" align="center">
+          <img id="cancel_set_description_button" src="<s:url value="/skin/icon.undo.png"/>"
+              title="<s:text name="tooltip.cancel"/>" />
+        </td>
+        <td>
+          <script language='JavaScript'>
+              displayTextEditor('descriptionValue', '', 300, 120);
+          </script>   
+        </td>
+      </tr>
+    </table> 
+  </form>
+</div>
\ No newline at end of file
index 0cb6e7162c5ca4ad06e64c02454522bc31d96c2d..df543ae902ac856f292d8785d13cbff7bbfc1199 100644 (file)
         <s:if test="isEnabled()">
         <td onMouseOver="this.style.backgroundImage='url(<s:url value="/skin/image.highlighted.png"/>)'" onMouseOut="this.style.backgroundImage='url(<s:url value="/skin/image.white.png"/>)'">
           <s:if test="isClientSide()">
-            <s:set var="menu" value="%{action}"/>
+            <s:if test="#entitindex!=null">
+              <s:set var="menu" value="%{action.replaceAll('entity_index', #entitindex.toString())}"/>
+            </s:if><s:else>
+              <s:set var="menu" value="%{action}"/>
+            </s:else>
           </s:if><s:else>
             <s:url id="menu"  namespace="/study" action="%{action}">
               <s:param name="index" value="%{#entitindex}" />
index fe5b44573e0e8ffc367b5260a4a17f0310275e91..7e518b620d03449d0b8d00edb3a011a3834c20f8 100644 (file)
@@ -2,20 +2,45 @@
     pageEncoding="ISO-8859-1"%>
 <%@ taglib prefix="s" uri="/struts-tags"
 %>
+
+<script type="text/javascript"> _mouseOverContext = false; </script>
  
 <s:if test="%{comments != null && !comments.isEmpty()}">
   <table width="100%" cellpadding="0" cellspacing="5" border="0" class="attribute">
     <s:iterator var="current" value="comments">
-      <tr>
-        <td width="20" height="20" align="center">
-        </td>
-        <td>
-          <s:date name="#current.date" format="dd.MM.yyyy" />, <s:property value="#current.title"/>
-          <br><s:property value="#current.text" escapeHtml="false"/>
-          <br><s:property value="#current.user.displayName"/>
-        </td> 
-      </tr>
-      <tr height="1" bgcolor="#AAAAAA"><td colspan="2"></td></tr>
+      <tbody id="comment_<s:property value='%{id}' />_tbody" >
+           <tr valign="top">
+           
+             <!-- Pop-up menu -->
+               <td width="20" height="20" align="center">
+                 <s:if test="%{user.index == connectedUser.index}">
+                   <div id="popup<s:property value="%{id}"/>"
+                       style="position:absolute; display:none; top:0px; left:0px; z-index:10000;"
+                    onmouseover="javascript:_mouseOverContext=true;" onmouseout="javascript:_mouseOverContext=false;">
+                  <jsp:include page="/jsp/menupopup.jsp" />
+                </div>
+                <s:a href="popup%{id}">
+                  <img src="<s:url value="/skin/icon.ed.png"/>" width=14 height=14 border="none" title=""/>
+                </s:a>
+                 </s:if>
+               </td>
+               
+          <!-- The comment body -->
+               <td>
+                 <s:date name="%{date}" format="dd.MM.yyyy" />,&nbsp;
+                 <div id="comment_<s:property value="%{id}"/>_title" style="display: inline">
+                      <s:property value="%{title}"/>
+                 </div>
+                 <br/>
+              <div id="comment_<s:property value="%{id}"/>_body" style="display: inline">
+                    <s:property value="%{text}" escapeHtml="false"/>
+              </div>
+              <br/>
+                 <s:property value="%{user.displayName}"/>
+               </td>   
+           </tr>
+           <tr height="1" bgcolor="#AAAAAA"><td colspan="2"></td></tr>
+         </tbody>           
     </s:iterator>
   </table>
 </s:if>
index 14c32db387ed6d9a8118310cefdd378810674c39..85fbc203efe79cf35114d0bcbe7e13f9637afa2c 100644 (file)
@@ -1,4 +1,78 @@
 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
     pageEncoding="ISO-8859-1"%>
 <%@ taglib prefix="s" uri="/struts-tags"%>
-<s:property value="descriptionValue" escapeHtml="false"/>
\ No newline at end of file
+
+<div id="description_value_div">
+    <s:property value="descriptionValue" escapeHtml="false"/>
+</div>
+
+
+<s:if test="userCanModufyDescription()">
+
+<!-- Set description functionality -->
+   <script type="text/javascript">
+       function showDescriptionEditor() {
+         document.getElementById("descriptionValue").contentDocument.body.innerHTML = 
+            document.getElementById("description_value_div").innerHTML;
+         document.getElementById("display_description_div").style.display = 'none';
+         document.getElementById("description_buttons_div").style.display = 'none';
+         document.getElementById("description_editor_div").style.display = 'block';
+       }
+   
+       function hideDescriptionEditor() {
+         document.getElementById("display_description_div").style.display = 'block';
+         document.getElementById("description_buttons_div").style.display = 'block';
+         document.getElementById("description_editor_div").style.display = 'none';
+       }
+           
+       $(document).ready(function(){
+           $("#description_form").ajaxForm({
+               target: '#display_description_div'
+           });
+       
+           // Bind the cancel button
+           $("#cancel_set_description_button").click(hideDescriptionEditor);
+           
+           // Bind the submit event
+           $('#description_form').on('submit', hideDescriptionEditor);
+       });
+   </script>
+
+  <div id="description_buttons_div">
+    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
+      <tr>
+        <td width="20" height="20" align="center">
+          <s:if test="%{descriptionValue==null}">  
+            <img id="add_description_button" src="<s:url value="/skin/icon.add.png"/>"
+                onMouseOver=this.src="<s:url value="/skin/icon.addhot.png"/>"
+                onMouseOut=this.src="<s:url value="/skin/icon.add.png"/>"
+                title="<s:text name="tooltip.adddescription"/>" onClick="showDescriptionEditor()"/>
+          </s:if>
+          <s:else>
+            <div id="popupDescription" style="position:absolute; display:none; top:0px; left:0px; z-index:10000;"
+              onmouseover="javascript:_mouseOverContext=true;" onmouseout="javascript:_mouseOverContext=false;">
+              <jsp:include page="/jsp/menupopup.jsp" />
+            </div>
+            <s:a href="popupDescription">
+              <img src="<s:url value="/skin/icon.ed.png"/>" width=14 height=14 border="none" title=""/>
+            </s:a>
+          </s:else>
+        </td>
+      <td>&nbsp;</td>
+    </tr> 
+  </table>  
+  </div>
+
+<!-- Remove description functionality -->
+<form name="remove_description_form" id="remove_description_form" action="remove-description" method="post">
+    <input type="hidden" name="studyId" value="<s:property value="openStudy.index"/>"/>
+</form>
+<script>
+    function removeDescription() {
+        $("#remove_description_form").ajaxSubmit({
+                   target: '#display_description_div'
+              });
+    }
+</script>
+
+</s:if>
\ No newline at end of file
index 4a6a90ea9177cd919fe62561724095e2f224fef2..94833cd795dd3864ce91f8d9d0ddad5f2ccb623c 100644 (file)
@@ -248,6 +248,7 @@ tooltip.version        = Versionner ce document
 tooltip.refresh        = Actualiser
 tooltip.close          = Fermer
 tooltip.cancel         = Abandonner
+tooltip.compare        = Compare
 
 tooltip.shared         = Document partagé entre plusieurs scénarios
 tooltip.versioned      = Document modifié dans cette version de l''étude
@@ -279,6 +280,8 @@ message.delete.study      = Voulez-vous placer l&#146;
 message.delete.context    = Voulez-vous retirer ce contexte de simulation ?
 message.delete.document   = Voulez-vous supprimer ce document ?
 message.delete.knowledge  = Voulez-vous supprimer cette connaissance ?
+message.delete.comment    = Do you really want to remove this comment ?
+message.delete.description= Do you really want to remove this description ?
 message.purge.study       = Voulez-vous supprimer l&#146;historique de l&#146;étude ?
 message.purge.document    = Voulez-vous supprimer l&#146;historique de ce document ?
 message.markasreference.study = Do you really want to mark the study as reference ?
index 95d7378a8efd9c8c8ec15d97fcdee5993d766d4f..60c95fdbc5ebde5d9064fa22d457f1789efaacd9 100644 (file)
@@ -249,6 +249,7 @@ tooltip.version        = Version this document
 tooltip.refresh        = Refresh
 tooltip.close          = Close
 tooltip.cancel         = Cancel
+tooltip.compare        = Compare
 
 tooltip.shared         = Document shared by several scenarios
 tooltip.versioned      = Document modified in this version of the study
@@ -280,6 +281,8 @@ message.delete.study      = Do you really want to move this study to Trash ?
 message.delete.context    = Do you really want to remove this simulation context ?
 message.delete.document   = Do you really want to remove this document ?
 message.delete.knowledge  = Do you really want to remove this knowledge ?
+message.delete.comment    = Do you really want to remove this comment ?
+message.delete.description= Do you really want to remove this description ?
 message.purge.study       = Do you really want to remove the history of the study ?
 message.purge.document    = Do you really want to remove the history of this document ?
 message.markasreference.study = Do you really want to mark the study as reference ?
index 06b640ce694e4871ba985d65e79d5c43b924bbdc..e39cf3d7826075a098e917eb1b6f87377ec0c853 100644 (file)
@@ -959,6 +959,59 @@ public class ApplicationSettings {
                        }
                }
        }
+       
+       /**
+        * Pop-up menu for comments.
+        */
+       private static class CommentPopup extends PopupMenu {
+               /**
+                * Default constructor.
+                */
+               private CommentPopup() {
+                       super();
+                       addItem(MNU_EDIT, new PopupItem(MNU_NAME_EDIT).icon("icon.ed.png")
+                                       .action("editComment(entity_index)"));
+                       addItem(MNU_REMOVE, new PopupItem("menu.remove").icon(IMG_DELETE)
+                                       .action("removeComment(entity_index)").confirmation("message.delete.comment"));
+               }
+
+               /**
+                * Is enabled.
+                * @param name the entry name
+                * @return true
+                */
+               @Override
+               public boolean isEnabled(final String name) {
+                       return true;
+               }
+       }
+       
+       /**
+        * Pop-up menu for comments.
+        */
+       private static class DescritptionPopup extends PopupMenu {
+               /**
+                * Default constructor.
+                */
+               private DescritptionPopup() {
+                       super();
+                       addItem(MNU_EDIT, new PopupItem(MNU_NAME_EDIT).icon("icon.ed.png")
+                                       .action("showDescriptionEditor()"));
+                       addItem(MNU_REMOVE, new PopupItem("menu.remove").icon(IMG_DELETE)
+                                       .action("removeDescription()")
+                                       .confirmation("message.delete.description"));
+               }
+
+               /**
+                * Is enable.
+                * @param name the entry name
+                * @return true
+                */
+               @Override
+               public boolean isEnabled(final String name) {
+                       return true;
+               }
+       }
 
        // ==============================================================================================================================
        // Construction
@@ -995,6 +1048,8 @@ public class ApplicationSettings {
                _popups.put("extern", new ExternPopup());
                _popups.put("scontext", new ScontextPopup());
                _popups.put("feedbex", new FeedbexPopup());
+               _popups.put("comment", new CommentPopup());
+               _popups.put("description", new DescritptionPopup());
 
                // Default customizable mandatory settings
                Map<String, Object> fprop = new HashMap<String, Object>();
index 4474f20d8088a6256cae95b1bd22c978edd1b8f9..8d377558d3712d7680b29c8b2a657b946a6bae08 100644 (file)
@@ -4,10 +4,7 @@ import java.util.List;
 
 import org.splat.dal.bo.som.ProjectElement;
 import org.splat.dal.bo.som.Scenario;
-import org.splat.exception.InvalidParameterException;
-import org.splat.service.StepService;
 import org.splat.service.StudyService;
-import org.splat.service.dto.StepCommentDTO;
 import org.splat.som.StepRights;
 import org.splat.wapp.Constants;
 import org.splat.wapp.PopupMenu;
@@ -15,9 +12,9 @@ import org.splat.wapp.SimpleMenu;
 
 /**
  * Presents the current open study information.
- * 
+ *
  * @author Daniel Brunier-Coulin.
- * 
+ *
  */
 public class DisplayStudyStepAction extends AbstractDisplayAction {
 
@@ -35,21 +32,6 @@ public class DisplayStudyStepAction extends AbstractDisplayAction {
         * Injected study service.
         */
        private StudyService _studyService;
-       
-       /**
-        * Step comments.
-        */
-       private List<StepCommentDTO> _comments = null;
-
-       /**
-        * Injected Step Service.
-        */
-       private StepService _stepService;
-       
-       /**
-        * Study description.
-        */
-       private String _descriptionValue;
 
        // ==============================================================================================================================
        // Action methods
@@ -57,7 +39,7 @@ public class DisplayStudyStepAction extends AbstractDisplayAction {
 
        /**
         * Open the selected study.
-        * 
+        *
         * @return SUCCESS if succeeded or ERROR if can't open
         */
        public String doOpen() {
@@ -106,8 +88,6 @@ public class DisplayStudyStepAction extends AbstractDisplayAction {
 
                        setMenu();
                }
-               loadComments();
-               loadDescription();
                return res;
        }
 
@@ -183,7 +163,7 @@ public class DisplayStudyStepAction extends AbstractDisplayAction {
 
        /**
         * Close the currently open study.
-        * 
+        *
         * @return SUCCESS
         */
        public String doClose() {
@@ -191,46 +171,6 @@ public class DisplayStudyStepAction extends AbstractDisplayAction {
                initializationScreenContext("none");
                return SUCCESS;
        }
-
-       /**
-        * Loads step comments (if already loaded - reloads).
-        */
-       public void loadComments() {
-               try {
-                       _comments = _stepService.getStepComments(_openStudy.getSelectedStep());
-               } catch(InvalidParameterException exception) {
-                       _comments = null;
-                       LOG.debug("Error while trying to add comment: " + exception.getMessage());
-               }
-       }
-       
-       /**
-        * Loads description (if already loaded - reloads).
-        */
-       public void loadDescription() {
-               try {
-                       _descriptionValue = _studyService.getDescription(_openStudy.getIndex());
-               } catch(InvalidParameterException exception) {
-                       _descriptionValue = null;
-                       LOG.debug("Error while trying to add description: " + exception.getMessage());
-               }
-       }
-       
-       /**
-        * Sets study description.
-        * @return SUCCESS if succeeded, INPUT otherwise.
-        */
-       public String doSetDescription() {
-               String res = INPUT;
-               try {
-                       _studyService.setDescription(_openStudy.getIndex(), _descriptionValue);
-                       res = SUCCESS;
-               } catch(InvalidParameterException exception) {
-                       LOG.debug("Error while trying to add description: " + exception.getMessage());
-               }
-               loadDescription();
-               return res;
-       }
        
        // ==============================================================================================================================
        // Getters
@@ -275,7 +215,7 @@ public class DisplayStudyStepAction extends AbstractDisplayAction {
 
        /**
         * Get the studyService.
-        * 
+        *
         * @return the studyService
         */
        public StudyService getStudyService() {
@@ -284,7 +224,7 @@ public class DisplayStudyStepAction extends AbstractDisplayAction {
 
        /**
         * Set the studyService.
-        * 
+        *
         * @param studyService
         *            the studyService to set
         */
@@ -294,7 +234,7 @@ public class DisplayStudyStepAction extends AbstractDisplayAction {
 
        /**
         * {@inheritDoc}
-        * 
+        *
         * @see org.splat.simer.Action#setOpenStudy(org.splat.simer.OpenStudy)
         */
        @Override
@@ -302,52 +242,4 @@ public class DisplayStudyStepAction extends AbstractDisplayAction {
                super.setOpenStudy(study);
                _openStudy = study;
        }
-       
-       /**
-        * Get the comments.
-        * @return the comments
-        */
-       public List<StepCommentDTO> getComments() {
-               return _comments;
-       }
-
-       /**
-        * Set the comments.
-        * @param comments the comments to set
-        */
-       public void setComments(final List<StepCommentDTO> comments) {
-               _comments = comments;
-       }
-
-       /**
-        * Get the stepService.
-        * @return the stepService
-        */
-       public StepService getStepService() {
-               return _stepService;
-       }
-
-       /**
-        * Set the stepService.
-        * @param stepService the stepService to set
-        */
-       public void setStepService(final StepService stepService) {
-               _stepService = stepService;
-       }
-       
-       /**
-        * Get the descriptionValue.
-        * @return the descriptionValue
-        */
-       public String getDescriptionValue() {
-               return _descriptionValue;
-       }
-
-       /**
-        * Set the descriptionValue.
-        * @param descriptionValue the descriptionValue to set
-        */
-       public void setDescriptionValue(final String descriptionValue) {
-               _descriptionValue = descriptionValue;
-       }
 }
\ No newline at end of file
index ea857b029ff785f1205014c336b4abd865e82f45..2ce9a154f56ad39f620c3308d291ea8919e3959f 100644 (file)
 package org.splat.simer;
 
 import java.util.Date;
+import java.util.List;
+import java.util.ResourceBundle;
 
 import org.splat.exception.InvalidParameterException;
+import org.splat.service.StepService;
 import org.splat.service.dto.StepCommentDTO;
+import org.splat.wapp.PopupMenu;
 /**
  * Step comment creation/modification action.
  *
@@ -24,26 +28,73 @@ public class EditStepCommentAction extends DisplayStudyStepAction {
         */
        private static final long serialVersionUID = 6467920934724352021L;
 
+       /**
+        * Step comments.
+        */
+       private List<StepCommentDTO> _comments = null;
+
        /**
         * The value of the comment.
         */
        private String _commentValue;
 
+       /**
+        * The value of the comment.
+        */
+       private String _commentToEditValue;
+
        /**
         * The title of the comment.
         */
        private String _commentTitle;
 
+       /**
+        * Step comment id.
+        */
+       private Long _commentId;
+       
+       /**
+        * Comment popup menu.
+        */
+       private transient PopupMenu _commentPopup = null;
+
+       /**
+        * Injected Step Service.
+        */
+       private StepService _stepService;
+
        // ==============================================================================================================================
        // Action methods
        // ==============================================================================================================================
 
+       /**
+        * Display step comments.
+        * @return SUCCESS
+        */
+       public String doDisplayComments() {
+               try {
+                       _comments = getStepService().getStepComments(getOpenStudy().getSelectedStep());
+                       _commentPopup = getApplicationSettings().getPopupMenu("comment");
+                       
+                       //necessary for sysadmin user (with label.sysadmin displayName)
+                       ResourceBundle label = ResourceBundle.getBundle("labels",
+                                       getApplicationSettings().getCurrentLocale());
+                       for(StepCommentDTO comment : _comments) {
+                               comment.getUser().setDisplayName(label.getString(
+                                               comment.getUser().getDisplayName()));
+                       }
+               } catch(InvalidParameterException exception) {
+                       _comments = null;
+                       LOG.debug("Error while trying to load comments: " + exception.getMessage());
+               }
+               return SUCCESS;
+       }
+       
        /**
         * Creation of a new comment.
-        * @return SUCCESS if operation succeeded, ERROR if Runtime exception, otherwise INPUT
+        * @return SUCCESS
         */
        public String doCreate() {
-               String res = INPUT;
                if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()
                                && _commentValue!=null  && _commentValue.length()>0
                                && _commentTitle!=null  && _commentTitle.length()>0) {
@@ -60,14 +111,44 @@ public class EditStepCommentAction extends DisplayStudyStepAction {
                                );
                        try {
                                getStepService().addStepComment(stepCommentDTO);
-                               res = SUCCESS;
                        } catch (InvalidParameterException error) {
                                LOG.debug("Error while trying to add comment: " + error.getMessage());
-                               res = INPUT;
                        }
                }
-               loadComments();
-               return res;
+               doDisplayComments();
+               return SUCCESS;
+       }
+       
+       /**
+        * Edit a comment.
+        * @return SUCCESS
+        */
+       public String doEdit() {
+               try {
+                       if(_stepService.isCommentMadeByUser(_commentId, getConnectedUser().getIndex())) {
+                               getStepService().editStepComment(_commentId, _commentToEditValue, _commentTitle);
+                       }
+               } catch(InvalidParameterException error) {
+                       LOG.debug("Error while trying to remove comment: " + error.getMessage());
+               }
+               doDisplayComments();
+               return SUCCESS;
+       }
+       
+       /**
+        * Removal of a comment.
+        * @return SUCCESS
+        */
+       public String doRemove() {
+               try {
+                       if(_stepService.isCommentMadeByUser(_commentId, getConnectedUser().getIndex())) {
+                               getStepService().removeStepComment(_commentId);
+                       }
+               } catch(InvalidParameterException error) {
+                       LOG.debug("Error while trying to remove comment: " + error.getMessage());
+               }
+               doDisplayComments();
+               return SUCCESS;
        }
 
        /**
@@ -101,4 +182,76 @@ public class EditStepCommentAction extends DisplayStudyStepAction {
        public void setCommentTitle(final String commentTitle) {
                _commentTitle = commentTitle;
        }
+
+       /**
+        * Get the comments.
+        * @return the comments
+        */
+       public List<StepCommentDTO> getComments() {
+               return _comments;
+       }
+
+       /**
+        * Set the comments.
+        * @param comments the comments to set
+        */
+       public void setComments(final List<StepCommentDTO> comments) {
+               _comments = comments;
+       }
+
+       /**
+        * Get the stepService.
+        * @return the stepService
+        */
+       public StepService getStepService() {
+               return _stepService;
+       }
+
+       /**
+        * Set the stepService.
+        * @param stepService the stepService to set
+        */
+       public void setStepService(final StepService stepService) {
+               _stepService = stepService;
+       }
+       
+       /**
+        * Get the commentPopup. Should have this exact name since it is used in menupopup.jsp.
+        * @return the commentPopup
+        */
+       public PopupMenu getPopup() {
+               return _commentPopup;
+       }
+
+       /**
+        * Get the commentId.
+        * @return the commentId
+        */
+       public Long getCommentId() {
+               return _commentId;
+       }
+
+       /**
+        * Set the commentId.
+        * @param commentId the commentId to set
+        */
+       public void setCommentId(final Long commentId) {
+               _commentId = commentId;
+       }
+
+       /**
+        * Get the commentToEditValue.
+        * @return the commentToEditValue
+        */
+       public String getCommentToEditValue() {
+               return _commentToEditValue;
+       }
+
+       /**
+        * Set the commentToEditValue.
+        * @param commentToEditValue the commentToEditValue to set
+        */
+       public void setCommentToEditValue(final String commentToEditValue) {
+               _commentToEditValue = commentToEditValue;
+       }
 }
diff --git a/Workspace/Siman/src/org/splat/simer/EditStudyDescriptionAction.java b/Workspace/Siman/src/org/splat/simer/EditStudyDescriptionAction.java
new file mode 100644 (file)
index 0000000..e90734c
--- /dev/null
@@ -0,0 +1,126 @@
+package org.splat.simer; 
+
+import org.splat.exception.InvalidParameterException;
+import org.splat.wapp.PopupMenu;
+
+/**
+ * Description creation/modification action.
+ */
+public class EditStudyDescriptionAction extends DisplayStudyStepAction {
+
+       /**
+        * Serial version ID.
+        */
+       private static final long serialVersionUID = 6467920934724352021L;
+       
+       /**
+        * Study description.
+        */
+       private String _descriptionValue;
+       
+       /**
+        * Description popup menu.
+        */
+       private transient PopupMenu _descriptionPopup = null;
+       
+       /**
+        * Study id.
+        */
+       private Long _studyId;
+       
+       /**
+        * Loads description (if already loaded - reloads).
+        * @return SUCCESS
+        */
+       public String doDisplayDescription() {
+               try {
+                       _descriptionValue = getStudyService().getDescription(getOpenStudy().getIndex());
+                       _descriptionPopup = getApplicationSettings().getPopupMenu("description");
+               } catch(InvalidParameterException exception) {
+                       _descriptionValue = null;
+                       LOG.debug("Error while trying to add description: " + exception.getMessage());
+               }
+               return SUCCESS;
+       }
+       
+       /**
+        * Checks if user can set description.
+        * @return true if user can set description
+        */
+       public boolean userCanModufyDescription() {
+               return "true".equals(getWriteAccess())
+                       && _openStudy.getStudyRights().canEditDescription();
+       }
+       
+       /**
+        * Sets study description.
+        * @return SUCCESS
+        */
+       public String doSetDescription() {
+               try {
+                       if (userCanModufyDescription() && _descriptionValue != null && _descriptionValue.length()>0) {
+                               getStudyService().setDescription(_studyId, _descriptionValue);
+                       }
+               } catch(InvalidParameterException exception) {
+                       LOG.debug("Error while trying to add description: " + exception.getMessage());
+               }
+               doDisplayDescription();
+               return SUCCESS;
+       }
+       
+       /**
+        * Removes study description.
+        * @return SUCCESS
+        */
+       public String doRemoveDescription() {
+               try {
+                       if(userCanModufyDescription()) {
+                               getStudyService().removeDescription(_studyId);
+                       }
+               } catch(InvalidParameterException exception) {
+                       LOG.debug("Error while trying to add description: " + exception.getMessage());
+               }
+               doDisplayDescription();
+               return SUCCESS;
+       }
+
+       /**
+        * Get the descriptionValue.
+        * @return the descriptionValue
+        */
+       public String getDescriptionValue() {
+               return _descriptionValue;
+       }
+
+       /**
+        * Set the descriptionValue.
+        * @param descriptionValue the descriptionValue to set
+        */
+       public void setDescriptionValue(final String descriptionValue) {
+               _descriptionValue = descriptionValue;
+       }
+
+       /**
+        * Get the descriptionPopup. Should have this exact name since it is used in menupopup.jsp.
+        * @return the descriptionPopup
+        */
+       public PopupMenu getPopup() {
+               return _descriptionPopup;
+       }
+
+       /**
+        * Get the studyId.
+        * @return the studyId
+        */
+       public Long getStudyId() {
+               return _studyId;
+       }
+
+       /**
+        * Set the studyId.
+        * @param studyId the studyId to set
+        */
+       public void setStudyId(final Long studyId) {
+               _studyId = studyId;
+       }
+}
index 13d8f095fe5a5881c53e779cbacd5c16a2cacb57..90e2811d30655babc8c4b09572fec68678bd01ef 100644 (file)
@@ -98,7 +98,7 @@ public class ExceptionAction extends ActionSupport {
                                 */
                        else {
 
-                               Exception exc = (Exception) obj;
+                               Throwable exc = (Throwable) obj;
                                StringBuffer msg = new StringBuffer();
                                if (exc.getMessage() != null) {
                                        msg.append(exc.getMessage());
@@ -124,7 +124,7 @@ public class ExceptionAction extends ActionSupport {
                        this._message = e.getMessage();
                        Throwable cause = e.getCause();
                        if (null != cause) {
-                               LOG.errorMsg(cause.getMessage(), (Exception) cause);
+                               LOG.errorMsg(cause.getMessage(), cause);
                                this._message = cause.getMessage();
                        }
                }
index 871896c4d238e5ad972862b8a779c17f9afb3935..643374cdb757d747ba1ec5446074897963927514 100644 (file)
@@ -154,7 +154,6 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd">
                class="org.splat.simer.DisplayStudyStepAction" parent="baseAction"
                scope="prototype">
                <property name="studyService" ref="studyService" />
-               <property name="stepService" ref="stepService" />
        </bean>
 
        <!--========= Inherited from displayStudyStepAction ========= -->
@@ -210,8 +209,15 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd">
        <bean id="editStepCommentAction"
         class="org.splat.simer.EditStepCommentAction" scope="prototype"
         parent="displayStudyStepAction">
+        <property name="stepService" ref="stepService" />
+    </bean>
+    
+    <bean id="editStudyDescriptionAction"
+        class="org.splat.simer.EditStudyDescriptionAction" scope="prototype"
+        parent="displayStudyStepAction">
     </bean>
     
+    
     <!-- bean id="CompareStudyAction"
         class="org.splat.simer.CompareStudyAction" scope="prototype"
         parent="displayStudyStepAction">
@@ -283,7 +289,6 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd">
        <bean id="versionDocumentAction"
                class="org.splat.simer.VersionDocumentAction" scope="prototype"
                parent="baseAction">
-        <property name="studyService" ref="studyService" />
                <property name="projectSettings" ref="projectSettings" />
                <property name="publicationService" ref="publicationService" />
                <property name="stepService" ref="stepService" />
index b8226791c267601a361bc223b71a036f44f52093..00271a70ed2ff8afae5ce9419ac2e5c27dc86bbb 100644 (file)
                                page.editscenarioproperties
                        </result>
                </action>
-               <action name="set-description"
-            class="displayStudyStepAction" method="setDescription">
-            <result name="success" type="tiles">
-                zone.description
-            </result>
-        </action>      
 
                <!-- Edition of scenario
                -->
                
                <!-- Edition of step
           -->
+        <action name="display-comments"
+            class="editStepCommentAction" method="displayComments">
+            <result name="success" type="tiles">zone.stepcomments</result>
+        </action>
+        
         <action name="create-stepComment" class="editStepCommentAction" method="create">
             <result name="success" type="tiles">zone.stepcomments</result>
-            <result name="input" type="tiles">zone.stepcomments</result>
+        </action>
+        
+        <action name="remove-comment" class="editStepCommentAction" method="remove">
+            <result name="success" type="tiles">zone.stepcomments</result>
+        </action>
+        <action name="edit-comment" class="editStepCommentAction" method="edit">
+            <result name="success" type="tiles">zone.stepcomments</result>
+        </action>
+        
+        <!-- Edition of study description -->
+        <action name="display-description"
+            class="editStudyDescriptionAction" method="displayDescription">
+            <result name="success" type="tiles">zone.description</result>
+        </action>
+        <action name="set-description"
+            class="editStudyDescriptionAction" method="setDescription">
+            <result name="success" type="tiles">zone.description</result>
+        </action>
+        <action name="remove-description"
+            class="editStudyDescriptionAction" method="removeDescription">
+            <result name="success" type="tiles">zone.description</result>
         </action>
         
         <!-- Comparison of studies