use of org.olat.course.member.PermissionHelper.RepoPermission in project OpenOLAT by OpenOLAT.
the class EditMembershipController method collectRepoChanges.
public void collectRepoChanges(MemberPermissionChangeEvent e) {
if (repoEntry == null)
return;
RepoPermission repoPermission = PermissionHelper.getPermission(repoEntry, member, memberships);
Collection<String> selectRepoRights = repoRightsEl.getSelectedKeys();
boolean repoOwner = selectRepoRights.contains("owner");
e.setRepoOwner(repoOwner == repoPermission.isOwner() ? null : new Boolean(repoOwner));
boolean repoTutor = selectRepoRights.contains("tutor");
e.setRepoTutor(repoTutor == repoPermission.isTutor() ? null : new Boolean(repoTutor));
boolean repoParticipant = selectRepoRights.contains("participant");
e.setRepoParticipant(repoParticipant == repoPermission.isParticipant() ? null : new Boolean(repoParticipant));
}
use of org.olat.course.member.PermissionHelper.RepoPermission in project openolat by klemens.
the class EditMembershipController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
String name = repoEntry == null ? businessGroup.getName() : repoEntry.getDisplayname();
name = StringHelper.escapeHtml(name);
String title = translate("edit.member.title", new String[] { name });
layoutCont.contextPut("editTitle", title);
}
// repository entry rights
if (repoEntry != null) {
String[] repoValues = new String[] { translate("role.repo.owner"), translate("role.repo.tutor"), translate("role.repo.participant") };
boolean managed = RepositoryEntryManagedFlag.isManaged(repoEntry, RepositoryEntryManagedFlag.membersmanagement) && !overrideManaged;
repoRightsEl = uifactory.addCheckboxesVertical("repoRights", null, formLayout, repoRightsKeys, repoValues, 1);
repoRightsEl.setEnabled(!managed);
if (member != null) {
RepoPermission repoPermission = PermissionHelper.getPermission(repoEntry, member, memberships);
repoRightsEl.select("owner", repoPermission.isOwner());
repoRightsEl.select("tutor", repoPermission.isTutor());
repoRightsEl.select("participant", repoPermission.isParticipant());
}
}
// group rights
FlexiTableColumnModel tableColumnModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.groups", 0));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.tutorsCount", 1));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.participantsCount", 2));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, "table.header.freePlace", 3, false, null, FlexiColumnModel.ALIGNMENT_LEFT, new TextFlexiCellRenderer(EscapeMode.none)));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.tutors", 4));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.participants", 5));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.waitingList", 6));
tableDataModel = new EditMemberTableDataModel(Collections.<MemberOption>emptyList(), tableColumnModel);
FlexiTableElement tableEl = uifactory.addTableElement(getWindowControl(), "groupList", tableDataModel, getTranslator(), formLayout);
tableEl.setCustomizeColumns(false);
if (withButtons) {
FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("buttonLayout", getTranslator());
formLayout.add(buttonLayout);
buttonLayout.setRootForm(mainForm);
uifactory.addFormSubmitButton("ok", buttonLayout);
uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl());
}
}
use of org.olat.course.member.PermissionHelper.RepoPermission in project openolat by klemens.
the class EditMembershipController method collectRepoChanges.
public void collectRepoChanges(MemberPermissionChangeEvent e) {
if (repoEntry == null)
return;
RepoPermission repoPermission = PermissionHelper.getPermission(repoEntry, member, memberships);
Collection<String> selectRepoRights = repoRightsEl.getSelectedKeys();
boolean repoOwner = selectRepoRights.contains("owner");
e.setRepoOwner(repoOwner == repoPermission.isOwner() ? null : new Boolean(repoOwner));
boolean repoTutor = selectRepoRights.contains("tutor");
e.setRepoTutor(repoTutor == repoPermission.isTutor() ? null : new Boolean(repoTutor));
boolean repoParticipant = selectRepoRights.contains("participant");
e.setRepoParticipant(repoParticipant == repoPermission.isParticipant() ? null : new Boolean(repoParticipant));
}
use of org.olat.course.member.PermissionHelper.RepoPermission in project OpenOLAT by OpenOLAT.
the class EditMembershipController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
String name = repoEntry == null ? businessGroup.getName() : repoEntry.getDisplayname();
name = StringHelper.escapeHtml(name);
String title = translate("edit.member.title", new String[] { name });
layoutCont.contextPut("editTitle", title);
}
// repository entry rights
if (repoEntry != null) {
String[] repoValues = new String[] { translate("role.repo.owner"), translate("role.repo.tutor"), translate("role.repo.participant") };
boolean managed = RepositoryEntryManagedFlag.isManaged(repoEntry, RepositoryEntryManagedFlag.membersmanagement) && !overrideManaged;
repoRightsEl = uifactory.addCheckboxesVertical("repoRights", null, formLayout, repoRightsKeys, repoValues, 1);
repoRightsEl.setEnabled(!managed);
if (member != null) {
RepoPermission repoPermission = PermissionHelper.getPermission(repoEntry, member, memberships);
repoRightsEl.select("owner", repoPermission.isOwner());
repoRightsEl.select("tutor", repoPermission.isTutor());
repoRightsEl.select("participant", repoPermission.isParticipant());
}
}
// group rights
FlexiTableColumnModel tableColumnModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.groups", 0));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.tutorsCount", 1));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.participantsCount", 2));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, "table.header.freePlace", 3, false, null, FlexiColumnModel.ALIGNMENT_LEFT, new TextFlexiCellRenderer(EscapeMode.none)));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.tutors", 4));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.participants", 5));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.waitingList", 6));
tableDataModel = new EditMemberTableDataModel(Collections.<MemberOption>emptyList(), tableColumnModel);
FlexiTableElement tableEl = uifactory.addTableElement(getWindowControl(), "groupList", tableDataModel, getTranslator(), formLayout);
tableEl.setCustomizeColumns(false);
if (withButtons) {
FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("buttonLayout", getTranslator());
formLayout.add(buttonLayout);
buttonLayout.setRootForm(mainForm);
uifactory.addFormSubmitButton("ok", buttonLayout);
uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl());
}
}
Aggregations