if (req.getParameter("cancelChangesSubmit")!=null) {
form.reset();
return am.findForward("cancel");
}
GameTemplateHiber gt=null;
if (form.isModifyMe()) {
//modify existing
gt=GameTemplateDao.findGameTemplateHiber(form.getModifyId(),session);
if (!SecurityCenter.canIEditGameTemplate(webUser.getId(), gt)) {
MessageBean.setMyMessage(req, ("Error: Insufficient privileges."));
form.reset();
return am.findForward("ok");
}
} else {
//add new
gt=new GameTemplateHiber();
if (!SecurityCenter.canICreateGameTemplate(webUser.getId(),session)) {
MessageBean.setMyMessage(req, ("Error: Insufficient privileges."));
form.reset();
return am.findForward("ok");
}
}
gt.setAuthoringHandlerCode(form.getAuthoringHandlerCode());
gt.setName(form.getName());
gt.setDescription(form.getDescription());
//gt.setGameType(form.getGameType());
gt.setCreator(webUser.getId());
gt.setLearningGoal(form.getLearningGoal());
gt.setTargetGroup(form.getTargetGroup());
gt.setGameType(form.getSelectedArticle()+"");
gt.setLearningGoal(form.getLearningGoal());
gt.setTargetGroup(form.getTargetGroup());
//gt.setLogo(null);
//gt.setJarContent(null);
//gt.setParamFileContent(null);
//gt.setLogoType("image/jpeg");
//TODO save jar file to filesystem! - that file will be used to produce games for mobile phones
if (form.getLogo().getFileName()!=null)
if (!form.getLogo().getFileName().equals("")) {
try {
gt.setLogo(Hibernate.createBlob(form.getLogo().getInputStream()));
gt.setLogoType(form.getLogo().getContentType());
} catch (Exception e) {
// TODO Wo handle exception
}
}
// if (form.getJarContent().getFileName()!=null)