Search in sources :

Example 6 with Contributor

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

the class EditLocaleController method handleSubmit.

@RequestMapping(method = RequestMethod.POST)
public String handleSubmit(HttpSession session, @RequestParam Locale locale, Model model) {
    logger.info("handleSubmit");
    logger.info("locale: " + locale);
    if (locale == null) {
        model.addAttribute("errorCode", "NotNull.locale");
        model.addAttribute("locales", Locale.values());
        return "content/contributor/edit-locale";
    } else {
        Contributor contributor = (Contributor) session.getAttribute("contributor");
        contributor.setLocale(locale);
        contributorDao.update(contributor);
        session.setAttribute("contributor", contributor);
        return "redirect:/content";
    }
}
Also used : Contributor(ai.elimu.model.Contributor) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with Contributor

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

the class EditTeamsController method handleSubmit.

@RequestMapping(method = RequestMethod.POST)
public String handleSubmit(HttpSession session, @RequestParam(required = false) Set<Team> teams, Model model) {
    logger.info("handleSubmit");
    logger.info("teams: " + teams);
    if (teams == null) {
        model.addAttribute("errorCode", "NotNull.teams");
        model.addAttribute("teams", Team.values());
        return "content/contributor/edit-teams";
    } else {
        Contributor contributor = (Contributor) session.getAttribute("contributor");
        contributor.setTeams(teams);
        contributorDao.update(contributor);
        session.setAttribute("contributor", contributor);
        if (EnvironmentContextLoaderListener.env == Environment.PROD) {
            String text = URLEncoder.encode(contributor.getFirstName() + " just updated his/her team(s):\n" + contributor.getTeams() + "\n" + "See ") + "http://elimu.ai/content/community/contributors";
            String iconUrl = contributor.getImageUrl();
            SlackApiHelper.postMessage(null, text, iconUrl, null);
        }
        return "redirect:/content";
    }
}
Also used : Contributor(ai.elimu.model.Contributor) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with Contributor

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

the class LetterEditController method handleRequest.

@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String handleRequest(HttpSession session, Model model, @PathVariable Long id) {
    logger.info("handleRequest");
    Contributor contributor = (Contributor) session.getAttribute("contributor");
    Letter letter = letterDao.read(id);
    model.addAttribute("letter", letter);
    List<Allophone> allophones = allophoneDao.readAllOrderedByUsage(contributor.getLocale());
    model.addAttribute("allophones", allophones);
    return "content/letter/edit";
}
Also used : Letter(ai.elimu.model.content.Letter) Allophone(ai.elimu.model.content.Allophone) Contributor(ai.elimu.model.Contributor) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with Contributor

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

the class AudioEditController method handleRequest.

@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String handleRequest(HttpSession session, Model model, @PathVariable Long id) {
    logger.info("handleRequest");
    Contributor contributor = (Contributor) session.getAttribute("contributor");
    Audio audio = audioDao.read(id);
    model.addAttribute("audio", audio);
    model.addAttribute("contentLicenses", ContentLicense.values());
    model.addAttribute("literacySkills", LiteracySkill.values());
    model.addAttribute("numeracySkills", NumeracySkill.values());
    // model.addAttribute("audioRevisionEvents", audioRevisionEventDao.readAll(audio));
    model.addAttribute("letters", letterDao.readAllOrdered(contributor.getLocale()));
    model.addAttribute("numbers", numberDao.readAllOrdered(contributor.getLocale()));
    model.addAttribute("words", wordDao.readAllOrdered(contributor.getLocale()));
    return "content/multimedia/audio/edit";
}
Also used : Contributor(ai.elimu.model.Contributor) Audio(ai.elimu.model.content.multimedia.Audio) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with Contributor

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

the class AudioListController method handleRequest.

@RequestMapping(method = RequestMethod.GET)
public String handleRequest(Model model, HttpSession session) {
    logger.info("handleRequest");
    Contributor contributor = (Contributor) session.getAttribute("contributor");
    List<Audio> audios = audioDao.readAllOrdered(contributor.getLocale());
    model.addAttribute("audios", audios);
    return "content/multimedia/audio/list";
}
Also used : Contributor(ai.elimu.model.Contributor) Audio(ai.elimu.model.content.multimedia.Audio) 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