From 3654366dc8f65318122cb8b7160eeb58687a0df7 Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 16 May 2019 17:17:08 +0200 Subject: [PATCH] more seb config pages --- .../gui/content/action/ActionDefinition.java | 2 +- .../examconfig/impl/AbstractInputField.java | 1 - .../impl/CellFieldBuilderAdapter.java | 9 ++- .../examconfig/impl/TextFieldBuilder.java | 24 ++++++ .../examconfig/impl/ViewGridBuilder.java | 8 +- src/main/resources/logback-spring.xml | 4 +- src/main/resources/messages.properties | 81 +++++++++++++++++-- 7 files changed, 115 insertions(+), 14 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/action/ActionDefinition.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/action/ActionDefinition.java index 3634f038..bf9bb806 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/action/ActionDefinition.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/action/ActionDefinition.java @@ -335,7 +335,7 @@ public enum ActionDefinition { ActionCategory.FORM), SEB_EXAM_CONFIG_MODIFY_PROPERTIES_FROM_LIST( - new LocTextKey("sebserver.examconfig.props.action.list.modify"), + new LocTextKey("sebserver.examconfig.action.list.modify.properties"), ImageIcon.EDIT, PageStateDefinition.SEB_EXAM_CONFIG_PROPERTIES_EDIT, ActionCategory.SEB_EXAM_CONFIG_LIST), diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/AbstractInputField.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/AbstractInputField.java index d4adaee1..d217ba32 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/AbstractInputField.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/AbstractInputField.java @@ -123,7 +123,6 @@ public abstract class AbstractInputField implements InputFiel setValueToControl(this.attribute.defaultValue); final Event event = new Event(); try { - this.control.notifyListeners(SWT.Selection, event); this.control.notifyListeners(SWT.FocusOut, event); } catch (final Exception e) { log.warn("Failed to send value update to server: {}", this.attribute, e); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java index cb3718e9..2c79ce07 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java @@ -88,7 +88,12 @@ interface CellFieldBuilderAdapter { gridData.verticalIndent = 5; break; } - case LEFT_SPAN: + case LEFT_SPAN: { + label.setAlignment(SWT.LEFT); + gridData.horizontalSpan = orientation.width; + gridData.verticalIndent = 5; + break; + } case RIGHT_SPAN: { label.setAlignment(SWT.LEFT); gridData.verticalIndent = 5; @@ -180,7 +185,7 @@ interface CellFieldBuilderAdapter { builder.parent, this.width, groupLabelKey); - group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, this.width, this.height)); + group.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, this.width, this.height)); final ViewGridBuilder groupBuilder = new ViewGridBuilder( group, diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TextFieldBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TextFieldBuilder.java index dfbc7a60..2b905c8b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TextFieldBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TextFieldBuilder.java @@ -8,6 +8,9 @@ package ch.ethz.seb.sebserver.gui.service.examconfig.impl; +import java.util.function.Consumer; + +import org.apache.commons.lang3.StringUtils; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; @@ -21,8 +24,12 @@ import ch.ethz.seb.sebserver.gbl.model.sebconfig.AttributeType; import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationAttribute; import ch.ethz.seb.sebserver.gbl.model.sebconfig.Orientation; import ch.ethz.seb.sebserver.gbl.profile.GuiProfile; +import ch.ethz.seb.sebserver.gui.service.examconfig.ExamConfigurationService; import ch.ethz.seb.sebserver.gui.service.examconfig.InputField; import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder; +import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport; +import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; +import ch.ethz.seb.sebserver.gui.service.i18n.PolyglotPageService; @Lazy @Component @@ -50,6 +57,7 @@ public class TextFieldBuilder implements InputFieldBuilder { final ConfigurationAttribute attribute, final ViewContext viewContext) { + final I18nSupport i18nSupport = viewContext.getI18nSupport(); final Orientation orientation = viewContext .getOrientation(attribute.id); final Composite innerGrid = InputFieldBuilder @@ -65,6 +73,17 @@ public class TextFieldBuilder implements InputFieldBuilder { } text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + final LocTextKey toolTipKey = ExamConfigurationService.getToolTipKey( + attribute, + i18nSupport); + if (toolTipKey != null) { + final Consumer updateFunction = t -> t.setToolTipText(i18nSupport.getText(toolTipKey)); + text.setData( + PolyglotPageService.POLYGLOT_ITEM_TOOLTIP_DATA_KEY, + updateFunction); + updateFunction.accept(text); + } + final TextInputField textInputField = new TextInputField( attribute, orientation, @@ -98,6 +117,11 @@ public class TextFieldBuilder implements InputFieldBuilder { @Override protected void setValueToControl(final String value) { + if (value == null) { + this.control.setText(StringUtils.EMPTY); + return; + } + this.control.setText(value); } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewGridBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewGridBuilder.java index 0a99155d..32998046 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewGridBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewGridBuilder.java @@ -128,8 +128,12 @@ public class ViewGridBuilder { break; } case LEFT_SPAN: { - fillDummy(xpos - orientation.width, ypos, orientation.width, 1); - this.grid[ypos][xpos - orientation.width] = CellFieldBuilderAdapter.labelBuilder( + int spanxpos = xpos - orientation.width; + if (spanxpos < 0) { + spanxpos = 0; + } + fillDummy(spanxpos, ypos, orientation.width, 1); + this.grid[ypos][spanxpos] = CellFieldBuilderAdapter.labelBuilder( attribute, orientation); break; diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index a949f6f1..cb74e485 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -21,7 +21,7 @@ - + @@ -38,7 +38,7 @@ - + diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index d11a5c8b..ef2756d7 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -355,7 +355,8 @@ sebserver.examconfig.info.pleaseSelect=Please Select an exam configuration first sebserver.examconfig.action.list.new=New Exam Configuration sebserver.examconfig.action.list.view=View Configuration -sebserver.examconfig.action.list.modify=Edit Attributes +sebserver.examconfig.action.list.modify=Edit +sebserver.examconfig.action.list.modify.properties=Edit Properties sebserver.examconfig.action.modify=Edit sebserver.examconfig.action.save=Save @@ -372,6 +373,9 @@ sebserver.examconfig.status.IN_USE=In Use sebserver.examconfig.props.from.title=Exam Configuration Properties sebserver.examconfig.props.form.views.general=General sebserver.examconfig.props.form.views.user_interface=User Interface +sebserver.examconfig.props.form.views.browser=Browser +sebserver.examconfig.props.form.views.down_upload=Down/Uploads +sebserver.examconfig.props.form.views.exam=Exam sebserver.examconfig.props.label.hashedAdminPassword=Administrator password sebserver.examconfig.props.label.hashedAdminPassword.confirm=Confirm password @@ -453,15 +457,80 @@ sebserver.examconfig.props.label.allowSpellCheckDictionary.pt-PT=Portuguese (Por sebserver.examconfig.props.label.allowSpellCheckDictionary.sv-SE=Swedish (Sweden) sebserver.examconfig.props.label.allowSpellCheckDictionary.sv-FI=Swedish (Finland) -sebserver.examconfig.props.form.views.testView=Test View -sebserver.examconfig.props.form.views.testView.tooltip=This is a test View -sebserver.examconfig.props.action.list.modify=Edit Properties +sebserver.examconfig.props.group.newBrowserWindow=Links requesting to be opened in a new browser window (Mac) +sebserver.examconfig.props.label.newBrowserWindowByLinkPolicy.0=get generally blocked +sebserver.examconfig.props.label.newBrowserWindowByLinkPolicy.1=open in same window +sebserver.examconfig.props.label.newBrowserWindowByLinkPolicy.2=open in new window +sebserver.examconfig.props.label.newBrowserWindowByLinkBlockForeign=block when directing\nto a different server -sebserver.examconfig.props.label.testNumber1=Test Number 1 -sebserver.examconfig.props.label.testNumber2=Test Number 2 +sebserver.examconfig.props.group.newwinsize=New browser window size and position +sebserver.examconfig.props.label.newBrowserWindowByLinkWidth=Width +sebserver.examconfig.props.label.newBrowserWindowByLinkHeight=Height +sebserver.examconfig.props.label.newBrowserWindowByLinkPositioning=Horizontal positioning +sebserver.examconfig.props.label.newBrowserWindowByLinkPositioning.0=Left +sebserver.examconfig.props.label.newBrowserWindowByLinkPositioning.1=Center +sebserver.examconfig.props.label.newBrowserWindowByLinkPositioning.2=Right +sebserver.examconfig.props.group.browserSecurity=Browser security +sebserver.examconfig.props.label.enablePlugIns=Enable plug-ins (Win: only Flash) +sebserver.examconfig.props.label.enableJavaScript=Enable Java Script +sebserver.examconfig.props.label.enableJava=Enable Java +sebserver.examconfig.props.label.blockPopUpWindows=Block pup-up windows +sebserver.examconfig.props.label.allowVideoCapture=Allow video capture (webcam) +sebserver.examconfig.props.label.allowAudioCapture=Allow audio capture (microphone) +sebserver.examconfig.props.label.allowBrowsingBackForward=Allow navigating back/forward in exam +sebserver.examconfig.props.label.newBrowserWindowNavigation=Allow navigating in additional windows +sebserver.examconfig.props.label.browserWindowAllowReload=Allow realod exam +sebserver.examconfig.props.label.newBrowserWindowAllowReload=Allow reload in additional windows +sebserver.examconfig.props.label.showReloadWarning=Show reload warning in exam +sebserver.examconfig.props.label.newBrowserWindowShowReloadWarning=Show reload warning in additional windows +sebserver.examconfig.props.label.removeBrowserProfile=Remove profile (Win) +sebserver.examconfig.props.label.removeLocalStorage=Disable locale storage (Mac) +sebserver.examconfig.props.label.browserUserAgent=Suffix to be added to any user agent +sebserver.examconfig.props.group.userAgentDesktop=User agent for desktop mode +sebserver.examconfig.props.label.browserUserAgentWinDesktopMode.0=Desktop default +sebserver.examconfig.props.label.browserUserAgentWinDesktopMode.0.tooltip=Zoom whole web pages using Ctrl-Mousewheel (Win) +sebserver.examconfig.props.label.browserUserAgentWinDesktopMode.1=Custom +sebserver.examconfig.props.label.browserUserAgentWinDesktopMode.1.tooltip=Zoom only text on web pages using Ctrl-Mousewheel (Win) +sebserver.examconfig.props.label.browserUserAgentWinDesktopModeCustom.tooltip=Custom desktop user agent string\n(SEB appends its version number automatically) +sebserver.examconfig.props.group.userAgentTouch=User agent for touch/table mode +sebserver.examconfig.props.label.browserUserAgentWinTouchMode.0=Touch default +sebserver.examconfig.props.label.browserUserAgentWinTouchMode.1=iPad +sebserver.examconfig.props.label.browserUserAgentWinTouchMode.2=Custom +sebserver.examconfig.props.label.browserUserAgentWinTouchMode.2.tooltip=Zoom only text on web pages using Ctrl-Mousewheel (Win) + +sebserver.examconfig.props.group.userAgentMac=User agent (Mac) +sebserver.examconfig.props.label.browserUserAgentMac.0=Default (depends on installed Safari/WebKit version) +sebserver.examconfig.props.label.browserUserAgentMac.1=Custom +sebserver.examconfig.props.label.browserUserAgentMac.1.tooltip=Zoom only text on web pages using Ctrl-Mousewheel (Win) + +sebserver.examconfig.props.label.enableSebBrowser=Enable SEB with browser window +sebserver.examconfig.props.label.enableSebBrowser.tooltip=Disable this to start another application in kiosk mode\n(for example a virtual desktop infrastructure client) +sebserver.examconfig.props.label.browserWindowTitleSuffix=Suffix to be added to every browser window + +sebserver.examconfig.props.label.allowDownUploads=Allow downloading and uploading files (Mac) +sebserver.examconfig.props.label.downloadDirectoryWin=Download directory (Win) +sebserver.examconfig.props.label.downloadDirectoryOSX=Download directory (Mac) +sebserver.examconfig.props.label.openDownloads=Open files after downloading (Mac) +sebserver.examconfig.props.label.chooseFileToUploadPolicy=Choose file to upload (Mac) +sebserver.examconfig.props.label.chooseFileToUploadPolicy.0=manually with file requester +sebserver.examconfig.props.label.chooseFileToUploadPolicy.1=by attempting to upload the same file downloaded before +sebserver.examconfig.props.label.chooseFileToUploadPolicy.2=by only allowing to upload the same file downloaded before +sebserver.examconfig.props.label.downloadPDFFiles=Download and open PDF files instead of displaying them inline (Mac) +sebserver.examconfig.props.label.allowPDFPlugIn=Allow using Acrobat Reader PDF plugin (insecure! Mac only) +sebserver.examconfig.props.label.downloadAndOpenSebConfig=Download and open SEB Config Files + +sebserver.examconfig.props.group.quitLink=Link to quit SEB after exam +sebserver.examconfig.props.label.quitURL=Place this quit link to the 'feedback' page displayed after an exam was successfully finished.\nClicking that link will quit SEB without having to enter the quit password. +sebserver.examconfig.props.label.quitURLConfirm=Ask user to confirm quitting + +sebserver.examconfig.props.group.backToStart=Back to Start Button +sebserver.examconfig.props.label.restartExamUseStartURL=Use Start URL +sebserver.examconfig.props.label.restartExamURL=Enter custom URL or select 'Use Start URL' to display a back to start button in the SEB taskbar. +sebserver.examconfig.props.label.restartExamText=Title/tool tip text for the back to start button (leave empty for localized standard text) +sebserver.examconfig.props.label.restartExamPasswordProtected=Protect back to start button with the quit/unlock password sebserver.examconfig.props.validation.password.confirm=Please enter correct confirm password