/** * Copyright © 2002 Instituto Superior Técnico * * This file is part of FenixEdu Academic. * * FenixEdu Academic is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * FenixEdu Academic is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with FenixEdu Academic. If not, see <http://www.gnu.org/licenses/>. */ package org.fenixedu.academic.ui.struts.action.teacher.executionCourse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import org.apache.struts.action.DynaActionForm; import org.fenixedu.academic.domain.Curriculum; import org.fenixedu.academic.domain.ExecutionCourse; import org.fenixedu.academic.domain.Teacher; import org.fenixedu.academic.service.services.exceptions.FenixServiceException; import org.fenixedu.academic.ui.struts.action.exceptions.FenixActionException; import org.fenixedu.academic.ui.struts.action.teacher.ManageExecutionCourseDA; import org.fenixedu.bennu.struts.annotations.Input; import org.fenixedu.bennu.struts.annotations.Mapping; @Mapping(path = "/manageProgram", module = "teacher", functionality = ManageExecutionCourseDA.class, formBean = "programForm") public class ExecutionCourseProgramDA extends ManageExecutionCourseDA { @Input public ActionForward program(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return forward(request, "/teacher/executionCourse/program.jsp"); } public ActionForward prepareCreateProgram(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { prepareCurricularCourse(request); return forward(request, "/teacher/executionCourse/createProgram.jsp"); } public ActionForward createProgram(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixActionException, FenixServiceException { executeFactoryMethod(); return forward(request, "/teacher/executionCourse/program.jsp"); } public ActionForward prepareEditProgram(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { final ExecutionCourse executionCourse = (ExecutionCourse) request.getAttribute("executionCourse"); final Teacher teacher = getUserView(request).getPerson().getTeacher(); if (teacher.isResponsibleFor(executionCourse) == null) { ActionMessages messages = new ActionMessages(); messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.teacherNotResponsibleOrNotCoordinator")); saveErrors(request, messages); return forward(request, "/teacher/executionCourse/program.jsp"); } final String curriculumIDString = request.getParameter("curriculumID"); if (executionCourse != null && curriculumIDString != null && curriculumIDString.length() > 0) { final Curriculum curriculum = findCurriculum(executionCourse, curriculumIDString); if (curriculum != null) { final DynaActionForm dynaActionForm = (DynaActionForm) form; dynaActionForm.set("program", curriculum.getProgram()); dynaActionForm.set("programEn", curriculum.getProgramEn()); } request.setAttribute("curriculum", curriculum); } return forward(request, "/teacher/executionCourse/editProgram.jsp"); } public ActionForward editProgram(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixActionException, FenixServiceException { executeFactoryMethod(); return forward(request, "/teacher/executionCourse/program.jsp"); } }