1 | |
package org.kuali.student.lum.lu.ui.course.client.configuration; |
2 | |
|
3 | |
import org.kuali.student.common.dto.DtoConstants; |
4 | |
import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle; |
5 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.Section; |
6 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView; |
7 | |
import org.kuali.student.common.ui.client.mvc.View; |
8 | |
import org.kuali.student.common.ui.client.widgets.KSLabel; |
9 | |
import org.kuali.student.lum.common.client.lu.LUUIConstants; |
10 | |
import org.kuali.student.lum.lu.ui.course.client.controllers.CourseAdminRetireController; |
11 | |
import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController; |
12 | |
import org.kuali.student.lum.lu.ui.course.client.requirements.CourseRequirementsViewController; |
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | 0 | public class CourseAdminRetireConfigurer extends CourseProposalConfigurer{ |
21 | |
|
22 | |
protected CourseRequirementsViewController requisitesSection; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
@Override |
31 | |
public void configure(final CourseProposalController layout) { |
32 | 0 | type = "course"; |
33 | 0 | state = DtoConstants.STATE_RETIRED; |
34 | 0 | nextState = DtoConstants.STATE_RETIRED; |
35 | |
|
36 | 0 | groupName = LUUIConstants.COURSE_GROUP_NAME; |
37 | |
|
38 | 0 | KSLabel courseStatusLabel = new KSLabel(""); |
39 | 0 | if (layout.getCourseState() != null) |
40 | 0 | courseStatusLabel.setText("Status: " + layout.getCourseState()); |
41 | |
else |
42 | 0 | courseStatusLabel.setText("Status: Unknown"); |
43 | 0 | layout.addContentWidget(courseStatusLabel); |
44 | |
|
45 | 0 | layout.addView(generateCourseAdminView((CourseAdminRetireController)layout)); |
46 | 0 | } |
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
protected View generateCourseAdminView(final CourseAdminRetireController layout) { |
54 | 0 | VerticalSectionView view = |
55 | |
new VerticalSectionView(CourseSections.COURSE_INFO, getLabel(LUUIConstants.RETIREMENT_LABEL_KEY), COURSE_PROPOSAL_MODEL, false); |
56 | 0 | view.addStyleName(LUUIConstants.STYLE_SECTION); |
57 | |
|
58 | |
|
59 | 0 | Section activeDatesSection = generateActiveDatesSection(initSection(LUUIConstants.ACTIVE_DATES_LABEL_KEY)); |
60 | 0 | Section retirementSection = generateRetirementSection(initSection(LUUIConstants.RETIREMENT_LABEL_KEY)); |
61 | |
|
62 | |
|
63 | 0 | view.addSection(activeDatesSection); |
64 | 0 | view.addSection(retirementSection); |
65 | |
|
66 | |
|
67 | 0 | String sections = getLabel(LUUIConstants.COURSE_SECTIONS); |
68 | 0 | layout.addMenu(sections); |
69 | 0 | layout.addMenuItemSection(sections, getLabel(LUUIConstants.ACTIVE_DATES_LABEL_KEY), LUUIConstants.ACTIVE_DATES_LABEL_KEY, activeDatesSection.getLayout()); |
70 | 0 | layout.addMenuItemSection(sections, getLabel(LUUIConstants.RETIREMENT_LABEL_KEY), LUUIConstants.RETIREMENT_LABEL_KEY, retirementSection.getLayout()); |
71 | |
|
72 | |
|
73 | 0 | layout.addButtonForView(CourseSections.COURSE_INFO, layout.getSaveButton()); |
74 | 0 | layout.addButtonForView(CourseSections.COURSE_INFO, layout.getCancelButton()); |
75 | 0 | layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getSaveButton()); |
76 | 0 | layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getCancelButton()); |
77 | |
|
78 | 0 | return view; |
79 | |
} |
80 | |
|
81 | |
protected Section generateActiveDatesSection(Section section) { |
82 | 0 | addField(section, COURSE + "/" + START_TERM, generateMessageInfo(LUUIConstants.START_TERM_LABEL_KEY)); |
83 | 0 | addField(section, COURSE + "/" + END_TERM, generateMessageInfo(LUUIConstants.END_TERM_LABEL_KEY)); |
84 | |
|
85 | 0 | return section; |
86 | |
} |
87 | |
|
88 | |
protected Section generateRetirementSection(Section section) { |
89 | 0 | addField(section, COURSE + "/" + RETIREMENT_RATIONALE, generateMessageInfo(LUUIConstants.RETIREMENT_RATIONALE_LABEL_KEY)); |
90 | 0 | addField(section, COURSE + "/" + LAST_TERM_OFFERED, generateMessageInfo(LUUIConstants.LAST_TERM_OFFERED_LABEL_KEY)); |
91 | 0 | addField(section, COURSE + "/" + LAST_PUBLICATION_YEAR, generateMessageInfo(LUUIConstants.LAST_PUBLICATION_YEAR_LABEL_KEY)); |
92 | 0 | addField(section, COURSE + "/" + SPECIAL_CIRCUMSTANCES, generateMessageInfo(LUUIConstants.SPECIAL_CIRCUMSTANCES_LABEL_KEY)); |
93 | |
|
94 | 0 | return section; |
95 | |
} |
96 | |
|
97 | |
protected Section initSection(String labelKey){ |
98 | 0 | return initSection(SectionTitle.generateH2Title(getLabel(labelKey)), NO_DIVIDER); |
99 | |
} |
100 | |
|
101 | |
|
102 | |
} |