SEBSERV-133 simplify exam delete

This commit is contained in:
anhefti 2020-07-22 16:12:18 +02:00
parent 6255a6bf38
commit d85fd1b1d7
2 changed files with 9 additions and 33 deletions

View file

@ -73,8 +73,6 @@ public class ExamDeletePopup {
private final static LocTextKey ACTION_DELETE = private final static LocTextKey ACTION_DELETE =
new LocTextKey("sebserver.exam.delete.action.delete"); new LocTextKey("sebserver.exam.delete.action.delete");
private final static LocTextKey ACTION_REPORT =
new LocTextKey("sebserver.exam.delete.action.report");
private final static LocTextKey DELETE_CONFIRM_TITLE = private final static LocTextKey DELETE_CONFIRM_TITLE =
new LocTextKey("sebserver.exam.delete.confirm.title"); new LocTextKey("sebserver.exam.delete.confirm.title");
@ -95,29 +93,18 @@ public class ExamDeletePopup {
.setVeryLargeDialogWidth(); .setVeryLargeDialogWidth();
final String page1Id = "DELETE_PAGE"; final String page1Id = "DELETE_PAGE";
final String page2Id = "REPORT_PAGE";
final Predicate<PageContext> callback = pc -> doDelete(this.pageService, pc); final Predicate<PageContext> callback = pc -> doDelete(this.pageService, pc);
final BiFunction<PageContext, Composite, Supplier<PageContext>> composePage1 = final BiFunction<PageContext, Composite, Supplier<PageContext>> composePage1 =
(prefPageContext, content) -> composeDeleteDialog(content, (prefPageContext, content) -> composeDeleteDialog(content,
(prefPageContext != null) ? prefPageContext : pageContext); (prefPageContext != null) ? prefPageContext : pageContext);
final BiFunction<PageContext, Composite, Supplier<PageContext>> composePage2 =
(prefPageContext, content) -> composeReportDialog(content,
(prefPageContext != null) ? prefPageContext : pageContext);
final WizardPage<PageContext> page1 = new WizardPage<>( final WizardPage<PageContext> page1 = new WizardPage<>(
page1Id, page1Id,
true, true,
composePage1, composePage1,
new WizardAction<>(ACTION_DELETE, callback),
new WizardAction<>(ACTION_REPORT, page2Id));
final WizardPage<PageContext> page2 = new WizardPage<>(
page2Id,
false,
composePage2,
new WizardAction<>(ACTION_DELETE, callback)); new WizardAction<>(ACTION_DELETE, callback));
wizard.open(FORM_TITLE, Utils.EMPTY_EXECUTION, page1, page2); wizard.open(FORM_TITLE, Utils.EMPTY_EXECUTION, page1);
return action; return action;
}; };
@ -172,6 +159,7 @@ public class ExamDeletePopup {
final Composite parent, final Composite parent,
final PageContext pageContext) { final PageContext pageContext) {
final I18nSupport i18nSupport = this.pageService.getI18nSupport();
final Composite grid = this.pageService.getWidgetFactory() final Composite grid = this.pageService.getWidgetFactory()
.createPopupScrollComposite(parent); .createPopupScrollComposite(parent);
@ -182,23 +170,12 @@ public class ExamDeletePopup {
gridData.verticalIndent = 10; gridData.verticalIndent = 10;
title.setLayoutData(gridData); title.setLayoutData(gridData);
return () -> pageContext; final Label titleReport = this.pageService.getWidgetFactory()
}
private Supplier<PageContext> composeReportDialog(
final Composite parent,
final PageContext pageContext) {
final Composite grid = this.pageService.getWidgetFactory()
.createPopupScrollCompositeFilled(parent);
final I18nSupport i18nSupport = this.pageService.getI18nSupport();
final Label title = this.pageService.getWidgetFactory()
.labelLocalized(grid, CustomVariant.TEXT_H3, FORM_REPORT_INFO); .labelLocalized(grid, CustomVariant.TEXT_H3, FORM_REPORT_INFO);
final GridData gridData = new GridData(); final GridData gridDataReport = new GridData();
gridData.horizontalIndent = 10; gridDataReport.horizontalIndent = 10;
gridData.verticalIndent = 10; gridDataReport.verticalIndent = 10;
title.setLayoutData(gridData); titleReport.setLayoutData(gridDataReport);
try { try {

View file

@ -610,13 +610,12 @@ sebserver.exam.indicator.thresholds.list.add=Add a new threshold
sebserver.exam.indicator.thresholds.list.remove=Delete this threshold sebserver.exam.indicator.thresholds.list.remove=Delete this threshold
sebserver.exam.delete.form.title=Delete Exam sebserver.exam.delete.form.title=Delete Exam
sebserver.exam.delete.form.info=Please Note:<br/>&nbsp;&nbsp;&nbsp;&nbsp;This deletes the exam and local import of a course or quiz in SEB Server<br/>&nbsp;&nbsp;&nbsp;&nbsp;This will not delete any course or quiz on a Learning Management System (LMS).<br/>&nbsp;&nbsp;&nbsp;&nbsp;Dependencies of the exam like indicators or SEB client connections will also be deleted.<br/>&nbsp;&nbsp;&nbsp;&nbsp;Please use the "Show Report" action below to see a report of all objects that will be<br/>&nbsp;&nbsp;&nbsp;&nbsp;deleted and check them carefully. sebserver.exam.delete.form.info=Please Note:<br/>&nbsp;&nbsp;&nbsp;&nbsp;This deletes the exam and local import of a course or quiz in SEB Server<br/>&nbsp;&nbsp;&nbsp;&nbsp;This will not delete any course or quiz on a Learning Management System (LMS).
sebserver.exam.delete.report.info=The following objects will be deleted within this exam deletion.<br/>Please check them carefully before delete. sebserver.exam.delete.report.info=The following dependencies will be deleted within this exam deletion.<br/>Please check them carefully before delete.
sebserver.exam.delete.report.list.type=Type sebserver.exam.delete.report.list.type=Type
sebserver.exam.delete.report.list.name=Name sebserver.exam.delete.report.list.name=Name
sebserver.exam.delete.report.list.description=Description sebserver.exam.delete.report.list.description=Description
sebserver.exam.delete.action.delete=Delete Exam sebserver.exam.delete.action.delete=Delete Exam
sebserver.exam.delete.action.report=Show Report
sebserver.exam.delete.confirm.title==Deletion Successful sebserver.exam.delete.confirm.title==Deletion Successful
sebserver.exam.delete.confirm.message=The Exam ({0}) was successfully deleted.<br/>Also the following number dependencies where successfully deleted: {1}.<br/><br/>And there where {2} errors. sebserver.exam.delete.confirm.message=The Exam ({0}) was successfully deleted.<br/>Also the following number dependencies where successfully deleted: {1}.<br/><br/>And there where {2} errors.
sebserver.exam.delete.report.list.empty=No dependencies will be deleted. sebserver.exam.delete.report.list.empty=No dependencies will be deleted.