use of org.olat.resource.accesscontrol.OfferAccess in project openolat by klemens.
the class PublishStep01AccessForm method editMethod.
private void editMethod(UserRequest ureq, AccessInfo infos) {
OfferAccess link = infos.getLink();
removeAsListenerAndDispose(editMethodCtrl);
AccessMethodHandler methodHandler = acModule.getAccessMethodHandler(link.getMethod().getType());
if (methodHandler != null) {
editMethodCtrl = methodHandler.editConfigurationController(ureq, getWindowControl(), link);
}
if (editMethodCtrl != null) {
listenTo(editMethodCtrl);
String title = methodHandler.getMethodName(getLocale());
cmc = new CloseableModalController(getWindowControl(), translate("close"), editMethodCtrl.getInitialComponent(), true, title);
cmc.activate();
listenTo(cmc);
}
}
use of org.olat.resource.accesscontrol.OfferAccess in project openolat by klemens.
the class PublishStep01AccessForm method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (newMethodCtrl == source) {
if (event.equals(Event.DONE_EVENT)) {
OfferAccess newLink = newMethodCtrl.commitChanges();
button_id++;
if (!offerAccess.contains(newLink)) {
offerAccess.add(newLink);
}
addConfiguration(newLink);
fireEvent(ureq, Event.CHANGED_EVENT);
}
cmc.deactivate();
cleanUp();
} else if (editMethodCtrl == source) {
if (event.equals(Event.DONE_EVENT)) {
OfferAccess newLink = editMethodCtrl.commitChanges();
if (!offerAccess.contains(newLink)) {
offerAccess.add(newLink);
}
replace(newLink);
fireEvent(ureq, Event.CHANGED_EVENT);
}
cmc.deactivate();
cleanUp();
} else if (cmc == source) {
cleanUp();
} else {
super.event(ureq, source, event);
}
}
use of org.olat.resource.accesscontrol.OfferAccess in project openolat by klemens.
the class PublishStep01AccessForm method loadConfigurations.
protected void loadConfigurations() {
List<Offer> offers = acService.findOfferByResource(resource, true, null);
for (Offer offer : offers) {
List<OfferAccess> offerAccessList = acService.getOfferAccess(offer, true);
for (OfferAccess access : offerAccessList) {
button_id++;
addConfiguration(access);
}
}
}
use of org.olat.resource.accesscontrol.OfferAccess in project openolat by klemens.
the class PublishStep01AccessForm method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
super.formInnerEvent(ureq, source, event);
if (source == authorsSwitch) {
if (authorsSwitch.getSelectedKey().equals(YES_KEY)) {
authorConfigLayout.setVisible(true);
} else {
authorConfigLayout.setVisible(false);
if (!publishedForUsers.getSelectedKey().equals(MEMBERSONLY_KEY)) {
usersSwitch.select(NO_KEY, false);
userConfigLayout.setVisible(false);
}
}
} else if (source == usersSwitch || source == publishedForUsers) {
if (usersSwitch.getSelectedKey().equals(YES_KEY)) {
userConfigLayout.setVisible(true);
accessLayout.setVisible(true);
if (publishedForUsers.getSelectedKey().equals(MEMBERSONLY_KEY)) {
authorConfigLayout.setVisible(false);
authorsSwitch.select(NO_KEY, false);
authorsSwitch.setEnabled(false);
} else {
authorsSwitch.select(YES_KEY, false);
authorsSwitch.setEnabled(true);
authorConfigLayout.setVisible(true);
}
} else {
userConfigLayout.setVisible(false);
accessLayout.setVisible(false);
authorsSwitch.setEnabled(true);
}
} else if (addMethods.contains(source)) {
AccessMethod method = (AccessMethod) source.getUserObject();
addMethod(ureq, method);
} else if (confirmationEmailEl == source) {
for (AccessInfo info : confControllers) {
if (!offerAccess.contains(info.getLink())) {
offerAccess.add(info.getLink());
}
}
} else if (source instanceof FormLink) {
FormLink button = (FormLink) source;
String cmd = button.getCmd();
if ("delete".equals(cmd)) {
AccessInfo infos = (AccessInfo) source.getUserObject();
OfferAccess deleteOffer = infos.getLink();
offerAccess.remove(deleteOffer);
if (deleteOffer.getKey() != null) {
deletedOfferAccess.add(deleteOffer);
}
confControllers.remove(infos);
updateConfirmationEmail();
fireEvent(ureq, Event.CHANGED_EVENT);
} else if ("edit".equals(cmd)) {
AccessInfo infos = (AccessInfo) source.getUserObject();
editMethod(ureq, infos);
}
}
}
Aggregations