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

OO-623,OPENOLAT-123: only show the booking infos / warning if the course or...

OO-623,OPENOLAT-123: only show the booking infos / warning if the course or the group is not managed, or it's managed but has already a booking configured
parent 20b0da01
No related branches found
No related tags found
No related merge requests found
......@@ -66,6 +66,10 @@ public class BusinessGroupEditAccessController extends FormBasicController {
initForm(ureq);
}
public int getNumOfBookingConfigurations() {
return configController == null ? 0 : configController.getNumOfBookingConfigurations();
}
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
......
......@@ -55,6 +55,7 @@ import org.olat.core.util.coordinate.LockResult;
import org.olat.core.util.event.GenericEventListener;
import org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent;
import org.olat.group.BusinessGroup;
import org.olat.group.BusinessGroupManagedFlag;
import org.olat.group.BusinessGroupService;
import org.olat.group.GroupLoggingAction;
import org.olat.group.ui.BGControllerFactory;
......@@ -231,7 +232,13 @@ public class BusinessGroupEditController extends BasicController implements Cont
private BusinessGroupEditAccessController getAccessController(UserRequest ureq) {
if(tabAccessCtrl == null && acModule.isEnabled()) {
tabAccessCtrl = new BusinessGroupEditAccessController(ureq, getWindowControl(), currBusinessGroup);
listenTo(tabAccessCtrl);
if(BusinessGroupManagedFlag.isManaged(currBusinessGroup, BusinessGroupManagedFlag.bookings)
&& tabAccessCtrl.getNumOfBookingConfigurations() == 0) {
//booking is managed, no booking, don't show it
tabAccessCtrl = null;
} else {
listenTo(tabAccessCtrl);
}
}
if(tabAccessCtrl != null) {
tabAccessCtrl.updateBusinessGroup(currBusinessGroup);
......
......@@ -178,9 +178,12 @@ public class RepositoryEditPropertiesController extends BasicController implemen
acCtr = new AccessConfigurationController(ureq, getWindowControl(), repositoryEntry.getOlatResource(), repositoryEntry.getDisplayname(),
true, !managedBookings);
int access = propPupForm.getAccess();
int numOfBookingConfigs = acCtr.getNumOfBookingConfigurations();
if(access == RepositoryEntry.ACC_USERS || access == RepositoryEntry.ACC_USERS_GUESTS) {
editproptabpubVC.put("accesscontrol", acCtr.getInitialComponent());
editproptabpubVC.contextPut("isGuestAccess", Boolean.valueOf(access == RepositoryEntry.ACC_USERS_GUESTS));
if(!managedBookings || numOfBookingConfigs > 0) {
editproptabpubVC.put("accesscontrol", acCtr.getInitialComponent());
editproptabpubVC.contextPut("isGuestAccess", Boolean.valueOf(access == RepositoryEntry.ACC_USERS_GUESTS));
}
}
tabbedPane.addListener(this);
......@@ -490,9 +493,13 @@ public class RepositoryEditPropertiesController extends BasicController implemen
}
int access = propPupForm.getAccess();
int numOfBookingConfigs = acCtr.getNumOfBookingConfigurations();
boolean managedBookings = RepositoryEntryManagedFlag.isManaged(repositoryEntry, RepositoryEntryManagedFlag.bookings);
if(access == RepositoryEntry.ACC_USERS || access == RepositoryEntry.ACC_USERS_GUESTS) {
editproptabpubVC.put("accesscontrol", acCtr.getInitialComponent());
editproptabpubVC.contextPut("isGuestAccess", Boolean.valueOf(access == RepositoryEntry.ACC_USERS_GUESTS));
if(!managedBookings || numOfBookingConfigs > 0) {
editproptabpubVC.put("accesscontrol", acCtr.getInitialComponent());
editproptabpubVC.contextPut("isGuestAccess", Boolean.valueOf(access == RepositoryEntry.ACC_USERS_GUESTS));
}
} else {
editproptabpubVC.remove(acCtr.getInitialComponent());
}
......
......@@ -118,6 +118,10 @@ public class AccessConfigurationController extends FormBasicController {
initForm(ureq);
}
public int getNumOfBookingConfigurations() {
return confControllers.size();
}
public FormItem getInitialFormItem() {
return flc;
}
......
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