Search in sources :

Example 1 with KalendarEventLink

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);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) ArrayList(java.util.ArrayList) KalendarEventLink(org.olat.commons.calendar.model.KalendarEventLink) RepositoryEntry(org.olat.repository.RepositoryEntry) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 2 with KalendarEventLink

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);
}
Also used : MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) Kalendar(org.olat.commons.calendar.model.Kalendar) KalendarEvent(org.olat.commons.calendar.model.KalendarEvent) KalendarEventLink(org.olat.commons.calendar.model.KalendarEventLink) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper)

Example 3 with KalendarEventLink

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;
}
Also used : KalendarEventLink(org.olat.commons.calendar.model.KalendarEventLink)

Example 4 with KalendarEventLink

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);
            }
        }
    }
}
Also used : KalendarEventLink(org.olat.commons.calendar.model.KalendarEventLink)

Example 5 with KalendarEventLink

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);
}
Also used : ArrayList(java.util.ArrayList) KalendarEventLink(org.olat.commons.calendar.model.KalendarEventLink) HashSet(java.util.HashSet)

Aggregations

KalendarEventLink (org.olat.commons.calendar.model.KalendarEventLink)32 ArrayList (java.util.ArrayList)14 Kalendar (org.olat.commons.calendar.model.Kalendar)6 KalendarEvent (org.olat.commons.calendar.model.KalendarEvent)6 Date (java.util.Date)4 HashSet (java.util.HashSet)4 PropertyList (net.fortuna.ical4j.model.PropertyList)4 Contact (net.fortuna.ical4j.model.property.Contact)4 Created (net.fortuna.ical4j.model.property.Created)4 Description (net.fortuna.ical4j.model.property.Description)4 ExDate (net.fortuna.ical4j.model.property.ExDate)4 LastModified (net.fortuna.ical4j.model.property.LastModified)4 Location (net.fortuna.ical4j.model.property.Location)4 RecurrenceId (net.fortuna.ical4j.model.property.RecurrenceId)4 Uid (net.fortuna.ical4j.model.property.Uid)4 XProperty (net.fortuna.ical4j.model.property.XProperty)4 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)4 TreeNode (org.olat.core.gui.components.tree.TreeNode)3 OLATResourceable (org.olat.core.id.OLATResourceable)3 ContextEntry (org.olat.core.id.context.ContextEntry)3