use of org.olat.resource.accesscontrol.OfferAccess in project openolat by klemens.
the class AccessConfigurationController 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();
newLink = acService.saveOfferAccess(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();
newLink = acService.saveOfferAccess(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 AccessConfigurationController method editMethod.
private void editMethod(UserRequest ureq, AccessInfo infos) {
OfferAccess link = infos.getLink();
removeAsListenerAndDispose(editMethodCtrl);
AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType());
if (handler != null) {
editMethodCtrl = handler.editConfigurationController(ureq, getWindowControl(), link);
}
if (editMethodCtrl != null) {
listenTo(editMethodCtrl);
String title = handler.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 MainAccessController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
backLink = uifactory.addFormLink("back", formLayout, Link.LINK_BACK);
FormLayoutContainer methodChooseContainer = FormLayoutContainer.createDefaultFormLayout("methodChooser", getTranslator());
methodChooseContainer.setRootForm(mainForm);
formLayout.add("methodChooser", methodChooseContainer);
for (OfferAccess link : links) {
AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType());
String methodName = handler.getMethodName(getLocale());
FormLink accessButton = uifactory.addFormLink("m_" + link.getKey(), methodName, null, methodChooseContainer, Link.BUTTON + Link.NONTRANSLATED);
accessButton.setUserObject(link);
accessButtons.add(accessButton);
}
}
use of org.olat.resource.accesscontrol.OfferAccess in project openolat by klemens.
the class PublishProcess method changeAccessAndProperties.
public void changeAccessAndProperties(Identity author, CourseAccessAndProperties accessAndProps) {
RepositoryManager manager = RepositoryManager.getInstance();
manager.setAccessAndProperties(accessAndProps.getRepositoryEntry(), accessAndProps.getAccess(), accessAndProps.isMembersOnly(), accessAndProps.isCanCopy(), accessAndProps.isCanReference(), accessAndProps.isCanDownload());
manager.setLeaveSetting(accessAndProps.getRepositoryEntry(), accessAndProps.getSetting());
List<OfferAccess> offerAccess = accessAndProps.getOfferAccess();
// 1: add new and update existing offerings
ACService acService = CoreSpringFactory.getImpl(ACService.class);
for (OfferAccess newLink : offerAccess) {
if (accessAndProps.getConfirmationEmail() != null) {
Offer offer = newLink.getOffer();
boolean confirmation = accessAndProps.getConfirmationEmail().booleanValue();
if (offer.isConfirmationEmail() != confirmation) {
offer.setConfirmationEmail(confirmation);
if (offer.getKey() != null) {
offer = acService.save(offer);
}
}
}
acService.saveOfferAccess(newLink);
}
// 2: remove offerings not available anymore
List<OfferAccess> deletedOfferAccess = accessAndProps.getDeletedOfferAccess();
for (OfferAccess deletedLink : deletedOfferAccess) {
acService.deletedLinkToMethod(deletedLink);
}
MultiUserEvent modifiedEvent = new EntryChangedEvent(repositoryEntry, author, Change.modifiedAtPublish, "publish");
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, repositoryEntry);
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, RepositoryService.REPOSITORY_EVENT_ORES);
}
use of org.olat.resource.accesscontrol.OfferAccess in project openolat by klemens.
the class PublishStep01AccessForm method addMethod.
protected void addMethod(UserRequest ureq, AccessMethod method) {
Offer offer = acService.createOffer(resource, displayName);
OfferAccess link = acService.createOfferAccess(offer, method);
removeAsListenerAndDispose(newMethodCtrl);
AccessMethodHandler methodHandler = acModule.getAccessMethodHandler(link.getMethod().getType());
if (methodHandler != null) {
newMethodCtrl = methodHandler.createConfigurationController(ureq, getWindowControl(), link);
}
if (newMethodCtrl != null) {
listenTo(newMethodCtrl);
String title = methodHandler.getMethodName(getLocale());
cmc = new CloseableModalController(getWindowControl(), translate("close"), newMethodCtrl.getInitialComponent(), true, title);
cmc.activate();
listenTo(cmc);
} else {
if (!offerAccess.contains(link)) {
offerAccess.add(link);
}
addConfiguration(link);
}
}
Aggregations