Skip to content
Snippets Groups Projects
Commit fb9bc390 authored by srosse's avatar srosse
Browse files

OO-2636: add managed flags

parent 5115d16d
No related branches found
No related tags found
No related merge requests found
Showing
with 127 additions and 14 deletions
...@@ -27,6 +27,9 @@ managed.flags.course.settings=Einstellungen ...@@ -27,6 +27,9 @@ managed.flags.course.settings=Einstellungen
managed.flags.course.access=Einstellung f\u00fcr Zugriff managed.flags.course.access=Einstellung f\u00fcr Zugriff
managed.flags.course.chat=Einstellung f\u00fcr Chat managed.flags.course.chat=Einstellung f\u00fcr Chat
managed.flags.course.layout=Einstellung f\u00fcr Layout managed.flags.course.layout=Einstellung f\u00fcr Layout
managed.flags.course.lecture=Lektionen
managed.flags.course.lecturemanagement=Lektionen verwalten
managed.flags.course.lectureconfig=Lektionen un Absenzen in Kurs konfigurieren
managed.flags.course.resourcefolder=Einstellung f\u00fcr Ressourcenordner managed.flags.course.resourcefolder=Einstellung f\u00fcr Ressourcenordner
managed.flags.course.efficencystatement=Einstellung f\u00fcr Leistungsnachweis managed.flags.course.efficencystatement=Einstellung f\u00fcr Leistungsnachweis
managed.flags.course.calendar=Einstellung f\u00fcr Kalender managed.flags.course.calendar=Einstellung f\u00fcr Kalender
......
...@@ -23,6 +23,9 @@ managed.flags.course.efficencystatement=Efficiency statement settings ...@@ -23,6 +23,9 @@ managed.flags.course.efficencystatement=Efficiency statement settings
managed.flags.course.glossary=Glossary settings managed.flags.course.glossary=Glossary settings
managed.flags.course.groups=Group management managed.flags.course.groups=Group management
managed.flags.course.layout=Layout settings managed.flags.course.layout=Layout settings
managed.flags.course.lecture=Lectures
managed.flags.course.lecturemanagement=Lectures management
managed.flags.course.lectureconfig=Configuration of lectures and absences in the course
managed.flags.course.membersmanagement=Members management managed.flags.course.membersmanagement=Members management
managed.flags.course.resourcefolder=Resource folder configuration managed.flags.course.resourcefolder=Resource folder configuration
managed.flags.course.settings=Settings managed.flags.course.settings=Settings
......
...@@ -55,6 +55,15 @@ public interface LectureService { ...@@ -55,6 +55,15 @@ public interface LectureService {
*/ */
public RepositoryEntryLectureConfiguration updateRepositoryEntryLectureConfiguration(RepositoryEntryLectureConfiguration config); public RepositoryEntryLectureConfiguration updateRepositoryEntryLectureConfiguration(RepositoryEntryLectureConfiguration config);
/**
* Clone the configuration of the source if it's available.
*
* @param sourceEntry The source of the clonage
* @param targetEntry The target of the clonage
* @return A cloned configuration if the source has one, or null
*/
public RepositoryEntryLectureConfiguration copyRepositoryEntryLectureConfiguration(RepositoryEntry sourceEntry, RepositoryEntry targetEntry);
/** /**
* Create but not persist a new lecture block. * Create but not persist a new lecture block.
* *
......
...@@ -123,6 +123,15 @@ public class LectureServiceImpl implements LectureService { ...@@ -123,6 +123,15 @@ public class LectureServiceImpl implements LectureService {
} }
return config; return config;
} }
@Override
public RepositoryEntryLectureConfiguration copyRepositoryEntryLectureConfiguration(RepositoryEntry sourceEntry, RepositoryEntry targetEntry) {
RepositoryEntryLectureConfiguration config = lectureConfigurationDao.getConfiguration(sourceEntry);
if(config != null) {
config = lectureConfigurationDao.cloneConfiguration(config, targetEntry);
}
return config;
}
@Override @Override
public RepositoryEntryLectureConfiguration updateRepositoryEntryLectureConfiguration(RepositoryEntryLectureConfiguration config) { public RepositoryEntryLectureConfiguration updateRepositoryEntryLectureConfiguration(RepositoryEntryLectureConfiguration config) {
......
...@@ -52,6 +52,22 @@ public class RepositoryEntryLectureConfigurationDAO { ...@@ -52,6 +52,22 @@ public class RepositoryEntryLectureConfigurationDAO {
return config; return config;
} }
public RepositoryEntryLectureConfiguration cloneConfiguration(RepositoryEntryLectureConfiguration sourceConfig, RepositoryEntry entry) {
RepositoryEntryLectureConfigurationImpl config = new RepositoryEntryLectureConfigurationImpl();
config.setCreationDate(new Date());
config.setLastModified(config.getCreationDate());
config.setLectureEnabled(sourceConfig.isLectureEnabled());
config.setOverrideModuleDefault(sourceConfig.isOverrideModuleDefault());
config.setCalculateAttendanceRate(sourceConfig.getCalculateAttendanceRate());
config.setRequiredAttendanceRate(sourceConfig.getRequiredAttendanceRate());
config.setParticipantCalendarSyncEnabled(sourceConfig.getParticipantCalendarSyncEnabled());
config.setTeacherCalendarSyncEnabled(sourceConfig.getTeacherCalendarSyncEnabled());
config.setRollCallEnabled(sourceConfig.getRollCallEnabled());
config.setEntry(entry);
dbInstance.getCurrentEntityManager().persist(config);
return config;
}
public RepositoryEntryLectureConfiguration getConfiguration(RepositoryEntryRef entry) { public RepositoryEntryLectureConfiguration getConfiguration(RepositoryEntryRef entry) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("select config from lectureentryconfig config") sb.append("select config from lectureentryconfig config")
......
...@@ -24,6 +24,7 @@ import java.util.Calendar; ...@@ -24,6 +24,7 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.olat.admin.restapi.RestapiAdminController;
import org.olat.basesecurity.BaseSecurity; import org.olat.basesecurity.BaseSecurity;
import org.olat.basesecurity.Group; import org.olat.basesecurity.Group;
import org.olat.basesecurity.GroupRoles; import org.olat.basesecurity.GroupRoles;
...@@ -38,8 +39,10 @@ import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer; ...@@ -38,8 +39,10 @@ import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer;
import org.olat.core.gui.control.Controller; 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.translator.Translator;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
import org.olat.core.util.Util;
import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroup;
import org.olat.group.BusinessGroupOrder; import org.olat.group.BusinessGroupOrder;
import org.olat.group.BusinessGroupService; import org.olat.group.BusinessGroupService;
...@@ -47,6 +50,7 @@ import org.olat.group.model.SearchBusinessGroupParams; ...@@ -47,6 +50,7 @@ import org.olat.group.model.SearchBusinessGroupParams;
import org.olat.modules.lecture.LectureBlock; import org.olat.modules.lecture.LectureBlock;
import org.olat.modules.lecture.LectureService; import org.olat.modules.lecture.LectureService;
import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntry;
import org.olat.repository.RepositoryEntryManagedFlag;
import org.olat.repository.RepositoryService; import org.olat.repository.RepositoryService;
import org.olat.user.UserManager; import org.olat.user.UserManager;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -77,6 +81,7 @@ public class EditLectureController extends FormBasicController { ...@@ -77,6 +81,7 @@ public class EditLectureController extends FormBasicController {
private List<Identity> teachers; private List<Identity> teachers;
private List<GroupBox> groupBox; private List<GroupBox> groupBox;
private String[] teacherKeys, teacherValues; private String[] teacherKeys, teacherValues;
private final boolean lectureManagementManaged;
@Autowired @Autowired
private UserManager userManager; private UserManager userManager;
...@@ -88,7 +93,6 @@ public class EditLectureController extends FormBasicController { ...@@ -88,7 +93,6 @@ public class EditLectureController extends FormBasicController {
private RepositoryService repositoryService; private RepositoryService repositoryService;
@Autowired @Autowired
private BusinessGroupService businessGroupService; private BusinessGroupService businessGroupService;
public EditLectureController(UserRequest ureq, WindowControl wControl, RepositoryEntry entry) { public EditLectureController(UserRequest ureq, WindowControl wControl, RepositoryEntry entry) {
this(ureq, wControl, entry, null); this(ureq, wControl, entry, null);
...@@ -98,6 +102,8 @@ public class EditLectureController extends FormBasicController { ...@@ -98,6 +102,8 @@ public class EditLectureController extends FormBasicController {
super(ureq, wControl); super(ureq, wControl);
this.entry = entry; this.entry = entry;
this.lectureBlock = lectureBlock; this.lectureBlock = lectureBlock;
lectureManagementManaged = RepositoryEntryManagedFlag.isManaged(entry, RepositoryEntryManagedFlag.lecturemanagement);
if(lectureBlock != null && lectureBlock.getKey() != null) { if(lectureBlock != null && lectureBlock.getKey() != null) {
teachers = lectureService.getTeachers(lectureBlock); teachers = lectureService.getTeachers(lectureBlock);
} }
...@@ -107,11 +113,35 @@ public class EditLectureController extends FormBasicController { ...@@ -107,11 +113,35 @@ public class EditLectureController extends FormBasicController {
@Override @Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if(lectureManagementManaged) {
String flags = entry.getManagedFlagsString() == null ? "" : entry.getManagedFlagsString().trim();
String flagsFormatted = null;
if (flags.length() > 0) {
// use translator from REST admin package to import managed flags context help strings
Translator managedTrans = Util.createPackageTranslator(RestapiAdminController.class, ureq.getLocale());
StringBuilder flagList = new StringBuilder();
flagList.append("<ul>");
for (String flag : flags.split(",")) {
flagList.append("<li>");
flagList.append(managedTrans.translate("managed.flags.course." + flag));
flagList.append("</li>");
}
flagList.append("</ul>");
flagsFormatted = flagList.toString();
} else {
flagsFormatted = flags;
}
setFormWarning("form.managedflags.intro", new String[]{ flagsFormatted });
}
String title = lectureBlock == null ? null : lectureBlock.getTitle(); String title = lectureBlock == null ? null : lectureBlock.getTitle();
titleEl = uifactory.addTextElement("title", "lecture.title", 128, title, formLayout); titleEl = uifactory.addTextElement("title", "lecture.title", 128, title, formLayout);
titleEl.setEnabled(!lectureManagementManaged);
plannedLecturesEl = uifactory.addDropdownSingleselect("planned.lectures", "planned.lectures", formLayout, plannedLecturesEl = uifactory.addDropdownSingleselect("planned.lectures", "planned.lectures", formLayout,
plannedLecturesKeys, plannedLecturesKeys, null); plannedLecturesKeys, plannedLecturesKeys, null);
plannedLecturesEl.setEnabled(!lectureManagementManaged);
String plannedlectures = lectureBlock == null ? "4" : Integer.toString(lectureBlock.getPlannedLecturesNumber()); String plannedlectures = lectureBlock == null ? "4" : Integer.toString(lectureBlock.getPlannedLecturesNumber());
for(String plannedLecturesKey:plannedLecturesKeys) { for(String plannedLecturesKey:plannedLecturesKeys) {
if(plannedlectures.equals(plannedLecturesKey)) { if(plannedlectures.equals(plannedLecturesKey)) {
...@@ -128,6 +158,7 @@ public class EditLectureController extends FormBasicController { ...@@ -128,6 +158,7 @@ public class EditLectureController extends FormBasicController {
teacherValues[i] = userManager.getUserDisplayName(coaches.get(i)); teacherValues[i] = userManager.getUserDisplayName(coaches.get(i));
} }
teacherEl = uifactory.addDropdownSingleselect("teacher", "lecture.teacher", formLayout, teacherKeys, teacherValues, null); teacherEl = uifactory.addDropdownSingleselect("teacher", "lecture.teacher", formLayout, teacherKeys, teacherValues, null);
teacherEl.setEnabled(!lectureManagementManaged);
if(teachers != null && teachers.size() > 0) { if(teachers != null && teachers.size() > 0) {
String currentTeacherKey = teachers.get(0).getKey().toString(); String currentTeacherKey = teachers.get(0).getKey().toString();
for(String teacherKey:teacherKeys) { for(String teacherKey:teacherKeys) {
...@@ -152,6 +183,7 @@ public class EditLectureController extends FormBasicController { ...@@ -152,6 +183,7 @@ public class EditLectureController extends FormBasicController {
groupValues[i] = groupBox.get(i).getName(); groupValues[i] = groupBox.get(i).getName();
} }
groupsEl = uifactory.addCheckboxesVertical("lecture.groups", "lecture.groups", formLayout, groupKeys, groupValues, 2); groupsEl = uifactory.addCheckboxesVertical("lecture.groups", "lecture.groups", formLayout, groupKeys, groupValues, 2);
groupsEl.setEnabled(!lectureManagementManaged);
if(lectureBlock != null) { if(lectureBlock != null) {
List<Group> selectedGroups = lectureService.getLectureBlockToGroups(lectureBlock); List<Group> selectedGroups = lectureService.getLectureBlockToGroups(lectureBlock);
for(int i=0; i<groupBox.size(); i++) { for(int i=0; i<groupBox.size(); i++) {
...@@ -163,13 +195,17 @@ public class EditLectureController extends FormBasicController { ...@@ -163,13 +195,17 @@ public class EditLectureController extends FormBasicController {
String description = lectureBlock == null ? "" : lectureBlock.getDescription(); String description = lectureBlock == null ? "" : lectureBlock.getDescription();
descriptionEl = uifactory.addTextAreaElement("lecture.descr", 4, 72, description, formLayout); descriptionEl = uifactory.addTextAreaElement("lecture.descr", 4, 72, description, formLayout);
descriptionEl.setEnabled(!lectureManagementManaged);
String preparation = lectureBlock == null ? "" : lectureBlock.getPreparation(); String preparation = lectureBlock == null ? "" : lectureBlock.getPreparation();
preparationEl = uifactory.addTextAreaElement("lecture.preparation", 4, 72, preparation, formLayout); preparationEl = uifactory.addTextAreaElement("lecture.preparation", 4, 72, preparation, formLayout);
preparationEl.setEnabled(!lectureManagementManaged);
String location = lectureBlock == null ? "" : lectureBlock.getLocation(); String location = lectureBlock == null ? "" : lectureBlock.getLocation();
locationEl = uifactory.addTextElement("location", "lecture.location", 128, location, formLayout); locationEl = uifactory.addTextElement("location", "lecture.location", 128, location, formLayout);
locationEl.setEnabled(!lectureManagementManaged);
Date startDate = lectureBlock == null ? null : lectureBlock.getStartDate(); Date startDate = lectureBlock == null ? null : lectureBlock.getStartDate();
startDateEl = uifactory.addDateChooser("lecture.start", startDate, formLayout); startDateEl = uifactory.addDateChooser("lecture.start", startDate, formLayout);
startDateEl.setEnabled(!lectureManagementManaged);
startDateEl.setDomReplacementWrapperRequired(false); startDateEl.setDomReplacementWrapperRequired(false);
startDateEl.setDateChooserTimeEnabled(true); startDateEl.setDateChooserTimeEnabled(true);
...@@ -179,9 +215,11 @@ public class EditLectureController extends FormBasicController { ...@@ -179,9 +215,11 @@ public class EditLectureController extends FormBasicController {
formLayout.add(dateCont); formLayout.add(dateCont);
endHourEl = uifactory.addTextElement("lecture.end.hour", null, 2, "", dateCont); endHourEl = uifactory.addTextElement("lecture.end.hour", null, 2, "", dateCont);
endHourEl.setEnabled(!lectureManagementManaged);
endHourEl.setDomReplacementWrapperRequired(false); endHourEl.setDomReplacementWrapperRequired(false);
endHourEl.setDisplaySize(2); endHourEl.setDisplaySize(2);
endMinuteEl = uifactory.addTextElement("lecture.end.minute", null, 2, "", dateCont); endMinuteEl = uifactory.addTextElement("lecture.end.minute", null, 2, "", dateCont);
endMinuteEl.setEnabled(!lectureManagementManaged);
endMinuteEl.setDomReplacementWrapperRequired(false); endMinuteEl.setDomReplacementWrapperRequired(false);
endMinuteEl.setDisplaySize(2); endMinuteEl.setDisplaySize(2);
...@@ -200,7 +238,9 @@ public class EditLectureController extends FormBasicController { ...@@ -200,7 +238,9 @@ public class EditLectureController extends FormBasicController {
FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator()); FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonsCont); formLayout.add(buttonsCont);
uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl()); uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
uifactory.addFormSubmitButton("save", buttonsCont); if(!lectureManagementManaged) {
uifactory.addFormSubmitButton("save", buttonsCont);
}
} }
@Override @Override
......
...@@ -44,6 +44,7 @@ import org.olat.modules.lecture.LectureService; ...@@ -44,6 +44,7 @@ import org.olat.modules.lecture.LectureService;
import org.olat.modules.lecture.model.LectureBlockRow; import org.olat.modules.lecture.model.LectureBlockRow;
import org.olat.modules.lecture.ui.LectureListRepositoryDataModel.BlockCols; import org.olat.modules.lecture.ui.LectureListRepositoryDataModel.BlockCols;
import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntry;
import org.olat.repository.RepositoryEntryManagedFlag;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
/** /**
...@@ -63,12 +64,15 @@ public class LectureListRepositoryController extends FormBasicController { ...@@ -63,12 +64,15 @@ public class LectureListRepositoryController extends FormBasicController {
private RepositoryEntry entry; private RepositoryEntry entry;
private final boolean lectureManagementManaged;
@Autowired @Autowired
private LectureService lectureService; private LectureService lectureService;
public LectureListRepositoryController(UserRequest ureq, WindowControl wControl, RepositoryEntry entry) { public LectureListRepositoryController(UserRequest ureq, WindowControl wControl, RepositoryEntry entry) {
super(ureq, wControl, "admin_repository_lectures"); super(ureq, wControl, "admin_repository_lectures");
this.entry = entry; this.entry = entry;
lectureManagementManaged = RepositoryEntryManagedFlag.isManaged(entry, RepositoryEntryManagedFlag.lecturemanagement);
initForm(ureq); initForm(ureq);
loadModel(); loadModel();
...@@ -76,15 +80,21 @@ public class LectureListRepositoryController extends FormBasicController { ...@@ -76,15 +80,21 @@ public class LectureListRepositoryController extends FormBasicController {
@Override @Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
addLectureButton = uifactory.addFormLink("add.lecture", formLayout, Link.BUTTON); if(!lectureManagementManaged) {
addLectureButton = uifactory.addFormLink("add.lecture", formLayout, Link.BUTTON);
}
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel(); FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, BlockCols.id)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, BlockCols.id));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.title)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.title));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.location)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.location));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.date, new DateFlexiCellRenderer(getLocale()))); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.date, new DateFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("edit", translate("edit"), "edit")); if(lectureManagementManaged) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("details", translate("details"), "edit"));//edit check it
} else {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("edit", translate("edit"), "edit"));
}
tableModel = new LectureListRepositoryDataModel(columnsModel, getLocale()); tableModel = new LectureListRepositoryDataModel(columnsModel, getLocale());
tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout); tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
tableEl.setExportEnabled(true); tableEl.setExportEnabled(true);
...@@ -135,8 +145,6 @@ public class LectureListRepositoryController extends FormBasicController { ...@@ -135,8 +145,6 @@ public class LectureListRepositoryController extends FormBasicController {
} else if(cmc == source) { } else if(cmc == source) {
cleanUp(); cleanUp();
} }
super.event(ureq, source, event); super.event(ureq, source, event);
} }
...@@ -153,8 +161,9 @@ public class LectureListRepositoryController extends FormBasicController { ...@@ -153,8 +161,9 @@ public class LectureListRepositoryController extends FormBasicController {
} }
private void doEditLectureBlock(UserRequest ureq, LectureBlockRow row) { private void doEditLectureBlock(UserRequest ureq, LectureBlockRow row) {
LectureBlock block = lectureService.getLectureBlock(row); if(editLectureCtrl != null) return;
LectureBlock block = lectureService.getLectureBlock(row);
editLectureCtrl = new EditLectureController(ureq, getWindowControl(), entry, block); editLectureCtrl = new EditLectureController(ureq, getWindowControl(), entry, block);
listenTo(editLectureCtrl); listenTo(editLectureCtrl);
...@@ -164,6 +173,8 @@ public class LectureListRepositoryController extends FormBasicController { ...@@ -164,6 +173,8 @@ public class LectureListRepositoryController extends FormBasicController {
} }
private void doAddLectureBlock(UserRequest ureq) { private void doAddLectureBlock(UserRequest ureq) {
if(editLectureCtrl != null) return;
editLectureCtrl = new EditLectureController(ureq, getWindowControl(), entry); editLectureCtrl = new EditLectureController(ureq, getWindowControl(), entry);
listenTo(editLectureCtrl); listenTo(editLectureCtrl);
......
...@@ -35,6 +35,7 @@ import org.olat.modules.lecture.LectureModule; ...@@ -35,6 +35,7 @@ import org.olat.modules.lecture.LectureModule;
import org.olat.modules.lecture.LectureService; import org.olat.modules.lecture.LectureService;
import org.olat.modules.lecture.RepositoryEntryLectureConfiguration; import org.olat.modules.lecture.RepositoryEntryLectureConfiguration;
import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntry;
import org.olat.repository.RepositoryEntryManagedFlag;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
/** /**
...@@ -56,6 +57,7 @@ public class LectureRepositorySettingsController extends FormBasicController { ...@@ -56,6 +57,7 @@ public class LectureRepositorySettingsController extends FormBasicController {
private MultipleSelectionElement rollCallEnabledEl, calculateAttendanceRateEl; private MultipleSelectionElement rollCallEnabledEl, calculateAttendanceRateEl;
private MultipleSelectionElement teacherCalendarSyncEl, participantCalendarSyncEl; private MultipleSelectionElement teacherCalendarSyncEl, participantCalendarSyncEl;
private final boolean lectureConfigManaged;
private boolean overrideModuleDefaults = false; private boolean overrideModuleDefaults = false;
private RepositoryEntryLectureConfiguration lectureConfig; private RepositoryEntryLectureConfiguration lectureConfig;
...@@ -69,6 +71,8 @@ public class LectureRepositorySettingsController extends FormBasicController { ...@@ -69,6 +71,8 @@ public class LectureRepositorySettingsController extends FormBasicController {
lectureConfig = lectureService.getRepositoryEntryLectureConfiguration(entry); lectureConfig = lectureService.getRepositoryEntryLectureConfiguration(entry);
overrideModuleDefaults = lectureConfig.isOverrideModuleDefault(); overrideModuleDefaults = lectureConfig.isOverrideModuleDefault();
lectureConfigManaged = RepositoryEntryManagedFlag.isManaged(entry, RepositoryEntryManagedFlag.lectureconfig);
initForm(ureq); initForm(ureq);
updateOverride(); updateOverride();
updateVisibility(); updateVisibility();
...@@ -79,6 +83,7 @@ public class LectureRepositorySettingsController extends FormBasicController { ...@@ -79,6 +83,7 @@ public class LectureRepositorySettingsController extends FormBasicController {
setFormTitle("lecture.admin.title"); setFormTitle("lecture.admin.title");
enableEl = uifactory.addCheckboxesHorizontal("lecture.admin.enabled", formLayout, onKeys, onValues); enableEl = uifactory.addCheckboxesHorizontal("lecture.admin.enabled", formLayout, onKeys, onValues);
enableEl.setEnabled(!lectureConfigManaged);
enableEl.addActionListener(FormEvent.ONCHANGE); enableEl.addActionListener(FormEvent.ONCHANGE);
if(lectureConfig.isLectureEnabled()) { if(lectureConfig.isLectureEnabled()) {
enableEl.select(onKeys[0], true); enableEl.select(onKeys[0], true);
...@@ -86,6 +91,7 @@ public class LectureRepositorySettingsController extends FormBasicController { ...@@ -86,6 +91,7 @@ public class LectureRepositorySettingsController extends FormBasicController {
String[] overrideValues = new String[]{ translate("config.override.yes"), translate("config.override.no") }; String[] overrideValues = new String[]{ translate("config.override.yes"), translate("config.override.no") };
overrideEl = uifactory.addRadiosHorizontal("config.override", formLayout, overrideKeys, overrideValues); overrideEl = uifactory.addRadiosHorizontal("config.override", formLayout, overrideKeys, overrideValues);
overrideEl.setEnabled(!lectureConfigManaged);
overrideEl.addActionListener(FormEvent.ONCHANGE); overrideEl.addActionListener(FormEvent.ONCHANGE);
if(lectureConfig.isOverrideModuleDefault()) { if(lectureConfig.isOverrideModuleDefault()) {
overrideEl.select(overrideKeys[0], true);//yes overrideEl.select(overrideKeys[0], true);//yes
...@@ -103,7 +109,9 @@ public class LectureRepositorySettingsController extends FormBasicController { ...@@ -103,7 +109,9 @@ public class LectureRepositorySettingsController extends FormBasicController {
FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator()); FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonsCont); formLayout.add(buttonsCont);
uifactory.addFormSubmitButton("save", buttonsCont); if(!lectureConfigManaged) {
uifactory.addFormSubmitButton("save", buttonsCont);
}
} }
private void updateOverride() { private void updateOverride() {
...@@ -120,7 +128,7 @@ public class LectureRepositorySettingsController extends FormBasicController { ...@@ -120,7 +128,7 @@ public class LectureRepositorySettingsController extends FormBasicController {
} }
long attendanceRatePerCent = Math.round(attendanceRate * 100.0d); long attendanceRatePerCent = Math.round(attendanceRate * 100.0d);
attendanceRateEl.setValue(Long.toString(attendanceRatePerCent)); attendanceRateEl.setValue(Long.toString(attendanceRatePerCent));
attendanceRateEl.setEnabled(overrideModuleDefaults); attendanceRateEl.setEnabled(overrideModuleDefaults && !lectureConfigManaged);
} }
private void updateOverrideElement(MultipleSelectionElement el, Boolean entryConfig, boolean defaultValue) { private void updateOverrideElement(MultipleSelectionElement el, Boolean entryConfig, boolean defaultValue) {
...@@ -130,7 +138,7 @@ public class LectureRepositorySettingsController extends FormBasicController { ...@@ -130,7 +138,7 @@ public class LectureRepositorySettingsController extends FormBasicController {
} else { } else {
el.uncheckAll(); el.uncheckAll();
} }
el.setEnabled(overrideModuleDefaults); el.setEnabled(overrideModuleDefaults && !lectureConfigManaged);
} }
private void updateVisibility() { private void updateVisibility() {
......
#if($r.available("add.lecture"))
<div class="o_button_group o_button_group_right"> <div class="o_button_group o_button_group_right">
$r.render("add.lecture") $r.render("add.lecture")
</div> </div>
#end
$r.render("table") $r.render("table")
\ No newline at end of file
...@@ -19,12 +19,14 @@ config.override.yes=Ja ...@@ -19,12 +19,14 @@ config.override.yes=Ja
config.rollcall.enabled=Roll call einschalten config.rollcall.enabled=Roll call einschalten
config.sync.participant.calendar=Teilnehmer Kalender synchronizieren config.sync.participant.calendar=Teilnehmer Kalender synchronizieren
config.sync.teacher.calendar=Lehrer Kalender synchronizieren config.sync.teacher.calendar=Lehrer Kalender synchronizieren
details=Details
done=Erledigt done=Erledigt
edit.participant.rate=Teilnehmersschwellwert bearbeiten edit.participant.rate=Teilnehmersschwellwert bearbeiten
edit.reason=Begr\u00FCndung bearbeiten edit.reason=Begr\u00FCndung bearbeiten
entry.rate=Kursschwellwert entry.rate=Kursschwellwert
error.integer.between=Der Eingabe muss ein Zahl zwischen {0} und {1} error.integer.between=Der Eingabe muss ein Zahl zwischen {0} und {1}
error.reason.mandatory=Begr\u00FCndung ist erforderlich error.reason.mandatory=Begr\u00FCndung ist erforderlich
form.managedflags.intro=Diese LektionBlock wurde von einem externen Werkzeug erstellt. Einige Einstellungen und Module k\u00F6nnen daher in OpenOLAT nicht ver\u00E4ndert und benutzt werden. Folgende Elemente sind in OpenOLAT gesperrt\: {0}
lecture.admin.enabled=Lektionen und absenzmanagement einschalten lecture.admin.enabled=Lektionen und absenzmanagement einschalten
lecture.admin.title=Konfiguration lektionen und absenzmanagement lecture.admin.title=Konfiguration lektionen und absenzmanagement
lecture.attendance.rate.default=Absenzenquote global in % lecture.attendance.rate.default=Absenzenquote global in %
......
...@@ -17,11 +17,13 @@ config.override.yes=Yes ...@@ -17,11 +17,13 @@ config.override.yes=Yes
config.rollcall.enabled=Roll call enabled config.rollcall.enabled=Roll call enabled
config.sync.participant.calendar=Synchronize participants calendar config.sync.participant.calendar=Synchronize participants calendar
config.sync.teacher.calendar=Synchronize teacher calendar config.sync.teacher.calendar=Synchronize teacher calendar
details=Details
done=Done done=Done
edit.participant.rate=Edit participant's rate edit.participant.rate=Edit participant's rate
edit.reason=Edit reason edit.reason=Edit reason
entry.rate=Course's rate entry.rate=Course's rate
error.reason.mandatory=Reason is mandatory error.reason.mandatory=Reason is mandatory
form.managedflags.intro=This lecture block has been created by an external tool. Therefore some settings and modules can not be modified and used within OpenOLAT. The following elements are blocked within OpenOLAT\: {0}
lecture.admin.enabled=Enable lectures and absence management lecture.admin.enabled=Enable lectures and absence management
lecture.admin.title=Configuration lectures and absence management lecture.admin.title=Configuration lectures and absence management
lecture.attendance.rate.default=Absence quota global in % lecture.attendance.rate.default=Absence quota global in %
......
form.managedflags.intro=Ce bloc de leçons a \u00E9t\u00E9 cr\u00E9\u00E9 par un outil externe. Certains r\u00E9glages et modules ne peuvent pas \u00EAtre modifi\u00E9s et utilis\u00E9s dans OpenOLAT. Les \u00E9l\u00E9ments suivants sont bloqu\u00E9s dans OpenOLAT\: {0}
...@@ -54,7 +54,7 @@ public enum RepositoryEntryManagedFlag { ...@@ -54,7 +54,7 @@ public enum RepositoryEntryManagedFlag {
glossary(settings,all), glossary(settings,all),
lecture(all), lecture(all),
lectureconfig(lecture, all), lectureconfig(lecture, all),
lecturemanagemenet(lecture, all), lecturemanagement(lecture, all),
bookings(all),// change booking rules bookings(all),// change booking rules
membersmanagement(all), membersmanagement(all),
groups(all), groups(all),
......
...@@ -92,6 +92,7 @@ import org.olat.fileresource.types.GlossaryResource; ...@@ -92,6 +92,7 @@ import org.olat.fileresource.types.GlossaryResource;
import org.olat.fileresource.types.ResourceEvaluation; import org.olat.fileresource.types.ResourceEvaluation;
import org.olat.fileresource.types.SharedFolderFileResource; import org.olat.fileresource.types.SharedFolderFileResource;
import org.olat.modules.glossary.GlossaryManager; import org.olat.modules.glossary.GlossaryManager;
import org.olat.modules.lecture.LectureService;
import org.olat.modules.reminder.Reminder; import org.olat.modules.reminder.Reminder;
import org.olat.modules.reminder.ReminderModule; import org.olat.modules.reminder.ReminderModule;
import org.olat.modules.reminder.ReminderRule; import org.olat.modules.reminder.ReminderRule;
...@@ -426,10 +427,16 @@ public class CourseHandler implements RepositoryHandler { ...@@ -426,10 +427,16 @@ public class CourseHandler implements RepositoryHandler {
course.postCopy(envMapper, sourceCourse); course.postCopy(envMapper, sourceCourse);
cloneReminders(author, envMapper, source, target); cloneReminders(author, envMapper, source, target);
cloneLectureConfig(source, target);
return target; return target;
} }
private void cloneLectureConfig(RepositoryEntry source, RepositoryEntry target) {
LectureService lectureService = CoreSpringFactory.getImpl(LectureService.class);
lectureService.copyRepositoryEntryLectureConfiguration(source, target);
}
private void cloneReminders(Identity author, CourseEnvironmentMapper envMapper, RepositoryEntry source, RepositoryEntry target) { private void cloneReminders(Identity author, CourseEnvironmentMapper envMapper, RepositoryEntry source, RepositoryEntry target) {
ReminderModule reminderModule = CoreSpringFactory.getImpl(ReminderModule.class); ReminderModule reminderModule = CoreSpringFactory.getImpl(ReminderModule.class);
ReminderService reminderService = CoreSpringFactory.getImpl(ReminderService.class); ReminderService reminderService = CoreSpringFactory.getImpl(ReminderService.class);
......
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