diff --git a/src/main/java/org/olat/modules/curriculum/CurriculumRepositoryEntryRelation.java b/src/main/java/org/olat/modules/curriculum/CurriculumRepositoryEntryRelation.java index 4695a97fd2b352618e00f2c7ff07f72ec9017973..c57779bed167432b8f29b3b635b9c15148de9118 100644 --- a/src/main/java/org/olat/modules/curriculum/CurriculumRepositoryEntryRelation.java +++ b/src/main/java/org/olat/modules/curriculum/CurriculumRepositoryEntryRelation.java @@ -1,3 +1,22 @@ +/** + * <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.curriculum; import org.olat.core.id.CreateInfo; diff --git a/src/main/java/org/olat/modules/curriculum/CurriculumRoles.java b/src/main/java/org/olat/modules/curriculum/CurriculumRoles.java index 44a81c9ff215bde1b4a39902e19d37094b77853e..6dca311f822bd75660d682e12f30b32521c58bda 100644 --- a/src/main/java/org/olat/modules/curriculum/CurriculumRoles.java +++ b/src/main/java/org/olat/modules/curriculum/CurriculumRoles.java @@ -1,3 +1,22 @@ +/** + * <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.curriculum; /** diff --git a/src/main/java/org/olat/modules/curriculum/CurriculumService.java b/src/main/java/org/olat/modules/curriculum/CurriculumService.java index a71b1cd7d6eae74c8f7a375efe89e1da25706211..2dfda1670b11220a2a7d3a32a32a504051829987 100644 --- a/src/main/java/org/olat/modules/curriculum/CurriculumService.java +++ b/src/main/java/org/olat/modules/curriculum/CurriculumService.java @@ -81,6 +81,7 @@ public interface CurriculumService { public CurriculumElement createCurriculumElement(String identifier, String displayName, Date beginDate, Date endDate, CurriculumElementRef parent, CurriculumElementType elementType, Curriculum curriculum); + public CurriculumElement getCurriculumElement(CurriculumElementRef element); /** @@ -89,7 +90,7 @@ public interface CurriculumService { * @param curriculum The curriculum * @return A list of curriculum elements */ - public List<CurriculumElement> getCurriculumElements(CurriculumRef element); + public List<CurriculumElement> getCurriculumElements(CurriculumRef curriculum); /** * Return the parent line of the specified curriculum element. diff --git a/src/main/java/org/olat/modules/curriculum/manager/CurriculumRepositoryEntryRelationDAO.java b/src/main/java/org/olat/modules/curriculum/manager/CurriculumRepositoryEntryRelationDAO.java index d273298b7bb2fa292f1497a82d6f0c7a1987ff94..1a26bf705c846a5e7adb973967c8735066f8e886 100644 --- a/src/main/java/org/olat/modules/curriculum/manager/CurriculumRepositoryEntryRelationDAO.java +++ b/src/main/java/org/olat/modules/curriculum/manager/CurriculumRepositoryEntryRelationDAO.java @@ -1,3 +1,22 @@ +/** + * <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.curriculum.manager; import java.util.Date; diff --git a/src/main/java/org/olat/modules/curriculum/model/CurriculumElementMember.java b/src/main/java/org/olat/modules/curriculum/model/CurriculumElementMember.java index d2966ab870158a4237b18ce591025be7eb912ae5..9e06c012391bad4954269358c7b02430737e79a8 100644 --- a/src/main/java/org/olat/modules/curriculum/model/CurriculumElementMember.java +++ b/src/main/java/org/olat/modules/curriculum/model/CurriculumElementMember.java @@ -1,3 +1,22 @@ +/** + * <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.curriculum.model; import org.olat.basesecurity.GroupMembershipInheritance; diff --git a/src/main/java/org/olat/modules/curriculum/model/CurriculumElementTypeRefImpl.java b/src/main/java/org/olat/modules/curriculum/model/CurriculumElementTypeRefImpl.java index 938b890f2eafa3ff6da390940aca8e5cc2d5a3af..c4d89670246bb8c25bdac63545ce7e9db698e377 100644 --- a/src/main/java/org/olat/modules/curriculum/model/CurriculumElementTypeRefImpl.java +++ b/src/main/java/org/olat/modules/curriculum/model/CurriculumElementTypeRefImpl.java @@ -1,3 +1,22 @@ +/** + * <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.curriculum.model; import org.olat.modules.curriculum.CurriculumElementTypeRef; diff --git a/src/main/java/org/olat/modules/curriculum/model/CurriculumRepositoryEntryRelationImpl.java b/src/main/java/org/olat/modules/curriculum/model/CurriculumRepositoryEntryRelationImpl.java index 24120f45380f00f073f51839d8e3b174df21c9f4..271482c1b89c83716d29f967a4aeb39fe4a86b09 100644 --- a/src/main/java/org/olat/modules/curriculum/model/CurriculumRepositoryEntryRelationImpl.java +++ b/src/main/java/org/olat/modules/curriculum/model/CurriculumRepositoryEntryRelationImpl.java @@ -1,3 +1,22 @@ +/** + * <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.curriculum.model; import java.util.Date; diff --git a/src/main/java/org/olat/modules/curriculum/ui/CurriculumElementDataModel.java b/src/main/java/org/olat/modules/curriculum/ui/CurriculumElementDataModel.java new file mode 100644 index 0000000000000000000000000000000000000000..b3491c2251fb35c5785847aeebf56b333cadfca0 --- /dev/null +++ b/src/main/java/org/olat/modules/curriculum/ui/CurriculumElementDataModel.java @@ -0,0 +1,93 @@ +/** + * <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.curriculum.ui; + +import org.olat.core.commons.persistence.SortKey; +import org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableDataModel; +import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiSortableColumnDef; +import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel; +import org.olat.core.gui.components.form.flexible.impl.elements.table.SortableFlexiTableDataModel; + +/** + * + * Initial date: 11 mai 2018<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class CurriculumElementDataModel extends DefaultFlexiTableDataModel<CurriculumElementRow> +implements SortableFlexiTableDataModel<CurriculumElementRow> { + + public CurriculumElementDataModel(FlexiTableColumnModel columnsModel) { + super(columnsModel); + } + + @Override + public void sort(SortKey sortKey) { + // + } + + @Override + public Object getValueAt(int row, int col) { + CurriculumElementRow curriculum = getObject(row); + return getValueAt(curriculum, col); + } + + @Override + public Object getValueAt(CurriculumElementRow row, int col) { + switch(ElementCols.values()[col]) { + case key: return row.getKey(); + case displayName: return row.getDisplayName(); + case identifier: return row.getIdentifier(); + default: return "ERROR"; + } + } + + @Override + public CurriculumElementDataModel createCopyWithEmptyList() { + return new CurriculumElementDataModel(getTableColumnModel()); + } + + public enum ElementCols implements FlexiSortableColumnDef { + key("table.header.key"), + displayName("table.header.displayName"), + identifier("table.header.identifier"); + + private final String i18nHeaderKey; + + private ElementCols(String i18nHeaderKey) { + this.i18nHeaderKey = i18nHeaderKey; + } + + @Override + public boolean sortable() { + return true; + } + + @Override + public String sortKey() { + return name(); + } + + @Override + public String i18nHeaderKey() { + return i18nHeaderKey; + } + } +} diff --git a/src/main/java/org/olat/modules/curriculum/ui/CurriculumElementListController.java b/src/main/java/org/olat/modules/curriculum/ui/CurriculumElementListController.java new file mode 100644 index 0000000000000000000000000000000000000000..277b1dfd014d086822bc4c40a791147601609835 --- /dev/null +++ b/src/main/java/org/olat/modules/curriculum/ui/CurriculumElementListController.java @@ -0,0 +1,99 @@ +/** + * <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.curriculum.ui; + +import java.util.List; +import java.util.stream.Collectors; + +import org.olat.core.gui.UserRequest; +import org.olat.core.gui.components.form.flexible.FormItemContainer; +import org.olat.core.gui.components.form.flexible.elements.FlexiTableElement; +import org.olat.core.gui.components.form.flexible.impl.FormBasicController; +import org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel; +import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel; +import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory; +import org.olat.core.gui.control.Controller; +import org.olat.core.gui.control.WindowControl; +import org.olat.modules.curriculum.CurriculumElement; +import org.olat.modules.curriculum.CurriculumRef; +import org.olat.modules.curriculum.CurriculumService; +import org.olat.modules.curriculum.ui.CurriculumElementDataModel.ElementCols; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * + * Initial date: 11 mai 2018<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class CurriculumElementListController extends FormBasicController { + + private FlexiTableElement tableEl; + private CurriculumElementDataModel tableModel; + + private final CurriculumRef curriculum; + + @Autowired + private CurriculumService curriculumService; + + public CurriculumElementListController(UserRequest ureq, WindowControl wControl, CurriculumRef curriculum) { + super(ureq, wControl, "curriculum_element_list"); + this.curriculum = curriculum; + + initForm(ureq); + loadModel(); + } + + @Override + protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { + FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel(); + columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ElementCols.key)); + columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ElementCols.displayName, "select")); + columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ElementCols.identifier, "select")); + + tableModel = new CurriculumElementDataModel(columnsModel); + tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout); + tableEl.setCustomizeColumns(true); + tableEl.setEmtpyTableMessageKey("table.curriculum.empty"); + tableEl.setAndLoadPersistedPreferences(ureq, "cur-curriculum-manage"); + } + + private void loadModel() { + List<CurriculumElement> elements = curriculumService.getCurriculumElements(curriculum); + List<CurriculumElementRow> rows = elements.stream() + .map(element -> new CurriculumElementRow(element, null)) + .collect(Collectors.toList()); + tableModel.setObjects(rows); + tableEl.reset(true, true, true); + } + + @Override + protected void doDispose() { + // + } + + @Override + protected void formOK(UserRequest ureq) { + // + } + + + +} diff --git a/src/main/java/org/olat/modules/curriculum/ui/CurriculumElementUserRow.java b/src/main/java/org/olat/modules/curriculum/ui/CurriculumElementUserRow.java index fd35efde886a8d1fd56e80ccd99da950d3cdb6f6..4be34ce2d7f0395be39877427d64acf12d659b25 100644 --- a/src/main/java/org/olat/modules/curriculum/ui/CurriculumElementUserRow.java +++ b/src/main/java/org/olat/modules/curriculum/ui/CurriculumElementUserRow.java @@ -1,3 +1,22 @@ +/** + * <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.curriculum.ui; import java.util.List; diff --git a/src/main/java/org/olat/modules/curriculum/ui/CurriculumListController.java b/src/main/java/org/olat/modules/curriculum/ui/CurriculumListController.java new file mode 100644 index 0000000000000000000000000000000000000000..768448fa0ae26a3ec232fd985e7cfd5f965b493c --- /dev/null +++ b/src/main/java/org/olat/modules/curriculum/ui/CurriculumListController.java @@ -0,0 +1,137 @@ +/** + * <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.curriculum.ui; + +import java.util.List; +import java.util.stream.Collectors; + +import org.olat.core.gui.UserRequest; +import org.olat.core.gui.components.form.flexible.FormItem; +import org.olat.core.gui.components.form.flexible.FormItemContainer; +import org.olat.core.gui.components.form.flexible.elements.FlexiTableElement; +import org.olat.core.gui.components.form.flexible.impl.FormBasicController; +import org.olat.core.gui.components.form.flexible.impl.FormEvent; +import org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel; +import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel; +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.stack.BreadcrumbedStackedPanel; +import org.olat.core.gui.control.Controller; +import org.olat.core.gui.control.WindowControl; +import org.olat.core.gui.control.generic.dtabs.Activateable2; +import org.olat.core.id.context.ContextEntry; +import org.olat.core.id.context.StateEntry; +import org.olat.modules.curriculum.Curriculum; +import org.olat.modules.curriculum.CurriculumService; +import org.olat.modules.curriculum.model.CurriculumSearchParameters; +import org.olat.modules.curriculum.ui.CurriculumManagerDataModel.CurriculumCols; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * + * Initial date: 11 mai 2018<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class CurriculumListController extends FormBasicController implements Activateable2 { + + private FlexiTableElement tableEl; + private CurriculumManagerDataModel tableModel; + + private final BreadcrumbedStackedPanel stackPanel; + + private CurriculumElementListController elementlistCtrl; + + @Autowired + private CurriculumService curriculumService; + + public CurriculumListController(UserRequest ureq, WindowControl wControl, BreadcrumbedStackedPanel stackPanel) { + super(ureq, wControl, "curriculum_list"); + this.stackPanel = stackPanel; + + initForm(ureq); + loadModel(); + } + + @Override + protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { + FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel(); + columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, CurriculumCols.key)); + columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CurriculumCols.displayName, "select")); + columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CurriculumCols.identifier, "select")); + DefaultFlexiColumnModel toolsCol = new DefaultFlexiColumnModel(CurriculumCols.tools); + toolsCol.setExportable(false); + toolsCol.setAlwaysVisible(true); + columnsModel.addFlexiColumnModel(toolsCol); + + tableModel = new CurriculumManagerDataModel(columnsModel); + tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout); + tableEl.setCustomizeColumns(true); + tableEl.setEmtpyTableMessageKey("table.curriculum.empty"); + tableEl.setAndLoadPersistedPreferences(ureq, "cur-curriculum-list"); + } + + private void loadModel() { + CurriculumSearchParameters params = new CurriculumSearchParameters(); + List<Curriculum> curriculums = curriculumService.getCurriculums(params); + List<CurriculumRow> rows = curriculums.stream() + .map(curriculum -> new CurriculumRow(curriculum, null)).collect(Collectors.toList()); + tableModel.setObjects(rows); + tableEl.reset(false, false, true); + } + + @Override + protected void doDispose() { + // + } + + + @Override + public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) { + // + } + + @Override + protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) { + if(tableEl == source) { + if(event instanceof SelectionEvent) { + SelectionEvent se = (SelectionEvent)event; + String cmd = se.getCommand(); + if("select".equals(cmd)) { + CurriculumRow row = tableModel.getObject(se.getIndex()); + doSelectCurriculum(ureq, row); + } + } + } + super.formInnerEvent(ureq, source, event); + } + + @Override + protected void formOK(UserRequest ureq) { + // + } + + private void doSelectCurriculum(UserRequest ureq, CurriculumRow row) { + elementlistCtrl = new CurriculumElementListController(ureq, getWindowControl(), row); + listenTo(elementlistCtrl); + stackPanel.pushController(row.getDisplayName(), elementlistCtrl); + } + +} diff --git a/src/main/java/org/olat/modules/curriculum/ui/_content/curriculum_element_list.html b/src/main/java/org/olat/modules/curriculum/ui/_content/curriculum_element_list.html new file mode 100644 index 0000000000000000000000000000000000000000..bade9402acda206e8171adcb2d85adb1b884ea54 --- /dev/null +++ b/src/main/java/org/olat/modules/curriculum/ui/_content/curriculum_element_list.html @@ -0,0 +1 @@ +$r.render("table") \ No newline at end of file diff --git a/src/main/java/org/olat/modules/curriculum/ui/_content/curriculum_list.html b/src/main/java/org/olat/modules/curriculum/ui/_content/curriculum_list.html new file mode 100644 index 0000000000000000000000000000000000000000..bade9402acda206e8171adcb2d85adb1b884ea54 --- /dev/null +++ b/src/main/java/org/olat/modules/curriculum/ui/_content/curriculum_list.html @@ -0,0 +1 @@ +$r.render("table") \ No newline at end of file diff --git a/src/main/java/org/olat/modules/curriculum/ui/event/RoleEvent.java b/src/main/java/org/olat/modules/curriculum/ui/event/RoleEvent.java index c829ee9ece07c2f96c9b47e69670b0d3b96f1d1e..a49496dad4d3b7603819e79901a29cfa2c3855cd 100644 --- a/src/main/java/org/olat/modules/curriculum/ui/event/RoleEvent.java +++ b/src/main/java/org/olat/modules/curriculum/ui/event/RoleEvent.java @@ -1,3 +1,22 @@ +/** + * <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.curriculum.ui.event; import org.olat.core.gui.control.Event; diff --git a/src/main/java/org/olat/repository/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/repository/_i18n/LocalStrings_de.properties index 1687c66c590ad11ca9db3662598de92471a73897..bef52bf7f0c8374f14ef0cdfab4df80817cd9b40 100644 --- a/src/main/java/org/olat/repository/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/repository/_i18n/LocalStrings_de.properties @@ -473,6 +473,7 @@ search.course=Kurse search.courses.closed=Beendet search.courses.student=Suchen search.cp=CP-Lerninhalte +search.curriculums=Curriculum search.deleted=Gel\u00F6scht search.filter.showAll=alle anzeigen search.filter.type=Typ diff --git a/src/main/java/org/olat/repository/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/repository/_i18n/LocalStrings_en.properties index 845b579b01c117e49f49b9eb3a421dc8c83b744d..528ce6ff4805706a745abdfb7f4cf20da5d1c240 100644 --- a/src/main/java/org/olat/repository/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/repository/_i18n/LocalStrings_en.properties @@ -470,6 +470,7 @@ search.course=Courses search.courses.closed=Finished search.courses.student=Search search.cp=CP learning content +search.curriculums=Curriculum search.deleted=Deleted search.filter.showAll=Show all search.filter.type=Type diff --git a/src/main/java/org/olat/repository/ui/RepositoryFlexiTableModel.java b/src/main/java/org/olat/repository/ui/RepositoryFlexiTableModel.java index f945ff4c00c5776e978916cd518b65676a783008..3c89ac7ab9daca1cde49e1081319d35821b376c7 100644 --- a/src/main/java/org/olat/repository/ui/RepositoryFlexiTableModel.java +++ b/src/main/java/org/olat/repository/ui/RepositoryFlexiTableModel.java @@ -1,3 +1,22 @@ +/** + * <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.repository.ui; import java.util.Collections; diff --git a/src/main/java/org/olat/repository/ui/list/OverviewRepositoryListController.java b/src/main/java/org/olat/repository/ui/list/OverviewRepositoryListController.java index aec47125eb9ccb9df598e1a561af364b1a3fbb17..8380e5882b140e4b611694b103c06d078351a5fa 100644 --- a/src/main/java/org/olat/repository/ui/list/OverviewRepositoryListController.java +++ b/src/main/java/org/olat/repository/ui/list/OverviewRepositoryListController.java @@ -45,6 +45,8 @@ import org.olat.core.util.Util; import org.olat.core.util.event.EventBus; import org.olat.core.util.event.GenericEventListener; import org.olat.core.util.resource.OresHelper; +import org.olat.modules.curriculum.CurriculumModule; +import org.olat.modules.curriculum.ui.CurriculumListController; import org.olat.repository.CatalogEntry; import org.olat.repository.RepositoryManager; import org.olat.repository.RepositoryModule; @@ -68,7 +70,11 @@ public class OverviewRepositoryListController extends BasicController implements private final VelocityContainer mainVC; private final SegmentViewComponent segmentView; private final Link myCourseLink; - private Link favoriteLink, catalogLink, searchCourseLink, closedCourseLink; + private Link favoriteLink; + private Link catalogLink; + private Link searchCourseLink; + private Link closedCourseLink; + private Link curriculumLink; private Controller currentCtrl; private RepositoryEntryListController markedCtrl; @@ -77,6 +83,8 @@ public class OverviewRepositoryListController extends BasicController implements private BreadcrumbedStackedPanel myCoursesStackPanel; private CatalogNodeController catalogCtrl; private BreadcrumbedStackedPanel catalogStackPanel; + private CurriculumListController curriculumListCtrl; + private BreadcrumbedStackedPanel curriculumStackPanel; private RepositoryEntryListController searchCoursesCtrl; private RepositoryEntryListController closedCoursesCtrl; private BreadcrumbedStackedPanel searchCoursesStackPanel; @@ -90,6 +98,8 @@ public class OverviewRepositoryListController extends BasicController implements private CatalogManager catalogManager; @Autowired private RepositoryModule repositoryModule; + @Autowired + private CurriculumModule curriculumModule; public OverviewRepositoryListController(UserRequest ureq, WindowControl wControl) { super(ureq, wControl); @@ -117,6 +127,12 @@ public class OverviewRepositoryListController extends BasicController implements closedCourseLink.setElementCssClass("o_sel_mycourses_closed"); segmentView.addSegment(closedCourseLink, false); + if(curriculumModule.isEnabled() && curriculumModule.isCurriculumInMyCourses()) { + curriculumLink = LinkFactory.createLink("search.curriculums", mainVC, this); + curriculumLink.setElementCssClass("o_sel_mycurriculums"); + segmentView.addSegment(curriculumLink, false); + } + if(repositoryModule.isCatalogEnabled() && repositoryModule.isCatalogBrowsingEnabled()) { catalogLink = LinkFactory.createLink("search.catalog", mainVC, this); catalogLink.setElementCssClass("o_sel_mycourses_catlog"); @@ -181,6 +197,12 @@ public class OverviewRepositoryListController extends BasicController implements ctrl.activate(ureq, entries, entry.getTransientState()); segmentView.select(catalogLink); } + } else if("Curriculum".equalsIgnoreCase(segment)) { + CurriculumListController ctrl = doOpenCurriculum(ureq); + if(ctrl != null) { + ctrl.activate(ureq, subEntries, entry.getTransientState()); + segmentView.select(curriculumLink); + } } else if("Search".equalsIgnoreCase(segment) && searchCourseLink != null) { doOpenSearchCourses(ureq).activate(ureq, subEntries, entry.getTransientState()); segmentView.select(searchCourseLink); @@ -231,6 +253,8 @@ public class OverviewRepositoryListController extends BasicController implements doOpenMyCourses(ureq); } else if (clickedLink == catalogLink) { doOpenCatalog(ureq); + } else if (clickedLink == curriculumLink) { + doOpenCurriculum(ureq); } else if(clickedLink == searchCourseLink) { doOpenSearchCourses(ureq); } else if(clickedLink == closedCourseLink) { @@ -304,7 +328,7 @@ public class OverviewRepositoryListController extends BasicController implements List<CatalogEntry> entries = catalogManager.getRootCatalogEntries(); CatalogEntry rootEntry = null; - if(entries.size() > 0) { + if(!entries.isEmpty()) { rootEntry = entries.get(0); } @@ -322,6 +346,28 @@ public class OverviewRepositoryListController extends BasicController implements return catalogCtrl; } + private CurriculumListController doOpenCurriculum(UserRequest ureq) { + if(!curriculumModule.isEnabled() || !curriculumModule.isCurriculumInMyCourses()) { + return null; + } + cleanUp(); + + + OLATResourceable ores = OresHelper.createOLATResourceableInstance("Curriculum", 0l); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); + curriculumStackPanel = new BreadcrumbedStackedPanel("curriculumstack", getTranslator(), this); + curriculumListCtrl = new CurriculumListController(ureq, bwControl, curriculumStackPanel); + curriculumStackPanel.pushController(translate("search.curriculums"), curriculumListCtrl); + listenTo(curriculumListCtrl); + currentCtrl = curriculumListCtrl; + + addToHistory(ureq, curriculumListCtrl); + mainVC.put("segmentCmp", curriculumStackPanel); + return curriculumListCtrl; + } + + private RepositoryEntryListController doOpenSearchCourses(UserRequest ureq) { cleanUp(); diff --git a/src/test/java/org/olat/modules/curriculum/manager/CurriculumRepositoryEntryRelationDAOTest.java b/src/test/java/org/olat/modules/curriculum/manager/CurriculumRepositoryEntryRelationDAOTest.java index 91a92fa0179ec5ee6577de9051ff615bd7ef8174..2bbd97a47b5653eef9c26a8576bb63b207cbac16 100644 --- a/src/test/java/org/olat/modules/curriculum/manager/CurriculumRepositoryEntryRelationDAOTest.java +++ b/src/test/java/org/olat/modules/curriculum/manager/CurriculumRepositoryEntryRelationDAOTest.java @@ -1,3 +1,22 @@ +/** + * <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.curriculum.manager; import java.util.List;