updated wording as discussed
This commit is contained in:
parent
c9eda69065
commit
c3b767b7a0
4 changed files with 74 additions and 60 deletions
|
@ -13,12 +13,9 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.eclipse.rap.rwt.RWT;
|
||||
import org.eclipse.rap.rwt.client.service.UrlLauncher;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -48,8 +45,6 @@ import ch.ethz.seb.sebserver.gui.service.page.PageService.PageActionBuilder;
|
|||
import ch.ethz.seb.sebserver.gui.service.page.TemplateComposer;
|
||||
import ch.ethz.seb.sebserver.gui.service.page.impl.ModalInputDialog;
|
||||
import ch.ethz.seb.sebserver.gui.service.page.impl.PageAction;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.download.DownloadService;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.download.SEBExamConfigPlaintextDownload;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestService;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetExamConfigMappingNames;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetExamConfigMappingsPage;
|
||||
|
@ -84,7 +79,7 @@ public class SEBExamConfigForm implements TemplateComposer {
|
|||
static final LocTextKey FORM_STATUS_TEXT_KEY =
|
||||
new LocTextKey("sebserver.examconfig.form.status");
|
||||
static final LocTextKey FORM_IMPORT_TEXT_KEY =
|
||||
new LocTextKey("sebserver.examconfig.action.import-config");
|
||||
new LocTextKey("sebserver.examconfig.action.import-settings");
|
||||
static final LocTextKey FORM_IMPORT_SELECT_TEXT_KEY =
|
||||
new LocTextKey("sebserver.examconfig.action.import-file-select");
|
||||
static final LocTextKey FORM_IMPORT_PASSWORD_TEXT_KEY =
|
||||
|
@ -104,25 +99,16 @@ public class SEBExamConfigForm implements TemplateComposer {
|
|||
private final PageService pageService;
|
||||
private final RestService restService;
|
||||
private final SEBExamConfigCreationPopup sebExamConfigCreationPopup;
|
||||
private final SEBExamConfigImportPopup sebExamConfigImportPopup;
|
||||
private final CurrentUser currentUser;
|
||||
private final DownloadService downloadService;
|
||||
private final String downloadFileName;
|
||||
|
||||
protected SEBExamConfigForm(
|
||||
final PageService pageService,
|
||||
final SEBExamConfigCreationPopup sebExamConfigCreationPopup,
|
||||
final SEBExamConfigImportPopup sebExamConfigImportPopup,
|
||||
final DownloadService downloadService,
|
||||
@Value("${sebserver.gui.seb.exam.config.download.filename}") final String downloadFileName) {
|
||||
final SEBExamConfigCreationPopup sebExamConfigCreationPopup) {
|
||||
|
||||
this.pageService = pageService;
|
||||
this.restService = pageService.getRestService();
|
||||
this.sebExamConfigCreationPopup = sebExamConfigCreationPopup;
|
||||
this.sebExamConfigImportPopup = sebExamConfigImportPopup;
|
||||
this.currentUser = pageService.getCurrentUser();
|
||||
this.downloadService = downloadService;
|
||||
this.downloadFileName = downloadFileName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -211,7 +197,6 @@ public class SEBExamConfigForm implements TemplateComposer {
|
|||
? this.restService.getRestCall(NewExamConfig.class)
|
||||
: this.restService.getRestCall(SaveExamConfig.class));
|
||||
|
||||
final UrlLauncher urlLauncher = RWT.getClient().getService(UrlLauncher.class);
|
||||
final PageContext actionContext = formContext.clearEntityKeys();
|
||||
final PageActionBuilder actionBuilder = this.pageService.pageActionBuilder(actionContext);
|
||||
actionBuilder
|
||||
|
@ -245,7 +230,7 @@ public class SEBExamConfigForm implements TemplateComposer {
|
|||
.noEventPropagation()
|
||||
.publishIf(() -> modifyGrant && isReadonly)
|
||||
|
||||
.newAction(ActionDefinition.SEA_EXAM_CONFIG_COPY_CONFIG_AS_TEMPLATE)
|
||||
.newAction(ActionDefinition.SEB_EXAM_CONFIG_COPY_CONFIG_AS_TEMPLATE)
|
||||
.withEntityKey(entityKey)
|
||||
.withExec(this.sebExamConfigCreationPopup.configCreationFunction(
|
||||
pageContext.withAttribute(
|
||||
|
@ -254,30 +239,18 @@ public class SEBExamConfigForm implements TemplateComposer {
|
|||
.noEventPropagation()
|
||||
.publishIf(() -> modifyGrant && isReadonly)
|
||||
|
||||
.newAction(ActionDefinition.SEB_EXAM_CONFIG_EXPORT_PLAIN_XML)
|
||||
.withEntityKey(entityKey)
|
||||
.withExec(action -> {
|
||||
final String downloadURL = this.downloadService.createDownloadURL(
|
||||
entityKey.modelId,
|
||||
SEBExamConfigPlaintextDownload.class,
|
||||
this.downloadFileName);
|
||||
urlLauncher.openURL(downloadURL);
|
||||
return action;
|
||||
})
|
||||
.noEventPropagation()
|
||||
.publishIf(() -> modifyGrant && isReadonly)
|
||||
|
||||
.newAction(ActionDefinition.SEB_EXAM_CONFIG_GET_CONFIG_KEY)
|
||||
.withEntityKey(entityKey)
|
||||
.withExec(SEBExamConfigForm.getConfigKeyFunction(this.pageService))
|
||||
.noEventPropagation()
|
||||
.publishIf(() -> modifyGrant && isReadonly)
|
||||
|
||||
.newAction(ActionDefinition.SEB_EXAM_CONFIG_IMPORT_TO_EXISTING_CONFIG)
|
||||
.withEntityKey(entityKey)
|
||||
.withExec(this.sebExamConfigImportPopup.importFunction(false))
|
||||
.noEventPropagation()
|
||||
.publishIf(() -> modifyGrant && isReadonly && !isAttachedToExam)
|
||||
// // TODO shall this got to settings form?
|
||||
// .newAction(ActionDefinition.SEB_EXAM_CONFIG_IMPORT_TO_EXISTING_CONFIG)
|
||||
// .withEntityKey(entityKey)
|
||||
// .withExec(this.sebExamConfigImportPopup.importFunction(false))
|
||||
// .noEventPropagation()
|
||||
// .publishIf(() -> modifyGrant && isReadonly && !isAttachedToExam)
|
||||
|
||||
.newAction(ActionDefinition.SEB_EXAM_CONFIG_PROP_SAVE)
|
||||
.withEntityKey(entityKey)
|
||||
|
|
|
@ -12,6 +12,8 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.rap.rwt.RWT;
|
||||
import org.eclipse.rap.rwt.client.service.UrlLauncher;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
|
@ -20,6 +22,7 @@ import org.eclipse.swt.widgets.TabFolder;
|
|||
import org.eclipse.swt.widgets.TabItem;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -29,6 +32,7 @@ import ch.ethz.seb.sebserver.gbl.api.APIMessage;
|
|||
import ch.ethz.seb.sebserver.gbl.api.APIMessageError;
|
||||
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||
import ch.ethz.seb.sebserver.gbl.model.EntityKey;
|
||||
import ch.ethz.seb.sebserver.gbl.model.exam.ExamConfigurationMap;
|
||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.Configuration;
|
||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationNode;
|
||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationNode.ConfigurationStatus;
|
||||
|
@ -44,7 +48,10 @@ import ch.ethz.seb.sebserver.gui.service.page.PageContext;
|
|||
import ch.ethz.seb.sebserver.gui.service.page.PageMessageException;
|
||||
import ch.ethz.seb.sebserver.gui.service.page.PageService;
|
||||
import ch.ethz.seb.sebserver.gui.service.page.TemplateComposer;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.download.DownloadService;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.download.SEBExamConfigPlaintextDownload;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestService;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetExamConfigMappingNames;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetConfigurations;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetExamConfigNode;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetSettingsPublished;
|
||||
|
@ -78,20 +85,26 @@ public class SEBSettingsForm implements TemplateComposer {
|
|||
|
||||
private final PageService pageService;
|
||||
private final RestService restService;
|
||||
private final SEBExamConfigCreationPopup sebExamConfigCreationPopup;
|
||||
private final CurrentUser currentUser;
|
||||
private final ExamConfigurationService examConfigurationService;
|
||||
private final SEBExamConfigImportPopup sebExamConfigImportPopup;
|
||||
private final DownloadService downloadService;
|
||||
private final String downloadFileName;
|
||||
|
||||
protected SEBSettingsForm(
|
||||
final PageService pageService,
|
||||
final SEBExamConfigCreationPopup sebExamConfigCreationPopup,
|
||||
final ExamConfigurationService examConfigurationService) {
|
||||
final ExamConfigurationService examConfigurationService,
|
||||
final SEBExamConfigImportPopup sebExamConfigImportPopup,
|
||||
final DownloadService downloadService,
|
||||
@Value("${sebserver.gui.seb.exam.config.download.filename}") final String downloadFileName) {
|
||||
|
||||
this.pageService = pageService;
|
||||
this.restService = pageService.getRestService();
|
||||
this.sebExamConfigCreationPopup = sebExamConfigCreationPopup;
|
||||
this.currentUser = pageService.getCurrentUser();
|
||||
this.examConfigurationService = examConfigurationService;
|
||||
this.sebExamConfigImportPopup = sebExamConfigImportPopup;
|
||||
this.downloadService = downloadService;
|
||||
this.downloadFileName = downloadFileName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -114,6 +127,13 @@ public class SEBSettingsForm implements TemplateComposer {
|
|||
.getOr(false);
|
||||
|
||||
final boolean readonly = pageContext.isReadonly() || configNode.status == ConfigurationStatus.IN_USE;
|
||||
final boolean isAttachedToExam = !readonly && this.restService
|
||||
.getBuilder(GetExamConfigMappingNames.class)
|
||||
.withQueryParam(ExamConfigurationMap.FILTER_ATTR_CONFIG_ID, configNode.getModelId())
|
||||
.call()
|
||||
.map(names -> names != null && !names.isEmpty())
|
||||
.getOr(Boolean.FALSE);
|
||||
|
||||
final Composite warningPanelAnchor = new Composite(pageContext.getParent(), SWT.NONE);
|
||||
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
|
||||
warningPanelAnchor.setLayoutData(gridData);
|
||||
|
@ -185,6 +205,7 @@ public class SEBSettingsForm implements TemplateComposer {
|
|||
|
||||
this.examConfigurationService.initInputFieldValues(configuration.id, viewContexts);
|
||||
|
||||
final UrlLauncher urlLauncher = RWT.getClient().getService(UrlLauncher.class);
|
||||
final GrantCheck examConfigGrant = this.currentUser.grantCheck(EntityType.CONFIGURATION_NODE);
|
||||
this.pageService.pageActionBuilder(pageContext.clearEntityKeys())
|
||||
|
||||
|
@ -218,18 +239,38 @@ public class SEBSettingsForm implements TemplateComposer {
|
|||
.ignoreMoveAwayFromEdit()
|
||||
.publishIf(() -> examConfigGrant.iw() && !readonly)
|
||||
|
||||
.newAction(ActionDefinition.SEA_EXAM_CONFIG_COPY_CONFIG_AS_TEMPLATE)
|
||||
// .newAction(ActionDefinition.SEA_EXAM_CONFIG_COPY_CONFIG_AS_TEMPLATE)
|
||||
// .withEntityKey(entityKey)
|
||||
// .withExec(this.sebExamConfigCreationPopup.configCreationFunction(
|
||||
// pageContext
|
||||
// .withAttribute(
|
||||
// PageContext.AttributeKeys.COPY_AS_TEMPLATE,
|
||||
// Constants.TRUE_STRING)
|
||||
// .withAttribute(
|
||||
// PageContext.AttributeKeys.CREATE_FROM_TEMPLATE,
|
||||
// Constants.FALSE_STRING)))
|
||||
// .noEventPropagation()
|
||||
// .publishIf(examConfigGrant::iw)
|
||||
|
||||
.newAction(ActionDefinition.SEB_EXAM_CONFIG_EXPORT_PLAIN_XML)
|
||||
.withEntityKey(entityKey)
|
||||
.withExec(this.sebExamConfigCreationPopup.configCreationFunction(
|
||||
pageContext
|
||||
.withAttribute(
|
||||
PageContext.AttributeKeys.COPY_AS_TEMPLATE,
|
||||
Constants.TRUE_STRING)
|
||||
.withAttribute(
|
||||
PageContext.AttributeKeys.CREATE_FROM_TEMPLATE,
|
||||
Constants.FALSE_STRING)))
|
||||
.withExec(action -> {
|
||||
final String downloadURL = this.downloadService.createDownloadURL(
|
||||
entityKey.modelId,
|
||||
SEBExamConfigPlaintextDownload.class,
|
||||
this.downloadFileName);
|
||||
urlLauncher.openURL(downloadURL);
|
||||
return action;
|
||||
})
|
||||
.noEventPropagation()
|
||||
.publishIf(examConfigGrant::iw)
|
||||
.publishIf(() -> examConfigGrant.iw() && !readonly)
|
||||
|
||||
// TODO shall this got to settings form?
|
||||
.newAction(ActionDefinition.SEB_EXAM_CONFIG_IMPORT_TO_EXISTING_CONFIG)
|
||||
.withEntityKey(entityKey)
|
||||
.withExec(this.sebExamConfigImportPopup.importFunction(false))
|
||||
.noEventPropagation()
|
||||
.publishIf(() -> examConfigGrant.iw() && !readonly && !isAttachedToExam)
|
||||
|
||||
.newAction(ActionDefinition.SEB_EXAM_CONFIG_VIEW_PROP)
|
||||
.withEntityKey(entityKey)
|
||||
|
|
|
@ -503,7 +503,7 @@ public enum ActionDefinition {
|
|||
ImageIcon.SECURE,
|
||||
ActionCategory.FORM),
|
||||
SEB_EXAM_CONFIG_IMPORT_TO_EXISTING_CONFIG(
|
||||
new LocTextKey("sebserver.examconfig.action.import-config"),
|
||||
new LocTextKey("sebserver.examconfig.action.import-settings"),
|
||||
ImageIcon.IMPORT,
|
||||
ActionCategory.FORM),
|
||||
|
||||
|
@ -511,7 +511,7 @@ public enum ActionDefinition {
|
|||
new LocTextKey("sebserver.examconfig.action.copy"),
|
||||
ImageIcon.COPY,
|
||||
ActionCategory.FORM),
|
||||
SEA_EXAM_CONFIG_COPY_CONFIG_AS_TEMPLATE(
|
||||
SEB_EXAM_CONFIG_COPY_CONFIG_AS_TEMPLATE(
|
||||
new LocTextKey("sebserver.examconfig.action.copy-as-template"),
|
||||
ImageIcon.TEMPLATE,
|
||||
ActionCategory.FORM),
|
||||
|
|
|
@ -444,7 +444,7 @@ sebserver.exam.action.delete=Delete Exam
|
|||
sebserver.exam.action.sebrestriction.enable=Apply SEB Lock
|
||||
sebserver.exam.action.sebrestriction.disable=Release SEB Lock
|
||||
sebserver.exam.action.sebrestriction.details=SEB Restriction Details
|
||||
sebserver.exam.action.createClientToStartExam=Export Exam Connection Config
|
||||
sebserver.exam.action.createClientToStartExam=Export Exam Connection Configuration
|
||||
|
||||
sebserver.exam.info.pleaseSelect=At first please select an Exam from the list
|
||||
|
||||
|
@ -545,11 +545,10 @@ sebserver.exam.configuration.list.pleaseSelect=At first please select an exam co
|
|||
sebserver.exam.configuration.action.noconfig.message=There is currently no exam configuration to select.<br/>Please create one in Exam Configurations
|
||||
|
||||
sebserver.exam.configuration.action.list.new=Add Exam Configuration
|
||||
sebserver.exam.configuration.action.list.modify=Edit Configuration
|
||||
sebserver.exam.configuration.action.list.view=View Configuration
|
||||
sebserver.exam.configuration.action.list.delete=Delete Configuration
|
||||
sebserver.exam.configuration.action.save=Save Configuration
|
||||
sebserver.exam.configuration.action.export-config=Export Configuration
|
||||
sebserver.exam.configuration.action.list.modify=Edit Exam Configuration
|
||||
sebserver.exam.configuration.action.list.view=View Exam Configuration
|
||||
sebserver.exam.configuration.action.list.delete=Remove Exam Configuration
|
||||
sebserver.exam.configuration.action.save=Save Exam Configuration
|
||||
sebserver.exam.configuration.action.get-config-key=Export Config Key
|
||||
|
||||
sebserver.exam.configuration.form.title.new=Add exam configuration mapping
|
||||
|
@ -762,9 +761,10 @@ sebserver.examconfig.action.copy=Copy Exam Configuration
|
|||
sebserver.examconfig.action.copy.dialog=Exam Configuration
|
||||
sebserver.examconfig.action.copy-as-template=Save As Template
|
||||
sebserver.examconfig.action.copy-as-template.dialog=Configuration Template
|
||||
sebserver.examconfig.action.export.plainxml=Export Exam Configuration
|
||||
sebserver.examconfig.action.export.plainxml=Export SEB Settings
|
||||
sebserver.examconfig.action.get-config-key=Export Config Key
|
||||
sebserver.examconfig.action.import-config=Import Exam Configuration
|
||||
sebserver.examconfig.action.import-settings=Import SEB Settings
|
||||
sebserver.examconfig.action.import-file-select=Import From File
|
||||
sebserver.examconfig.action.import-file-password=Password
|
||||
sebserver.examconfig.action.import-config.confirm=Exam Configuration successfully imported
|
||||
|
@ -792,7 +792,7 @@ sebserver.examconfig.status.READY_TO_USE=Ready To Use
|
|||
sebserver.examconfig.status.IN_USE=In Use
|
||||
|
||||
sebserver.examconfig.props.from.unpublished.message=Note: There are unpublished changes to this Settings. Use 'Save/Publish Settings' to make sure the settings are active.
|
||||
sebserver.examconfig.props.from.title=Exam Configuration Settings ({0})
|
||||
sebserver.examconfig.props.from.title=SEB Settings ({0})
|
||||
sebserver.examconfig.props.from.title.subtitle=
|
||||
sebserver.examconfig.props.form.views.general=General
|
||||
sebserver.examconfig.props.form.views.user_interface=User Interface
|
||||
|
|
Loading…
Reference in a new issue