return null;
}
@Override
protected void doService(final ToolPageContext page) throws IOException, ServletException {
Schedule schedule = (Schedule) page.findOrReserve(Schedule.class);
boolean newSchedule = schedule.getState().isNew();
if (page.isFormPost()) {
try {
if (page.param(String.class, "action-save") != null) {
ToolUser toolUser = page.getUser();
page.include("/WEB-INF/objectPost.jsp", "object", schedule);
if (newSchedule) {
schedule.setTriggerUser(toolUser);
schedule.setTriggerSite(page.getSite());
}
schedule.save();
if (newSchedule) {
toolUser.setCurrentSchedule(schedule);
toolUser.save();
}
} else if (page.param(String.class, "action-delete") != null) {
try {
schedule.beginWrites();
Query.from(Draft.class).where("schedule = ?", schedule).deleteAll();
schedule.delete();
schedule.commitWrites();
} finally {
schedule.endWrites();
}
}
page.writeStart("script", "type", "text/javascript");
page.writeRaw("window.location = window.location;");
page.writeEnd();
return;
} catch (Exception error) {
page.getErrors().add(error);
}
}
page.writeStart("div", "class", "widget");
page.writeFormHeading(schedule, "class", "icon icon-object-schedule");
page.include("/WEB-INF/errors.jsp");
page.writeStart("form",
"method", "post",
"action", page.url("", "id", schedule.getId()));
page.include("/WEB-INF/objectForm.jsp", "object", schedule);
page.writeStart("div", "class", "actions");
page.writeStart("button",
"class", "icon icon-action-save",