use of org.olat.commons.calendar.model.KalendarEventLink in project OpenOLAT by OpenOLAT.
the class DENManager method createKalendarEventLinks.
private void createKalendarEventLinks(ICourse course, DENCourseNode courseNode, KalendarEvent event) {
List<KalendarEventLink> kalendarEventLinks = event.getKalendarEventLinks();
RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(course, true);
OLATResourceable oresNode = OresHelper.createOLATResourceableInstance("CourseNode", Long.valueOf(courseNode.getIdent()));
List<ContextEntry> ces = new ArrayList<ContextEntry>();
ces.add(BusinessControlFactory.getInstance().createContextEntry(re));
ces.add(BusinessControlFactory.getInstance().createContextEntry(oresNode));
String extLink = BusinessControlFactory.getInstance().getAsURIString(ces, false);
String iconCssClass = CourseNodeFactory.getInstance().getCourseNodeConfiguration(courseNode.getType()).getIconCSSClass();
KalendarEventLink link = new KalendarEventLink("COURSE", courseNode.getIdent(), courseNode.getShortTitle(), extLink, iconCssClass);
kalendarEventLinks.clear();
kalendarEventLinks.add(link);
}
use of org.olat.commons.calendar.model.KalendarEventLink in project OpenOLAT by OpenOLAT.
the class CopyEventToCalendarController method formOK.
@Override
protected void formOK(UserRequest ureq) {
for (MultipleSelectionElement copyEl : copyEls) {
if (copyEl.isEnabled() && copyEl.isAtLeastSelected(1)) {
KalendarRenderWrapper calendarWrapper = (KalendarRenderWrapper) copyEl.getUserObject();
Kalendar cal = calendarWrapper.getKalendar();
KalendarEvent clonedKalendarEvent = (KalendarEvent) XStreamHelper.xstreamClone(kalendarEvent);
if (clonedKalendarEvent.getKalendarEventLinks().size() > 0) {
clonedKalendarEvent.setKalendarEventLinks(new ArrayList<KalendarEventLink>());
}
calendarManager.addEventTo(cal, clonedKalendarEvent);
}
}
fireEvent(ureq, Event.DONE_EVENT);
}
use of org.olat.commons.calendar.model.KalendarEventLink in project OpenOLAT by OpenOLAT.
the class MediaLinksController method createLinkWrapper.
private LinkWrapper createLinkWrapper() {
String id = UUID.randomUUID().toString().replaceAll("-", "");
KalendarEventLink newLink = new KalendarEventLink(provider, id, "", "", "");
LinkWrapper newLinkWrapper = new LinkWrapper(newLink);
return newLinkWrapper;
}
use of org.olat.commons.calendar.model.KalendarEventLink in project OpenOLAT by OpenOLAT.
the class ExternalLinksController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source == newButton) {
String id = UUID.randomUUID().toString().replaceAll("-", "");
KalendarEventLink link = new KalendarEventLink(EXTERNAL_LINKS_PROVIDER, id, "", "", "");
LinkWrapper linkWrapper = new LinkWrapper(link);
externalLinks.add(linkWrapper);
addNewFormLink(linkWrapper, linksContainer);
} else if (source.getUserObject() instanceof LinkWrapper) {
LinkWrapper link = (LinkWrapper) source.getUserObject();
if (link.getDelButton().equals(source)) {
externalLinks.remove(link);
} else if (link.getAddButton().equals(source)) {
int index = externalLinks.indexOf(link);
LinkWrapper newLinkWrapper = createLinkWrapper();
addNewFormLink(newLinkWrapper, linksContainer);
if (index >= 0 && index + 1 < externalLinks.size()) {
externalLinks.add(index + 1, newLinkWrapper);
} else {
externalLinks.add(newLinkWrapper);
}
}
}
}
use of org.olat.commons.calendar.model.KalendarEventLink in project OpenOLAT by OpenOLAT.
the class ExternalLinksController method formOK.
@Override
protected void formOK(UserRequest ureq) {
List<KalendarEventLink> links = kalendarEvent.getKalendarEventLinks();
List<LinkWrapper> filledWrappers = new ArrayList<LinkWrapper>();
for (LinkWrapper linkWrapper : externalLinks) {
if (!linkWrapper.isEmpty()) {
filledWrappers.add(linkWrapper);
}
}
// add and update links
Set<String> usedUuids = new HashSet<String>();
for (LinkWrapper linkWrapper : filledWrappers) {
boolean found = false;
usedUuids.add(linkWrapper.getId());
for (KalendarEventLink link : links) {
if (link.getId().equals(linkWrapper.getId())) {
link.setURI(linkWrapper.getUrl().getValue());
link.setDisplayName(linkWrapper.getName().getValue());
link.setIconCssClass("o_icon o_icon_link_extern");
found = true;
}
}
if (!found) {
KalendarEventLink newLink = linkWrapper.getLink();
newLink.setURI(linkWrapper.getUrl().getValue());
newLink.setDisplayName(linkWrapper.getName().getValue());
newLink.setIconCssClass("o_icon o_icon_link_extern");
links.add(newLink);
}
}
// remove deleted links
for (Iterator<KalendarEventLink> it = links.iterator(); it.hasNext(); ) {
KalendarEventLink link = it.next();
if (EXTERNAL_LINKS_PROVIDER.equals(link.getId()) && !usedUuids.contains(link.getId())) {
it.remove();
}
}
fireEvent(ureq, Event.DONE_EVENT);
}
Aggregations