Search in sources :

Example 1 with BookSection

use of org.olat.modules.edubase.BookSection in project OpenOLAT by OpenOLAT.

the class EdubaseBookSectionListController method doAddBookSection.

private void doAddBookSection() {
    BookSection bookSection = new BookSectionImpl();
    wrapBookSection(bookSection);
    flc.setDirty(true);
}
Also used : BookSection(org.olat.modules.edubase.BookSection) BookSectionImpl(org.olat.modules.edubase.model.BookSectionImpl)

Example 2 with BookSection

use of org.olat.modules.edubase.BookSection in project OpenOLAT by OpenOLAT.

the class EdubaseManagerImplTest method getLtiLaunchUrlShoudAppendBookIdAndMandatoryPageFrom.

@Test
public void getLtiLaunchUrlShoudAppendBookIdAndMandatoryPageFrom() {
    BookSection bookSection = new BookSectionImpl();
    bookSection.setBookId(BOOK_ID);
    String baseUrl = "https://edubase.ch";
    when(edubaseModuleMock.getLtiLaunchUrl()).thenReturn(baseUrl);
    String generatedLtiUrl = sut.getLtiLaunchUrl(bookSection);
    String expectedLtiUrl = baseUrl + "/" + BOOK_ID + "/1";
    assertThat(generatedLtiUrl).isEqualTo(expectedLtiUrl);
}
Also used : BookSection(org.olat.modules.edubase.BookSection) BookSectionImpl(org.olat.modules.edubase.model.BookSectionImpl) Test(org.junit.Test)

Example 3 with BookSection

use of org.olat.modules.edubase.BookSection in project OpenOLAT by OpenOLAT.

the class EdubaseManagerImplTest method getLtiLaunchUrlShoudAppendPageFrom.

@Test
public void getLtiLaunchUrlShoudAppendPageFrom() {
    BookSection bookSection = new BookSectionImpl();
    bookSection.setBookId(BOOK_ID);
    Integer pageFrom = 9898;
    bookSection.setPageFrom(pageFrom);
    String baseUrl = "https://edubase.ch";
    when(edubaseModuleMock.getLtiLaunchUrl()).thenReturn(baseUrl);
    String generatedLtiUrl = sut.getLtiLaunchUrl(bookSection);
    String expectedLtiUrl = baseUrl + "/" + BOOK_ID + "/" + pageFrom;
    assertThat(generatedLtiUrl).isEqualTo(expectedLtiUrl);
}
Also used : BookSection(org.olat.modules.edubase.BookSection) BookSectionImpl(org.olat.modules.edubase.model.BookSectionImpl) Test(org.junit.Test)

Example 4 with BookSection

use of org.olat.modules.edubase.BookSection in project openolat by klemens.

the class EdubasePeekViewController method createPeekviewComponent.

private Component createPeekviewComponent(ModuleConfiguration modulConfiguration) {
    VelocityContainer container = createVelocityContainer(PEEKVIEW_CONTAINER);
    ;
    // BookSections
    List<BookSection> bookSections = modulConfiguration.getList(EdubaseCourseNode.CONFIG_BOOK_SECTIONS, BookSection.class).stream().sorted(new PositionComparator()).limit(NUMBER_BOOK_SECTION_DESC_DISABLED).collect(Collectors.toList());
    container.contextPut("bookSections", bookSections);
    // Add a link to show all BookSections (go to node)
    Link allItemsLink = LinkFactory.createLink("peekview.allItemsLink", container, this);
    allItemsLink.setIconRightCSS("o_icon o_icon_start");
    allItemsLink.setCustomEnabledLinkCSS("pull-right");
    return container;
}
Also used : PositionComparator(org.olat.modules.edubase.model.PositionComparator) BookSection(org.olat.modules.edubase.BookSection) Link(org.olat.core.gui.components.link.Link) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 5 with BookSection

use of org.olat.modules.edubase.BookSection in project openolat by klemens.

the class EdubaseRunController method createOverviewComponent.

private Component createOverviewComponent(ModuleConfiguration modulConfiguration) {
    VelocityContainer container;
    if (modulConfiguration.getBooleanSafe(EdubaseCourseNode.CONFIG_DESCRIPTION_ENABLED)) {
        container = createVelocityContainer(OVERVIEW_DESCRIPTION_ENABLED);
    } else {
        container = createVelocityContainer(OVERVIEW_DESCRIPTION_DISABLED);
    }
    bookSections = modulConfiguration.getList(EdubaseCourseNode.CONFIG_BOOK_SECTIONS, BookSection.class).stream().sorted(new PositionComparator()).collect(Collectors.toList());
    container.contextPut("bookSections", bookSections);
    for (BookSection bookSection : bookSections) {
        Link nodeLink = LinkFactory.createLink("startReader_" + bookSection.getPosition(), container, this);
        nodeLink.setCustomDisplayText(getTranslator().translate("open.document"));
        nodeLink.setIconRightCSS("o_icon o_icon_start");
        nodeLink.setUserObject(bookSection);
    }
    EdubaseViewHelper edubaseViewHelper = new EdubaseViewHelper(getTranslator());
    container.contextPut("helper", edubaseViewHelper);
    container.contextPut("run", EVENT_RUN);
    return container;
}
Also used : PositionComparator(org.olat.modules.edubase.model.PositionComparator) BookSection(org.olat.modules.edubase.BookSection) Link(org.olat.core.gui.components.link.Link) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Aggregations

BookSection (org.olat.modules.edubase.BookSection)14 BookSectionImpl (org.olat.modules.edubase.model.BookSectionImpl)8 Link (org.olat.core.gui.components.link.Link)6 PositionComparator (org.olat.modules.edubase.model.PositionComparator)6 Test (org.junit.Test)4 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)4 ArrayList (java.util.ArrayList)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2