From af2cfb6a61bfa0fcaa81b1b42f3c7c952163bb9c Mon Sep 17 00:00:00 2001 From: uhensler <urs.hensler@frentix.com> Date: Tue, 7 Aug 2018 14:30:38 +0200 Subject: [PATCH] OO-3304: Quality management splash page --- .../ExecutorParticipationsListController.java | 15 +- .../quality/ui/QualityHomeController.java | 174 ++++++++++++++++++ .../quality/ui/QualityMainController.java | 103 +++-------- .../modules/quality/ui/_content/home.html | 21 +++ .../modules/quality/ui/_content/main.html | 7 - .../ui/_i18n/LocalStrings_de.properties | 11 +- .../ui/_i18n/LocalStrings_en.properties | 11 +- 7 files changed, 245 insertions(+), 97 deletions(-) create mode 100644 src/main/java/org/olat/modules/quality/ui/QualityHomeController.java create mode 100644 src/main/java/org/olat/modules/quality/ui/_content/home.html delete mode 100644 src/main/java/org/olat/modules/quality/ui/_content/main.html diff --git a/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java b/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java index ae4f852738c..965bec14d84 100644 --- a/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java +++ b/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java @@ -40,6 +40,7 @@ import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTable import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory; import org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent; import org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer; +import org.olat.core.gui.components.stack.TooledStackedPanel; import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; @@ -75,11 +76,13 @@ public class ExecutorParticipationsListController extends FormBasicController im private ExecutionController executionCtrl; private LayoutMain3ColsBackController fullLayoutCtrl; + private final TooledStackedPanel stackPanel; private final QualitySecurityCallback secCallback; public ExecutorParticipationsListController(UserRequest ureq, WindowControl wControl, - QualitySecurityCallback secCallback) { + TooledStackedPanel stackPanel, QualitySecurityCallback secCallback) { super(ureq, wControl, LAYOUT_BAREBONE); + this.stackPanel = stackPanel; this.secCallback = secCallback; initForm(ureq); } @@ -87,7 +90,8 @@ public class ExecutorParticipationsListController extends FormBasicController im @Override protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel(); - columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ExecutorParticipationCols.executionStatus, new QualityExecutionParticipationStatusRenderer())); + columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ExecutorParticipationCols.executionStatus, + new QualityExecutionParticipationStatusRenderer())); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ExecutorParticipationCols.start)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ExecutorParticipationCols.deadline)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ExecutorParticipationCols.title)); @@ -198,12 +202,7 @@ public class ExecutorParticipationsListController extends FormBasicController im WindowControl bwControl = addToHistory(ureq, ores, null); executionCtrl = new ExecutionController(ureq, bwControl, participation); listenTo(executionCtrl); - - fullLayoutCtrl = new LayoutMain3ColsBackController(ureq, getWindowControl(), null, - executionCtrl.getInitialComponent(), null); - fullLayoutCtrl.addDisposableChildController(executionCtrl); - fullLayoutCtrl.activate(); - listenTo(fullLayoutCtrl); + stackPanel.pushController(participation.getTitle(), executionCtrl); } @Override diff --git a/src/main/java/org/olat/modules/quality/ui/QualityHomeController.java b/src/main/java/org/olat/modules/quality/ui/QualityHomeController.java new file mode 100644 index 00000000000..7e0d42571f2 --- /dev/null +++ b/src/main/java/org/olat/modules/quality/ui/QualityHomeController.java @@ -0,0 +1,174 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.modules.quality.ui; + +import java.util.ArrayList; +import java.util.List; + +import org.olat.core.gui.UserRequest; +import org.olat.core.gui.components.Component; +import org.olat.core.gui.components.link.Link; +import org.olat.core.gui.components.link.LinkFactory; +import org.olat.core.gui.components.stack.TooledStackedPanel; +import org.olat.core.gui.components.velocity.VelocityContainer; +import org.olat.core.gui.control.Event; +import org.olat.core.gui.control.WindowControl; +import org.olat.core.gui.control.controller.BasicController; +import org.olat.core.gui.control.generic.dtabs.Activateable2; +import org.olat.core.id.OLATResourceable; +import org.olat.core.id.context.ContextEntry; +import org.olat.core.id.context.StateEntry; +import org.olat.core.util.resource.OresHelper; +import org.olat.modules.quality.QualitySecurityCallback; + +/** + * + * Initial date: 07.08.2018<br> + * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com + * + */ +public class QualityHomeController extends BasicController implements Activateable2{ + + private static final String ORES_MY_TYPE = "my"; + private static final String ORES_DATA_COLLECTIONS_TYPE = "datacollections"; + + private final VelocityContainer mainVC; + private Link dataCollectionLink; + private Link executorParticipationLink; + + private final TooledStackedPanel stackPanel; + private DataCollectionListController dataCollectionListCtrl; + private ExecutorParticipationsListController executorParticipationListCtrl; + + private final QualitySecurityCallback secCallback; + + public QualityHomeController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, QualitySecurityCallback secCallback) { + super(ureq, wControl); + this.stackPanel = stackPanel; + this.stackPanel.setToolbarAutoEnabled(true); + this.secCallback = secCallback; + + mainVC = createVelocityContainer("home"); + + List<PanelWrapper> wrappers = new ArrayList<>(6); + executorParticipationLink = LinkFactory.createLink("goto.executor.participation.link", mainVC, this); + executorParticipationLink.setIconRightCSS("o_icon o_icon_start"); + wrappers.add(new PanelWrapper(translate("goto.executor.participation.title"), + translate("goto.executor.participation.help"), executorParticipationLink)); + + if (secCallback.canViewDataCollections()) { + dataCollectionLink = LinkFactory.createLink("goto.data.collection.link", mainVC, this); + dataCollectionLink.setIconRightCSS("o_icon o_icon_start"); + wrappers.add(new PanelWrapper(translate("goto.data.collection.title"), + translate("goto.data.collection.help"), dataCollectionLink)); + } + + mainVC.contextPut("panels", wrappers); + + putInitialPanel(mainVC); + } + + @Override + public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) { + if (entries == null || entries.isEmpty()) { + if (canOnlyExecute()) { + doOpenUserParticipations(ureq); + } + return; + } + + OLATResourceable resource = entries.get(0).getOLATResourceable(); + if (ORES_MY_TYPE.equalsIgnoreCase(resource.getResourceableTypeName())) { + doOpenUserParticipations(ureq); + List<ContextEntry> subEntries = entries.subList(1, entries.size()); + executorParticipationListCtrl.activate(ureq, subEntries, entries.get(0).getTransientState()); + } else if (ORES_DATA_COLLECTIONS_TYPE.equalsIgnoreCase(resource.getResourceableTypeName())) { + if (secCallback.canViewDataCollections()) { + doOpenDataCollection(ureq); + List<ContextEntry> subEntries = entries.subList(1, entries.size()); + dataCollectionListCtrl.activate(ureq, subEntries, entries.get(0).getTransientState()); + } else { + doOpenUserParticipations(ureq); + } + } else if (canOnlyExecute()) { + doOpenUserParticipations(ureq); + } + } + + private boolean canOnlyExecute() { + return !secCallback.canViewDataCollections(); + } + + @Override + protected void event(UserRequest ureq, Component source, Event event) { + if (executorParticipationLink == source) { + doOpenUserParticipations(ureq); + } else if (dataCollectionLink == source) { + doOpenDataCollection(ureq); + } + } + + private void doOpenUserParticipations(UserRequest ureq) { + OLATResourceable ores = OresHelper.createOLATResourceableInstance(ORES_MY_TYPE, 0l); + WindowControl bwControl = addToHistory(ureq, ores, null); + executorParticipationListCtrl = new ExecutorParticipationsListController(ureq, bwControl, stackPanel, secCallback); + listenTo(executorParticipationListCtrl); + stackPanel.pushController(translate("breadcrumb.executor.participations"), executorParticipationListCtrl); + } + + private void doOpenDataCollection(UserRequest ureq) { + OLATResourceable ores = OresHelper.createOLATResourceableInstance(ORES_DATA_COLLECTIONS_TYPE, 0l); + WindowControl bwControl = addToHistory(ureq, ores, null); + dataCollectionListCtrl = new DataCollectionListController(ureq, bwControl, stackPanel, secCallback); + listenTo(dataCollectionListCtrl); + stackPanel.pushController(translate("breadcrumb.data.collections"), dataCollectionListCtrl); + } + + @Override + protected void doDispose() { + // + } + + public static class PanelWrapper { + + private final String title; + private final String helpText; + private final Component link; + + public PanelWrapper(String title, String helpText, Component link) { + this.title = title; + this.helpText = helpText; + this.link = link; + } + + public String getTitle() { + return title; + } + + public String getHelpText() { + return helpText; + } + + public Component getLink() { + return link; + } + + } +} diff --git a/src/main/java/org/olat/modules/quality/ui/QualityMainController.java b/src/main/java/org/olat/modules/quality/ui/QualityMainController.java index 8a9ba413635..0968026b8cf 100644 --- a/src/main/java/org/olat/modules/quality/ui/QualityMainController.java +++ b/src/main/java/org/olat/modules/quality/ui/QualityMainController.java @@ -23,13 +23,7 @@ import java.util.List; import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.Component; -import org.olat.core.gui.components.link.Link; -import org.olat.core.gui.components.link.LinkFactory; -import org.olat.core.gui.components.segmentedview.SegmentViewComponent; -import org.olat.core.gui.components.segmentedview.SegmentViewEvent; -import org.olat.core.gui.components.segmentedview.SegmentViewFactory; import org.olat.core.gui.components.stack.TooledStackedPanel; -import org.olat.core.gui.components.velocity.VelocityContainer; import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.controller.MainLayoutBasicController; @@ -48,93 +42,46 @@ import org.olat.modules.quality.QualitySecurityCallback; */ public class QualityMainController extends MainLayoutBasicController implements Activateable2 { - private static final String ORES_MY_TYPE = "my"; - private static final String ORES_DATA_COLLECTIONS_TYPE = "datacollections"; - private static final String SEGMENTS_CMP = "segmentCmp"; + private static final String ORES_TYPE_QUALITY = "quality"; - private final VelocityContainer mainVC; - private final SegmentViewComponent segmentView; - private Link dataCollectionLink; - private Link executorParticipationLink; - - private TooledStackedPanel stackPanel; - private DataCollectionListController dataCollectionListCtrl; - private ExecutorParticipationsListController executorParticipationListCtrl; - - private final QualitySecurityCallback secCallback; + private final TooledStackedPanel stackPanel; + private final QualityHomeController homeCtrl; public QualityMainController(UserRequest ureq, WindowControl wControl) { super(ureq, wControl); - this.secCallback = new QualitySecurityCallbackImpl(ureq.getUserSession().getRoles()); - - mainVC = createVelocityContainer("main"); + QualitySecurityCallback secCallback = new QualitySecurityCallbackImpl(ureq.getUserSession().getRoles()); - segmentView = SegmentViewFactory.createSegmentView("segments", mainVC, this); - executorParticipationLink = LinkFactory.createLink("segments.executor.participation", mainVC, this); - segmentView.addSegment(executorParticipationLink, true); - if (secCallback.canViewDataCollections()) { - dataCollectionLink = LinkFactory.createLink("segments.data.collection", mainVC, this); - segmentView.addSegment(dataCollectionLink, false); - } - - doOpenUserParticipations(ureq); + stackPanel = new TooledStackedPanel("qualitiy.management", getTranslator(), this); + stackPanel.setToolbarAutoEnabled(true); + stackPanel.setShowCloseLink(true, false); + stackPanel.setInvisibleCrumb(0); + putInitialPanel(stackPanel); - putInitialPanel(mainVC); + OLATResourceable ores = OresHelper.createOLATResourceableInstance(ORES_TYPE_QUALITY, 0l); + WindowControl swControl = addToHistory(ureq, ores, null, getWindowControl(), true); + homeCtrl = new QualityHomeController(ureq, swControl, stackPanel, secCallback); + listenTo(homeCtrl); + stackPanel.pushController(translate("breadcrumb.root"), homeCtrl); + stackPanel.setCssClass("o_qual_main"); } - + @Override public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) { - if (entries == null || entries.isEmpty()) return; - - OLATResourceable resource = entries.get(0).getOLATResourceable(); - if (ORES_MY_TYPE.equalsIgnoreCase(resource.getResourceableTypeName())) { - doOpenUserParticipations(ureq); - segmentView.select(executorParticipationLink); - List<ContextEntry> subEntries = entries.subList(1, entries.size()); - executorParticipationListCtrl.activate(ureq, subEntries, entries.get(0).getTransientState()); - } else if (ORES_DATA_COLLECTIONS_TYPE.equalsIgnoreCase(resource.getResourceableTypeName())) { - if (secCallback.canViewDataCollections()) { - doOpenDataCollection(ureq); - segmentView.select(dataCollectionLink); - List<ContextEntry> subEntries = entries.subList(1, entries.size()); - dataCollectionListCtrl.activate(ureq, subEntries, entries.get(0).getTransientState()); - } else { - doOpenUserParticipations(ureq); - segmentView.select(executorParticipationLink); + if (entries != null && entries.size() > 0) { + String resName = entries.get(0).getOLATResourceable().getResourceableTypeName(); + if (ORES_TYPE_QUALITY.equalsIgnoreCase(resName)) { + entries = entries.subList(1, entries.size()); } } + + if (homeCtrl != null) { + homeCtrl.activate(ureq, entries, state); + } } @Override protected void event(UserRequest ureq, Component source, Event event) { - if(source == segmentView && event instanceof SegmentViewEvent) { - SegmentViewEvent sve = (SegmentViewEvent) event; - String segmentCName = sve.getComponentName(); - Component clickedLink = mainVC.getComponent(segmentCName); - if (clickedLink == executorParticipationLink) { - doOpenUserParticipations(ureq); - } else if (clickedLink == dataCollectionLink) { - doOpenDataCollection(ureq); - } - } - } - - private void doOpenUserParticipations(UserRequest ureq) { - OLATResourceable ores = OresHelper.createOLATResourceableInstance(ORES_MY_TYPE, 0l); - WindowControl bwControl = addToHistory(ureq, ores, null); - executorParticipationListCtrl = new ExecutorParticipationsListController(ureq, bwControl, secCallback); - mainVC.put(SEGMENTS_CMP, executorParticipationListCtrl.getInitialComponent()); - } - - private void doOpenDataCollection(UserRequest ureq) { - stackPanel = new TooledStackedPanel("qualitiy.management", getTranslator(), this); - stackPanel.setInvisibleCrumb(0); - OLATResourceable ores = OresHelper.createOLATResourceableInstance(ORES_DATA_COLLECTIONS_TYPE, 0l); - WindowControl bwControl = addToHistory(ureq, ores, null); - dataCollectionListCtrl = new DataCollectionListController(ureq, bwControl, stackPanel, secCallback); - listenTo(dataCollectionListCtrl); - stackPanel.pushController(translate("data.collections"), dataCollectionListCtrl); - mainVC.put(SEGMENTS_CMP, stackPanel); + // } @Override diff --git a/src/main/java/org/olat/modules/quality/ui/_content/home.html b/src/main/java/org/olat/modules/quality/ui/_content/home.html new file mode 100644 index 00000000000..bba22fcbb2e --- /dev/null +++ b/src/main/java/org/olat/modules/quality/ui/_content/home.html @@ -0,0 +1,21 @@ +<div class="o_qual_main clearfix"> + #foreach($panel in $panels) + #if($index % 2 == 1)<div class="row">#end + <div class="col-sm-6"> + <div class="panel panel-default"> + <div class="panel-heading"> + <h4 class="panel-title"> + $panel.title + </h4> + </div> + <div class="panel-body"> + $panel.helpText + <div class="o_button_group o_button_group_right"> + $r.render($panel.link) + </div> + </div> + </div> + </div> + #if($index % 2 == 1 || $index == $panels.size())</div>#end + #end +</div> \ No newline at end of file diff --git a/src/main/java/org/olat/modules/quality/ui/_content/main.html b/src/main/java/org/olat/modules/quality/ui/_content/main.html deleted file mode 100644 index 3e1cf5e9003..00000000000 --- a/src/main/java/org/olat/modules/quality/ui/_content/main.html +++ /dev/null @@ -1,7 +0,0 @@ -<div class="o_qual_main clearfix"> - $r.render("segments")<br/> - - #if($r.available("segmentCmp")) - $r.render("segmentCmp") - #end -</div> \ No newline at end of file diff --git a/src/main/java/org/olat/modules/quality/ui/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/modules/quality/ui/_i18n/LocalStrings_de.properties index 0065f6622db..7325822df72 100644 --- a/src/main/java/org/olat/modules/quality/ui/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/modules/quality/ui/_i18n/LocalStrings_de.properties @@ -2,6 +2,9 @@ admin.config.title=Einstellungen Qualit\u00e4tsmanagement admin.enabled=Qualit\u00e4tsmanagement admin.menu.title.alt=$\:admin.menu.title admin.menu.title=Qualit\u00e4tsmanagement +breadcrumb.data.collections=$\:goto.data.collection.title +breadcrumb.executor.participations=$\:goto.executor.participation.title +breadcrumb.root=Qualit\u00e4tsmanagement data.collection.configuration=Konfiguration data.collection.create=Datenerhebung erstellen data.collection.deadline=Bis @@ -82,6 +85,12 @@ executor.participation.title=$:\data.collection.title executor.participation.topic.title=Beurteilungsgsgenstand executor.participation.topic.type=$:\data.collection.topic.type executor.participation.topic=$:\data.collection.topic +goto.data.collection.help=Erstellen und bearbeiten Sie einzelne Datenerhebungen +goto.data.collection.link=Datenerhebungen \u00F6ffnen +goto.data.collection.title=Datenerhebungen +goto.executor.participation.help=Beantworten Sie Ihre offenen Umfragen +goto.executor.participation.link=Meine Umfragen \u00F6ffnen +goto.executor.participation.title=Meine Umfragen participation.curriculum.element=Curriculum element participation.email=Email participation.firstname=Vorname @@ -128,7 +137,5 @@ reminder.reminder1.subject=$title: $topictype $topic reminder.reminder2.body=Liebe Teilnehmerin<br/>Lieber Teilnehmer<br/><br/>Wir haben Sie am <b>$invitation</b> h\u00f6flich eingeladen, an der an Sie versandten Befragung teilzunehmen. Leider sind Ihre Antworten bis dato nicht bei uns eingegangen. Bitte nehmen Sie sich umgehende die Zeit und f\u00fcllen den Fragebogen aus. Sie helfen uns mit Ihrer R\u00fcckmeldung, dass wir unser Angebot als Bildungseinrichtung stetig verbessern k\u00f6nnen. Mit einem Klick auf den nachfolgenden Link gelangen Sie bequem zur betreffenden Umfrage: $url.<br/><br/>Die Umfrage endet am <b>$deadline</b>. Nach diesem Zeitpunkt kann nicht mehr an der Befragung teilgenommen werden.<br/><br/>Besten Dank\!<br/><br/>Freundliche Gr\u00f6sse<br/>Ihr QM Officer reminder.reminder2.date=Versanddatum Erinnerung 2 reminder.reminder2.subject=$title: $topictype $topic -segments.data.collection=Datenerhebung -segments.executor.participation=Meine Umfragen site.title.alt=Qualit\u00e4tsmanagement site.title=Qualit\u00e4tsmanagement \ No newline at end of file diff --git a/src/main/java/org/olat/modules/quality/ui/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/modules/quality/ui/_i18n/LocalStrings_en.properties index 88c0bb0455e..a691c2905b3 100644 --- a/src/main/java/org/olat/modules/quality/ui/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/modules/quality/ui/_i18n/LocalStrings_en.properties @@ -2,6 +2,9 @@ admin.config.title=Configuration quality management admin.enabled=Quality management admin.menu.title.alt=$\:admin.menu.title admin.menu.title=Quality management +breadcrumb.data.collections=$\:goto.data.collections.title +breadcrumb.executor.participations=$\:goto.executor.participation.title +breadcrumb.root=Quality management data.collection.configuration=Configuration data.collection.create=Create data collection data.collection.deadline=To @@ -81,6 +84,12 @@ executor.participation.title=$:\data.collection.title executor.participation.topic.title=Topic executor.participation.topic.type=$:\data.collection.topic.type executor.participation.topic=$:\data.collection.topic +goto.data.collection.help=Create and edit individual data collections. +goto.data.collection.link=Go to data collections +goto.data.collection.title=Data collections +goto.executor.participation.help=Fill out your pending surveys +goto.executor.participation.link=Go to my surveys +goto.executor.participation.title=My surveys participation.curriculum.element=Curriculumelement participation.email=E-mail participation.firstname=First name @@ -128,7 +137,5 @@ reminder.reminder1.subject=$title: $topictype $topic reminder.reminder2.body=Dear participant<br/><br/>We have politely invited you to participate in the survey sent to you <b>$invitation</b>. Unfortunately, we have not received your answers to date. Please take the time to complete the questionnaire as soon as possible. With your answers you will help us to continuously improve our offer as an educational institution. By clicking on the link below, you can easily reach the relevant survey: $url.<br/><br/>The survey ends on <b>$deadline</b>. It is not possible to take part in the survey after this date.<br/><br/>Tank you\!<br/><br/>Kind regards<br/>Your QM officer reminder.reminder2.date=Delivery date reminder 2 reminder.reminder2.subject=$title: $topictype $topic -segments.data.collection=Data collection -segments.executor.participation=My surveys site.title.alt=Quality management site.title=Quality management \ No newline at end of file -- GitLab