From 3e4e5931b2dd48739278186ca23a5b508e9cfcce Mon Sep 17 00:00:00 2001 From: Prashant Ravindra Jadhav <55036442+prjadhav14@users.noreply.github.com> Date: Fri, 5 Jun 2020 11:17:55 -0700 Subject: [PATCH 01/47] [VSPC-78] Module layout changes for bigger and smaller screens --- .../src/main/webapp/WEB-INF/views/exhibition/module.jsp | 9 +++++++++ vspace/src/main/webapp/resources/extra/Module_1.css | 9 ++++++++- .../webapp/resources/extra/Module_1___slideshow___1.css | 7 +++++++ 3 files changed, 24 insertions(+), 1 deletion(-) 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 109526491..df2ab78a4 100644 --- a/vspace/src/main/webapp/WEB-INF/views/exhibition/module.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/exhibition/module.jsp @@ -28,6 +28,15 @@ body { function closeLangNav() { document.getElementById("myLangSidenav").style.width = "0"; } + $( document ).ready(function() { + if($.browser.chrome) { + alert(1); + } else if ($.browser.mozilla) { + alert(2); + } else if ($.browser.msie) { + alert(3); + } + });
diff --git a/vspace/src/main/webapp/resources/extra/Module_1.css b/vspace/src/main/webapp/resources/extra/Module_1.css index 13fd1417b..4635fc38c 100644 --- a/vspace/src/main/webapp/resources/extra/Module_1.css +++ b/vspace/src/main/webapp/resources/extra/Module_1.css @@ -5,8 +5,8 @@ } .Group_8_Class { - /* text-align: center; */ text-align: -webkit-center; + text-align: -moz-center; } .Module_header_Class { @@ -200,4 +200,11 @@ a, a:hover, a:focus { .emptyPlace{ /* min-height: 100%; */ height: 700px; +} + +@media only screen and (max-width: 800px) { + /* For mobile phones: */ + [class*="exit_to_space_Class"] { + top: 45%; + } } \ 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 index 22267aee2..0c77de951 100644 --- a/vspace/src/main/webapp/resources/extra/Module_1___slideshow___1.css +++ b/vspace/src/main/webapp/resources/extra/Module_1___slideshow___1.css @@ -210,4 +210,11 @@ a, a:hover, a:focus { .language-picker { display: inline-block; position: relative; +} + +@media only screen and (max-width: 800px) { + /* For mobile phones: */ + [class*="Group_7_Class"] { + width: 98%; + } } \ No newline at end of file From c870b57dcdfc96a0f93f6a4e13f31261cad17939 Mon Sep 17 00:00:00 2001 From: Prashant Ravindra Jadhav <55036442+prjadhav14@users.noreply.github.com> Date: Mon, 8 Jun 2020 09:07:46 -0700 Subject: [PATCH 02/47] [VSPC-78] Deleting debug code added in jsp file. --- .../src/main/webapp/WEB-INF/views/exhibition/module.jsp | 9 --------- 1 file changed, 9 deletions(-) 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 df2ab78a4..109526491 100644 --- a/vspace/src/main/webapp/WEB-INF/views/exhibition/module.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/exhibition/module.jsp @@ -28,15 +28,6 @@ body { function closeLangNav() { document.getElementById("myLangSidenav").style.width = "0"; } - $( document ).ready(function() { - if($.browser.chrome) { - alert(1); - } else if ($.browser.mozilla) { - alert(2); - } else if ($.browser.msie) { - alert(3); - } - });
From f1078db8acd45d81436cf7b76a41dabe878e6260 Mon Sep 17 00:00:00 2001 From: Prashant Ravindra Jadhav <55036442+prjadhav14@users.noreply.github.com> Date: Tue, 9 Jun 2020 16:08:24 -0700 Subject: [PATCH 03/47] Story/vspc 77 (#124) * [VSPC-77] Changes using media query for mobile screen size. * [VSPC-77] Saving updates to the code for minimum height * [VSPC-77] Changes for links positioning * [VSPC-77] Link positioning for space layout for smaller screen size. * [VSPC-77] removing wrongly printed value from console. * [VSPC-77] Links positioning for mobile screens * [VSPC-77] Space description position fix. * [VSPC-77] Links positioning changes for mobile screens * [VSPC-77] Changes with respect to image width as per screen resolution. * [VSPC-77] Width fix for changing window sizes * [VSPC-77] Fix for intermittent issue of links repositioning * [VSPC-77] Adding back the debugging line of code for sourceURL. --- .../webapp/WEB-INF/views/exhibition/space.jsp | 132 ++++++++++++------ .../src/main/webapp/resources/extra/Home.css | 30 ++-- 2 files changed, 111 insertions(+), 51 deletions(-) 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 10e81c797..e8bea27a8 100644 --- a/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp @@ -8,16 +8,29 @@ + + + + + + +" + rel="stylesheet"> + + + + + + + +
+ + + + +
+
+ +
+ ${message}
+
+
+
+
+ + + + + + + + + \ 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 e8bea27a8..768bad188 100644 --- a/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp @@ -54,7 +54,7 @@ function openSpaceDescription(){ $(window).on("load", function() { let spaceHeight = $("#bgImage").css("height"); - $("#Module_1").css("min-height",spaceHeight); + $("#Module_1").css("height",spaceHeight); $( window ).resize(function() { console.log("In Resize"); $("#space a").remove(); From 6408999fd90e35010623769034348aeed0cb3e20 Mon Sep 17 00:00:00 2001 From: Sagar Khar <44152998+Sagar-k93@users.noreply.github.com> Date: Fri, 19 Jun 2020 15:13:57 -0600 Subject: [PATCH 05/47] [VSPC-96] Updated project for spring security 5.3.3. (#130) Co-authored-by: skhar --- vspace/pom.xml | 2 +- .../authority/SimpleGrantedAuthority.java | 68 +++++++++++++++++++ .../spring/appServlet/servlet-context.xml | 2 +- .../webapp/WEB-INF/spring/root-context.xml | 2 +- 4 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 vspace/src/main/java/org/springframework/security/core/authority/SimpleGrantedAuthority.java diff --git a/vspace/pom.xml b/vspace/pom.xml index c2d9cf2b4..c19bccbea 100644 --- a/vspace/pom.xml +++ b/vspace/pom.xml @@ -12,7 +12,7 @@ 1.7.5 5.0.7.RELEASE Kay-SR8 - 4.1.5.RELEASE + 5.3.3.RELEASE 3.10.1 0.5 admin diff --git a/vspace/src/main/java/org/springframework/security/core/authority/SimpleGrantedAuthority.java b/vspace/src/main/java/org/springframework/security/core/authority/SimpleGrantedAuthority.java new file mode 100644 index 000000000..4d6c0e701 --- /dev/null +++ b/vspace/src/main/java/org/springframework/security/core/authority/SimpleGrantedAuthority.java @@ -0,0 +1,68 @@ +package org.springframework.security.core.authority; +/* + * Copyright 2002-2016 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.springframework.security.core.GrantedAuthority; +import org.springframework.util.Assert; + +/** + * Basic concrete implementation of a {@link GrantedAuthority}. + * + *

+ * Stores a {@code String} representation of an authority granted to the + * {@link org.springframework.security.core.Authentication Authentication} object. + * + * @author Luke Taylor + */ +public final class SimpleGrantedAuthority implements GrantedAuthority { + + private static final long serialVersionUID = 410L; + + private final String role; + + public SimpleGrantedAuthority(String role) { + Assert.hasText(role, "A granted authority textual representation is required"); + this.role = role; + } + + @Override + public String getAuthority() { + return role; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (obj instanceof SimpleGrantedAuthority) { + return role.equals(((SimpleGrantedAuthority) obj).role); + } + + return false; + } + + @Override + public int hashCode() { + return this.role.hashCode(); + } + + @Override + public String toString() { + return this.role; + } +} \ No newline at end of file diff --git a/vspace/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml b/vspace/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml index c42241463..6da33ba7a 100644 --- a/vspace/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml +++ b/vspace/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml @@ -8,7 +8,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd - http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.1.xsd + http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-5.3.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd"> diff --git a/vspace/src/main/webapp/WEB-INF/spring/root-context.xml b/vspace/src/main/webapp/WEB-INF/spring/root-context.xml index dbdaff37a..2a87404a7 100644 --- a/vspace/src/main/webapp/WEB-INF/spring/root-context.xml +++ b/vspace/src/main/webapp/WEB-INF/spring/root-context.xml @@ -11,7 +11,7 @@ http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd - http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.1.xsd + http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-5.3.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"> From 3b6296cfe4b2e6567eec6bb2768f20a8a88c30e3 Mon Sep 17 00:00:00 2001 From: Prashant Ravindra Jadhav <55036442+prjadhav14@users.noreply.github.com> Date: Wed, 24 Jun 2020 13:20:56 -0700 Subject: [PATCH 06/47] Story/VSPC-79 (#131) * [VSPC-79] Changes to delete Space * [VSPC-79] Delete Space Changes * [VSPC-79] Delete linked Modules, External links and spaces * [VSPC-79]Reverting commits * [VSPC-79] Changes to delete Space Links * [VSPC-79] Indentation Fix --- .../vspace/core/data/ExternalLinkDisplayRepository.java | 3 +++ .../core/data/display/ModuleLinkDisplayRepository.java | 3 +++ .../core/data/display/SpaceLinkDisplayRepository.java | 7 +++++-- .../asu/diging/vspace/core/services/impl/LinkManager.java | 3 +++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/data/ExternalLinkDisplayRepository.java b/vspace/src/main/java/edu/asu/diging/vspace/core/data/ExternalLinkDisplayRepository.java index 8a69a45d7..21da1ee24 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/data/ExternalLinkDisplayRepository.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/data/ExternalLinkDisplayRepository.java @@ -7,6 +7,7 @@ import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.stereotype.Repository; +import edu.asu.diging.vspace.core.model.IExternalLink; import edu.asu.diging.vspace.core.model.display.impl.ExternalLinkDisplay; @Repository @@ -15,4 +16,6 @@ public interface ExternalLinkDisplayRepository extends PagingAndSortingRepositor @Query("SELECT d FROM ExternalLinkDisplay d WHERE d.externalLink.space.id = ?1") public List findExternalLinkDisplaysForSpace(String spaceId); + + public void deleteByExternalLink(IExternalLink link); } diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/data/display/ModuleLinkDisplayRepository.java b/vspace/src/main/java/edu/asu/diging/vspace/core/data/display/ModuleLinkDisplayRepository.java index 5e289f521..de3afc123 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/data/display/ModuleLinkDisplayRepository.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/data/display/ModuleLinkDisplayRepository.java @@ -7,6 +7,7 @@ import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.stereotype.Repository; +import edu.asu.diging.vspace.core.model.IModuleLink; import edu.asu.diging.vspace.core.model.display.impl.ModuleLinkDisplay; @Repository @@ -15,4 +16,6 @@ public interface ModuleLinkDisplayRepository extends PagingAndSortingRepository< @Query("SELECT d FROM ModuleLinkDisplay d WHERE d.link.space.id = ?1") public List findModuleLinkDisplaysForSpace(String spaceId); + + public void deleteByLink(IModuleLink link); } diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/data/display/SpaceLinkDisplayRepository.java b/vspace/src/main/java/edu/asu/diging/vspace/core/data/display/SpaceLinkDisplayRepository.java index c5e52304e..bb6608d6a 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/data/display/SpaceLinkDisplayRepository.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/data/display/SpaceLinkDisplayRepository.java @@ -7,12 +7,15 @@ import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.stereotype.Repository; +import edu.asu.diging.vspace.core.model.ISpaceLink; import edu.asu.diging.vspace.core.model.display.impl.SpaceLinkDisplay; @Repository @JaversSpringDataAuditable public interface SpaceLinkDisplayRepository extends PagingAndSortingRepository { - @Query("SELECT d FROM SpaceLinkDisplay d WHERE d.link.sourceSpace.id = ?1") - public List findSpaceLinkDisplaysForSpace(String spaceId); + @Query("SELECT d FROM SpaceLinkDisplay d WHERE d.link.sourceSpace.id = ?1") + public List findSpaceLinkDisplaysForSpace(String spaceId); + + public void deleteByLink(ISpaceLink space); } diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/LinkManager.java b/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/LinkManager.java index 04e31d0da..dbd674330 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/LinkManager.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/LinkManager.java @@ -172,6 +172,7 @@ public void deleteSpaceLink(String linkId) { ISpace space = linkOptional.get().getSourceSpace(); ISpaceLink link = linkOptional.get(); space.getSpaceLinks().remove(link); + spaceLinkDisplayRepo.deleteByLink(link); spaceLinkRepo.delete((SpaceLink) link); } @@ -185,6 +186,7 @@ public void deleteModuleLink(String linkId) { ISpace space = linkOptional.get().getSpace(); IModuleLink link = linkOptional.get(); space.getModuleLinks().remove(link); + moduleLinkDisplayRepo.deleteByLink(link); moduleLinkRepo.delete((ModuleLink) link); } @@ -198,6 +200,7 @@ public void deleteExternalLink(String linkId) { ISpace space = linkOptional.get().getSpace(); IExternalLink link = linkOptional.get(); space.getExternalLinks().remove(link); + externalLinkDisplayRepo.deleteByExternalLink(link); externalLinkRepo.delete((ExternalLink) link); } From fa04057a20b4d4d219fb73071ad4389c383f2458 Mon Sep 17 00:00:00 2001 From: Sagar Khar <44152998+Sagar-k93@users.noreply.github.com> Date: Fri, 26 Jun 2020 12:50:40 -0600 Subject: [PATCH 07/47] Story/vspc 71 (#107) * [VSPC-71] Added field 'Mode' on exhibition config page. * [VSPC-71] Added changes to show custom message on UI if site is in different modes. * [VSPC-71] Changes to remove existing message when user chooses offline mode. * [VSPC-71] Setting up AOP for Exhibition view on mode changes. * [VSPC-71] Exhibition only shown if user is logged in or exhibition is active. * [VSPC-71] Added modal when user is logged in and sees exhibition if exhibition is down. * [VSPC-71] Changes to show popup only once in exhibition page. * [VSPC-71] Added new page to redirect public users if exhibition not up. * [VSPC-71] Formatting changes. * [VSPC-71] Made changes to address pr comments. * [VSPC-71] Verified values present before querying them in array. * [VSPC-71] Created new package for all public view related controllers. * [VSPC-71] Removed unnecessary code blocks. * [VSPC-71] Formatting changes. * [VSPC-71] Changes to make mode enum and modemessage to customMessage. * [VSPC-71] Removed getAllValues method from ExhibitionModes enum. * [VSPC-71] Changes to configcontroller to store null if exhibition mode is not offline. * [VSPC-71] Modified customMessage to be retained when mode is changed. * [VSPC-71] Formatting changes in config.jsp * [VSPC-71] Change to show correct message on exhibition page pop up for maintenance mode. * [VSPC-71] Changes to handle nullpointer exception when invalid space is accessed. * [VSPC-71] Formatting changes. * [VSPC-71] Changes to let aspect around public view controller get by passed if not called for space view. * [VSPC-71] Changed aspect to validate for modules and spaces in exhibition. * [VSPC-71] Removed the comments and prints. * [VSPC-71] Added constants for prefixes and divided complex method into parts. * [VSPC-71] Divided functionality into multiple methods in aspect for exhibition. * [VSPC-71] Merged with develop and moved exhibition controllers to publicview package. * [VSPC-71] Added changes based on pr review comments. * [VSPC-71] Indentation changes. * [VSPC-71] Indentation changes. * [VSPC-71] Moved ExhibitionSpaceController to publicview package. * [VSPC-71] Placed the message after pop up back in spaces page. * [VSPC-71] Made changes to exhibition aspect. * [VSPC-71] Changes for naming convention and exhibitionModes. * [VSPC-71] Added comments to aspect methods. * [VSPC-71] Removed the pop up for the exhibition view. * [VSPC-71] Added image for exhibition maintenance page. * [VSPC-71] Made changes as per review comments. * [VSPC-71] To add Exhibition status in dashboard. Co-authored-by: skhar --- .../web/admin/ListUsersController.java | 37 ++++ .../core/aspects/ExhibitionDataAspect.java | 116 ++++++++++- .../vspace/core/model/ExhibitionModes.java | 21 ++ .../asu/diging/vspace/core/model/IPrefix.java | 7 + .../diging/vspace/core/model/IdPrefix.java | 17 ++ .../vspace/core/model/impl/Exhibition.java | 28 ++- .../diging/vspace/core/model/impl/Module.java | 3 +- .../diging/vspace/core/model/impl/Space.java | 183 +++++++++--------- .../services/impl/SpaceDisplayManager.java | 24 ++- .../web/exception/SpaceNotFoundException.java | 2 +- .../ExhibitionModuleController.java | 2 +- .../ExhibitionSequencesController.java | 2 +- .../ExhibitionSlideController.java | 2 +- .../ExhibitionSpaceController.java | 13 +- .../ExhibitionConfigurationController.java | 24 ++- vspace/src/main/webapp/WEB-INF/tiles-defs.xml | 9 + .../webapp/WEB-INF/tiles/skeleton_bt4.jsp | 12 +- .../WEB-INF/views/exhibition/maintenance.jsp | 11 ++ .../WEB-INF/views/exhibition/module.jsp | 2 +- .../WEB-INF/views/exhibition/notFound.jsp | 13 ++ .../webapp/WEB-INF/views/exhibition/space.jsp | 25 ++- .../WEB-INF/views/staff/exhibit/config.jsp | 74 +++++-- .../webapp/WEB-INF/views/staff/users/list.jsp | 4 +- .../resources/maintenance/img/maintenance.png | Bin 0 -> 23330 bytes 24 files changed, 475 insertions(+), 156 deletions(-) create mode 100644 vspace/src/main/java/edu/asu/diging/simpleusers/web/admin/ListUsersController.java create mode 100644 vspace/src/main/java/edu/asu/diging/vspace/core/model/ExhibitionModes.java create mode 100644 vspace/src/main/java/edu/asu/diging/vspace/core/model/IPrefix.java create mode 100644 vspace/src/main/java/edu/asu/diging/vspace/core/model/IdPrefix.java rename vspace/src/main/java/edu/asu/diging/vspace/web/{ => publicview}/ExhibitionModuleController.java (97%) rename vspace/src/main/java/edu/asu/diging/vspace/web/{ => publicview}/ExhibitionSequencesController.java (98%) rename vspace/src/main/java/edu/asu/diging/vspace/web/{ => publicview}/ExhibitionSlideController.java (99%) rename vspace/src/main/java/edu/asu/diging/vspace/web/{ => publicview}/ExhibitionSpaceController.java (81%) create mode 100644 vspace/src/main/webapp/WEB-INF/views/exhibition/maintenance.jsp create mode 100644 vspace/src/main/webapp/WEB-INF/views/exhibition/notFound.jsp create mode 100644 vspace/src/main/webapp/resources/maintenance/img/maintenance.png diff --git a/vspace/src/main/java/edu/asu/diging/simpleusers/web/admin/ListUsersController.java b/vspace/src/main/java/edu/asu/diging/simpleusers/web/admin/ListUsersController.java new file mode 100644 index 000000000..6aca7af06 --- /dev/null +++ b/vspace/src/main/java/edu/asu/diging/simpleusers/web/admin/ListUsersController.java @@ -0,0 +1,37 @@ +package edu.asu.diging.simpleusers.web.admin; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.AbstractController; + +import edu.asu.diging.simpleusers.core.config.ConfigurationProvider; +import edu.asu.diging.simpleusers.core.service.IUserManager; +import edu.asu.diging.vspace.core.services.IExhibitionManager; + +@Controller +public class ListUsersController extends AbstractController { + + public final static String REQUEST_MAPPING_PATH = "list"; + + @Autowired + private ConfigurationProvider configProvider; + + @Autowired + private IUserManager userManager; + + @Autowired + private IExhibitionManager exhibitionManager; + + @Override + protected ModelAndView handleRequestInternal(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception { + ModelAndView model = new ModelAndView(); + model.addObject("users", userManager.findAll()); + model.addObject("exhibition",exhibitionManager.getStartExhibition()); + model.setViewName(configProvider.getUserListView()); + return model; + } +} 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 1d9117993..3834b9d16 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,19 +1,30 @@ package edu.asu.diging.vspace.core.aspects; - +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import java.util.List; - import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.After; +import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.ui.Model; +import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; - +import edu.asu.diging.vspace.core.auth.impl.AuthenticationFacade; +import edu.asu.diging.vspace.core.model.ExhibitionModes; +import edu.asu.diging.vspace.core.model.IModule; +import edu.asu.diging.vspace.core.model.ISpace; +import edu.asu.diging.vspace.core.model.IdPrefix; +import edu.asu.diging.vspace.core.model.impl.Exhibition; 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.IModuleManager; import edu.asu.diging.vspace.core.services.ISpaceManager; @Component @@ -26,6 +37,12 @@ public class ExhibitionDataAspect { @Autowired private ISpaceManager spaceManager; + @Autowired + private IModuleManager moduleManager; + + @Autowired + private AuthenticationFacade authFacade; + @After("execution(public * edu.asu.diging.vspace.web..*Controller.*(..))") public void setExhibition(JoinPoint jp) { Object[] args = jp.getArgs(); @@ -33,10 +50,10 @@ public void setExhibition(JoinPoint jp) { Class returnType = signature.getReturnType(); // only if there is a model object injected and if we're returning a string // (assuming that returning a string implies rendering of a view afterwards - if (args != null && returnType == String.class) { - for (Object obj : args) { - if (obj instanceof Model && !(obj instanceof RedirectAttributes)) { - if (!((Model) obj).containsAttribute("exhibition")) { + if(args!=null && returnType==String.class) { + for(Object obj : args) { + if(obj instanceof Model && !(obj instanceof RedirectAttributes)) { + if(!((Model) obj).containsAttribute("exhibition")) { ((Model) obj).addAttribute("exhibition", exhibitionManager.getStartExhibition()); } if (!((Model) obj).containsAttribute("publishedSpaces")) { @@ -48,7 +65,92 @@ public void setExhibition(JoinPoint jp) { ((Model) obj).addAttribute("publishedSpaces", publishedSpaces); } } + } + } + } + + @Around("execution(public * edu.asu.diging.vspace.web.publicview..*Controller.*(..))") + public Object showExhibition(ProceedingJoinPoint jp) throws Throwable { + Object[] args = jp.getArgs(); + MethodSignature signature = (MethodSignature) jp.getSignature(); + int indexOfModel = (Arrays.asList(signature.getParameterTypes())).indexOf(Model.class); + Exhibition exhibition = (Exhibition) exhibitionManager.getStartExhibition(); + // If there is no exhibition, we go back to root url page. + if(exhibition==null) { + return "redirect:/"; + } + //If no exhibition mode has been setup for existing exhibition, we skip modes and aspects. + if(exhibition.getMode() == null) { + return jp.proceed(); + } + Map ids = getIds(args, signature); + String spaceId = ids.getOrDefault(IdPrefix.SPACEID, ""); + String moduleId = ids.getOrDefault(IdPrefix.MODULEID, ""); + return redirectRequest(jp, spaceId, moduleId, indexOfModel, exhibition); + } + + + /** + * Based on exhibition mode, get the redirect page or pass control to controller. + * @param jp The joinpoint variable, used to fetch request parameters and proceed with the request. + * @param spaceId Current spaceId that is requested to be viewed by user. + * @param moduleId The moduleId that the user has requested to view. + * @param modelIndex Index of the model information in the reuest parameters. + * @param exhibition Current exhibition that is being shown to user. + * @return returns the page to load upon aspect completion. + * @throws Throwable + */ + private Object redirectRequest(ProceedingJoinPoint jp, String spaceId, String moduleId, int modelIndex, Exhibition exhibition) throws Throwable{ + ISpace space = spaceManager.getSpace(spaceId); + IModule module = moduleManager.getModule(moduleId); + Object[] args = jp.getArgs(); + ExhibitionModes exhibitionMode = exhibition.getMode(); + // If exhibition is set to offline, set the custom message or default message. + if(exhibitionMode.equals(ExhibitionModes.OFFLINE)) { + String modeValue = exhibition.getCustomMessage().equals("") == false ? exhibition.getCustomMessage() : exhibitionMode.getValue(); + ((Model) args[modelIndex]).addAttribute("modeValue", modeValue); + } + // If exhibition is set to maintenance, set the default message. + if(exhibitionMode.equals(ExhibitionModes.MAINTENANCE)) { + ((Model) args[modelIndex]).addAttribute("modeValue", exhibitionMode.getValue()); + } + // If user is not logged in and exhibition is not active, show maintenance page. + if(authFacade.getAuthenticatedUser()==null && !exhibitionMode.equals(ExhibitionModes.ACTIVE)) { + return "maintenance"; + } + // If the space and module Id is not found, show message on screen. + if(space==null && module==null) { + return "notFound"; + } + // If user is logged in and exhibition is not active, show exhibition with pop up message. + if(authFacade.getAuthenticatedUser()!=null && !exhibitionMode.equals(ExhibitionModes.ACTIVE)) { + return jp.proceed(); + } + return jp.proceed(); + } + + + /** + * Method to get the space or module id's from the request body. + * @param args The request parameters from the original request. + * @param signature Contains the information about the arguments present in args. + * @return A map with spaceId and moduleId from the request args. + */ + private Map getIds(Object[] args, MethodSignature signature) { + Map res = new HashMap<>(); + for(int i=0; i 2) { + String prefix = ((String) args[i]).substring(0,3); + if(prefix.equalsIgnoreCase(IdPrefix.SPACEID.getValue())) { + res.put(IdPrefix.SPACEID, (String) args[i]); + } + if(prefix.equalsIgnoreCase(IdPrefix.MODULEID.getValue())) { + res.put(IdPrefix.MODULEID, (String) args[i]); + } + } } } + return res; } } diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/model/ExhibitionModes.java b/vspace/src/main/java/edu/asu/diging/vspace/core/model/ExhibitionModes.java new file mode 100644 index 000000000..903c67ec9 --- /dev/null +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/model/ExhibitionModes.java @@ -0,0 +1,21 @@ +package edu.asu.diging.vspace.core.model; + +import java.util.ArrayList; +import java.util.List; + +public enum ExhibitionModes { + + ACTIVE(""), + MAINTENANCE("This exhibition is currently under maintenance. Please check back later."), + OFFLINE("This exhibition is currently offline. Please check back later."); + + private final String value; + + private ExhibitionModes(String value) { + this.value = value; + } + + public String getValue() { + return value; + } +} diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/model/IPrefix.java b/vspace/src/main/java/edu/asu/diging/vspace/core/model/IPrefix.java new file mode 100644 index 000000000..af0dd772b --- /dev/null +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/model/IPrefix.java @@ -0,0 +1,7 @@ +package edu.asu.diging.vspace.core.model; + +public interface IPrefix { + + public static String SPACE_PREFIX = "SPA"; + public static String MODULE_PREFIX = "MOD"; +} diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/model/IdPrefix.java b/vspace/src/main/java/edu/asu/diging/vspace/core/model/IdPrefix.java new file mode 100644 index 000000000..ece583ce3 --- /dev/null +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/model/IdPrefix.java @@ -0,0 +1,17 @@ +package edu.asu.diging.vspace.core.model; + +public enum IdPrefix { + + SPACEID(IPrefix.SPACE_PREFIX), + MODULEID(IPrefix.MODULE_PREFIX); + + private final String value; + + private IdPrefix(String value) { + this.value = value; + } + + public String getValue() { + return value; + } +} diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/Exhibition.java b/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/Exhibition.java index a9886b746..93e548703 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/Exhibition.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/Exhibition.java @@ -1,11 +1,14 @@ package edu.asu.diging.vspace.core.model.impl; import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToOne; import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.Parameter; +import edu.asu.diging.vspace.core.model.ExhibitionModes; import edu.asu.diging.vspace.core.model.IExhibition; import edu.asu.diging.vspace.core.model.ISpace; @@ -20,9 +23,7 @@ public class Exhibition extends VSpaceElement implements IExhibition { @Id @GeneratedValue(generator = "exhibit_id_generator") - @GenericGenerator(name = "exhibit_id_generator", - parameters = @Parameter(name = "prefix", value = "EXH"), - strategy = "edu.asu.diging.vspace.core.data.IdGenerator") + @GenericGenerator(name = "exhibit_id_generator", parameters = @Parameter(name = "prefix", value = "EXH"), strategy = "edu.asu.diging.vspace.core.data.IdGenerator") private String id; @OneToOne(targetEntity = Space.class) @@ -30,6 +31,11 @@ public class Exhibition extends VSpaceElement implements IExhibition { private String title; + @Enumerated(EnumType.STRING) + private ExhibitionModes mode; + + private String customMessage; + /* * (non-Javadoc) * @@ -81,5 +87,21 @@ public String getTitle() { public void setTitle(String title) { this.title = title; } + + public ExhibitionModes getMode() { + return mode; + } + + public void setMode(ExhibitionModes mode) { + this.mode = mode; + } + + public String getCustomMessage() { + return customMessage; + } + + public void setCustomMessage(String customMessage) { + this.customMessage = customMessage; + } } diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/Module.java b/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/Module.java index e1eaa1412..e0e8b73ed 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/Module.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/Module.java @@ -14,6 +14,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import edu.asu.diging.vspace.core.model.IModule; +import edu.asu.diging.vspace.core.model.IPrefix; import edu.asu.diging.vspace.core.model.ISequence; import edu.asu.diging.vspace.core.model.ISlide; @@ -23,7 +24,7 @@ public class Module extends VSpaceElement implements IModule { @Id @GeneratedValue(generator = "module_id_generator") @GenericGenerator(name = "module_id_generator", - parameters = @Parameter(name = "prefix", value = "MOD"), + parameters = @Parameter(name = "prefix", value = IPrefix.MODULE_PREFIX), strategy = "edu.asu.diging.vspace.core.data.IdGenerator") private String id; diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/Space.java b/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/Space.java index 6204ac646..cc04c88c6 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/Space.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/model/impl/Space.java @@ -15,6 +15,7 @@ import edu.asu.diging.vspace.core.model.IExternalLink; import edu.asu.diging.vspace.core.model.IModuleLink; +import edu.asu.diging.vspace.core.model.IPrefix; import edu.asu.diging.vspace.core.model.ISpace; import edu.asu.diging.vspace.core.model.ISpaceLink; import edu.asu.diging.vspace.core.model.IVSImage; @@ -22,95 +23,95 @@ @Entity public class Space extends VSpaceElement implements ISpace { - @Id - @GeneratedValue(generator = "space_id_generator") - @GenericGenerator(name = "space_id_generator", - parameters = @Parameter(name = "prefix", value = "SPA"), - strategy = "edu.asu.diging.vspace.core.data.IdGenerator") - private String id; - - @OneToMany(mappedBy="sourceSpace", targetEntity=SpaceLink.class) - private List spaceLinks; - - @OneToMany(mappedBy = "space", targetEntity=ModuleLink.class) - private List moduleLinks; - - @OneToMany(mappedBy = "space", targetEntity=ExternalLink.class) - private List externalLinks; - - @OneToOne(targetEntity=VSImage.class) - @NotFound(action=NotFoundAction.IGNORE) - private IVSImage image; - - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.ISpacee#getId() - */ - @Override - public String getId() { - return id; - } - - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.ISpacee#setId(java.lang.String) - */ - @Override - public void setId(String id) { - this.id = id; - } - - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.ISpacee#getSpaceLinks() - */ - @Override - public List getSpaceLinks() { - return spaceLinks; - } - - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.ISpacee#setSpaceLinks(java.util.List) - */ - @Override - public void setSpaceLinks(List spaceLinks) { - this.spaceLinks = spaceLinks; - } - - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.ISpacee#getModuleLinks() - */ - @Override - public List getModuleLinks() { - return moduleLinks; - } - - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.ISpacee#setModuleLinks(java.util.List) - */ - @Override - public void setModuleLinks(List moduleLinks) { - this.moduleLinks = moduleLinks; - } - - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.ISpacee#getExternalLinks() - */ - @Override - public List getExternalLinks() { - return externalLinks; - } - - /* (non-Javadoc) - * @see edu.asu.diging.vspace.core.model.impl.ISpacee#setExternalLinks(java.util.List) - */ - @Override - public void setExternalLinks(List externalLinks) { - this.externalLinks = externalLinks; - } - - public IVSImage getImage() { - return image; - } - - public void setImage(IVSImage image) { - this.image = image; - } + @Id + @GeneratedValue(generator = "space_id_generator") + @GenericGenerator(name = "space_id_generator", + parameters = @Parameter(name = "prefix", value = IPrefix.SPACE_PREFIX), + strategy = "edu.asu.diging.vspace.core.data.IdGenerator") + private String id; + + @OneToMany(mappedBy="sourceSpace", targetEntity=SpaceLink.class) + private List spaceLinks; + + @OneToMany(mappedBy = "space", targetEntity=ModuleLink.class) + private List moduleLinks; + + @OneToMany(mappedBy = "space", targetEntity=ExternalLink.class) + private List externalLinks; + + @OneToOne(targetEntity=VSImage.class) + @NotFound(action=NotFoundAction.IGNORE) + private IVSImage image; + + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.ISpacee#getId() + */ + @Override + public String getId() { + return id; + } + + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.ISpacee#setId(java.lang.String) + */ + @Override + public void setId(String id) { + this.id = id; + } + + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.ISpacee#getSpaceLinks() + */ + @Override + public List getSpaceLinks() { + return spaceLinks; + } + + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.ISpacee#setSpaceLinks(java.util.List) + */ + @Override + public void setSpaceLinks(List spaceLinks) { + this.spaceLinks = spaceLinks; + } + + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.ISpacee#getModuleLinks() + */ + @Override + public List getModuleLinks() { + return moduleLinks; + } + + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.ISpacee#setModuleLinks(java.util.List) + */ + @Override + public void setModuleLinks(List moduleLinks) { + this.moduleLinks = moduleLinks; + } + + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.ISpacee#getExternalLinks() + */ + @Override + public List getExternalLinks() { + return externalLinks; + } + + /* (non-Javadoc) + * @see edu.asu.diging.vspace.core.model.impl.ISpacee#setExternalLinks(java.util.List) + */ + @Override + public void setExternalLinks(List externalLinks) { + this.externalLinks = externalLinks; + } + + public IVSImage getImage() { + return image; + } + + public void setImage(IVSImage image) { + this.image = image; + } } diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/SpaceDisplayManager.java b/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/SpaceDisplayManager.java index 3dac377ac..dfbd398f3 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/SpaceDisplayManager.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/SpaceDisplayManager.java @@ -3,12 +3,15 @@ import java.io.IOException; import java.util.List; +import javax.servlet.http.HttpServletResponse; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Service; +import org.springframework.web.servlet.resource.HttpResource; import edu.asu.diging.vspace.core.data.display.SpaceDisplayRepository; import edu.asu.diging.vspace.core.factory.ISpaceDisplayFactory; @@ -54,16 +57,17 @@ public class SpaceDisplayManager implements ISpaceDisplayManager { */ @Override public ISpaceDisplay getBySpace(ISpace space) { - IVSImage image = space.getImage(); + IVSImage image = space!=null ? space.getImage():null; List displays = spaceDisplayRepo.getBySpace(space); - ISpaceDisplay display = displays.isEmpty() ? null : displays.get(0); - if (display == null ) { + ISpaceDisplay display = displays.isEmpty() ? null:displays.get(0); + if(display==null) { display = displayFactory.createSpaceDisplay(); } - if (image != null) { - if (image.getWidth() <= 0 || image.getHeight() <= 0) { + if(image!=null) { + if(image.getWidth()<=0 || image.getHeight()<=0) { try { - ImageData data = imageService.getImageData(storage.getImageContent(image.getId(), image.getFilename())); + ImageData data = imageService + .getImageData(storage.getImageContent(image.getId(), image.getFilename())); image.setWidth(data.getWidth()); image.setHeight(data.getHeight()); } catch (IOException e) { @@ -71,19 +75,19 @@ public ISpaceDisplay getBySpace(ISpace space) { return display; } } - - if (image.getWidth() <= maxBgImageWidth && image.getHeight() <= maxBgImageHeight) { + + if(image.getWidth()<=maxBgImageWidth && image.getHeight()<=maxBgImageHeight) { display.setWidth(image.getWidth()); display.setHeight(image.getHeight()); return display; } - + ImageData data = imageService.getImageDimensions(image, maxBgImageWidth, maxBgImageHeight); display.setHeight(data.getHeight()); display.setWidth(data.getWidth()); spaceDisplayRepo.save((SpaceDisplay) display); } - + return display; } } 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 index f3adddd32..847ea374a 100644 --- 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 @@ -8,7 +8,7 @@ public class SpaceNotFoundException extends Exception { private static final long serialVersionUID = 1L; public SpaceNotFoundException(String id) { - super("Space not found"); + super("Space with id "+ id +" not found"); } } \ No newline at end of file diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionModuleController.java b/vspace/src/main/java/edu/asu/diging/vspace/web/publicview/ExhibitionModuleController.java similarity index 97% rename from vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionModuleController.java rename to vspace/src/main/java/edu/asu/diging/vspace/web/publicview/ExhibitionModuleController.java index 115a42e0d..edbdabebb 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionModuleController.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/publicview/ExhibitionModuleController.java @@ -1,4 +1,4 @@ -package edu.asu.diging.vspace.web; +package edu.asu.diging.vspace.web.publicview; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSequencesController.java b/vspace/src/main/java/edu/asu/diging/vspace/web/publicview/ExhibitionSequencesController.java similarity index 98% rename from vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSequencesController.java rename to vspace/src/main/java/edu/asu/diging/vspace/web/publicview/ExhibitionSequencesController.java index b42206171..71f3be608 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSequencesController.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/publicview/ExhibitionSequencesController.java @@ -1,4 +1,4 @@ -package edu.asu.diging.vspace.web; +package edu.asu.diging.vspace.web.publicview; import java.util.List; diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSlideController.java b/vspace/src/main/java/edu/asu/diging/vspace/web/publicview/ExhibitionSlideController.java similarity index 99% rename from vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSlideController.java rename to vspace/src/main/java/edu/asu/diging/vspace/web/publicview/ExhibitionSlideController.java index e0a2eeaec..65bb7e2ca 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSlideController.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/publicview/ExhibitionSlideController.java @@ -1,4 +1,4 @@ -package edu.asu.diging.vspace.web; +package edu.asu.diging.vspace.web.publicview; import java.util.List; diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSpaceController.java b/vspace/src/main/java/edu/asu/diging/vspace/web/publicview/ExhibitionSpaceController.java similarity index 81% rename from vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSpaceController.java rename to vspace/src/main/java/edu/asu/diging/vspace/web/publicview/ExhibitionSpaceController.java index 122461d0d..9cf2584f1 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/web/ExhibitionSpaceController.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/publicview/ExhibitionSpaceController.java @@ -1,4 +1,4 @@ -package edu.asu.diging.vspace.web; +package edu.asu.diging.vspace.web.publicview; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -6,8 +6,10 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import edu.asu.diging.vspace.core.model.IExhibition; 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.ILinkManager; import edu.asu.diging.vspace.core.services.ISpaceDisplayManager; import edu.asu.diging.vspace.core.services.ISpaceManager; @@ -21,16 +23,21 @@ public class ExhibitionSpaceController { @Autowired private ISpaceDisplayManager spaceDisplayManager; + @Autowired + private IExhibitionManager exhibitManager; + @Autowired private ILinkManager linkManager; - @RequestMapping(value="/exhibit/space/{id}") + @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)) { + IExhibition exhibition = exhibitManager.getStartExhibition(); + model.addAttribute("exhibitionConfig", exhibition); model.addAttribute("space", space); model.addAttribute("spaceLinks", linkManager.getSpaceLinkDisplays(id)); model.addAttribute("moduleList", linkManager.getModuleLinkDisplays(id)); @@ -45,4 +52,4 @@ public String space(@PathVariable("id") String id, Model model) { } return "space"; } -} +} \ No newline at end of file diff --git a/vspace/src/main/java/edu/asu/diging/vspace/web/staff/ExhibitionConfigurationController.java b/vspace/src/main/java/edu/asu/diging/vspace/web/staff/ExhibitionConfigurationController.java index aaf23c98b..d8e729edd 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/web/staff/ExhibitionConfigurationController.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/web/staff/ExhibitionConfigurationController.java @@ -1,9 +1,12 @@ package edu.asu.diging.vspace.web.staff; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import javax.servlet.http.HttpServletRequest; +import org.javers.common.collections.Arrays; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -15,6 +18,7 @@ import edu.asu.diging.vspace.core.data.SpaceRepository; import edu.asu.diging.vspace.core.factory.impl.ExhibitionFactory; +import edu.asu.diging.vspace.core.model.ExhibitionModes; import edu.asu.diging.vspace.core.model.IExhibition; import edu.asu.diging.vspace.core.model.ISpace; import edu.asu.diging.vspace.core.model.impl.Exhibition; @@ -40,12 +44,12 @@ public class ExhibitionConfigurationController { public String showExhibitions(Model model) { // for now we assume there is just one exhibition IExhibition exhibition = exhibitManager.getStartExhibition(); - if (exhibition != null) { + if(exhibition!=null) { model.addAttribute("exhibition", exhibition); } else { model.addAttribute("exhibition", new Exhibition()); } - + model.addAttribute("exhibitionModes", Arrays.asList(ExhibitionModes.values())); model.addAttribute("spacesList", spaceRepo.findAll()); return "staff/exhibit/config"; } @@ -60,26 +64,30 @@ public String showExhibitions(Model model) { */ @RequestMapping(value = "/staff/exhibit/config", method = RequestMethod.POST) public RedirectView createOrUpdateExhibition(HttpServletRequest request, - @RequestParam(required = false, name = "exhibitionParam") String exhibitID, - @RequestParam("spaceParam") String spaceID, @RequestParam("title") String title, RedirectAttributes attributes) - throws IOException { + @RequestParam(required = false, name = "exhibitionParam") String exhibitID, + @RequestParam("spaceParam") String spaceID, @RequestParam("title") String title, + @RequestParam("exhibitMode") ExhibitionModes exhibitMode, + @RequestParam(value = "customMessage", required = false, defaultValue = "") String customMessage, + RedirectAttributes attributes) throws IOException { ISpace startSpace = spaceManager.getSpace(spaceID); Exhibition exhibition; - if (exhibitID == null || exhibitID.isEmpty()) { + if(exhibitID==null || exhibitID.isEmpty()) { exhibition = (Exhibition) exhibitFactory.createExhibition(); } else { exhibition = (Exhibition) exhibitManager.getExhibitionById(exhibitID); } - exhibition.setStartSpace(startSpace); exhibition.setTitle(title); + exhibition.setMode(exhibitMode); + if(exhibitMode.equals(ExhibitionModes.OFFLINE) && !customMessage.equals(ExhibitionModes.OFFLINE.getValue())) { + exhibition.setCustomMessage(customMessage); + } exhibition = (Exhibition) exhibitManager.storeExhibition(exhibition); attributes.addAttribute("alertType", "success"); attributes.addAttribute("message", "Successfully Saved!"); attributes.addAttribute("showAlert", "true"); return new RedirectView(request.getContextPath() + "/staff/exhibit/config"); } - } diff --git a/vspace/src/main/webapp/WEB-INF/tiles-defs.xml b/vspace/src/main/webapp/WEB-INF/tiles-defs.xml index 58f29539e..1989f4a33 100644 --- a/vspace/src/main/webapp/WEB-INF/tiles-defs.xml +++ b/vspace/src/main/webapp/WEB-INF/tiles-defs.xml @@ -66,6 +66,10 @@ + + + + @@ -121,6 +125,11 @@ + + + + + diff --git a/vspace/src/main/webapp/WEB-INF/tiles/skeleton_bt4.jsp b/vspace/src/main/webapp/WEB-INF/tiles/skeleton_bt4.jsp index 07bcd8bf2..56c08b277 100644 --- a/vspace/src/main/webapp/WEB-INF/tiles/skeleton_bt4.jsp +++ b/vspace/src/main/webapp/WEB-INF/tiles/skeleton_bt4.jsp @@ -3,11 +3,9 @@ <%@ 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" %> - - - + @@ -52,6 +50,14 @@

- \ No newline at end of file + diff --git a/vspace/src/main/webapp/WEB-INF/views/exhibition/notFound.jsp b/vspace/src/main/webapp/WEB-INF/views/exhibition/notFound.jsp new file mode 100644 index 000000000..78e2d2c50 --- /dev/null +++ b/vspace/src/main/webapp/WEB-INF/views/exhibition/notFound.jsp @@ -0,0 +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"%> + + +
+The space or module could not be found. +
\ 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 768bad188..a034ec784 100644 --- a/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/exhibition/space.jsp @@ -2,7 +2,6 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%> - "> @@ -56,9 +55,8 @@ $(window).on("load", function() { let spaceHeight = $("#bgImage").css("height"); $("#Module_1").css("height",spaceHeight); $( window ).resize(function() { - console.log("In Resize"); - $("#space a").remove(); - drawLinks(); + $("#space a").remove(); + drawLinks(); }); drawLinks(); }); @@ -70,7 +68,7 @@ function drawLinks() { var posY = $("#space").position().top; var link = $('
'); link.attr('href', ''); - + if ("${link.type}" == 'ALERT') { var linkDisplay = $('
From 0d5bdce2d277f7bbdd282a54db2e7aca1a5c0d36 Mon Sep 17 00:00:00 2001 From: Sagar Khar <44152998+Sagar-k93@users.noreply.github.com> Date: Wed, 8 Jul 2020 10:55:18 -0600 Subject: [PATCH 09/47] Story/vspc 81 (#134) * [VSPC-81] Completed the icon resize and icon positioning to center. * [VSPC-81] Icon changes to sequence page. * [VSPC-81] Removed commented code. Co-authored-by: skhar --- vspace/.classpath | 55 ++++++++++-------- .../staff/modules/sequences/sequence.jsp | 56 ++++++++++++------- .../main/webapp/resources/extra/Sequence.css | 8 +++ 3 files changed, 76 insertions(+), 43 deletions(-) create mode 100644 vspace/src/main/webapp/resources/extra/Sequence.css diff --git a/vspace/.classpath b/vspace/.classpath index 08ea4af33..8452cabca 100644 --- a/vspace/.classpath +++ b/vspace/.classpath @@ -1,50 +1,59 @@ - + - - + + - + - - + + - + - + - + - - - + + + - + - - + + - + - + - + - + - + - - + + - + diff --git a/vspace/src/main/webapp/WEB-INF/views/staff/modules/sequences/sequence.jsp b/vspace/src/main/webapp/WEB-INF/views/staff/modules/sequences/sequence.jsp index 1cd4a26bf..b2bb6b43a 100644 --- a/vspace/src/main/webapp/WEB-INF/views/staff/modules/sequences/sequence.jsp +++ b/vspace/src/main/webapp/WEB-INF/views/staff/modules/sequences/sequence.jsp @@ -3,8 +3,13 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> -" rel="stylesheet"> - +" + rel="stylesheet"> +" + rel="stylesheet"> +