1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 public class CourseAdminWithoutVersionConfigurer extends CourseProposalConfigurer{
30 protected CourseRequirementsViewController requisitesSection;
31
32 private RequiredContainer requiredContainer = new RequiredContainer();
33
34
35
36
37
38
39
40 @Override
41 public void configure(final CourseProposalController layout) {
42 type = "course";
43 state = DtoConstants.STATE_APPROVED;
44 nextState = DtoConstants.STATE_ACTIVE;
45
46 groupName = LUUIConstants.COURSE_GROUP_NAME;
47
48 KSLabel courseStatusLabel = new KSLabel("");
49 if (layout.getCourseState() != null)
50 courseStatusLabel.setText("Status: " + layout.getCourseState());
51 else
52 courseStatusLabel.setText("Status: Unknown");
53 layout.addContentWidget(courseStatusLabel);
54
55 layout.addInfoWidget(requiredContainer);
56 layout.addView(generateCourseAdminView((CourseAdminWithoutVersionController)layout));
57 }
58
59
60
61
62
63
64 protected View generateCourseAdminView(final CourseAdminWithoutVersionController layout) {
65 VerticalSectionView view =
66 new VerticalSectionView(CourseSections.COURSE_INFO, getLabel(LUUIConstants.INFORMATION_LABEL_KEY), COURSE_PROPOSAL_MODEL, false);
67 view.addStyleName(LUUIConstants.STYLE_SECTION);
68
69
70 Section courseSection = generateCourseInfoSection(initSection(LUUIConstants.INFORMATION_LABEL_KEY));
71 Section governanceSection = generateGovernanceSection(initSection(LUUIConstants.GOVERNANCE_LABEL_KEY));
72 Section logisticsSection = generateCourseLogisticsSection(initSection(LUUIConstants.LOGISTICS_LABEL_KEY));
73 Section loSection = initSection(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY);
74 loSection.addSection(generateLearningObjectivesNestedSection());
75 Section activeDatesSection = generateActiveDatesSection(initSection(LUUIConstants.ACTIVE_DATES_LABEL_KEY));
76 Section financialSection = generateFinancialsSection(initSection(LUUIConstants.FINANCIALS_LABEL_KEY));
77 Section retireSection = generateRetirementSection(initSection(LUUIConstants.RETIREMENT_LABEL_KEY));
78
79
80 requisitesSection = new CourseRequirementsViewController(layout, getLabel(LUUIConstants.REQUISITES_LABEL_KEY), CourseSections.COURSE_REQUISITES, false, false);
81
82
83 view.addSection(courseSection);
84 view.addSection(governanceSection);
85 view.addSection(logisticsSection);
86 view.addSection(loSection);
87 view.addView(requisitesSection);
88 view.addSection(this.createHiddenRequisitesSection());
89 view.addSection(activeDatesSection);
90 view.addSection(financialSection);
91 view.addSection(retireSection);
92
93
94 String sections = getLabel(LUUIConstants.COURSE_SECTIONS);
95 layout.addMenu(sections);
96 layout.addMenuItemSection(sections, getLabel(LUUIConstants.INFORMATION_LABEL_KEY), LUUIConstants.INFORMATION_LABEL_KEY, courseSection.getLayout());
97 layout.addMenuItemSection(sections, getLabel(LUUIConstants.GOVERNANCE_LABEL_KEY), LUUIConstants.GOVERNANCE_LABEL_KEY, governanceSection.getLayout());
98 layout.addMenuItemSection(sections, getLabel(LUUIConstants.LOGISTICS_LABEL_KEY), LUUIConstants.LOGISTICS_LABEL_KEY, logisticsSection.getLayout());
99 layout.addMenuItemSection(sections, getLabel(LUUIConstants.LEARNING_OBJECTIVE_LABEL_KEY), LUUIConstants.LEARNING_OBJECTIVE_LABEL_KEY, loSection.getLayout());
100 layout.addMenuItemSection(sections, getLabel(LUUIConstants.REQUISITES_LABEL_KEY), LUUIConstants.REQUISITES_LABEL_KEY, requisitesSection);
101 layout.addMenuItemSection(sections, getLabel(LUUIConstants.ACTIVE_DATES_LABEL_KEY), LUUIConstants.ACTIVE_DATES_LABEL_KEY, activeDatesSection.getLayout());
102 layout.addMenuItemSection(sections, getLabel(LUUIConstants.FINANCIALS_LABEL_KEY), LUUIConstants.FINANCIALS_LABEL_KEY, financialSection.getLayout());
103 layout.addMenuItemSection(sections, getLabel(LUUIConstants.RETIREMENT_LABEL_KEY), LUUIConstants.RETIREMENT_LABEL_KEY, retireSection.getLayout());
104
105
106 layout.addButtonForView(CourseSections.COURSE_INFO, layout.getSaveButton());
107 layout.addButtonForView(CourseSections.COURSE_INFO, layout.getCancelButton());
108 layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getSaveButton());
109 layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getCancelButton());
110
111 requiredContainer.setMainSection(view);
112
113 return view;
114 }
115
116
117
118
119
120
121 @Override
122 public Section generateCourseInfoSection(Section section) {
123 addField(section, COURSE + "/" + COURSE_TITLE, generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY));
124 addField(section, COURSE + "/" + TRANSCRIPT_TITLE, generateMessageInfo(LUUIConstants.SHORT_TITLE_LABEL_KEY));
125 section.addSection(generateCourseNumberSection());
126 FieldDescriptor instructorsFd = addField(section, COURSE + "/" + INSTRUCTORS, generateMessageInfo(LUUIConstants.INSTRUCTORS_LABEL_KEY));
127 instructorsFd.setWidgetBinding(new KeyListModelWigetBinding("personId"));
128
129 section.addSection(generateDescriptionRationaleSection());
130
131 return section;
132 }
133
134
135
136
137
138
139 @Override
140 protected VerticalSection generateDescriptionRationaleSection() {
141 SectionTitle title = getH4Title(LUUIConstants.PROPOSAL_TITLE_SECTION_LABEL_KEY);
142 VerticalSection description = initSection(title, !WITH_DIVIDER);
143 title.setStyleName("cluProposalTitleSection");
144 addField(description, COURSE + "/" + DESCRIPTION + "/" + RichTextInfoConstants.PLAIN, generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY));
145 return description;
146 }
147
148 public CourseRequirementsViewController getRequisitesSection(CourseAdminController layout) {
149 if(requisitesSection == null){
150 requisitesSection = new CourseRequirementsViewController(layout, getLabel(LUUIConstants.REQUISITES_LABEL_KEY), CourseSections.COURSE_REQUISITES, false, false);
151 }
152 return requisitesSection;
153 }
154
155 protected Section generateRetirementSection(Section section) {
156 addField(section, COURSE + "/" + RETIREMENT_RATIONALE, generateMessageInfo(LUUIConstants.RETIREMENT_RATIONALE_LABEL_KEY));
157 addField(section, COURSE + "/" + LAST_TERM_OFFERED, generateMessageInfo(LUUIConstants.LAST_TERM_OFFERED_LABEL_KEY));
158 addField(section, COURSE + "/" + LAST_PUBLICATION_YEAR, generateMessageInfo(LUUIConstants.LAST_PUBLICATION_YEAR_LABEL_KEY));
159 addField(section, COURSE + "/" + SPECIAL_CIRCUMSTANCES, generateMessageInfo(LUUIConstants.SPECIAL_CIRCUMSTANCES_LABEL_KEY));
160
161 return section;
162 }
163 protected VerticalSection initSection(String labelKey) {
164 final VerticalSection section = initSection(SectionTitle.generateH2Title(getLabel(labelKey)), NO_DIVIDER);
165
166 section.addShowAllLink(requiredContainer.createShowAllLink(new ClickHandler() {
167
168 @Override
169 public void onClick(ClickEvent event) {
170 requiredContainer.processInnerSection(section, true);
171 section.getShowAllLink().setVisible(false);
172 }
173 }));
174
175 return section;
176 }
177
178 private VerticalSection createHiddenRequisitesSection() {
179 final VerticalSection section = initSection(SectionTitle.generateH2Title(getLabel(LUUIConstants.REQUISITES_LABEL_KEY)), NO_DIVIDER);
180
181 section.addShowAllLink(requiredContainer.createShowAllLink(new ClickHandler() {
182
183 @Override
184 public void onClick(ClickEvent event) {
185 requisitesSection.asWidget().setVisible(true);
186 section.getLayout().setVisible(false);
187 }
188 }));
189
190
191 requiredContainer.addCallback(new Callback<Boolean>() {
192
193 @Override
194 public void exec(Boolean result) {
195 requisitesSection.asWidget().setVisible(result);
196 section.getLayout().setVisible(!result);
197 }
198 });
199 return section;
200 }
201
202 public CourseRequirementsViewController getRequisitesSection() {
203 return requisitesSection;
204 }
205
206 }