diff --git a/src/main/java/de/thm/arsnova/config/AppConfig.java b/src/main/java/de/thm/arsnova/config/AppConfig.java index fbb1624f1bd30274309842775af5958176c5af1a..e2bf1ab31ddb35b6d65ebc446875ff5e87eb0440 100644 --- a/src/main/java/de/thm/arsnova/config/AppConfig.java +++ b/src/main/java/de/thm/arsnova/config/AppConfig.java @@ -67,6 +67,7 @@ import org.springframework.web.servlet.config.annotation.ViewResolverRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.view.InternalResourceViewResolver; +import de.thm.arsnova.config.properties.FeatureProperties; import de.thm.arsnova.config.properties.SecurityProperties; import de.thm.arsnova.config.properties.SystemProperties; import de.thm.arsnova.connector.client.ConnectorClient; @@ -122,7 +123,9 @@ import de.thm.arsnova.websocket.ArsnovaSocketioServerImpl; encoding = CharEncoding.UTF_8, factory = YamlPropertySourceFactory.class ) -@EnableConfigurationProperties(SystemProperties.class) +@EnableConfigurationProperties({ + FeatureProperties.class, + SystemProperties.class}) public class AppConfig implements WebMvcConfigurer { public static final String API_V2_MEDIA_TYPE_VALUE = "application/vnd.de.thm.arsnova.v2+json"; public static final String API_V3_MEDIA_TYPE_VALUE = "application/vnd.de.thm.arsnova.v3+json"; diff --git a/src/main/java/de/thm/arsnova/config/properties/FeatureProperties.java b/src/main/java/de/thm/arsnova/config/properties/FeatureProperties.java new file mode 100644 index 0000000000000000000000000000000000000000..c6493953ef07dffb8e3d6ead7a2a6e574e6148ee --- /dev/null +++ b/src/main/java/de/thm/arsnova/config/properties/FeatureProperties.java @@ -0,0 +1,129 @@ +/* + * This file is part of ARSnova Backend. + * Copyright (C) 2012-2019 The ARSnova Team and Contributors + * + * ARSnova Backend is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ARSnova Backend is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package de.thm.arsnova.config.properties; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(FeatureProperties.PREFIX) +public class FeatureProperties { + public static final String PREFIX = "features"; + + public static class Contents { + private boolean enabled; + private int answerOptionLimit; + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(final boolean enabled) { + this.enabled = enabled; + } + + public int getAnswerOptionLimit() { + return answerOptionLimit; + } + + public void setAnswerOptionLimit(final int answerOptionLimit) { + this.answerOptionLimit = answerOptionLimit; + } + } + + public static class Comments { + private boolean enabled; + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(final boolean enabled) { + this.enabled = enabled; + } + } + + public static class LiveFeedback { + private boolean enabled; + private int resetInterval; + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(final boolean enabled) { + this.enabled = enabled; + } + + public int getResetInterval() { + return resetInterval; + } + + public void setResetInterval(final int resetInterval) { + this.resetInterval = resetInterval; + } + } + + public static class ContentPool { + private boolean enabled; + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(final boolean enabled) { + this.enabled = enabled; + } + } + + private Contents contents; + private Comments comments; + private LiveFeedback liveFeedback; + private ContentPool contentPool; + + public Contents getContents() { + return contents; + } + + public void setContents(final Contents contents) { + this.contents = contents; + } + + public Comments getComments() { + return comments; + } + + public void setComments(final Comments comments) { + this.comments = comments; + } + + public LiveFeedback getLiveFeedback() { + return liveFeedback; + } + + public void setLiveFeedback(final LiveFeedback liveFeedback) { + this.liveFeedback = liveFeedback; + } + + public ContentPool getContentPool() { + return contentPool; + } + + public void setContentPool(final ContentPool contentPool) { + this.contentPool = contentPool; + } +} diff --git a/src/main/java/de/thm/arsnova/controller/v2/ConfigurationController.java b/src/main/java/de/thm/arsnova/controller/v2/ConfigurationController.java index e1525659f8880368240c171132e5c9de1efc3f22..2aef967ef562aee1168448ff7bac127416a26509 100644 --- a/src/main/java/de/thm/arsnova/controller/v2/ConfigurationController.java +++ b/src/main/java/de/thm/arsnova/controller/v2/ConfigurationController.java @@ -55,82 +55,78 @@ public class ConfigurationController extends AbstractController { @Value("${presenter.path}") private String presenterPath; - @Value("${links.overlay.url}") + @Value("${ui.links.overlay.url}") private String overlayUrl; - @Value("${links.organization.url}") + @Value("${ui.links.organization.url}") private String organizationUrl; - @Value("${links.imprint.url}") + @Value("${ui.links.imprint.url}") private String imprintUrl; - @Value("${links.blog.url:}") + @Value("${ui.links.blog.url:}") private String blogUrl; - @Value("${links.privacy-policy.url}") + @Value("${ui.links.privacy-policy.url}") private String privacyPolicyUrl; - @Value("${links.documentation.url}") + @Value("${ui.links.documentation.url}") private String documentationUrl; - @Value("${links.presenter-documentation.url}") + @Value("${ui.links.presenter-documentation.url}") private String presenterDocumentationUrl; - @Value("${feedback.warning:5}") + @Value("${ui.feedback.warning:5}") private String feedbackWarningOffset; - @Value("${features.mathjax.enabled:true}") + @Value("${ui.mathjax.enabled:true}") private String mathJaxEnabled; - @Value("${features.mathjax.src:}") + @Value("${ui.mathjax.src:}") private String mathJaxSrc; - @Value("${features.freetext-imageanswer.enabled:false}") + @Value("${features.contents.formats.freetext.imageanswer.enabled:false}") private String imageAnswerEnabled; - @Value("${features.question-format.grid-square.enabled:false}") + @Value("${features.contents.formats.grid-square.enabled:false}") private String gridSquareEnabled; - @Value("${features.session-import-export.enabled:false}") - private String roomImportExportEnabled; + private String roomImportExportEnabled = "true"; - @Value("${features.public-pool.enabled:false}") + @Value("${features.content-pool.enabled:false}") private String publicPoolEnabled; - @Value("${features.export-to-click.enabled:false}") - private String exportToClickEnabled; - - @Value("${question.answer-option-limit:8}") + @Value("${features.contents.answer-option-limit:8}") private String answerOptionLimit; - @Value("${upload.filesize_b:}") + @Value("${system.uploads.max-filesize:}") private String maxUploadFilesize; - @Value("${question.parse-answer-option-formatting:false}") + @Value("${ui.parse-answer-option-formatting:false}") private String parseAnswerOptionFormatting; - @Value("${pp.subjects}") + @Value("${features.content-pool.subjects}") private String ppSubjects; - @Value("${pp.licenses}") + @Value("${features.content-pool.licenses}") private String ppLicenses; - @Value("${pp.logofilesize_b}") + @Value("${features.content-pool.logo-max-filesize}") private String ppLogoMaxFilesize; - @Value("${upload.filesize_b}") + @Value("${system.uploads.max-filesize}") private String gridImageMaxFileSize; - @Value("${tracking.provider}") + @Value("${ui.tracking.provider}") private String trackingProvider; - @Value("${tracking.tracker-url}") + @Value("${ui.tracking.tracker-url}") private String trackingTrackerUrl; - @Value("${tracking.site-id}") + @Value("${ui.tracking.site-id}") private String trackingSiteId; - @Value("${session.demo-id:}") + @Value("${ui.demo-room-id:}") private String demoRoomShortId; @Value("${ui.slogan:}") @@ -154,10 +150,10 @@ public class ConfigurationController extends AbstractController { @Value("${ui.splashscreen.min-delay:}") private String splashscreenDelay; - @Value("${pp.session-levels.de}") + @Value("${features.content-pool.session-levels.de}") private String ppLevelsDe; - @Value("${pp.session-levels.en}") + @Value("${features.content-pool.session-levels.en}") private String ppLevelsEn; public ConfigurationController(final SystemProperties systemProperties) { @@ -240,7 +236,7 @@ public class ConfigurationController extends AbstractController { features.put("gridSquare", "true".equals(gridSquareEnabled)); features.put("sessionImportExport", "true".equals(roomImportExportEnabled)); features.put("publicPool", "true".equals(publicPoolEnabled)); - features.put("exportToClick", "true".equals(exportToClickEnabled)); + features.put("exportToClick", false); // add public pool configuration on demand if (features.get("publicPool")) { diff --git a/src/main/java/de/thm/arsnova/service/FeedbackServiceImpl.java b/src/main/java/de/thm/arsnova/service/FeedbackServiceImpl.java index df6e52649fdb7939e1f3af6995233e55a665794b..bc7b8d43cff4818a1d2444708f7b307d20f78103 100644 --- a/src/main/java/de/thm/arsnova/service/FeedbackServiceImpl.java +++ b/src/main/java/de/thm/arsnova/service/FeedbackServiceImpl.java @@ -47,7 +47,7 @@ public class FeedbackServiceImpl implements FeedbackService, ApplicationEventPub /** * Minutes, after which the feedback is deleted. */ - @Value("${feedback.cleanup}") + @Value("${features.live-feedback.reset-interval}") private int cleanupFeedbackDelay; private RoomService roomService; diff --git a/src/main/java/de/thm/arsnova/service/RoomServiceImpl.java b/src/main/java/de/thm/arsnova/service/RoomServiceImpl.java index 4f249b077da2a46baacb90a0ed50780ffb0d4eee..ec28aeace561236438270c7f286557af0754fc37 100644 --- a/src/main/java/de/thm/arsnova/service/RoomServiceImpl.java +++ b/src/main/java/de/thm/arsnova/service/RoomServiceImpl.java @@ -88,10 +88,10 @@ public class RoomServiceImpl extends DefaultEntityServiceImpl<Room> implements R private ConnectorClient connectorClient; - @Value("${session.guest-session.cleanup-days:0}") + @Value("${system.inactivity-thresholds.delete-inactive-guest-rooms:0}") private int guestRoomInactivityThresholdDays; - @Value("${pp.logofilesize_b}") + @Value("${features.content-pool.logo-max-filesize}") private int uploadFileSizeByte; public RoomServiceImpl( diff --git a/src/main/java/de/thm/arsnova/util/ImageUtils.java b/src/main/java/de/thm/arsnova/util/ImageUtils.java index 0d02f2c499a5d6146880367f9678087776466e47..6604a12693890e94d5cb7db9a88adb769960684e 100644 --- a/src/main/java/de/thm/arsnova/util/ImageUtils.java +++ b/src/main/java/de/thm/arsnova/util/ImageUtils.java @@ -59,10 +59,10 @@ public class ImageUtils { private static final Logger logger = LoggerFactory.getLogger(ImageUtils.class); - @Value("${imageupload.thumbnail.width}") + @Value("${system.uploads.thumbnail.width}") private int thumbWidth = THUMB_WIDTH_DEFAULT; - @Value("${imageupload.thumbnail.height}") + @Value("${system.uploads.thumbnail.height}") private int thumbHeight = THUMB_HEIGHT_DEFAULT; /** diff --git a/src/main/resources/config/defaults.yml b/src/main/resources/config/defaults.yml index 80c46a9cf875d1152e861643150e2059f3387360..ba256cb28b73e0b8c34e2e2c7a1dec2b7778daf0 100644 --- a/src/main/resources/config/defaults.yml +++ b/src/main/resources/config/defaults.yml @@ -51,6 +51,21 @@ arsnova: port: 8090 proxy-path: /socket.io + inactivity-thresholds: + # Anonymize user content for users with X days of inactivity + anonymize-users: 180 + + # Delete guest sessions automatically after X days of owner inactivity. + delete-guest-rooms: 180 + + uploads: + # Maximal filesize in bytes + max-filesize: 4194304 + thumbnail: + # Maximal thumbnail size in pixels + width: 400 + height: 400 + ############################################################################## # Authentication ############################################################################## @@ -202,71 +217,50 @@ arsnova: # Features ############################################################################## features: - mathjax: - # Enable MathJax to allow the use of Math formulas written in TeX syntax - # in text fields. + contents: enabled: true - src: //cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js + formats: + grid-square: + enabled: false + freetext: + imageanswer: + enabled: false + # Maximal number of answer options allowed for a skill question + answer-option-limit: 8 - # The following features are considered experimental because they have not - # been tested in a production environment over a longer time frame and/or - # their behavior will change in future releases. - freetext-imageanswer: + comments: enabled: true - question-format: - grid-square: - enabled: true - # Without enabled session-import-export feature no sessions can be added to - # the public pool - session-import-export: - enabled: true - public-pool: - enabled: true - export-to-click: + live-feedback: enabled: true + # Minutes, after which the feedback is deleted + reset-interval: 10 + + content-pool: + enabled: false + subjects: Allgemeines,Anglistik,Architektur,Bauingenieurwesen,Betriebswirtschaftslehre,Biologie,Chemie,Elektrotechnik,Geographie,Geowissenschaften,Germanistik,Geschichtswissenschaft,Informatik,Kunst,Kunstpädagogik,Maschinenbau,Mathematik,Medienwissenschaften,Medizin,Musik,Pharmazie,Physik,Psychologie,Rechtswissenschaften,Stadtplanung,Theaterwissenschaften,Theologie,Vermessungswesen,Volkswirtschaftslehre + licenses: CC by - Attribution,CC nc - Non-Commercial,CC nd - No Derivatives,CC sa - Share Alike,CCO - Public Domain,CC by-nd - Attribution-No Derivatives,CC by-c - Attribution-Non-Commercial,CC by-nc-sa - Attribution-Non-Derivatives-Share Alike,CC by-nc-nd Attribution-Non-Commercial- No Derivatives,GNU GPL - GNU General Public License + # Logo file size in bytes + logo-max-filesize: 102400 + # Do not reorder levels. Append new levels to the end of the list. Otherwise, + # references in existing public sessions could be mixed up. + session-levels: + de: Allgemeinbildung,Abitur,Bachelor,Master,Wer wird Millionär,Sonstiges + en: General Education,Highschool,Bachelor,Master,Who Wants to Be a Millionaire,Miscellaneous ############################################################################## - # Customization + # User interface ############################################################################## - feedback: - # Minutes, after which the feedback is deleted - cleanup: 10 - # Number of "you've lost me"/"abgehängt" votes, starting to show warning - # sign - warning: 15 - upload: - # Maximal filesize in bytes - filesize_b: 4194304 - imageupload: - thumbnail: - # Maximal thumbnail size in pixels - width: 400 - height: 400 - question: - # Maximal number of answer options allowed for a skill question - answer-option-limit: 8 - # Enable Markdown and MathJax parsing in answer options. Formatting in - # answer options should be used cautiously since it could lead to display - # errors. Answer options will still not be parsed in diagrams. This setting - # has no effect if neither MathJax nor Markdown are enabled. - parse-answer-option-formatting: false - session: - # Demo session id to show above session login button - # You can freely use the demo session of https://arsnova.eu/mobile which can - # be imported from the repro: - # https://github.com/thm-projects/arsnova-mobile/tree/master/demo-sessions - demo-id: "" - guest-session: - # Delete guest sessions automatically after X days of owner inactivity. - cleanup-days: 180 - user: - # Anonymize user content for users with X days of inactivity - cleanup-days: 180 ui: # Label underneath ARSnova logo slogan: Audience Response System + # Demo room short id to show above room login button + # You can freely use the demo room of https://arsnova.eu/mobile which can + # be imported from the repo: + # https://github.com/thm-projects/arsnova-mobile/tree/master/demo-sessions + demo-room-id: "" + # Splashscreen configuration # Best results are achieved with logos that have the same width and height. splashscreen: @@ -280,33 +274,45 @@ arsnova: background-color: "" loading-ind-color: "" - # Links which are displayed in the frontend applications - links: - blog: - url: https://arsnova.eu/blog/ - documentation: - url: https://arsnova.eu/manual/ - presenter-documentation: - url: "" - overlay: - url: https://arsnova.eu/overlay/ - organization: - url: "" - imprint: - url: "" - privacy-policy: - url: "" - - # Configuration for the public pool - pp: - subjects: Allgemeines,Anglistik,Architektur,Bauingenieurwesen,Betriebswirtschaftslehre,Biologie,Chemie,Elektrotechnik,Geographie,Geowissenschaften,Germanistik,Geschichtswissenschaft,Informatik,Kunst,Kunstpädagogik,Maschinenbau,Mathematik,Medienwissenschaften,Medizin,Musik,Pharmazie,Physik,Psychologie,Rechtswissenschaften,Stadtplanung,Theaterwissenschaften,Theologie,Vermessungswesen,Volkswirtschaftslehre - licenses: CC by - Attribution,CC nc - Non-Commercial,CC nd - No Derivatives,CC sa - Share Alike,CCO - Public Domain,CC by-nd - Attribution-No Derivatives,CC by-c - Attribution-Non-Commercial,CC by-nc-sa - Attribution-Non-Derivatives-Share Alike,CC by-nc-nd Attribution-Non-Commercial- No Derivatives,GNU GPL - GNU General Public License - logofilesize_b: 102400 - # Do not reorder levels. Append new levels to the end of the list. Otherwise, - # references in existing public sessions could be mixed up. - session-levels: - de: Allgemeinbildung,Abitur,Bachelor,Master,Wer wird Millionär,Sonstiges - en: General Education,Highschool,Bachelor,Master,Who Wants to Be a Millionaire,Miscellaneous + # Enable Markdown and MathJax parsing in answer options. Formatting in + # answer options should be used cautiously since it could lead to display + # errors. Answer options will still not be parsed in diagrams. This setting + # has no effect if neither MathJax nor Markdown are enabled. + parse-answer-option-formatting: false + + mathjax: + # Enable MathJax to allow the use of Math formulas written in TeX syntax + # in text fields. + enabled: true + src: //cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js + + # Number of "you've lost me"/"abgehängt" votes, starting to show warning + # sign + feedback-warning: 15 + + # Links which are displayed in the frontend applications + links: + blog: + url: https://arsnova.eu/blog/ + documentation: + url: https://arsnova.eu/manual/ + presenter-documentation: + url: "" + overlay: + url: https://arsnova.eu/overlay/ + organization: + url: "" + imprint: + url: "" + privacy-policy: + url: "" + + # It is possible to use an external tracking software with ARSnova. Currently + # Matomo is the only supported tracking provider. + tracking: + provider: matomo + tracker-url: "" + site-id: "" # The context paths where the ARSnova modules have been deployed customization: @@ -315,13 +321,3 @@ arsnova: path: /mobile presenter: path: /presenter - - ############################################################################## - # Tracking - ############################################################################## - # It is possible to use an external tracking software with ARSnova. Currently - # Matomo is the only supported tracking provider. - tracking: - provider: matomo - tracker-url: "" - site-id: ""