Search in sources :

Example 46 with Contributor

use of ai.elimu.model.Contributor in project webapp by elimu-ai.

the class VideoListController method handleRequest.

@RequestMapping(method = RequestMethod.GET)
public String handleRequest(Model model, HttpSession session) {
    logger.info("handleRequest");
    Contributor contributor = (Contributor) session.getAttribute("contributor");
    List<Video> videos = videoDao.readAllOrdered(contributor.getLocale());
    model.addAttribute("videos", videos);
    return "content/multimedia/video/list";
}
Also used : Video(ai.elimu.model.content.multimedia.Video) Contributor(ai.elimu.model.Contributor) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 47 with Contributor

use of ai.elimu.model.Contributor in project webapp by elimu-ai.

the class NumberCreateController method handleRequest.

@RequestMapping(method = RequestMethod.GET)
public String handleRequest(HttpSession session, Model model) {
    logger.info("handleRequest");
    Number number = new Number();
    model.addAttribute("number", number);
    Contributor contributor = (Contributor) session.getAttribute("contributor");
    List<Word> words = wordDao.readAllOrdered(contributor.getLocale());
    model.addAttribute("words", words);
    return "content/number/create";
}
Also used : Word(ai.elimu.model.content.Word) Number(ai.elimu.model.content.Number) Contributor(ai.elimu.model.Contributor) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 48 with Contributor

use of ai.elimu.model.Contributor in project webapp by elimu-ai.

the class NumberEditController method handleRequest.

@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String handleRequest(HttpSession session, Model model, @PathVariable Long id) {
    logger.info("handleRequest");
    Number number = numberDao.read(id);
    model.addAttribute("number", number);
    Contributor contributor = (Contributor) session.getAttribute("contributor");
    List<Word> words = wordDao.readAllOrdered(contributor.getLocale());
    model.addAttribute("words", words);
    return "content/number/edit";
}
Also used : Word(ai.elimu.model.content.Word) Number(ai.elimu.model.content.Number) Contributor(ai.elimu.model.Contributor) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 49 with Contributor

use of ai.elimu.model.Contributor in project webapp by elimu-ai.

the class StoryBookEditController method handleRequest.

@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String handleRequest(Model model, @PathVariable Long id, HttpSession session) {
    logger.info("handleRequest");
    Contributor contributor = (Contributor) session.getAttribute("contributor");
    StoryBook storyBook = storyBookDao.read(id);
    model.addAttribute("storyBook", storyBook);
    model.addAttribute("contentLicenses", ContentLicense.values());
    List<Image> coverImages = imageDao.readAllOrdered(contributor.getLocale());
    model.addAttribute("coverImages", coverImages);
    model.addAttribute("gradeLevels", GradeLevel.values());
    Map<String, Integer> wordFrequencyMap = WordFrequencyHelper.getWordFrequency(storyBook);
    model.addAttribute("wordFrequencyMap", wordFrequencyMap);
    Map<String, Integer> letterFrequencyMap = LetterFrequencyHelper.getLetterFrequency(storyBook);
    model.addAttribute("letterFrequencyMap", letterFrequencyMap);
    return "content/storybook/edit";
}
Also used : StoryBook(ai.elimu.model.content.StoryBook) Contributor(ai.elimu.model.Contributor) Image(ai.elimu.model.content.multimedia.Image) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 50 with Contributor

use of ai.elimu.model.Contributor in project webapp by elimu-ai.

the class StoryBookListController method handleRequest.

@RequestMapping(method = RequestMethod.GET)
public String handleRequest(Model model, HttpSession session) {
    logger.info("handleRequest");
    Contributor contributor = (Contributor) session.getAttribute("contributor");
    // To ease development/testing, auto-generate StoryBooks
    List<StoryBook> storyBooksGenerated = generateStoryBooks(contributor.getLocale());
    for (StoryBook storyBook : storyBooksGenerated) {
        StoryBook existingStoryBook = storyBookDao.readByTitle(storyBook.getLocale(), storyBook.getTitle());
        if (existingStoryBook == null) {
            storyBookDao.create(storyBook);
        }
    }
    List<StoryBook> storyBooks = storyBookDao.readAllOrdered(contributor.getLocale());
    model.addAttribute("storyBooks", storyBooks);
    return "content/storybook/list";
}
Also used : StoryBook(ai.elimu.model.content.StoryBook) Contributor(ai.elimu.model.Contributor) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Contributor (ai.elimu.model.Contributor)57 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)51 Project (ai.elimu.model.project.Project)12 IOException (java.io.IOException)10 Allophone (ai.elimu.model.content.Allophone)9 Word (ai.elimu.model.content.Word)8 Image (ai.elimu.model.content.multimedia.Image)8 Audio (ai.elimu.model.content.multimedia.Audio)6 Letter (ai.elimu.model.content.Letter)5 Number (ai.elimu.model.content.Number)5 AppCategory (ai.elimu.model.project.AppCategory)5 StoryBook (ai.elimu.model.content.StoryBook)4 Video (ai.elimu.model.content.multimedia.Video)4 Scheduled (org.springframework.scheduling.annotation.Scheduled)4 AppCollection (ai.elimu.model.project.AppCollection)3 AppGroup (ai.elimu.model.project.AppGroup)3 Locale (java.util.Locale)3 Application (ai.elimu.model.admin.Application)2 ApplicationVersion (ai.elimu.model.admin.ApplicationVersion)2 Syllable (ai.elimu.model.content.Syllable)2