Skip to content
Snippets Groups Projects
Commit 5f837a83 authored by uhensler's avatar uhensler
Browse files

OO-3304: Show the saved analysis presentation name in breadcrumb

parent 14246f16
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,6 @@ package org.olat.modules.quality.analysis; ...@@ -21,7 +21,6 @@ package org.olat.modules.quality.analysis;
import org.olat.core.id.CreateInfo; import org.olat.core.id.CreateInfo;
import org.olat.core.id.ModifiedInfo; import org.olat.core.id.ModifiedInfo;
import org.olat.core.id.OLATResourceable;
import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntry;
/** /**
...@@ -30,9 +29,7 @@ import org.olat.repository.RepositoryEntry; ...@@ -30,9 +29,7 @@ import org.olat.repository.RepositoryEntry;
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
* *
*/ */
public interface AnalysisPresentation extends AnalysisPresentationRef, OLATResourceable, CreateInfo, ModifiedInfo { public interface AnalysisPresentation extends AnalysisPresentationRef, CreateInfo, ModifiedInfo {
public String RESOURCEABLE_TYPE = "presentation";
public String getName(); public String getName();
......
...@@ -21,7 +21,6 @@ package org.olat.modules.quality.analysis; ...@@ -21,7 +21,6 @@ package org.olat.modules.quality.analysis;
import java.util.Date; import java.util.Date;
import org.olat.core.id.OLATResourceable;
import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntry;
/** /**
...@@ -30,10 +29,8 @@ import org.olat.repository.RepositoryEntry; ...@@ -30,10 +29,8 @@ import org.olat.repository.RepositoryEntry;
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
* *
*/ */
public interface EvaluationFormView extends OLATResourceable { public interface EvaluationFormView {
public String RESOURCEABLE_TYPE = "form";
public RepositoryEntry getFormEntry(); public RepositoryEntry getFormEntry();
public Long getNumberDataCollections(); public Long getNumberDataCollections();
......
...@@ -96,16 +96,6 @@ public class AnalysisPresentationImpl implements AnalysisPresentation, Persistab ...@@ -96,16 +96,6 @@ public class AnalysisPresentationImpl implements AnalysisPresentation, Persistab
this.key = key; this.key = key;
} }
@Override
public String getResourceableTypeName() {
return AnalysisPresentation.RESOURCEABLE_TYPE;
}
@Override
public Long getResourceableId() {
return key;
}
@Override @Override
public Date getCreationDate() { public Date getCreationDate() {
return creationDate; return creationDate;
......
...@@ -47,16 +47,6 @@ public class EvaluationFormViewImpl implements EvaluationFormView { ...@@ -47,16 +47,6 @@ public class EvaluationFormViewImpl implements EvaluationFormView {
this.numberParticipationsDone = numberParticipationsDone; this.numberParticipationsDone = numberParticipationsDone;
} }
@Override
public String getResourceableTypeName() {
return EvaluationFormView.RESOURCEABLE_TYPE;
}
@Override
public Long getResourceableId() {
return formEntry.getKey();
}
@Override @Override
public RepositoryEntry getFormEntry() { public RepositoryEntry getFormEntry() {
return formEntry; return formEntry;
......
...@@ -48,9 +48,11 @@ import org.olat.core.gui.control.Controller; ...@@ -48,9 +48,11 @@ import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event; import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.dtabs.Activateable2; import org.olat.core.gui.control.generic.dtabs.Activateable2;
import org.olat.core.id.OLATResourceable;
import org.olat.core.id.Organisation; import org.olat.core.id.Organisation;
import org.olat.core.id.context.ContextEntry; import org.olat.core.id.context.ContextEntry;
import org.olat.core.id.context.StateEntry; import org.olat.core.id.context.StateEntry;
import org.olat.core.util.resource.OresHelper;
import org.olat.modules.quality.QualitySecurityCallback; import org.olat.modules.quality.QualitySecurityCallback;
import org.olat.modules.quality.analysis.AnalysisPresentation; import org.olat.modules.quality.analysis.AnalysisPresentation;
import org.olat.modules.quality.analysis.EvaluationFormView; import org.olat.modules.quality.analysis.EvaluationFormView;
...@@ -67,6 +69,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -67,6 +69,8 @@ import org.springframework.beans.factory.annotation.Autowired;
*/ */
public class AnalysisListController extends FormBasicController implements FlexiTableComponentDelegate, Activateable2 { public class AnalysisListController extends FormBasicController implements FlexiTableComponentDelegate, Activateable2 {
private static final String ORES_TYPE_FORM = "form";
private static final String ORES_TYPE_PRESENTATION = "presentation";
private static final String CMD_OPEN = "open"; private static final String CMD_OPEN = "open";
private static final Comparator<? super EvaluationFormView> CREATED_DESC = private static final Comparator<? super EvaluationFormView> CREATED_DESC =
(f1, f2) -> f2.getLatestDataCollectionFinishedDate().compareTo(f1.getLatestDataCollectionFinishedDate()); (f1, f2) -> f2.getLatestDataCollectionFinishedDate().compareTo(f1.getLatestDataCollectionFinishedDate());
...@@ -80,7 +84,7 @@ public class AnalysisListController extends FormBasicController implements Flexi ...@@ -80,7 +84,7 @@ public class AnalysisListController extends FormBasicController implements Flexi
private final List<Organisation> organisations; private final List<Organisation> organisations;
private int counter = 0; private int counter = 0;
private EvaluationFormView currentFormView; private AnalysisPresentation presentation;
@Autowired @Autowired
private QualityAnalysisService analysisService; private QualityAnalysisService analysisService;
...@@ -97,6 +101,12 @@ public class AnalysisListController extends FormBasicController implements Flexi ...@@ -97,6 +101,12 @@ public class AnalysisListController extends FormBasicController implements Flexi
secCallback.getAnalysisViewRoles()); secCallback.getAnalysisViewRoles());
initForm(ureq); initForm(ureq);
} }
public static OLATResourceable getOlatResourceable(AnalysisPresentation presentation) {
return presentation.getKey() != null
? OresHelper.createOLATResourceableInstance(ORES_TYPE_PRESENTATION, presentation.getKey())
: OresHelper.createOLATResourceableInstance(ORES_TYPE_FORM, presentation.getFormEntry().getKey());
}
@Override @Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
...@@ -173,14 +183,14 @@ public class AnalysisListController extends FormBasicController implements Flexi ...@@ -173,14 +183,14 @@ public class AnalysisListController extends FormBasicController implements Flexi
if(entries == null || entries.isEmpty()) return; if(entries == null || entries.isEmpty()) return;
String type = entries.get(0).getOLATResourceable().getResourceableTypeName(); String type = entries.get(0).getOLATResourceable().getResourceableTypeName();
if (EvaluationFormView.RESOURCEABLE_TYPE.equalsIgnoreCase(type)) { if (ORES_TYPE_FORM.equalsIgnoreCase(type)) {
Long formEntryKey = entries.get(0).getOLATResourceable().getResourceableId(); Long formEntryKey = entries.get(0).getOLATResourceable().getResourceableId();
AnalysisRow row = dataModel.getObjectByFormEntryKey(formEntryKey); AnalysisRow row = dataModel.getObjectByFormEntryKey(formEntryKey);
if (row != null) { if (row != null) {
currentFormView = row; presentation = createPresentation(row);
doOpenAnalysis(ureq); doOpenAnalysis(ureq);
} }
} else if (AnalysisPresentation.RESOURCEABLE_TYPE.equalsIgnoreCase(type)) { } else if (ORES_TYPE_PRESENTATION.equalsIgnoreCase(type)) {
Long presentationKey = entries.get(0).getOLATResourceable().getResourceableId(); Long presentationKey = entries.get(0).getOLATResourceable().getResourceableId();
doOpenPresentation(ureq, presentationKey); doOpenPresentation(ureq, presentationKey);
} }
...@@ -203,40 +213,49 @@ public class AnalysisListController extends FormBasicController implements Flexi ...@@ -203,40 +213,49 @@ public class AnalysisListController extends FormBasicController implements Flexi
if (source == tableEl && event instanceof SelectionEvent) { if (source == tableEl && event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent)event; SelectionEvent se = (SelectionEvent)event;
String cmd = se.getCommand(); String cmd = se.getCommand();
currentFormView = dataModel.getObject(se.getIndex()); AnalysisRow row = dataModel.getObject(se.getIndex());
presentation = createPresentation(row);
if (CMD_OPEN.equals(cmd)) { if (CMD_OPEN.equals(cmd)) {
doOpenAnalysis(ureq); doOpenAnalysis(ureq);
} }
} else if (source instanceof FormLink) { } else if (source instanceof FormLink) {
FormLink link = (FormLink)source; FormLink link = (FormLink)source;
if(CMD_OPEN.equals(link.getCmd())) { if(CMD_OPEN.equals(link.getCmd())) {
currentFormView = (AnalysisRow)link.getUserObject(); AnalysisRow row = (AnalysisRow)link.getUserObject();
presentation = createPresentation(row);
doOpenAnalysis(ureq); doOpenAnalysis(ureq);
} }
} }
super.formInnerEvent(ureq, source, event); super.formInnerEvent(ureq, source, event);
} }
private void doOpenAnalysis(UserRequest ureq) { private AnalysisPresentation createPresentation(EvaluationFormView formView) {
AnalysisPresentation presentation = analysisService.createPresentation(currentFormView.getFormEntry()); return analysisService.createPresentation(formView.getFormEntry());
WindowControl bwControl = addToHistory(ureq, currentFormView, null);
doOpenAnalysis(ureq, bwControl, presentation);
} }
private void doOpenPresentation(UserRequest ureq, Long presentationKey) { private void doOpenPresentation(UserRequest ureq, Long presentationKey) {
AnalysisPresentation presentation = analysisService.loadPresentationByKey(() -> presentationKey); presentation = analysisService.loadPresentationByKey(() -> presentationKey);
WindowControl bwControl = addToHistory(ureq, presentation, null); if (presentation != null) {
doOpenAnalysis(ureq, bwControl, presentation); doOpenAnalysis(ureq);
}
} }
private void doOpenAnalysis(UserRequest ureq, WindowControl wControl, AnalysisPresentation presentation) { private void doOpenAnalysis(UserRequest ureq) {
analysisCtrl = new AnalysisSegmentsController(ureq, wControl, secCallback, stackPanel, presentation); OLATResourceable ores = getOlatResourceable(presentation);
WindowControl bwControl = addToHistory(ureq, ores, null);
analysisCtrl = new AnalysisSegmentsController(ureq, bwControl, secCallback, stackPanel, presentation);
listenTo(analysisCtrl); listenTo(analysisCtrl);
String title = presentation.getFormEntry().getDisplayname(); String title = getBreadcrumbTitle(presentation);
stackPanel.pushController(title, analysisCtrl); stackPanel.pushController(title, analysisCtrl);
analysisCtrl.activate(ureq, null, null); analysisCtrl.activate(ureq, null, null);
} }
private String getBreadcrumbTitle(AnalysisPresentation presentation) {
return presentation.getKey() != null
? presentation.getName()
: presentation.getFormEntry().getDisplayname();
}
@Override @Override
protected void formOK(UserRequest ureq) { protected void formOK(UserRequest ureq) {
......
...@@ -41,16 +41,6 @@ public class AnalysisRow implements EvaluationFormView { ...@@ -41,16 +41,6 @@ public class AnalysisRow implements EvaluationFormView {
this.openLink = openLink; this.openLink = openLink;
} }
@Override
public String getResourceableTypeName() {
return formView.getResourceableTypeName();
}
@Override
public Long getResourceableId() {
return formView.getResourceableId();
}
@Override @Override
public RepositoryEntry getFormEntry() { public RepositoryEntry getFormEntry() {
return formView.getFormEntry(); return formView.getFormEntry();
......
...@@ -234,7 +234,8 @@ public class QualityHomeController extends BasicController implements Activateab ...@@ -234,7 +234,8 @@ public class QualityHomeController extends BasicController implements Activateab
} }
private void doOpenPresentation(UserRequest ureq, AnalysisPresentation presentation) { private void doOpenPresentation(UserRequest ureq, AnalysisPresentation presentation) {
ContextEntry contextEntry = BusinessControlFactory.getInstance().createContextEntry(presentation); OLATResourceable ores = AnalysisListController.getOlatResourceable(presentation);
ContextEntry contextEntry = BusinessControlFactory.getInstance().createContextEntry(ores);
List<ContextEntry> entries = Collections.singletonList(contextEntry); List<ContextEntry> entries = Collections.singletonList(contextEntry);
doOpenAnalysis(ureq, entries); doOpenAnalysis(ureq, entries);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment