From 020e7fc42e9c5867ddf461310e1fe7f672876aaa Mon Sep 17 00:00:00 2001 From: Julia Damerow Date: Thu, 9 Apr 2020 15:42:30 -0400 Subject: [PATCH 1/9] Create checkstyle.xml --- checkstyle.xml | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 checkstyle.xml diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 000000000..106038498 --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 4d5200d5662e8315b0930150e079a682ae2419cb Mon Sep 17 00:00:00 2001 From: Sagar Khar <44152998+Sagar-k93@users.noreply.github.com> Date: Fri, 24 Apr 2020 13:20:54 -0700 Subject: [PATCH 2/9] Story/vspc 69 (#105) * [VSPC-69] Changes for sorting in Images tab. * [VSPC-69] Changes to make column header look clickable. * [VSPC-69] Solving merge conflicts. * [VSPC-69] Adding new files from develop branch. * [VSPC-69] Addressed review comments for removing hard coded strings. * [VSPC-69] Indentation correction. * [VSPC-69] Addressed review comments, handled case when only order is sent. * [VSPC-69] Reformatted imageService file in project. * [VSPC-69] Indentation fix for listimagesController file. * [VSPC-69] Indentation changes. * [VSPC-69] Indentation fixes to SortByField file. * [VSPC-69] Changes made based on review comments for sorting order. * [VSPC-69] Changes based on review comments to remove duplicate code. * [VSPC-69] Removed blank line from code. * [VSPC-69] Added test cases for getImages method with 3 parameters. * [VSPC-69] Added test case for no result from DB. Also handled null case while retrieving sorted images list. * [VSPC-69] Added sorted method to check if images are sorted in imagesServiceTest. * [VSPC-69] Changes to add images sorting check in test cases. * [VSPC-69] Added sorting check to other sorting test cases. * [VSPC-69] Changes to null statement in imageService. Co-authored-by: sagarkhar Co-authored-by: sagarkhar --- .../diging/vspace/core/model/SortByField.java | 13 +- .../vspace/core/services/IImageService.java | 2 + .../core/services/impl/ImageService.java | 117 ++++++++----- .../web/staff/ListImagesController.java | 18 +- .../WEB-INF/views/staff/images/imagelist.jsp | 157 ++++++++++-------- .../core/services/impl/ImageServiceTest.java | 70 +++++++- 6 files changed, 248 insertions(+), 129 deletions(-) diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/model/SortByField.java b/vspace/src/main/java/edu/asu/diging/vspace/core/model/SortByField.java index 45544073d..9c16bb9d3 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/model/SortByField.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/model/SortByField.java @@ -1,7 +1,10 @@ package edu.asu.diging.vspace.core.model; +import java.util.ArrayList; +import java.util.List; + public enum SortByField { - CREATION_DATE("creationDate"); + CREATION_DATE("creationDate"), FILENAME("filename"), NAME("name"), CREATED_BY("createdBy"); private final String value; @@ -12,4 +15,12 @@ private SortByField(String value) { public String getValue() { return value; } + + public static List getAllValues() { + List allValues = new ArrayList<>(); + for(SortByField sbf : SortByField.values()) { + allValues.add(sbf.getValue()); + } + return allValues; + } } diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/services/IImageService.java b/vspace/src/main/java/edu/asu/diging/vspace/core/services/IImageService.java index cc989209f..f53105456 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/services/IImageService.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/services/IImageService.java @@ -19,6 +19,8 @@ public interface IImageService { List getImages(int pageNo); + List getImages(int pageNo, String sortedBy, String order); + long getTotalImageCount(); int validatePageNumber(int pageNo); diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/ImageService.java b/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/ImageService.java index 364f5afbf..d571073cb 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/ImageService.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/ImageService.java @@ -31,14 +31,15 @@ @Service public class ImageService implements IImageService { - + private final Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private ImageRepository imageRepo; - + @Value("${page_size}") private int pageSize; + /* * (non-Javadoc) * @@ -49,7 +50,7 @@ public class ImageService implements IImageService { public ImageData getImageData(byte[] image) { try { BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(image)); - if (bufferedImage != null) { + if(bufferedImage!=null) { int imageHeight = bufferedImage.getHeight(); int imageWidth = bufferedImage.getWidth(); return new ImageData(imageHeight, imageWidth); @@ -75,99 +76,125 @@ public ImageData getImageDimensions(IVSImage image, int width, int height) { int imageHeight = image.getHeight(); Float newWidth = (new Float(height) / new Float(imageHeight)) * new Float(imageWidth); - if (newWidth < width) { + if(newWidthtotal pages,last page is returned + * @param pageNo. if pageNo<1, 1st page is returned, if pageNo>total pages,last + * page is returned * @return list of images in the requested pageNo - */ + */ + @Override + public List getImages(int pageNo) { + return getImages(pageNo, SortByField.CREATION_DATE.getValue(), Sort.Direction.DESC.toString()); + } + + /** + * Method to return the requested images + * + * @param pageNo. if pageNo<1, 1st page is returned, if pageNo>total pages,last + * page is returned + * @return list of images in the requested pageNo and requested order. + */ @Override - public List getImages(int pageNo) { + public List getImages(int pageNo, String sortedBy, String order) { + Sort sortingParameters = Sort.by(SortByField.CREATION_DATE.getValue()).descending(); pageNo = validatePageNumber(pageNo); - Pageable sortByRequestedField = PageRequest.of(pageNo-1, pageSize, Sort.by(SortByField.CREATION_DATE.getValue()).descending()); + if(sortedBy!=null && SortByField.getAllValues().contains(sortedBy)) { + sortingParameters = Sort.by(sortedBy); + } + if(order!=null && order.equalsIgnoreCase(Sort.Direction.ASC.toString())) { + sortingParameters = sortingParameters.ascending(); + } + else { + sortingParameters = sortingParameters.descending(); + } + Pageable sortByRequestedField = PageRequest.of(pageNo - 1, pageSize, sortingParameters); Page images = imageRepo.findAll(sortByRequestedField); List results = new ArrayList<>(); - images.getContent().forEach(i -> results.add(i)); + if(images != null) { + images.getContent().forEach(i -> results.add(i)); + } return results; - } - + } + /** - * Method to return the total pages sufficient to display all images + * Method to return the total pages sufficient to display all images * * @return totalPages required to display all images in DB - */ + */ @Override public long getTotalPages() { - return (imageRepo.count() % pageSize == 0) ? imageRepo.count() / pageSize : (imageRepo.count() / pageSize) + 1; + return (imageRepo.count() % pageSize==0) ? imageRepo.count() / pageSize:(imageRepo.count() / pageSize) + 1; } - + /** - * Method to return the total image count + * Method to return the total image count * * @return total count of images in DB - */ + */ @Override public long getTotalImageCount() { return imageRepo.count(); } - + /** - * Method to return page number after validation + * Method to return page number after validation * * @param pageNo page provided by calling method - * @return 1 if pageNo less than 1 and lastPage if pageNo greater than totalPages. - */ + * @return 1 if pageNo less than 1 and lastPage if pageNo greater than + * totalPages. + */ @Override public int validatePageNumber(int pageNo) { long totalPages = getTotalPages(); if(pageNo<1) { return 1; } else if(pageNo>totalPages) { - return (totalPages == 0)? 1:(int) totalPages; + return (totalPages==0) ? 1:(int) totalPages; } return pageNo; } - + /** - * Method to edit image details + * Method to edit image details * - * @param imageId - image unique identifier + * @param imageId - image unique identifier * @param imageForm - ImageForm with updated values for image fields - * @return throws ImageDoesNotExistException if no image exists with id, - */ + * @return throws ImageDoesNotExistException if no image exists with id, + */ @Override - public void editImage(String imageId, ImageForm imageForm) throws ImageDoesNotExistException{ + public void editImage(String imageId, ImageForm imageForm) throws ImageDoesNotExistException { IVSImage image = getImageById(imageId); image.setName(imageForm.getName()); image.setDescription(imageForm.getDescription()); - imageRepo.save((VSImage)image); + imageRepo.save((VSImage) image); } /** - * Method to lookup image by id + * Method to lookup image by id * * @param imageId - image unique identifier - * @return image with provided image id if it exists, - * throws ImageDoesNotExistException if no image exists with id, - */ + * @return image with provided image id if it exists, throws + * ImageDoesNotExistException if no image exists with id, + */ @Override public IVSImage getImageById(String imageId) throws ImageDoesNotExistException { Optional imageOptional = imageRepo.findById(imageId); - if (imageOptional.isPresent()) { + if(imageOptional.isPresent()) { return imageOptional.get(); } else { throw new ImageDoesNotExistException("Image doesn't exist for image id" + imageId); - } + } } - + @Override public List findByFilenameOrNameContains(String searchTerm) { String likeSearchTerm = "%" + searchTerm + "%"; @@ -176,22 +203,22 @@ public List findByFilenameOrNameContains(String searchTerm) { results.forEach(r -> imageResults.add(r)); return imageResults; } - + @Override public void addCategory(IVSImage image, ImageCategory category) { - if (image.getCategories() == null) { + if(image.getCategories()==null) { image.setCategories(new ArrayList<>()); } - - if (!image.getCategories().contains(category)) { + + if(!image.getCategories().contains(category)) { image.getCategories().add(category); } - imageRepo.save((VSImage)image); + imageRepo.save((VSImage) image); } - + @Override public void removeCategory(IVSImage image, ImageCategory category) { image.getCategories().remove(category); - imageRepo.save((VSImage)image); + imageRepo.save((VSImage) image); } } diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/staff/ListImagesController.java b/vspace/src/main/java/edu/asu/diging/vspace/web/staff/ListImagesController.java index e8c295bc5..a3d4dc11c 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/web/staff/ListImagesController.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/staff/ListImagesController.java @@ -1,15 +1,15 @@ package edu.asu.diging.vspace.web.staff; -import java.util.ArrayList; -import java.util.List; - import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import edu.asu.diging.vspace.core.model.ImageCategory; +import edu.asu.diging.vspace.core.model.SortByField; import edu.asu.diging.vspace.core.services.IImageService; @Controller @@ -19,7 +19,9 @@ public class ListImagesController { private IImageService imageService; @RequestMapping("/staff/images/list/{page}") - public String listSpaces(@PathVariable String page, Model model) { + public String listImagesByPage(@PathVariable String page, + @RequestParam(value = "sort", required = false) String sortedBy, + @RequestParam(value = "order", required = false) String order, Model model) { int pageNo; try { pageNo = imageService.validatePageNumber(Integer.parseInt(page)); @@ -29,10 +31,12 @@ public String listSpaces(@PathVariable String page, Model model) { model.addAttribute("totalPages", imageService.getTotalPages()); model.addAttribute("currentPageNumber", pageNo); model.addAttribute("totalImageCount", imageService.getTotalImageCount()); - model.addAttribute("images", imageService.getImages(pageNo)); + model.addAttribute("images", imageService.getImages(pageNo, sortedBy, order)); model.addAttribute("imageCategories", ImageCategory.values()); - + model.addAttribute("sortProperty", + (sortedBy==null || sortedBy.equals("")) ? SortByField.CREATION_DATE.getValue():sortedBy); + model.addAttribute("order", + (order==null || order.equals("")) ? Sort.Direction.DESC.toString().toLowerCase():order); return "staff/images/list"; } - } diff --git a/vspace/src/main/webapp/WEB-INF/views/staff/images/imagelist.jsp b/vspace/src/main/webapp/WEB-INF/views/staff/images/imagelist.jsp index 5bf74523b..75dc3fd61 100644 --- a/vspace/src/main/webapp/WEB-INF/views/staff/images/imagelist.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/staff/images/imagelist.jsp @@ -1,12 +1,13 @@ <%@ page pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib prefix="sec" - uri="http://www.springframework.org/security/tags"%> + uri="http://www.springframework.org/security/tags"%> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> @@ -51,74 +74,66 @@ $( document ).ready(function() { } - -
This virtual exhibition - contains the following images.
- - - - - - - - - - - - - - - - - - - - - - -
FilenameNameCreated ByCreated DateTag
">" - class="img-thumbnail"> - ${image.filename} ${image.name}${image.createdBy}${image.creationDate} - - - - - - - -
${image.id}/tag?${_csrf.parameterName}=${_csrf.token}" - method="post"> - - -
-
-
- -
There are no images in - Virtual Space.
-
+ +
This virtual exhibition + contains the following images.
+ + + + + + + + + + + + + + + + + + + + + +
FilenameNameCreated + ByCreated + DateTag
">" + class="img-thumbnail"> ${image.filename} ${image.name}${image.createdBy}${image.creationDate} + + + + + +
${image.id}/tag?${_csrf.parameterName}=${_csrf.token}" + method="post"> + +
+
+
+
+ +
There are no images in + Virtual Space.
+
- \ No newline at end of file + Modules + "> + + + + \ No newline at end of file diff --git a/vspace/src/main/webapp/WEB-INF/views/staff/modules/module.jsp b/vspace/src/main/webapp/WEB-INF/views/staff/modules/module.jsp index 1edc9c701..f5d9bae63 100644 --- a/vspace/src/main/webapp/WEB-INF/views/staff/modules/module.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/staff/modules/module.jsp @@ -5,18 +5,63 @@ uri="http://www.springframework.org/security/tags"%> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> + +

Module: ${module.name}

@@ -102,31 +156,60 @@ $(document).ready(function($) {
-
- -
- -
-
- "> -
${sequences.name}
-

${sequences.description}

-
-
-
-
-
-
-
+
+ +
+ +
+
+ "> +
${sequences.name}
+

${sequences.description}

+
+
+
+
+
+
+ + + + + diff --git a/vspace/src/main/webapp/WEB-INF/views/staff/modules/slides/slide.jsp b/vspace/src/main/webapp/WEB-INF/views/staff/modules/slides/slide.jsp index 8133509ae..a6b3b4d96 100644 --- a/vspace/src/main/webapp/WEB-INF/views/staff/modules/slides/slide.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/staff/modules/slides/slide.jsp @@ -392,6 +392,7 @@ $(document).ready(function() { data: formData, enctype: 'multipart/form-data', success: function(data) { + var textblock = $('

'+text+'

'); $(textblock).css({ 'margin': "10px" diff --git a/vspace/src/test/java/edu/asu/diging/vspace/core/services/impl/SlideManagerTest.java b/vspace/src/test/java/edu/asu/diging/vspace/core/services/impl/SlideManagerTest.java new file mode 100644 index 000000000..6ffb0da77 --- /dev/null +++ b/vspace/src/test/java/edu/asu/diging/vspace/core/services/impl/SlideManagerTest.java @@ -0,0 +1,160 @@ +package edu.asu.diging.vspace.core.services.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; + +import edu.asu.diging.vspace.core.data.SequenceRepository; +import edu.asu.diging.vspace.core.data.SlideRepository; +import edu.asu.diging.vspace.core.exception.SlideDoesNotExistException; +import edu.asu.diging.vspace.core.model.ISlide; +import edu.asu.diging.vspace.core.model.impl.Sequence; +import edu.asu.diging.vspace.core.model.impl.Slide; + +public class SlideManagerTest { + + @Mock + private SequenceRepository sequenceRepo; + + @Mock + private SlideRepository slideRepo; + + @InjectMocks + private SlideManager slideManagerToTest = new SlideManager(); + + // setting common used variables and Objects + private String slideId, slideIdNotPresent, slideIdOther, moduleId, sequenceId, slideIdNotInSequence, sequenceIdOther; + private List slidesList = new ArrayList(); + private List slidesListOther = new ArrayList(); + private Sequence sequenceObj; + private Sequence sequenceObjOther; + + @Before + public void init() { + MockitoAnnotations.initMocks(this); + + sequenceObj = new Sequence(); + sequenceObjOther = new Sequence(); + + slideId = "SLI000000002"; + slideIdOther = "SLI000000001"; + slideIdNotPresent = "SLI000000300"; + slideIdNotInSequence = "SLI000000219"; + + moduleId = "MOD000000002"; + + sequenceId = "SEQ000000004"; + sequenceIdOther = "SEQ000000005"; + + Slide slideObj = new Slide(); + slideObj.setId(slideId); + + Slide slideObjOther = new Slide(); + slideObjOther.setId(slideIdOther); + + slidesList.add(slideObj); + slidesListOther.add(slideObj); + slidesListOther.add(slideObjOther); + } + + @Test + public void test_getSlideSequence_slideExistsInSequence() { + + // Positive scenario - Slide present in Sequence + + sequenceObj.setId(sequenceId); + sequenceObj.setSlides(slidesList); + List sequencesList = new ArrayList<>(); + sequencesList.add(sequenceObj); + Mockito.when(sequenceRepo.findSequencesForModule(moduleId)).thenReturn(sequencesList); + List slideSequencePresent = slideManagerToTest.getSlideSequences(slideId, moduleId); + + String actualSlideIdSequence = slideSequencePresent.get(0).getSlides().get(0).getId(); + + Assert.assertEquals(slideId, actualSlideIdSequence); + Assert.assertEquals(slideSequencePresent.size(), sequencesList.size()); + + } + + @Test + public void test_getSlideSequence_slideNotExistsInSequence() { + + sequenceObj.setId(sequenceId); + sequenceObj.setSlides(slidesList); + List sequencesList = new ArrayList<>(); + sequencesList.add(sequenceObj); + Mockito.when(sequenceRepo.findSequencesForModule(moduleId)).thenReturn(sequencesList); + + List actualSequenceSlideListNotPresent = slideManagerToTest.getSlideSequences(slideIdNotInSequence, + moduleId); + Assert.assertTrue(actualSequenceSlideListNotPresent.isEmpty()); + } + + @Test + public void test_deleteSlideById_slideIdPresent() throws SlideDoesNotExistException { + + sequenceObj.setId(sequenceId); + sequenceObj.setSlides(slidesList); + List sequencesList = new ArrayList<>(); + sequencesList.add(sequenceObj); + Mockito.when(sequenceRepo.findSequencesForModule(moduleId)).thenReturn(sequencesList); + + Slide slide = new Slide(); + slide.setId(slideId); + Optional slideObj = Optional.of(slide); + Mockito.when(slideRepo.findById(slide.getId())).thenReturn(slideObj); + slideManagerToTest.deleteSlideById(slideId, moduleId); + Mockito.verify(slideRepo).delete((Slide) slide); + } + + @Test + public void test_deleteSlideById_slideIdNotPresent() throws SlideDoesNotExistException { + + Mockito.when(slideRepo.findById(slideIdNotPresent)).thenReturn(Optional.empty()); + slideManagerToTest.deleteSlideById(slideIdNotPresent, moduleId); + Mockito.verify(slideRepo, Mockito.never()).deleteById(slideIdNotPresent); + + } + + @Test + public void test_deleteSlideById_slideIdIsNull() { + + Mockito.when(slideRepo.findById(null)).thenReturn(Optional.empty()); + slideManagerToTest.deleteSlideById(null, moduleId); + Mockito.verify(slideRepo, Mockito.never()).deleteById(slideIdNotPresent); + } + + @Test + public void test_deleteSlideById_slideIdPresentManySequences() throws SlideDoesNotExistException { + + sequenceObj.setId(sequenceId); + sequenceObj.setSlides(slidesList); + + sequenceObjOther.setId(sequenceIdOther); + sequenceObjOther.setSlides(slidesList); + sequenceObjOther.setSlides(slidesListOther); + + List sequencesList = new ArrayList<>(); + sequencesList.add(sequenceObj); + sequencesList.add(sequenceObjOther); + ISlide slideObjBeforeDeletion = sequencesList.get(1).getSlides().get(0); + Mockito.when(sequenceRepo.findSequencesForModule(moduleId)).thenReturn(sequencesList); + + ISlide slideObj = slidesList.get(0); + Mockito.when(slideRepo.findById(slideObj.getId())).thenReturn(Optional.of((Slide) slideObj)); + slideManagerToTest.deleteSlideById(slideId, moduleId); + Mockito.verify(slideRepo).delete((Slide) slideObj); + + Assert.assertFalse(sequencesList.get(1).getSlides().contains(slideObjBeforeDeletion)); + + + } +} From 9cad420335177aab13ba925ca5dfaae7d1c0e021 Mon Sep 17 00:00:00 2001 From: Prashant Ravindra Jadhav <55036442+prjadhav14@users.noreply.github.com> Date: Thu, 21 May 2020 14:04:28 -0700 Subject: [PATCH 5/9] Story/vspc 58 (#94) * [VSPC-58] Checking in for a safe copy, load first slide development. * [VSPC-58] Loading first slide of selected start sequence for a module. * [VSPC-58] deleting temporary files used for development * [VSPC-58] Safe copy * [VSPC-58] Making a safe copy * [VSPC 58] Safe Copy for exhibition slides * [VSPC-58]module-sequence recursion issue and slides load for startSeqId * [VSPC-58] links to first slide, slides in first seq and seq in slides * [VSPC-58] Copy for partial Module layout development * [VSPC 58] loading sidebar with slide links and partial slide show * [VSPC-58] slideshow and bootstrap sidebar * [VSPC 58] Loading module and slide show for the configured module * [VSPC-58] Changes in code based on review comments. * [VSPC-58] Stream filter used to check if sequence is present in the module. * [VSPC-58] removing slideShow jsp and adding UI changes * [VSPC-58] applying custom formatter * [VSPC-58] slideShow is removed. * [VSPC-58] bootstrap and jquery resolved * [VSPC-58] Error handling and UI changes as per review comments * [VSPC-58] Exception handling using Controller Advice and UI changes * [VSPC-58] WIP changes for space links from modules * [VSPC-58] Space links on Module layout * [VSPC-58] UI changes and exceptions for space links in controllers * [VSPC-58] Changes for review comments * [VSPC-58] Sequence check from repo and message handling * [VSPC-58] UI changes and controller logging * [VSPC 58] UI fixes for header menus and dynamic content for module * [VSPC-58] UI footer alignment issue * [VSPC 58] UI fix for managing footer on Module layout. * [VSPC-58] UI changes for new module layout * [VSPC 58] Module layout changes * [VSPC 58] Adding space link and sequence link in module layout * [VSPC 58] Module Layout changes * [VSPC 58] removing default padding of dropdown item * [VSPC 58] Commenting language picker component * [VSPC 58] Changes for review comments * [VSPC 58] Module Layout changes for review comments * [VSPC 58] Resolving Conflicts * Resolving conflicts and adding code * [VSPC-58] Footer alignment for shorter content * [VSPC-58] Fix for footer issue * [VSPC-58] Try fix to blown up images on module layout * [VSPC-58] Adding slide title to the module layout Co-authored-by: prashant Co-authored-by: prashant --- .../vspace/core/data/SequenceRepository.java | 41 +-- .../vspace/core/services/IModuleManager.java | 2 + .../core/services/impl/ModuleManager.java | 5 + .../web/ExhibitionModuleController.java | 29 +- .../web/ExhibitionSequencesController.java | 65 ++++ .../vspace/web/ExhibitionSlideController.java | 103 ++++++ .../exception/ExhibitionExceptionHandler.java | 88 +++++ .../exception/ModuleNotFoundException.java | 13 + .../exception/SequenceNotFoundException.java | 14 + .../web/exception/SlideNotFoundException.java | 13 + .../SlidesInSequenceNotFoundException.java | 14 + .../web/exception/SpaceNotFoundException.java | 14 + .../WEB-INF/tiles/skeleton_exhibition2.jsp | 303 ++++++++++-------- .../WEB-INF/views/exhibition/module.jsp | 124 ++++++- .../webapp/WEB-INF/views/exhibition/space.jsp | 2 +- .../main/webapp/resources/extra/Module_1.css | 203 ++++++++++++ .../extra/Module_1___slideshow___1.css | 213 ++++++++++++ 17 files changed, 1080 insertions(+), 166 deletions(-) create mode 100644 vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSequencesController.java create mode 100644 vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSlideController.java create mode 100644 vspace/src/main/java/edu/asu/diging/vspace/web/exception/ExhibitionExceptionHandler.java create mode 100644 vspace/src/main/java/edu/asu/diging/vspace/web/exception/ModuleNotFoundException.java create mode 100644 vspace/src/main/java/edu/asu/diging/vspace/web/exception/SequenceNotFoundException.java create mode 100644 vspace/src/main/java/edu/asu/diging/vspace/web/exception/SlideNotFoundException.java create mode 100644 vspace/src/main/java/edu/asu/diging/vspace/web/exception/SlidesInSequenceNotFoundException.java create mode 100644 vspace/src/main/java/edu/asu/diging/vspace/web/exception/SpaceNotFoundException.java create mode 100644 vspace/src/main/webapp/resources/extra/Module_1.css create mode 100644 vspace/src/main/webapp/resources/extra/Module_1___slideshow___1.css diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/data/SequenceRepository.java b/vspace/src/main/java/edu/asu/diging/vspace/core/data/SequenceRepository.java index a81fca8ef..bbf98338f 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/data/SequenceRepository.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/data/SequenceRepository.java @@ -1,19 +1,22 @@ -package edu.asu.diging.vspace.core.data; - -import java.util.List; - -import org.javers.spring.annotation.JaversSpringDataAuditable; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.PagingAndSortingRepository; -import org.springframework.stereotype.Repository; - -import edu.asu.diging.vspace.core.model.impl.Sequence; - -@Repository -@JaversSpringDataAuditable -public interface SequenceRepository extends PagingAndSortingRepository { - - @Query("SELECT d FROM Sequence d WHERE d.module.id = ?1") - public List findSequencesForModule(String moduleId); - -} +package edu.asu.diging.vspace.core.data; + +import java.util.List; + +import org.javers.spring.annotation.JaversSpringDataAuditable; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.PagingAndSortingRepository; +import org.springframework.stereotype.Repository; + +import edu.asu.diging.vspace.core.model.impl.Sequence; + +@Repository +@JaversSpringDataAuditable +public interface SequenceRepository extends PagingAndSortingRepository { + + @Query("SELECT d FROM Sequence d WHERE d.module.id = ?1") + public List findSequencesForModule(String moduleId); + + @Query("SELECT d FROM Sequence d WHERE d.module.id = ?1 and d.id = ?2") + public Sequence findSequenceForModuleAndSequence(String moduleId, String sequenceId); + +} diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/services/IModuleManager.java b/vspace/src/main/java/edu/asu/diging/vspace/core/services/IModuleManager.java index 80a7a577c..5f5e74b23 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/services/IModuleManager.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/services/IModuleManager.java @@ -18,4 +18,6 @@ public interface IModuleManager { List getModuleSequences(String moduleId); + ISequence checkIfSequenceExists(String moduleId, String sequenceId); + } \ No newline at end of file diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/ModuleManager.java b/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/ModuleManager.java index f524cd219..1fd7d5ba1 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/ModuleManager.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/ModuleManager.java @@ -76,4 +76,9 @@ public List getModuleSlides(String moduleId) { public List getModuleSequences(String moduleId) { return new LinkedList<>(sequenceRepo.findSequencesForModule(moduleId)); } + + @Override + public ISequence checkIfSequenceExists(String moduleId, String sequenceId) { + return sequenceRepo.findSequenceForModuleAndSequence(moduleId,sequenceId); + } } diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionModuleController.java b/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionModuleController.java index 07fe38adb..115a42e0d 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionModuleController.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionModuleController.java @@ -6,7 +6,12 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import edu.asu.diging.vspace.core.model.IModule; +import edu.asu.diging.vspace.core.model.ISpace; import edu.asu.diging.vspace.core.services.IModuleManager; +import edu.asu.diging.vspace.core.services.ISpaceManager; +import edu.asu.diging.vspace.web.exception.ModuleNotFoundException; +import edu.asu.diging.vspace.web.exception.SpaceNotFoundException; @Controller public class ExhibitionModuleController { @@ -14,10 +19,26 @@ public class ExhibitionModuleController { @Autowired private IModuleManager moduleManager; - @RequestMapping(value = "/exhibit/module/{id}") - public String module(@PathVariable("id") String id, Model model) { - model.addAttribute("module", moduleManager.getModule(id)); + @Autowired + private ISpaceManager spaceManager; - return "module"; + @RequestMapping(value = "/exhibit/{spaceId}/module/{id}") + public String module(@PathVariable("id") String id, @PathVariable("spaceId") String spaceId, Model model) + throws SpaceNotFoundException, ModuleNotFoundException { + ISpace space = spaceManager.getSpace(spaceId); + if (space == null) { + throw new SpaceNotFoundException(spaceId); + } + IModule module = moduleManager.getModule(id); + model.addAttribute("module", module); + if (module == null) { + throw new ModuleNotFoundException(id); + } else if (module.getStartSequence() == null) { + model.addAttribute("showAlert", true); + model.addAttribute("message", "Sorry, module has not been configured yet."); + return "module"; + } + String startSequenceID = module.getStartSequence().getId(); + return "redirect:/exhibit/{spaceId}/module/" + id + "/sequence/" + startSequenceID; } } diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSequencesController.java b/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSequencesController.java new file mode 100644 index 000000000..b42206171 --- /dev/null +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSequencesController.java @@ -0,0 +1,65 @@ +package edu.asu.diging.vspace.web; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; + +import edu.asu.diging.vspace.core.model.IModule; +import edu.asu.diging.vspace.core.model.ISequence; +import edu.asu.diging.vspace.core.model.ISlide; +import edu.asu.diging.vspace.core.model.ISpace; +import edu.asu.diging.vspace.core.services.IModuleManager; +import edu.asu.diging.vspace.core.services.ISequenceManager; +import edu.asu.diging.vspace.core.services.ISpaceManager; +import edu.asu.diging.vspace.web.exception.ModuleNotFoundException; +import edu.asu.diging.vspace.web.exception.SequenceNotFoundException; +import edu.asu.diging.vspace.web.exception.SlidesInSequenceNotFoundException; +import edu.asu.diging.vspace.web.exception.SpaceNotFoundException; + +@Controller +public class ExhibitionSequencesController { + + @Autowired + private IModuleManager moduleManager; + + @Autowired + private ISequenceManager sequenceManager; + + @Autowired + private ISpaceManager spaceManager; + + @RequestMapping(value = "/exhibit/{spaceId}/module/{moduleId}/sequence/{sequenceId}") + public String sequence(Model model, @PathVariable("sequenceId") String sequenceId, + @PathVariable("moduleId") String moduleId, @PathVariable("spaceId") String spaceId) + throws ModuleNotFoundException, SequenceNotFoundException, SlidesInSequenceNotFoundException, SpaceNotFoundException { + ISpace space = spaceManager.getSpace(spaceId); + if (space == null) { + throw new SpaceNotFoundException(spaceId); + } + IModule module = moduleManager.getModule(moduleId); + if (module == null) { + throw new ModuleNotFoundException(moduleId); + } + model.addAttribute("module", module); + if (module.getStartSequence() == null) { + model.addAttribute("showAlert", true); + model.addAttribute("message", "Sorry, module has not been configured yet."); + return "module"; + } + ISequence sequenceExist=moduleManager.checkIfSequenceExists(moduleId, sequenceId); + if (sequenceExist==null) { + throw new SequenceNotFoundException(sequenceId); + } + + List slides = sequenceManager.getSequence(sequenceId).getSlides(); + if (slides.size() == 0) { + throw new SlidesInSequenceNotFoundException(); + } + String firstSlideId = slides.get(0).getId(); + return "redirect:/exhibit/{spaceId}/module/" + moduleId + "/sequence/" + sequenceId + "/slide/" + firstSlideId; + } +} diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSlideController.java b/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSlideController.java new file mode 100644 index 000000000..e0a2eeaec --- /dev/null +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSlideController.java @@ -0,0 +1,103 @@ +package edu.asu.diging.vspace.web; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import edu.asu.diging.vspace.core.exception.SpaceDoesNotExistException; +import edu.asu.diging.vspace.core.model.IModule; +import edu.asu.diging.vspace.core.model.ISequence; +import edu.asu.diging.vspace.core.model.ISlide; +import edu.asu.diging.vspace.core.model.ISpace; +import edu.asu.diging.vspace.core.services.IModuleManager; +import edu.asu.diging.vspace.core.services.ISequenceManager; +import edu.asu.diging.vspace.core.services.ISpaceManager; +import edu.asu.diging.vspace.core.services.impl.SlideManager; +import edu.asu.diging.vspace.web.exception.ModuleNotFoundException; +import edu.asu.diging.vspace.web.exception.SequenceNotFoundException; +import edu.asu.diging.vspace.web.exception.SlideNotFoundException; +import edu.asu.diging.vspace.web.exception.SlidesInSequenceNotFoundException; +import edu.asu.diging.vspace.web.exception.SpaceNotFoundException; + +@Controller +public class ExhibitionSlideController { + + @Autowired + private IModuleManager moduleManager; + + @Autowired + private SlideManager sildeManager; + + @Autowired + private ISequenceManager sequenceManager; + + @Autowired + private ISpaceManager spaceManager; + + @RequestMapping(value = "/exhibit/{spaceId}/module/{moduleId}/sequence/{sequenceId}/slide/{slideId}", method = RequestMethod.GET) + public String slide(Model model, @PathVariable("slideId") String slideId, @PathVariable("moduleId") String moduleId, + @PathVariable("sequenceId") String sequenceId, @PathVariable("spaceId") String spaceId) + throws ModuleNotFoundException, SequenceNotFoundException, + SlidesInSequenceNotFoundException, SlideNotFoundException, SpaceDoesNotExistException, + SpaceNotFoundException { + + ISpace space = spaceManager.getSpace(spaceId); + if (space == null) { + throw new SpaceNotFoundException(spaceId); + } + IModule module = moduleManager.getModule(moduleId); + model.addAttribute("module", module); + if (module == null) { + throw new ModuleNotFoundException(moduleId); + } + if (module.getStartSequence() == null) { + model.addAttribute("showAlert", true); + model.addAttribute("message", "Sorry, module has not been configured yet."); + return "module"; + } + String startSequenceId = module.getStartSequence().getId(); + model.addAttribute("startSequenceId", startSequenceId); + ISequence sequenceExist=moduleManager.checkIfSequenceExists(moduleId, sequenceId); + if (sequenceExist==null) { + throw new SequenceNotFoundException(sequenceId); + } + List sequenceSlides = sequenceManager.getSequence(sequenceId).getSlides(); + + boolean slideExist = sequenceSlides.stream().anyMatch(slide -> slide.getId().equals(slideId)); + if (!slideExist) { + throw new SlideNotFoundException(slideId); + } + + if (sequenceSlides.size() == 0) { + throw new SlidesInSequenceNotFoundException(); + } + model.addAttribute("firstSlide", module.getStartSequence().getSlides().get(0).getId()); + String nextSlideId = ""; + String prevSlideId = ""; + int slideIndex = 0; + slideIndex = sequenceSlides.indexOf(sildeManager.getSlide(slideId)); + int slideSize = sequenceSlides.size(); + if (slideSize > slideIndex + 1) { + nextSlideId = sequenceSlides.get(slideIndex + 1).getId(); + } + if (slideIndex > 0) { + prevSlideId = sequenceSlides.get(slideIndex - 1).getId(); + } + model.addAttribute("sequence",sequenceExist); + model.addAttribute("slides", sequenceSlides); + model.addAttribute("currentSequenceId", sequenceId); + model.addAttribute("nextSlide", nextSlideId); + model.addAttribute("prevSlide", prevSlideId); + model.addAttribute("currentSlideCon", sildeManager.getSlide(slideId)); + model.addAttribute("numOfSlides", sequenceSlides.size()); + model.addAttribute("currentNumOfSlide", slideIndex + 1); + model.addAttribute("spaceId", spaceId); + model.addAttribute("spaceName", spaceManager.getSpace(spaceId).getName()); + return "module"; + } +} diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/exception/ExhibitionExceptionHandler.java b/vspace/src/main/java/edu/asu/diging/vspace/web/exception/ExhibitionExceptionHandler.java new file mode 100644 index 000000000..669135f2a --- /dev/null +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/exception/ExhibitionExceptionHandler.java @@ -0,0 +1,88 @@ +package edu.asu.diging.vspace.web.exception; + +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.servlet.ModelAndView; + +@ControllerAdvice +public class ExhibitionExceptionHandler { + + private static final Logger logger = LoggerFactory.getLogger(ExhibitionExceptionHandler.class); + private static final String module_not_found="module_not_found"; + private static final String space_not_found="space_not_found"; + private static final String sequence_not_found="sequence_not_found"; + private static final String slide_not_found="slide_not_found"; + private static final String slide_not_found_in_sequence="slide_not_found_in_sequence"; + + @ExceptionHandler({ ModuleNotFoundException.class }) + protected ModelAndView handleModuleNotFoundException(HttpServletRequest request, ModuleNotFoundException ex) { + ModelAndView modelAndView = new ModelAndView(); + modelAndView.addObject("error_code", module_not_found); + modelAndView.addObject("showAlert", true); + modelAndView.addObject("message", ex.getMessage()); + logger.info("ModuleNotFoundException Occured:: URL=" + request.getRequestURL()); + logger.info("Code:: "+module_not_found+" Message:: " + ex.getMessage()); + modelAndView.addObject("url", request.getRequestURL()); + modelAndView.setViewName("module"); + return modelAndView; + } + + @ExceptionHandler({ SlideNotFoundException.class }) + protected ModelAndView handleSlideNotFoundException(HttpServletRequest request, SlideNotFoundException ex) { + ModelAndView modelAndView = new ModelAndView(); + modelAndView.addObject("error_code", slide_not_found); + modelAndView.addObject("showAlert", true); + modelAndView.addObject("message", ex.getMessage()); + logger.info("SlideNotFoundException Occured:: URL=" + request.getRequestURL()); + logger.info("Code:: "+slide_not_found+" Message:: " + ex.getMessage()); + modelAndView.addObject("url", request.getRequestURL()); + modelAndView.setViewName("module"); + return modelAndView; + } + + @ExceptionHandler({ SequenceNotFoundException.class }) + protected ModelAndView handleSequenceNotFoundException(HttpServletRequest request, SequenceNotFoundException ex) { + ModelAndView modelAndView = new ModelAndView(); + modelAndView.addObject("error_code", sequence_not_found); + modelAndView.addObject("showAlert", true); + modelAndView.addObject("message", ex.getMessage()); + logger.info("SequenceNotFoundException Occured:: URL=" + request.getRequestURL()); + logger.info("Code:: "+sequence_not_found+" Message:: " + ex.getMessage()); + modelAndView.addObject("url", request.getRequestURL()); + modelAndView.setViewName("module"); + return modelAndView; + } + + @ExceptionHandler({ SlidesInSequenceNotFoundException.class }) + protected ModelAndView handleSlidesInSequenceNotFoundException(HttpServletRequest request, + SlidesInSequenceNotFoundException ex) { + ModelAndView modelAndView = new ModelAndView(); + modelAndView.addObject("error_code", slide_not_found_in_sequence); + modelAndView.addObject("showAlert", true); + modelAndView.addObject("message", ex.getMessage()); + logger.info("SlidesInSequenceNotFoundException Occured:: URL=" + request.getRequestURL()); + logger.info("Code:: "+slide_not_found_in_sequence+" Message:: " + ex.getMessage()); + modelAndView.addObject("url", request.getRequestURL()); + modelAndView.setViewName("module"); + return modelAndView; + } + + @ExceptionHandler({ SpaceNotFoundException.class }) + protected ModelAndView handleSpaceNotFoundException(HttpServletRequest request, + SlidesInSequenceNotFoundException ex) { + ModelAndView modelAndView = new ModelAndView(); + modelAndView.addObject("error_code", space_not_found); + modelAndView.addObject("showAlert", true); + modelAndView.addObject("message", ex.getMessage()); + logger.info("SpaceNotFoundException Occured:: URL=" + request.getRequestURL()); + logger.info("Code:: "+space_not_found+" Message:: " + ex.getMessage()); + modelAndView.addObject("url", request.getRequestURL()); + modelAndView.setViewName("module"); + return modelAndView; + } + +} \ No newline at end of file diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/exception/ModuleNotFoundException.java b/vspace/src/main/java/edu/asu/diging/vspace/web/exception/ModuleNotFoundException.java new file mode 100644 index 000000000..3f491b26f --- /dev/null +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/exception/ModuleNotFoundException.java @@ -0,0 +1,13 @@ +package edu.asu.diging.vspace.web.exception; + +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.http.HttpStatus; + +@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "Module Not Found") +public class ModuleNotFoundException extends Exception { + private static final long serialVersionUID = 1L; + + public ModuleNotFoundException(String id) { + super("Module with id " + id + " not found"); + } +} \ No newline at end of file diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/exception/SequenceNotFoundException.java b/vspace/src/main/java/edu/asu/diging/vspace/web/exception/SequenceNotFoundException.java new file mode 100644 index 000000000..ca8650bd6 --- /dev/null +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/exception/SequenceNotFoundException.java @@ -0,0 +1,14 @@ +package edu.asu.diging.vspace.web.exception; + +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.http.HttpStatus; + +@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "Module Not Found") +public class SequenceNotFoundException extends Exception { + private static final long serialVersionUID = 1L; + + public SequenceNotFoundException(String id) { + super("Sequence with id " + id + " not found"); + } + +} \ No newline at end of file diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/exception/SlideNotFoundException.java b/vspace/src/main/java/edu/asu/diging/vspace/web/exception/SlideNotFoundException.java new file mode 100644 index 000000000..aaef7f7dd --- /dev/null +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/exception/SlideNotFoundException.java @@ -0,0 +1,13 @@ +package edu.asu.diging.vspace.web.exception; + +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.http.HttpStatus; + +@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "Slide Not Found") +public class SlideNotFoundException extends Exception { + private static final long serialVersionUID = 1L; + + public SlideNotFoundException(String id) { + super("Slide with id " + id + " not found"); + } +} \ No newline at end of file diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/exception/SlidesInSequenceNotFoundException.java b/vspace/src/main/java/edu/asu/diging/vspace/web/exception/SlidesInSequenceNotFoundException.java new file mode 100644 index 000000000..3114daa45 --- /dev/null +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/exception/SlidesInSequenceNotFoundException.java @@ -0,0 +1,14 @@ +package edu.asu.diging.vspace.web.exception; + +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.http.HttpStatus; + +@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "Module Not Found") +public class SlidesInSequenceNotFoundException extends Exception { + private static final long serialVersionUID = 1L; + + public SlidesInSequenceNotFoundException() { + super("Selected Sequence contains no Slides to display"); + } + +} \ No newline at end of file diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/exception/SpaceNotFoundException.java b/vspace/src/main/java/edu/asu/diging/vspace/web/exception/SpaceNotFoundException.java new file mode 100644 index 000000000..f3adddd32 --- /dev/null +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/exception/SpaceNotFoundException.java @@ -0,0 +1,14 @@ +package edu.asu.diging.vspace.web.exception; + +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.http.HttpStatus; + +@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "Space Not Found") +public class SpaceNotFoundException extends Exception { + private static final long serialVersionUID = 1L; + + public SpaceNotFoundException(String id) { + super("Space not found"); + } + +} \ No newline at end of file diff --git a/vspace/src/main/webapp/WEB-INF/tiles/skeleton_exhibition2.jsp b/vspace/src/main/webapp/WEB-INF/tiles/skeleton_exhibition2.jsp index 94a695109..b018b1f54 100644 --- a/vspace/src/main/webapp/WEB-INF/tiles/skeleton_exhibition2.jsp +++ b/vspace/src/main/webapp/WEB-INF/tiles/skeleton_exhibition2.jsp @@ -1,141 +1,182 @@ <%@ page language="java" pageEncoding="UTF-8"%> -<%@ page contentType="text/html;charset=UTF-8" %> +<%@ page contentType="text/html;charset=UTF-8"%> <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> +<%@ taglib prefix="sec" + uri="http://www.springframework.org/security/tags"%> - - - - - - Virtual Exhibition - - - - - " rel="stylesheet" > - - - - - - - - " rel="stylesheet"> - - - - - - - -
- - - - - - - -
- -
- ${message} -
-
- -
-
- -
-
- This web application was built with Virtual Spaces 2.0 - (https://github.com/diging/virtual-spaces-2.0). -
-
- - - - + + + + + + +" + rel="stylesheet"> + + + + + +
+
+ + + +
+ + +
+
+ ${message}
+
+
+
+
+
+ +
+
+ + + - + \ No newline at end of file diff --git a/vspace/src/main/webapp/WEB-INF/views/exhibition/module.jsp b/vspace/src/main/webapp/WEB-INF/views/exhibition/module.jsp index 27571a4cd..109526491 100644 --- a/vspace/src/main/webapp/WEB-INF/views/exhibition/module.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/exhibition/module.jsp @@ -1,12 +1,114 @@ +<%@ page pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="t"%> +<%@ taglib prefix="sec" + uri="http://www.springframework.org/security/tags"%> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> +" + rel="stylesheet"> + -
-
-
-

${module.name}

- -

-This feature is currently under active development. Please check back later! -

-
-
-
\ No newline at end of file +"> + +"> + + + + +
+ +
+

${module.name}

+
+
+

Slide ${currentNumOfSlide}/${numOfSlides}

+
+ + "> +
+ + + + + +
+
+
+

${currentSlideCon.name}

+ + + " /> + + +
+

${contents.text}

+
+
+
+
+
+
+ \ No newline at end of file diff --git a/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp b/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp index 599839d87..ff36059c7 100644 --- a/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp @@ -55,7 +55,7 @@ function drawLinks() { var posX = parseInt($("#space").css('margin-left')) + $("#space").position().left; var posY = $("#space").position().top; var link = $(''); - link.attr('href', ''); + link.attr('href', ''); var linkDisplay = $(''); diff --git a/vspace/src/main/webapp/resources/extra/Module_1.css b/vspace/src/main/webapp/resources/extra/Module_1.css new file mode 100644 index 000000000..13fd1417b --- /dev/null +++ b/vspace/src/main/webapp/resources/extra/Module_1.css @@ -0,0 +1,203 @@ +.Module_1_Class { + margin: 0 auto 0 auto; + width: 100%; + min-height: 720px; +} + +.Group_8_Class { + /* text-align: center; */ + text-align: -webkit-center; +} + +.Module_header_Class { + left: 604px; + top: 78px; + overflow: visible; +} + +.Space_link_Class { + position: absolute; + left: 1166px; + top: 11px; + overflow: visible; + color: blue; + font-size: larger; +} + +.SLideshow_option_Class { + position: absolute; + width: 43.846px; + height: 44px; + left: 1026px; + top: 117px; + overflow: visible; - + -web-animation: fadein 0.3s ease-out; - + -web-action-type: page; - + -web-action-target: Module_1___slideshow.html; + cursor: pointer; +} + +.Ellipse_2 { + filter: drop-shadow(3px 3px 20px rgba(0, 0, 0, 0.251)); + position: absolute; + overflow: visible; + width: 103.846px; + height: 104px; + left: 0px; + top: 0px; +} + +.Icon_ionic_md_play_circle { + overflow: visible; + position: absolute; + width: 24px; + height: 24px; + left: 10px; + top: 10px; + transform: matrix(1, 0, 0, 1, 0, 0); +} + +.Ellipse_5 { + filter: drop-shadow(3px 3px 20px rgba(0, 0, 0, 0.251)); + position: absolute; + overflow: visible; + width: 104px; + height: 104px; + left: 0px; + top: 0px; +} + +a, a:hover, a:focus { + color: inherit; + text-decoration: none; + transition: all 0.3s; +} + +.navbar-nav>li>a { + padding-top: 0px; + padding-bottom: 15px; +} + +.navbar-nav>li button { + padding-top: 0px; + padding-bottom: 5px; + line-height: 18px; +} + +.sidenav { + height: 1000px;; + width: 0; + position: absolute; + z-index: 1; + top: 0; + left: 0; + overflow-x: hidden; + background: #fff; + transition: 0.5s; + box-shadow: 5px 5px 5px 0px rgba(0, 0, 0, 0.19); + padding-top: 60px; + word-break: break-all; +} + +.sidenav a { + white-space: pre-wrap; +} + +.sidenav a:hover { + color: #818181; +} + +.sidenav .closebtn { + position: absolute; + top: 0; + right: 3px; + margin-left: 50px; +} + +.sidenav .dropdown-item { + padding: 0px; +} +.barPosition { + position: absolute; + color: dimgrey; + padding-left: 1%; +} + +.backtoSpace { + position: absolute; + display: flex; + left: 3%; + top: 20%; + margin: auto; +} + +.Ellipse_5_be { + filter: drop-shadow(3px 3px 20px rgba(0, 0, 0, 0.251)); + position: absolute; + overflow: visible; + width: 46px; + height: 45px; + left: 0px; + top: 0px; + height: 45px; +} + +.Icon_awesome_angle_double_left { + overflow: visible; + position: absolute; + width: 24px; + height: 19.269px; + left: 8px; + top: 8px; + transform: matrix(1, 0, 0, 1, 0, 0); + color: rgba(0, 0, 0, .5); +} + +.exit_to_space_Class { + position: absolute; + width: 50px; + height: 44px; + left: 4%; + top: 28%; + overflow: visible; + cursor: pointer; +} + +.sideLangnav { + height: 1000px;; + width: 0; + position: absolute; + z-index: 1; + top: 0; + left: 0; + overflow-x: hidden; + background: #fff; + transition: 0.5s; + box-shadow: 5px 5px 5px 0px rgba(0, 0, 0, 0.19); + padding-top: 60px; +} + +.sideLangnav a { + padding: 8px 8px 8px 32px; + text-decoration: none; + font-size: 25px; + color: #818181; + display: block; + transition: 0.3s; +} + +.sideLangnav a:hover { + color: #f1f1f1; +} + +.sideLangnav .closebtn { + position: absolute; + top: 11px; + right: 7px; + margin-left: 50px; +} + +.emptyPlace{ + /* min-height: 100%; */ + height: 700px; +} \ No newline at end of file diff --git a/vspace/src/main/webapp/resources/extra/Module_1___slideshow___1.css b/vspace/src/main/webapp/resources/extra/Module_1___slideshow___1.css new file mode 100644 index 000000000..22267aee2 --- /dev/null +++ b/vspace/src/main/webapp/resources/extra/Module_1___slideshow___1.css @@ -0,0 +1,213 @@ +.Group_7_Class { + position: relative; + width: 69%; + top: 80px; + display: flex; + margin: auto; +} + +.Slideshow_previous_Class { + position: absolute; + width: 50px; + height: 50px; + left: 20px; + top: 15px; + overflow: visible; +} + +.Ellipse_11 { + filter: drop-shadow(3px 3px 20px rgba(0, 0, 0, 0.251)); + position: absolute; + overflow: visible; + width: 50px; + height: 50px; + left: 0px; + top: 0px; +} + +.Icon_ionic_ios_arrow_back { + overflow: visible; + position: absolute; + width: 11.021px; + height: 19.021px; + left: 14.456px; + top: 10.968px; + transform: matrix(1, 0, 0, 1, 0, 0); +} + +.slideshow_next_Class { + position: absolute; + width: 50px; + height: 50px; + right: 10px; + top: 15px; + overflow: visible; +} + +.Ellipse_12 { + filter: drop-shadow(3px 3px 20px rgba(0, 0, 0, 0.251)); + position: absolute; + overflow: visible; + width: 50px; + height: 50px; + left: 0px; + top: 0px; +} + +.Icon_ionic_ios_arrow_forward { + overflow: visible; + position: absolute; + width: 11.021px; + height: 19.021px; + left: 17.456px; + top: 10.968px; + transform: matrix(1, 0, 0, 1, 0, 0); +} + +.Back_to_first_Class { + position: absolute; + width: 44px; + height: 44px; + left: 20px; + top: 198px; + overflow: visible; - + -web-animation: fadein 0.3s ease-out; - + -web-action-type: page; - + -web-action-target: Module_1___1.html; + cursor: pointer; +} + +.Ellipse_5 { + filter: drop-shadow(3px 3px 20px rgba(0, 0, 0, 0.251)); + position: absolute; + overflow: visible; + width: 104px; + height: 104px; + left: 0px; + top: 0px; +} + +.Icon_material_first_page { + overflow: visible; + position: absolute; + width: 18px; + height: 17.405px; + left: 13px; + top: 13px; + transform: matrix(1, 0, 0, 1, 0, 0); +} + +._DigInG_Class { + position: absolute; + left: 1206px; + top: 693px; + overflow: visible; + width: 47px; + white-space: nowrap; + text-align: left; + font-family: Helvetica Neue; + font-style: normal; + font-weight: normal; + font-size: 12px; + color: rgba(0, 0, 0, 1); +} + +a, a:hover, a:focus { + color: inherit; + text-decoration: none; + transition: all 0.3s; +} + +#dismiss { + width: 35px; + height: 35px; + position: absolute; + top: 10px; + right: 10px; +} + +#wrapper_module { + width: 100%; + align-items: center; + overflow: hidden; +} + +#slide_sidebar_module { + min-width: 250px; + max-width: 250px; + transition: all 0.3s; +} + +#slide_sidebar_module.active { + margin-left: -250px; +} + +#slide_sidebar_module .slide_sidebar-header { + padding: 10px; +} + +.slide_sidebar-header h3 a:hover { + color: #7386D5; + background: #fff; +} + +#slide_sidebar_module ul li { + padding-left: 35px; +} + +#slide_sidebar_module ul li a:hover { + color: #7386D5; + background: #fff; +} + +#slide_content_module { + width: 100%; + padding: 20px; + min-height: 100vh; + transition: all 0.3s; +} + +.imgDiv { + position: relative; + max-width: 57%; + top: 0px; + overflow: visible; + margin: 1%; + display: block; +} + +.textDiv { + position: relative; + width: 57%; + top: 0px; + overflow: visible; + text-align: justify; + margin: auto; +} + +.slideNumberClass { + position: absolute; + width: 84%; + padding-top: 1%; + display: flex; + justify-content: flex-end; } .Component_31___11_Class { + position: absolute; + width: 97%; + display: flex; + justify-content: flex-end; +} + +.Mask_Group_9_Class { + position: realtive; + width: 34px; + height: 34px; + left: 0px; + top: 0px; + overflow: visible; + cursor: pointer; +} + +.language-picker { + display: inline-block; + position: relative; +} \ No newline at end of file From 8436c5ac0dff64caa0bc3c0f10807b7ca5dcc49d Mon Sep 17 00:00:00 2001 From: Prashant Ravindra Jadhav <55036442+prjadhav14@users.noreply.github.com> Date: Thu, 28 May 2020 10:36:56 -0700 Subject: [PATCH 6/9] Story/VSPC-48_1 (#117) * [VSPC-48] Partial Changes for Space UI as per new layout * [VSPC-48] styles for spaces as per new layout. * [VSPC-48] Space layout UI changes * [VSPC-48] Changes with respect to new space layout * [VSPC-48_1] Indentation fix for jsp and css applied * [VSPC-48_1] Formatting changes * [VSPC 48_1] Changes for Space layout * [VSPC 48_1] Space layout changes * [VSPC 48_1]rounded borders and moving module menu to top right of image * [VSPS 48_1] Changes for module menu * [VSPC_48] Changes for review comments * [VSPC_48] Adding ellipse for module menu * [VSPC 48_1] Fixing Module division position * [VSPC 48_1] Space layout changes per review comments. * [VSPC 48_1] Space layout changes * [VSPC 48_1] Space Layout changes per review comments * [VSPC 48_1] Changing the size of info button * [VSPC-48_1] Fixes related to spaces layout review comments * [VSPC-48_1] Fixes for module links, labels, description, and icon sizes * [VSPC 48_1] Indentation fix after resolving conflicts * [VSPC-48_1] Changes for adding roman list, padding and module name * [VSPC-48_1] Adding icon to modules list * [VSPC-48_1] Fixing the icon and text alignment * [VSPC-48_1] Module name in the list --- .../WEB-INF/tiles/skeleton_exhibition2.jsp | 128 +++--- .../webapp/WEB-INF/views/exhibition/space.jsp | 218 ++++++++-- .../src/main/webapp/resources/extra/Home.css | 380 ++++++++++++++++++ 3 files changed, 618 insertions(+), 108 deletions(-) create mode 100644 vspace/src/main/webapp/resources/extra/Home.css diff --git a/vspace/src/main/webapp/WEB-INF/tiles/skeleton_exhibition2.jsp b/vspace/src/main/webapp/WEB-INF/tiles/skeleton_exhibition2.jsp index b018b1f54..540c1ba59 100644 --- a/vspace/src/main/webapp/WEB-INF/tiles/skeleton_exhibition2.jsp +++ b/vspace/src/main/webapp/WEB-INF/tiles/skeleton_exhibition2.jsp @@ -70,8 +70,9 @@ body { width: 100%; } -.footerBox, .pushTop { - height: 75px +.footerBox, .push { + height: 75px; +} } @@ -88,72 +89,70 @@ body { $('#sidebarCollapse').on('click', function() { $('#sidebar').toggleClass('active'); }); - });
-
- - -
+ + + +
${message}
-
+
+
@@ -175,8 +175,8 @@ body { + feather.replace() + \ No newline at end of file diff --git a/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp b/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp index ff36059c7..aaef1a1e0 100644 --- a/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp @@ -3,10 +3,43 @@ <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%> +"> + + +
+
+ + -
-
col-md-3col-md-2"> - -
-
${space.name}
- ${space.description} +
+ + + +
+

${space.name} + + + +

- + +
')"> +
+ +
+ +
${space.description}
+
+
+
- - diff --git a/vspace/src/main/webapp/resources/extra/Home.css b/vspace/src/main/webapp/resources/extra/Home.css new file mode 100644 index 000000000..8856be876 --- /dev/null +++ b/vspace/src/main/webapp/resources/extra/Home.css @@ -0,0 +1,380 @@ +.Home_Class { + margin: 0 auto 0 auto; + width: 100%; + min-height: 780px; +} + +.Home__Class { + position: absolute; + left: 530px; + top: 90px; + overflow: visible; + font-size: 30px; +} + +.spaceClass { + text-align: center; +} + +#wrapper_module { + display: flex; + width: 100%; + align-items: stretch; + overflow: hidden; +} + +.Home__Image__Class { + position: absolute; + width: 44px; + height: 44px; + left: 229px; + top: 133px; + overflow: visible; +} + +#wrapper { + display: flex; + width: 100%; + align-items: stretch; +} + +#slide_sidebar { + min-width: 250px; + max-width: 250px; + transition: all 0.3s; +} + +#slide_sidebar.active { + margin-left: -250px; +} + +#slide_sidebar .slide_sidebar-header { + padding: 10px; +} + +.slide_sidebar-header h3 a:hover { + color: #7386D5; + background: #fff; +} + +#slide_sidebar ul li { + padding-left: 35px; +} + +#slide_sidebar ul li a:hover { + color: #7386D5; + background: #fff; +} + +#slide_content { + width: 100%; + padding: 20px; + min-height: 100vh; + transition: all 0.3s; +} + +@media ( max-width : 768px) { + #slide_sidebar { + margin-left: -250px; + } + #slide_sidebar.active { + margin-left: 0; + } + #slide_sidebarCollapse span { + display: none; + } +} + +.sidenav { + width: 0; + position: absolute; + z-index: 1; + top: -1px; + left: 0px; + overflow-x: hidden; + background: #fff; + transition: 0.5s; + box-shadow: 5px 5px 5px 0px rgba(0, 0, 0, 0.19); + padding-top: 26px; + word-break: break-all; +} + +} +.sidenav a { + white-space: pre-wrap; +} + +.sidenav a:hover { + color: #818181; +} + +.sidenav .closebtn { + position: absolute; + top: 8px; + right: 3px; + margin-left: 50px; +} + +.sidenav .dropdown-item { + padding: 0px; +} + +.sideModulenav { + width: 0; + position: absolute; + z-index: 1; + top: 45px; + right: 5px; + overflow-x: hidden; + background: #fff; + transition: 0.5s; + box-shadow: -8px 8px 5px -3px rgba(0, 0, 0, 0.19); + border-radius: 10px 10px 10px 10px; + padding-top: 32px; + word-break: break-all; +} + +.sideModulenav a { + white-space: pre-wrap; +} + +.sideModulenav a:hover { + color: #818181; +} + +.sideModulenav .closebtn { + position: absolute; + top: 8px; + right: 3px; + margin-left: 50px; +} + +.sideModulenav .dropdown-item { + padding: 0px; + text-align: justify; +} + +.spaceNav ul { + padding-inline-start: 20px; +} + +.barPosition { + position: absolute; + color: dimgrey; + padding-left: 1%; +} + +.textDiv { + position: relative; + /* width: 48%; */ + top: 0px; + overflow: visible; + text-align: justify; + margin: auto; +} + +.moduleBarPosition { + position: absolute; + color: rgba(150, 45, 62, 1); + right: 30%; + /* top: 2%; */ + padding-top: 12px; +} + +.Info_cz_Class { + position: absolute; + width: 29px; + height: 29px; + left: 957.622px; + top: 275.275px; + overflow: visible; - + -web-animation: fadein 0.3s ease-out; - + -web-action-type: view; - + -web-action-target: Modal; + cursor: pointer; +} + +.Ellipse_8_c { + position: absolute; + overflow: visible; + width: 29px; + height: 29px; + left: 0px; + top: 0px; +} + +.Ellipse_10_c { + position: absolute; + overflow: visible; + width: 25px; + height: 25px; + left: 2px; + top: 2px; +} + +.Ellipse_9_c { + filter: drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.161)); + position: absolute; + overflow: visible; + width: 21px; + height: 21px; + left: 4px; + top: 4px; +} + +.Icon_awesome_info_c { + overflow: visible; + position: absolute; + width: 5.403px; + height: 14.408px; + left: 7.793px; + top: 6.48px; + transform: matrix(1, 0, 0, 1, 0, 0); + font-size: larger; +} + +.Icon_awesome_info_m { + overflow: visible; + position: absolute; + width: 5.403px; + height: 14.408px; + left: 11.5px; + top: 7px; + transform: matrix(1, 0, 0, 1, 0, 0); + font-size: inherit; + color: rgba(150, 45, 62, 1); +} + +.Icon_awesome_info_e { + overflow: visible; + position: absolute; + width: 5.403px; + height: 14.408px; + left: 7px; + top: 8.4px; + transform: matrix(1, 0, 0, 1, 0, 0); + font-size: inherit; + color: rgba(150, 45, 62, 1); +} + +.Group_3_Class { + position: absolute; + width: 37px; + /* height: 39px; */ + /* left: 1px; */ + right: 0%; + top: 46px; + right: 1%; + overflow: visible; +} + +.Ellipse_8_dc { + position: absolute; + overflow: visible; + width: 39px; + height: 39px; + left: 0px; + top: 0px; +} + +.Ellipse_10_dd { + position: absolute; + overflow: visible; + width: 33px; + height: 33px; + left: 3px; + top: 3px; +} + +.Ellipse_9_de { + filter: drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.161)); + position: absolute; + overflow: visible; + width: 28px; + height: 26px; + left: 6px; + top: 6px; + height: 26px; +} + +#rightContent { + height: 0px; + width: 0px; + position: absolute; + z-index: 1; + top: 10%; + right: 15px; + overflow-x: hidden; + background: #fff; + transition: 0.5s; + box-shadow: 0px 0px 5px 3px rgba(0.09, 0.09, 0.09, 0.09); + border-radius: 10px 10px 10px 10px; +} + +.leftContent { + float: left; + width: 75%; +} + +.spaceDescription { + padding-top: 26px; + padding-left: 5px; + padding-right: 5px; + padding-bottom: 5px; + word-break: break-word; + text-align: justify; + margin: 5px; +} + +#rightContent .closebtn { + position: absolute; + top: 8px; + right: 3px; + margin-left: 50px; +} + +.Info_cz_module_Class { + height: 26px; + left: 965.622px; + cursor: pointer; + display: inline +} + +.Ellipse_8_module_c { + position: absolute; + overflow: visible; + width: 29px; + height: 29px; + left: 2px; +} + +.Ellipse_10_module_c { + position: absolute; + overflow: visible; + width: 25px; + height: 25px; + left: 4px; + padding-top: 2px; +} + +.Ellipse_9_module_c { + filter: drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.161)); + position: absolute; + overflow: visible; + width: 21px; + height: 21px; + left: 6px; + padding-top: 4px; +} + +.Icon_awesome_info_module_m { + overflow: visible; + position: absolute; + width: 5.403px; + height: 14.408px; + left: 14.5px; + padding-top: 8px; transform : matrix( 1, 0, 0, 1, 0, 0); + font-size: inherit; + color: rgba(150, 45, 62, 1); + transform: matrix(1, 0, 0, 1, 0, 0); +} \ No newline at end of file From 64cd9fc5f2ae144fb6339039e1e381839aafb697 Mon Sep 17 00:00:00 2001 From: Sagar Khar <44152998+Sagar-k93@users.noreply.github.com> Date: Thu, 28 May 2020 10:56:19 -0700 Subject: [PATCH 7/9] Bug/VSPC 76 (#113) * [VSPC-76] Setting page to 1 in case none is given in url. * [VSPC-76] Removed print commands and changed conditional statement. * [VSPC-76] Changes to make pagination work for link './vspace/staff/images/list' in image lists. * [VSPC-76] Changed page number to optional for image list. * [VSPC-76] Added the link to images without number. * [VSPC-76] Formatting changes to imageService. * [VSPC-76] Changed the page to optional in listImagesController. * [VSPC-76] Changes to ImagesListController to redirect page in case of no number. * [VSPC-76] Changes to indentation. * [VSPC-76] Removed unnecessary url paths to the controller. * [VSPC-76] Indentation changes. * [VSPC-76] Indentation changes. * [VSPC-76] Changed redirect url for imagelist page. --- .../vspace/core/services/impl/ImageService.java | 2 +- .../diging/vspace/web/staff/ListImagesController.java | 11 +++++++++-- .../webapp/WEB-INF/views/staff/images/imagelist.jsp | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/ImageService.java b/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/ImageService.java index d571073cb..7f841141a 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/ImageService.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/ImageService.java @@ -108,7 +108,7 @@ public List getImages(int pageNo, String sortedBy, String order) { Sort sortingParameters = Sort.by(SortByField.CREATION_DATE.getValue()).descending(); pageNo = validatePageNumber(pageNo); if(sortedBy!=null && SortByField.getAllValues().contains(sortedBy)) { - sortingParameters = Sort.by(sortedBy); + sortingParameters = Sort.by(sortedBy); } if(order!=null && order.equalsIgnoreCase(Sort.Direction.ASC.toString())) { sortingParameters = sortingParameters.ascending(); diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/staff/ListImagesController.java b/vspace/src/main/java/edu/asu/diging/vspace/web/staff/ListImagesController.java index a3d4dc11c..f64716019 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/web/staff/ListImagesController.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/staff/ListImagesController.java @@ -4,6 +4,7 @@ import org.springframework.data.domain.Sort; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -18,14 +19,20 @@ public class ListImagesController { @Autowired private IImageService imageService; + @RequestMapping("/staff/images/list") + public String listSpacesWithoutNum(Model model) { + return "redirect:/staff/images/list/1"; + } + @RequestMapping("/staff/images/list/{page}") - public String listImagesByPage(@PathVariable String page, + public String listSpaces(@PathVariable(required = false) String page, @RequestParam(value = "sort", required = false) String sortedBy, @RequestParam(value = "order", required = false) String order, Model model) { int pageNo; + page = StringUtils.isEmpty(page) ? "1" : page; try { pageNo = imageService.validatePageNumber(Integer.parseInt(page)); - } catch (NumberFormatException numberFormatException) { + } catch (NumberFormatException numberFormatException){ pageNo = 1; } model.addAttribute("totalPages", imageService.getTotalPages()); diff --git a/vspace/src/main/webapp/WEB-INF/views/staff/images/imagelist.jsp b/vspace/src/main/webapp/WEB-INF/views/staff/images/imagelist.jsp index 75dc3fd61..59640de3a 100644 --- a/vspace/src/main/webapp/WEB-INF/views/staff/images/imagelist.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/staff/images/imagelist.jsp @@ -25,7 +25,7 @@ $( document ).ready(function() { lastClass: 'last', firstClass: 'first' }).on("page", function(event, num){ - window.location.assign("./"+num+"?sort=${sortProperty}&order=${order}"); + window.location.assign("./"+num+"?sort=${sortProperty}&order=${order}"); }); $("table.table thead th").each(function(){ From 0c7b2e5e55ff628a39c265d0b1dc6562c6b5c273 Mon Sep 17 00:00:00 2001 From: Prashant Ravindra Jadhav <55036442+prjadhav14@users.noreply.github.com> Date: Mon, 1 Jun 2020 05:59:12 -0700 Subject: [PATCH 8/9] Story/vspc 72 (#119) * [VSPC-72] Adding status to Space * [VSPC-72] Adding status to Space * [VSPC-72] Loading only published spaces in the exhibition. * [VSPC-72] Resolving CodeFactor issues * [VSPC-72] Trying to fix issues caught by CodeFactor * [VSPC-72] Fixing indentation for VSpaceElement * [VSPC-72]Status check on request to load Space * [VSPC-72] Resolution to the review comments * [VSPC-72] Code style fix * [VSPC-72] Fixes for review comments * [VSPC-72]Resolving conflicts * [VSPC-72] Fixing indentation and resolving conflicts * [VSPC-72] Adding comments for null space status check * [VSPC-72] Updating the URL for status update * [VSPC 72] JUnit Test cases for space status * [VSPC-72] JUnit Test Cases for Space status as null, pub and unpublished * [VSPC-72] Adding published spaces to space layout * [VSPC-72] UI fixes and JUnit Test Case for Space not found --- .../core/aspects/ExhibitionDataAspect.java | 13 +- .../vspace/core/data/SpaceRepository.java | 3 + .../vspace/core/model/IVSpaceElement.java | 34 +-- .../vspace/core/model/impl/SpaceStatus.java | 6 + .../vspace/core/model/impl/VSpaceElement.java | 196 ++++++++++-------- .../vspace/core/services/ISpaceManager.java | 3 + .../core/services/impl/SpaceManager.java | 8 + .../vspace/web/ExhibitionSpaceController.java | 53 +++-- .../vspace/web/staff/AddSpaceController.java | 5 +- .../staff/UpdateSpaceStatusController.java | 33 +++ .../WEB-INF/tiles/skeleton_exhibition2.jsp | 11 +- .../webapp/WEB-INF/views/exhibition/space.jsp | 2 +- .../WEB-INF/views/staff/spaces/space.jsp | 24 ++- .../core/services/impl/SpaceManagerTest.java | 119 +++++++++-- 14 files changed, 360 insertions(+), 150 deletions(-) create mode 100644 vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/SpaceStatus.java create mode 100644 vspace/src/main/java/edu/asu/diging/vspace/web/staff/UpdateSpaceStatusController.java diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/aspects/ExhibitionDataAspect.java b/vspace/src/main/java/edu/asu/diging/vspace/core/aspects/ExhibitionDataAspect.java index 5b45a2540..1d9117993 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/aspects/ExhibitionDataAspect.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/aspects/ExhibitionDataAspect.java @@ -1,5 +1,7 @@ package edu.asu.diging.vspace.core.aspects; +import java.util.List; + import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.After; import org.aspectj.lang.annotation.Aspect; @@ -9,6 +11,8 @@ import org.springframework.ui.Model; import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import edu.asu.diging.vspace.core.model.ISpace; +import edu.asu.diging.vspace.core.model.impl.SpaceStatus; import edu.asu.diging.vspace.core.services.IExhibitionManager; import edu.asu.diging.vspace.core.services.ISpaceManager; @@ -35,8 +39,13 @@ public void setExhibition(JoinPoint jp) { if (!((Model) obj).containsAttribute("exhibition")) { ((Model) obj).addAttribute("exhibition", exhibitionManager.getStartExhibition()); } - if (!((Model) obj).containsAttribute("allSpaces")) { - ((Model) obj).addAttribute("allSpaces", spaceManager.getAllSpaces()); + if (!((Model) obj).containsAttribute("publishedSpaces")) { + List publishedSpaces=spaceManager.getSpacesWithStatus(SpaceStatus.PUBLISHED); + /* (non-Javadoc) + * Added to show spaces with null status and accommodate existing spaces with null space status + */ + publishedSpaces.addAll(spaceManager.getSpacesWithStatus(null)); + ((Model) obj).addAttribute("publishedSpaces", publishedSpaces); } } } diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/data/SpaceRepository.java b/vspace/src/main/java/edu/asu/diging/vspace/core/data/SpaceRepository.java index 0a284abb7..929ce67d7 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/data/SpaceRepository.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/data/SpaceRepository.java @@ -7,11 +7,14 @@ import org.springframework.stereotype.Repository; import edu.asu.diging.vspace.core.model.impl.Space; +import edu.asu.diging.vspace.core.model.impl.SpaceStatus; @Repository @JaversSpringDataAuditable public interface SpaceRepository extends PagingAndSortingRepository { List findTop5ByOrderByCreationDateDesc(); + + List findAllBySpaceStatus(SpaceStatus spaceStatus); } \ No newline at end of file diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/model/IVSpaceElement.java b/vspace/src/main/java/edu/asu/diging/vspace/core/model/IVSpaceElement.java index c1f92e940..7bc8fa8ae 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/model/IVSpaceElement.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/model/IVSpaceElement.java @@ -2,33 +2,39 @@ import java.time.OffsetDateTime; +import edu.asu.diging.vspace.core.model.impl.SpaceStatus; + public interface IVSpaceElement { - String getId(); + String getId(); + + void setId(String id); + + String getName(); - void setId(String id); + void setName(String name); - String getName(); + String getDescription(); - void setName(String name); + void setDescription(String description); - String getDescription(); + String getCreatedBy(); - void setDescription(String description); + void setCreatedBy(String createdBy); - String getCreatedBy(); + OffsetDateTime getCreationDate(); - void setCreatedBy(String createdBy); + void setCreationDate(OffsetDateTime creationDate); - OffsetDateTime getCreationDate(); + String getModifiedBy(); - void setCreationDate(OffsetDateTime creationDate); + void setModifiedBy(String modifiedBy); - String getModifiedBy(); + OffsetDateTime getModificationDate(); - void setModifiedBy(String modifiedBy); + void setModificationDate(OffsetDateTime modificationDate); - OffsetDateTime getModificationDate(); + SpaceStatus getSpaceStatus(); - void setModificationDate(OffsetDateTime modificationDate); + void setSpaceStatus(SpaceStatus status); } \ No newline at end of file diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/SpaceStatus.java b/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/SpaceStatus.java new file mode 100644 index 000000000..36058686a --- /dev/null +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/SpaceStatus.java @@ -0,0 +1,6 @@ +package edu.asu.diging.vspace.core.model.impl; + +public enum SpaceStatus { + PUBLISHED, + UNPUBLISHED +} \ No newline at end of file diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/VSpaceElement.java b/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/VSpaceElement.java index fb31c5241..c77539628 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/VSpaceElement.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/VSpaceElement.java @@ -9,96 +9,110 @@ @MappedSuperclass public abstract class VSpaceElement implements IVSpaceElement { + private String name; + @Lob private String description; + private String createdBy; + private OffsetDateTime creationDate; + private String modifiedBy; + private OffsetDateTime modificationDate; + private SpaceStatus spaceStatus; - private String name; - @Lob private String description; - private String createdBy; - private OffsetDateTime creationDate; - private String modifiedBy; - private OffsetDateTime modificationDate; - - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getName() - */ - @Override - public String getName() { - return name; - } - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setName(java.lang.String) - */ - @Override - public void setName(String name) { - this.name = name; - } - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getDescription() - */ - @Override - public String getDescription() { - return description; - } - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setDescription(java.lang.String) - */ - @Override - public void setDescription(String description) { - this.description = description; - } - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getCreatedBy() - */ - @Override - public String getCreatedBy() { - return createdBy; - } - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setCreatedBy(java.lang.String) - */ - @Override - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getCreationDate() - */ - @Override - public OffsetDateTime getCreationDate() { - return creationDate; - } - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setCreationDate(java.time.OffsetDateTime) - */ - @Override - public void setCreationDate(OffsetDateTime creationDate) { - this.creationDate = creationDate; - } - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getModifiedBy() - */ - @Override - public String getModifiedBy() { - return modifiedBy; - } - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setModifiedBy(java.lang.String) - */ - @Override - public void setModifiedBy(String modifiedBy) { - this.modifiedBy = modifiedBy; - } - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getModificationDate() - */ - @Override - public OffsetDateTime getModificationDate() { - return modificationDate; - } - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setModificationDate(java.time.OffsetDateTime) - */ - @Override - public void setModificationDate(OffsetDateTime modificationDate) { - this.modificationDate = modificationDate; - } + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getName() + */ + @Override + public String getName() { + return name; + } + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setName(java.lang.String) + */ + @Override + public void setName(String name) { + this.name = name; + } + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getDescription() + */ + @Override + public String getDescription() { + return description; + } + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setDescription(java.lang.String) + */ + @Override + public void setDescription(String description) { + this.description = description; + } + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getCreatedBy() + */ + @Override + public String getCreatedBy() { + return createdBy; + } + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setCreatedBy(java.lang.String) + */ + @Override + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getCreationDate() + */ + @Override + public OffsetDateTime getCreationDate() { + return creationDate; + } + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setCreationDate(java.time.OffsetDateTime) + */ + @Override + public void setCreationDate(OffsetDateTime creationDate) { + this.creationDate = creationDate; + } + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getModifiedBy() + */ + @Override + public String getModifiedBy() { + return modifiedBy; + } + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setModifiedBy(java.lang.String) + */ + @Override + public void setModifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + } + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getModificationDate() + */ + @Override + public OffsetDateTime getModificationDate() { + return modificationDate; + } + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setModificationDate(java.time.OffsetDateTime) + */ + @Override + public void setModificationDate(OffsetDateTime modificationDate) { + this.modificationDate = modificationDate; + } + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getSpaceStatus() + */ + @Override + public SpaceStatus getSpaceStatus() { + return spaceStatus; + } + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setSpaceStatus(edu.asu.diging.vspace.core.model.impl.SpaceStatus) + */ + @Override + public void setSpaceStatus(SpaceStatus spaceStatus) { + this.spaceStatus = spaceStatus; + } } diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/services/ISpaceManager.java b/vspace/src/main/java/edu/asu/diging/vspace/core/services/ISpaceManager.java index 20d01c648..3ac7daf7b 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/services/ISpaceManager.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/services/ISpaceManager.java @@ -5,6 +5,7 @@ import edu.asu.diging.vspace.core.exception.SpaceDoesNotExistException; import edu.asu.diging.vspace.core.model.ISpace; import edu.asu.diging.vspace.core.model.IVSImage; +import edu.asu.diging.vspace.core.model.impl.SpaceStatus; import edu.asu.diging.vspace.core.services.impl.CreationReturnValue; public interface ISpaceManager { @@ -19,5 +20,7 @@ public interface ISpaceManager { List getAllSpaces(); + List getSpacesWithStatus(SpaceStatus status); + void deleteSpaceById(String id) throws SpaceDoesNotExistException; } \ No newline at end of file diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/SpaceManager.java b/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/SpaceManager.java index 53a092408..b4244ec46 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/SpaceManager.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/SpaceManager.java @@ -25,6 +25,7 @@ import edu.asu.diging.vspace.core.model.display.ISpaceDisplay; import edu.asu.diging.vspace.core.model.display.impl.SpaceDisplay; import edu.asu.diging.vspace.core.model.impl.Space; +import edu.asu.diging.vspace.core.model.impl.SpaceStatus; import edu.asu.diging.vspace.core.model.impl.VSImage; import edu.asu.diging.vspace.core.services.IImageService; import edu.asu.diging.vspace.core.services.ISpaceManager; @@ -179,6 +180,13 @@ public List getAllSpaces() { return spaces; } + @Override + public List getSpacesWithStatus(SpaceStatus status) { + List spaces = new ArrayList<>(); + spaceRepo.findAllBySpaceStatus(status).forEach(s -> spaces.add(s)); + return spaces; + } + /** * Method to delete space based on id * diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSpaceController.java b/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSpaceController.java index 3ed8c36d8..122461d0d 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSpaceController.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSpaceController.java @@ -7,31 +7,42 @@ import org.springframework.web.bind.annotation.RequestMapping; import edu.asu.diging.vspace.core.model.ISpace; +import edu.asu.diging.vspace.core.model.impl.SpaceStatus; import edu.asu.diging.vspace.core.services.ILinkManager; import edu.asu.diging.vspace.core.services.ISpaceDisplayManager; import edu.asu.diging.vspace.core.services.ISpaceManager; @Controller public class ExhibitionSpaceController { - - @Autowired - private ISpaceManager spaceManager; - - @Autowired - private ISpaceDisplayManager spaceDisplayManager; - - @Autowired - private ILinkManager linkManager; - - @RequestMapping(value="/exhibit/space/{id}") - public String space(@PathVariable("id") String id, Model model) { - ISpace space = spaceManager.getSpace(id); - model.addAttribute("space", space); - model.addAttribute("spaceLinks", linkManager.getSpaceLinkDisplays(id)); - model.addAttribute("moduleList", linkManager.getModuleLinkDisplays(id)); - model.addAttribute("display", spaceDisplayManager.getBySpace(space)); - model.addAttribute("externalLinkList", linkManager.getExternalLinkDisplays(id)); - - return "space"; - } + + @Autowired + private ISpaceManager spaceManager; + + @Autowired + private ISpaceDisplayManager spaceDisplayManager; + + @Autowired + private ILinkManager linkManager; + + @RequestMapping(value="/exhibit/space/{id}") + public String space(@PathVariable("id") String id, Model model) { + ISpace space = spaceManager.getSpace(id); + /* (non-Javadoc) + * Below null check is added to accommodate already existing spaces with null space status + */ + if(space.getSpaceStatus() == null || space.getSpaceStatus().equals(SpaceStatus.PUBLISHED)) { + model.addAttribute("space", space); + model.addAttribute("spaceLinks", linkManager.getSpaceLinkDisplays(id)); + model.addAttribute("moduleList", linkManager.getModuleLinkDisplays(id)); + model.addAttribute("display", spaceDisplayManager.getBySpace(space)); + model.addAttribute("externalLinkList", linkManager.getExternalLinkDisplays(id)); + } + else { + model.addAttribute("showAlert", true); + model.addAttribute("alertType", "danger"); + model.addAttribute("messageType","invalidSpace"); + model.addAttribute("message", "Access Denied."); + } + return "space"; + } } diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/staff/AddSpaceController.java b/vspace/src/main/java/edu/asu/diging/vspace/web/staff/AddSpaceController.java index 884e9b02c..a4f3f2b1a 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/web/staff/AddSpaceController.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/staff/AddSpaceController.java @@ -19,6 +19,7 @@ import edu.asu.diging.vspace.core.factory.ISpaceFactory; import edu.asu.diging.vspace.core.model.ISpace; import edu.asu.diging.vspace.core.model.IVSImage; +import edu.asu.diging.vspace.core.model.impl.SpaceStatus; import edu.asu.diging.vspace.core.services.IImageService; import edu.asu.diging.vspace.core.services.ISpaceManager; import edu.asu.diging.vspace.core.services.impl.CreationReturnValue; @@ -51,13 +52,13 @@ public String showAddSpace(Model model) { public String addSpace(Model model, @ModelAttribute SpaceForm spaceForm, @RequestParam("file") MultipartFile file, Principal principal, @RequestParam(value = "imageId", required=false) String imageId, RedirectAttributes redirectAttrs) throws IOException { ISpace space = spaceFactory.createSpace(spaceForm); + space.setSpaceStatus(SpaceStatus.UNPUBLISHED); byte[] bgImage = null; String filename = null; if (file != null) { bgImage = file.getBytes(); filename = file.getOriginalFilename(); - } - + } CreationReturnValue creationValue = null; if(imageId != null && !imageId.isEmpty()) { IVSImage image; diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/staff/UpdateSpaceStatusController.java b/vspace/src/main/java/edu/asu/diging/vspace/web/staff/UpdateSpaceStatusController.java new file mode 100644 index 000000000..02be0666f --- /dev/null +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/staff/UpdateSpaceStatusController.java @@ -0,0 +1,33 @@ +package edu.asu.diging.vspace.web.staff; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import edu.asu.diging.vspace.core.model.ISpace; +import edu.asu.diging.vspace.core.model.impl.SpaceStatus; +import edu.asu.diging.vspace.core.services.ISpaceManager; + + +@Controller +public class UpdateSpaceStatusController { + @Autowired + private ISpaceManager spaceManager; + + @RequestMapping(value="/staff/space/{spaceId}/status", method=RequestMethod.POST) + public String updateStatus(HttpServletRequest request,RedirectAttributes attributes, @PathVariable("spaceId") String spaceId, @RequestParam("statusParam") SpaceStatus status) { + ISpace space = spaceManager.getSpace(spaceId); + space.setSpaceStatus(status); + spaceManager.storeSpace(space, null,null); + attributes.addAttribute("alertType", "success"); + attributes.addAttribute("message", "Status successfully updated!"); + attributes.addAttribute("showAlert", "true"); + return "redirect:/staff/space/{spaceId}"; + } +} diff --git a/vspace/src/main/webapp/WEB-INF/tiles/skeleton_exhibition2.jsp b/vspace/src/main/webapp/WEB-INF/tiles/skeleton_exhibition2.jsp index 540c1ba59..c616eb460 100644 --- a/vspace/src/main/webapp/WEB-INF/tiles/skeleton_exhibition2.jsp +++ b/vspace/src/main/webapp/WEB-INF/tiles/skeleton_exhibition2.jsp @@ -73,6 +73,12 @@ body { .footerBox, .push { height: 75px; } + +.custom-invalidSpace { + text-align: center; + position: absolute; + top: 106px; + width: 100%; } @@ -143,7 +149,7 @@ body {
- + " class="list-group-item @@ -157,7 +163,7 @@ body {
-
+
${message}
@@ -178,5 +184,4 @@ body { feather.replace() - \ No newline at end of file diff --git a/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp b/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp index aaef1a1e0..6fc883e9f 100644 --- a/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp @@ -179,7 +179,7 @@ function drawLinks() {
-->
    - +
  • ">${space.name} diff --git a/vspace/src/main/webapp/WEB-INF/views/staff/spaces/space.jsp b/vspace/src/main/webapp/WEB-INF/views/staff/spaces/space.jsp index 8b74fa90b..ed559f334 100644 --- a/vspace/src/main/webapp/WEB-INF/views/staff/spaces/space.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/staff/spaces/space.jsp @@ -750,6 +750,24 @@ $( document ).ready(function() {
    Modified on ${space.modificationDate} by ${space.modifiedBy}.
+
+ + + + +

+ +

+
+
Description:

${space.description} @@ -757,7 +775,7 @@ ${space.description}

-