package fi.otavanopisto.pyramus.views.courses;
import java.util.Locale;
import fi.internetix.smvc.controllers.PageRequestContext;
import fi.otavanopisto.pyramus.I18N.Messages;
import fi.otavanopisto.pyramus.breadcrumbs.Breadcrumbable;
import fi.otavanopisto.pyramus.framework.PyramusViewController;
import fi.otavanopisto.pyramus.framework.UserRole;
/**
* The controller responsible of the Create Course view of the application.
*
* @see fi.otavanopisto.pyramus.json.users.CreateGradingScaleJSONRequestController
*/
public class CreateCourseWizardViewController extends PyramusViewController implements Breadcrumbable {
/**
* Processes the page request by including the corresponding JSP page to the response.
*
* @param pageRequestContext Page request context
*/
public void process(PageRequestContext pageRequestContext) {
pageRequestContext.setIncludeJSP("/templates/courses/createcoursewizard.jsp");
}
/**
* Returns the roles allowed to access this page. Creating courses is available for users with
* {@link Role#MANAGER} or {@link Role#ADMINISTRATOR} privileges.
*
* @return The roles allowed to access this page
*/
public UserRole[] getAllowedRoles() {
return new UserRole[] { UserRole.MANAGER, UserRole.STUDY_PROGRAMME_LEADER, UserRole.ADMINISTRATOR };
}
/**
* Returns the localized name of this page. Used e.g. for breadcrumb navigation.
*
* @param locale The locale to be used for the name
*
* @return The localized name of this page
*/
public String getName(Locale locale) {
return Messages.getInstance().getText(locale, "courses.createCourseWizard.pageTitle");
}
}