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";
}
}
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";
}
}
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";
}
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";
}
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";
}
Aggregations