1 | |
package org.kuali.student.lum.lu.ui.course.client.configuration; |
2 | |
|
3 | |
import java.util.ArrayList; |
4 | |
import java.util.Arrays; |
5 | |
import java.util.HashMap; |
6 | |
import java.util.Iterator; |
7 | |
import java.util.List; |
8 | |
import java.util.Map; |
9 | |
|
10 | |
import org.kuali.student.common.assembly.data.Data; |
11 | |
import org.kuali.student.common.assembly.data.Metadata; |
12 | |
import org.kuali.student.common.assembly.data.QueryPath; |
13 | |
import org.kuali.student.common.assembly.data.Data.Property; |
14 | |
import org.kuali.student.common.ui.client.application.Application; |
15 | |
import org.kuali.student.common.ui.client.configurable.mvc.Configurer; |
16 | |
import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptorReadOnly; |
17 | |
import org.kuali.student.common.ui.client.configurable.mvc.LayoutController; |
18 | |
import org.kuali.student.common.ui.client.configurable.mvc.binding.ListToTextBinding; |
19 | |
import org.kuali.student.common.ui.client.configurable.mvc.binding.ModelWidgetBinding; |
20 | |
import org.kuali.student.common.ui.client.configurable.mvc.layouts.MenuSectionController; |
21 | |
import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityConfiguration; |
22 | |
import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityFieldConfiguration; |
23 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.WarnContainer; |
24 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView; |
25 | |
import org.kuali.student.common.ui.client.mvc.Callback; |
26 | |
import org.kuali.student.common.ui.client.mvc.Controller; |
27 | |
import org.kuali.student.common.ui.client.mvc.DataModel; |
28 | |
import org.kuali.student.common.ui.client.mvc.DataModelDefinition; |
29 | |
import org.kuali.student.common.ui.client.widgets.KSButton; |
30 | |
import org.kuali.student.common.ui.client.widgets.KSLabel; |
31 | |
import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle; |
32 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.MessageKeyInfo; |
33 | |
import org.kuali.student.common.ui.client.widgets.menus.KSListPanel; |
34 | |
import org.kuali.student.common.ui.client.widgets.table.summary.ShowRowConditionCallback; |
35 | |
import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableBlock; |
36 | |
import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableFieldBlock; |
37 | |
import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableFieldRow; |
38 | |
import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableSection; |
39 | |
import org.kuali.student.common.validation.dto.ValidationResultInfo; |
40 | |
import org.kuali.student.common.validation.dto.ValidationResultInfo.ErrorLevel; |
41 | |
import org.kuali.student.core.comments.ui.client.widgets.commenttool.CommentTool; |
42 | |
import org.kuali.student.core.comments.ui.client.widgets.commenttool.CommentTool.EditMode; |
43 | |
import org.kuali.student.core.document.ui.client.widgets.documenttool.DocumentList; |
44 | |
import org.kuali.student.core.document.ui.client.widgets.documenttool.DocumentListBinding; |
45 | |
import org.kuali.student.core.statement.dto.StatementTreeViewInfo; |
46 | |
import org.kuali.student.core.statement.dto.StatementTypeInfo; |
47 | |
import org.kuali.student.core.statement.ui.client.widgets.rules.SubrulePreviewWidget; |
48 | |
import org.kuali.student.core.workflow.ui.client.widgets.WorkflowEnhancedNavController; |
49 | |
import org.kuali.student.lum.common.client.lo.TreeStringBinding; |
50 | |
import org.kuali.student.lum.common.client.lu.LUUIConstants; |
51 | |
import org.kuali.student.lum.common.client.widgets.AppLocations; |
52 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.base.AcademicSubjectOrgInfoConstants; |
53 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.base.MetaInfoConstants; |
54 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.base.RichTextInfoConstants; |
55 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.orch.AffiliatedOrgInfoConstants; |
56 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseActivityConstants; |
57 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseConstants; |
58 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseDurationConstants; |
59 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseExpenditureInfoConstants; |
60 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseFormatConstants; |
61 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseJointsConstants; |
62 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseProposalConstants; |
63 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseProposalInfoConstants; |
64 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseRevenueInfoConstants; |
65 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.orch.FeeInfoConstants; |
66 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.orch.LearningObjectiveConstants; |
67 | |
import org.kuali.student.lum.lu.ui.course.client.configuration.CourseProposalConfigurer.CourseSections; |
68 | |
import org.kuali.student.lum.lu.ui.course.client.configuration.CourseProposalConfigurer.KeyListModelWigetBinding; |
69 | |
import org.kuali.student.lum.lu.ui.course.client.configuration.ViewCourseConfigurer.ViewCourseSections; |
70 | |
import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController; |
71 | |
import org.kuali.student.lum.lu.ui.course.client.controllers.VersionsController; |
72 | |
import org.kuali.student.lum.lu.ui.course.client.requirements.CourseRequirementsSummaryView; |
73 | |
import org.kuali.student.lum.lu.ui.course.client.requirements.HasRequirements; |
74 | |
|
75 | |
import com.google.gwt.core.client.GWT; |
76 | |
import com.google.gwt.event.dom.client.ClickEvent; |
77 | |
import com.google.gwt.event.dom.client.ClickHandler; |
78 | |
import com.google.gwt.user.client.ui.Anchor; |
79 | |
import com.google.gwt.user.client.ui.FlowPanel; |
80 | |
import com.google.gwt.user.client.ui.HTML; |
81 | |
import com.google.gwt.user.client.ui.Widget; |
82 | |
|
83 | 0 | public class CourseSummaryConfigurer extends Configurer implements |
84 | |
CreditCourseProposalConstants, CreditCourseProposalInfoConstants, |
85 | |
CreditCourseConstants, CreditCourseFormatConstants, |
86 | |
CreditCourseActivityConstants, MetaInfoConstants, |
87 | |
CreditCourseDurationConstants, FeeInfoConstants, |
88 | |
LearningObjectiveConstants, AcademicSubjectOrgInfoConstants, |
89 | |
AffiliatedOrgInfoConstants, CreditCourseRevenueInfoConstants, |
90 | |
CreditCourseExpenditureInfoConstants { |
91 | |
|
92 | |
public static final String PROPOSAL = ""; |
93 | |
public static final String COURSE = ""; |
94 | |
public static final String PROPOSAL_TITLE_PATH = "proposal/name"; |
95 | |
|
96 | |
private static final String OPTIONAL = "o"; |
97 | |
|
98 | 0 | private List<ValidationResultInfo> validationInfos = new ArrayList<ValidationResultInfo>(); |
99 | 0 | private boolean showingValidation = false; |
100 | |
|
101 | |
private List<StatementTypeInfo> stmtTypes; |
102 | |
|
103 | |
private Controller controller; |
104 | |
private SummaryTableSection tableSection; |
105 | |
private String modelId; |
106 | |
|
107 | 0 | private List<Anchor> validateLinks = new ArrayList<Anchor>(); |
108 | |
|
109 | |
private class EditHandler implements ClickHandler { |
110 | |
|
111 | |
Enum<?> view; |
112 | |
|
113 | 0 | public EditHandler(Enum<?> view) { |
114 | 0 | this.view = view; |
115 | 0 | } |
116 | |
|
117 | |
@Override |
118 | |
public void onClick(ClickEvent event) { |
119 | 0 | controller.showView(view); |
120 | 0 | } |
121 | |
} |
122 | |
|
123 | |
public CourseSummaryConfigurer(String type, String state, String groupName, |
124 | |
DataModelDefinition modelDefinition, |
125 | |
List<StatementTypeInfo> stmtTypes, Controller controller, |
126 | 0 | String modelId) { |
127 | 0 | this.type = type; |
128 | 0 | this.state = state; |
129 | 0 | this.groupName = groupName; |
130 | 0 | this.modelDefinition = modelDefinition; |
131 | 0 | this.stmtTypes = stmtTypes; |
132 | 0 | this.controller = controller; |
133 | 0 | this.modelId = modelId; |
134 | 0 | tableSection = new SummaryTableSection((Controller) controller); |
135 | 0 | } |
136 | |
|
137 | |
protected VerticalSectionView initSectionView(Enum<?> viewEnum, |
138 | |
String labelKey) { |
139 | 0 | VerticalSectionView section = new VerticalSectionView(viewEnum, |
140 | |
getLabel(labelKey), modelId); |
141 | 0 | section.addStyleName(LUUIConstants.STYLE_SECTION); |
142 | 0 | return section; |
143 | |
} |
144 | |
|
145 | |
protected SummaryTableFieldRow getFieldRow(String fieldKey, |
146 | |
MessageKeyInfo messageKey) { |
147 | 0 | return getFieldRow(fieldKey, messageKey, null, null, null, null, false); |
148 | |
} |
149 | |
|
150 | |
protected SummaryTableFieldRow getFieldRow(String fieldKey, |
151 | |
MessageKeyInfo messageKey, boolean optional) { |
152 | 0 | return getFieldRow(fieldKey, messageKey, null, null, null, null, |
153 | |
optional); |
154 | |
} |
155 | |
|
156 | |
protected SummaryTableFieldRow getFieldRow(String fieldKey, |
157 | |
MessageKeyInfo messageKey, Widget widget, Widget widget2, |
158 | |
String parentPath, ModelWidgetBinding<?> binding, boolean optional) { |
159 | 0 | QueryPath path = QueryPath.concat(parentPath, fieldKey); |
160 | 0 | Metadata meta = modelDefinition.getMetadata(path); |
161 | |
|
162 | 0 | FieldDescriptorReadOnly fd = new FieldDescriptorReadOnly( |
163 | |
path.toString(), messageKey, meta); |
164 | 0 | if (widget != null) { |
165 | 0 | fd.setFieldWidget(widget); |
166 | |
} |
167 | 0 | if (binding != null) { |
168 | 0 | fd.setWidgetBinding(binding); |
169 | |
} |
170 | 0 | fd.setOptional(optional); |
171 | |
|
172 | 0 | FieldDescriptorReadOnly fd2 = new FieldDescriptorReadOnly( |
173 | |
path.toString(), messageKey, meta); |
174 | 0 | if (widget2 != null) { |
175 | 0 | fd2.setFieldWidget(widget2); |
176 | |
} |
177 | 0 | if (binding != null) { |
178 | 0 | fd2.setWidgetBinding(binding); |
179 | |
} |
180 | 0 | fd2.setOptional(optional); |
181 | |
|
182 | 0 | SummaryTableFieldRow fieldRow = new SummaryTableFieldRow(fd, fd2); |
183 | |
|
184 | 0 | return fieldRow; |
185 | |
} |
186 | |
|
187 | |
public VerticalSectionView generateProposalSummarySection(boolean canEditSections) { |
188 | 0 | tableSection.setEditable(canEditSections); |
189 | 0 | tableSection.addSummaryTableFieldBlock(generateCourseInformationForProposal()); |
190 | 0 | tableSection.addSummaryTableFieldBlock(generateCourseInformationForProposalCrossListed()); |
191 | 0 | tableSection.addSummaryTableFieldBlock(generateGovernanceSection()); |
192 | 0 | tableSection.addSummaryTableFieldBlock(generateCourseLogisticsSection()); |
193 | 0 | tableSection.addSummaryTableFieldBlock(generateLearningObjectivesSection()); |
194 | 0 | tableSection.addSummaryTableFieldBlock(generateRequirementsSection()); |
195 | 0 | tableSection.addSummaryTableFieldBlock(generateActiveDatesSection()); |
196 | 0 | tableSection.addSummaryTableFieldBlock(generateFeesSection()); |
197 | 0 | tableSection.addSummaryTableFieldBlock(generateProposalDocumentsSection()); |
198 | |
|
199 | 0 | if (controller instanceof WorkflowEnhancedNavController |
200 | |
&& ((WorkflowEnhancedNavController) controller).getWfUtilities() != null) { |
201 | |
|
202 | |
final WarnContainer infoContainer1; |
203 | |
final WarnContainer infoContainer2; |
204 | |
|
205 | 0 | infoContainer1 = generateWorkflowWidgetContainer(((WorkflowEnhancedNavController) controller) |
206 | |
.getWfUtilities().getWorkflowActionsWidget()); |
207 | 0 | infoContainer2 = generateWorkflowWidgetContainer(((WorkflowEnhancedNavController) controller) |
208 | |
.getWfUtilities().getWorkflowActionsWidget()); |
209 | |
|
210 | 0 | ((WorkflowEnhancedNavController) controller).getWfUtilities() |
211 | 0 | .addSubmitCallback(new Callback<Boolean>() { |
212 | |
|
213 | |
@Override |
214 | |
public void exec(Boolean result) { |
215 | 0 | if (result) { |
216 | 0 | tableSection.setEditable(false); |
217 | 0 | if (controller instanceof MenuSectionController) { |
218 | 0 | ((MenuSectionController) controller).removeMenuNavigation(); |
219 | |
} |
220 | |
} |
221 | |
|
222 | 0 | } |
223 | |
}); |
224 | |
|
225 | |
|
226 | 0 | VerticalSectionView verticalSection = new VerticalSectionView( |
227 | |
CourseSections.SUMMARY, |
228 | 0 | getLabel(LUUIConstants.SUMMARY_LABEL_KEY), modelId) { |
229 | |
@Override |
230 | |
public void beforeShow(final Callback<Boolean> onReadyCallback) { |
231 | |
|
232 | 0 | super.beforeShow(new Callback<Boolean>() { |
233 | |
|
234 | |
@Override |
235 | |
public void exec(final Boolean result) { |
236 | |
|
237 | 0 | if (result) { |
238 | |
|
239 | 0 | ((WorkflowEnhancedNavController) controller).getWfUtilities().refresh(); |
240 | |
|
241 | |
|
242 | 0 | ((WorkflowEnhancedNavController) controller).getWfUtilities() |
243 | 0 | .doValidationCheck(new Callback<List<ValidationResultInfo>>() { |
244 | |
@Override |
245 | |
public void exec(List<ValidationResultInfo> validationResult) { |
246 | |
|
247 | 0 | tableSection.enableValidation(showingValidation); |
248 | 0 | ErrorLevel isValid = tableSection.processValidationResults( |
249 | |
validationResult, true); |
250 | |
|
251 | 0 | validationInfos = validationResult; |
252 | 0 | if (isValid == ErrorLevel.OK) { |
253 | 0 | infoContainer1.showWarningLayout(false); |
254 | 0 | infoContainer2.showWarningLayout(false); |
255 | 0 | ((WorkflowEnhancedNavController) controller) |
256 | |
.getWfUtilities() |
257 | |
.enableWorkflowActionsWidgets(true); |
258 | |
} else { |
259 | |
|
260 | 0 | infoContainer1.clearWarnLayout(); |
261 | 0 | infoContainer2.clearWarnLayout(); |
262 | |
|
263 | 0 | if (tableSection.getHasWarnings()) { |
264 | |
|
265 | 0 | infoContainer1 |
266 | |
.addWarnWidgetBlock(new KSLabel( |
267 | |
"This proposal contains warnings that prevent it from being submitted.")); |
268 | 0 | infoContainer2 |
269 | |
.addWarnWidgetBlock(new KSLabel( |
270 | |
"This proposal contains warnings that prevent it from being submitted.")); |
271 | |
} |
272 | |
|
273 | 0 | if (tableSection.getIsMissingFields()) { |
274 | |
|
275 | 0 | final Anchor link1 = new Anchor("Show what's missing."); |
276 | 0 | final Anchor link2 = new Anchor("Show what's missing."); |
277 | 0 | ClickHandler showHideMsgClickHandler = new ClickHandler() { |
278 | |
|
279 | |
|
280 | |
@Override |
281 | |
public void onClick(ClickEvent event) { |
282 | 0 | if (!showingValidation) { |
283 | |
|
284 | 0 | for (int i = 0; i < validateLinks.size(); i++) { |
285 | 0 | validateLinks.get(i).setText( |
286 | |
"Hide error highlighting."); |
287 | |
} |
288 | 0 | showingValidation = true; |
289 | 0 | tableSection.enableValidation(showingValidation); |
290 | 0 | tableSection.processValidationResults( |
291 | |
validationInfos, true); |
292 | |
} else { |
293 | |
|
294 | 0 | for (int i = 0; i < validateLinks.size(); i++) { |
295 | 0 | validateLinks.get(i).setText( |
296 | |
"Show what's missing."); |
297 | |
} |
298 | 0 | showingValidation = false; |
299 | 0 | tableSection.enableValidation(showingValidation); |
300 | 0 | tableSection.removeValidationHighlighting(); |
301 | |
} |
302 | 0 | } |
303 | |
}; |
304 | |
|
305 | |
|
306 | 0 | validateLinks.add(link1); |
307 | 0 | validateLinks.add(link2); |
308 | |
|
309 | 0 | link1.addClickHandler(showHideMsgClickHandler); |
310 | 0 | link2.addClickHandler(showHideMsgClickHandler); |
311 | |
|
312 | 0 | infoContainer1.addWarnWidget(new KSLabel( |
313 | |
"This proposal has missing fields. ")); |
314 | 0 | infoContainer1.addWarnWidget(link1); |
315 | 0 | infoContainer2.addWarnWidget(new KSLabel( |
316 | |
"This proposal has missing fields. ")); |
317 | 0 | infoContainer2.addWarnWidget(link2); |
318 | |
} |
319 | |
|
320 | 0 | infoContainer1.showWarningLayout(true); |
321 | 0 | infoContainer2.showWarningLayout(true); |
322 | 0 | ((WorkflowEnhancedNavController) controller).getWfUtilities() |
323 | |
.enableWorkflowActionsWidgets(false); |
324 | |
} |
325 | |
|
326 | 0 | onReadyCallback.exec(result); |
327 | 0 | } |
328 | |
}); |
329 | |
} else { |
330 | 0 | onReadyCallback.exec(result); |
331 | |
} |
332 | 0 | } |
333 | |
}); |
334 | 0 | } |
335 | |
}; |
336 | |
|
337 | 0 | verticalSection.addWidget(infoContainer1); |
338 | 0 | verticalSection.addSection(tableSection); |
339 | 0 | verticalSection.addWidget(infoContainer2); |
340 | |
|
341 | 0 | return verticalSection; |
342 | |
|
343 | |
} else { |
344 | |
|
345 | 0 | VerticalSectionView verticalSection = new VerticalSectionView( |
346 | |
CourseSections.SUMMARY, |
347 | |
getLabel(LUUIConstants.SUMMARY_LABEL_KEY), modelId); |
348 | 0 | verticalSection.addSection(tableSection); |
349 | 0 | GWT.log("CourseSummaryConfigurer - Summary table needs a workflow controller to provide submit/validation mechanism"); |
350 | |
|
351 | 0 | return verticalSection; |
352 | |
} |
353 | |
|
354 | |
} |
355 | |
|
356 | |
private SummaryTableFieldBlock generateProposalDocumentsSection() { |
357 | 0 | SummaryTableFieldBlock block = new SummaryTableFieldBlock(); |
358 | 0 | block.addEditingHandler(new EditHandler(CourseSections.DOCUMENTS)); |
359 | 0 | block.setTitle(getLabel(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY)); |
360 | 0 | block.addSummaryTableFieldRow(getFieldRow("proposal/id", |
361 | |
generateMessageInfo(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY), |
362 | |
new DocumentList(LUUIConstants.REF_DOC_RELATION_PROPOSAL_TYPE, |
363 | |
false, false), new DocumentList( |
364 | |
LUUIConstants.REF_DOC_RELATION_PROPOSAL_TYPE, false, |
365 | |
false), null, new DocumentListBinding("proposal/id"), |
366 | |
false)); |
367 | 0 | return block; |
368 | |
} |
369 | |
|
370 | |
|
371 | |
private WarnContainer generateWorkflowWidgetContainer(Widget w) { |
372 | |
|
373 | 0 | WarnContainer warnContainer = new WarnContainer(); |
374 | |
|
375 | 0 | warnContainer.add(w); |
376 | 0 | w.addStyleName("ks-button-spacing"); |
377 | 0 | warnContainer.add(new KSButton("Return to Curriculum Management", |
378 | 0 | ButtonStyle.DEFAULT_ANCHOR, new ClickHandler() { |
379 | |
|
380 | |
@Override |
381 | |
public void onClick(ClickEvent event) { |
382 | 0 | Application |
383 | |
.navigate(AppLocations.Locations.CURRICULUM_MANAGEMENT |
384 | |
.getLocation()); |
385 | 0 | } |
386 | |
})); |
387 | |
|
388 | |
|
389 | |
|
390 | 0 | return warnContainer; |
391 | |
} |
392 | |
|
393 | |
public VerticalSectionView generateCourseSummarySection() { |
394 | 0 | tableSection.setEditable(false); |
395 | 0 | tableSection.addSummaryTableFieldBlock(generateCourseInformation()); |
396 | 0 | tableSection |
397 | |
.addSummaryTableFieldBlock(generateCourseInformationCrossListing()); |
398 | 0 | tableSection.addSummaryTableFieldBlock(generateGovernanceSection()); |
399 | 0 | tableSection |
400 | |
.addSummaryTableFieldBlock(generateCourseLogisticsSection()); |
401 | 0 | tableSection |
402 | |
.addSummaryTableFieldBlock(generateLearningObjectivesSection()); |
403 | 0 | tableSection.addSummaryTableFieldBlock(generateRequirementsSection()); |
404 | 0 | tableSection.addSummaryTableFieldBlock(generateActiveDatesSection()); |
405 | 0 | tableSection.addSummaryTableFieldBlock(generateFeesSection()); |
406 | |
|
407 | 0 | VerticalSectionView verticalSection = new VerticalSectionView( |
408 | |
ViewCourseSections.DETAILED, |
409 | |
getLabel(LUUIConstants.SUMMARY_LABEL_KEY), modelId, false); |
410 | 0 | verticalSection.addSection(tableSection); |
411 | |
|
412 | 0 | return verticalSection; |
413 | |
} |
414 | |
|
415 | |
@SuppressWarnings("unchecked") |
416 | |
public SummaryTableFieldBlock generateCourseInformationForProposal() { |
417 | 0 | SummaryTableFieldBlock block = new SummaryTableFieldBlock(); |
418 | 0 | block.addEditingHandler(new EditHandler(CourseSections.COURSE_INFO)); |
419 | 0 | block.setTitle(getLabel(LUUIConstants.INFORMATION_LABEL_KEY)); |
420 | 0 | block.addSummaryTableFieldRow(getFieldRow(PROPOSAL_TITLE_PATH, |
421 | |
generateMessageInfo(LUUIConstants.PROPOSAL_TITLE_LABEL_KEY))); |
422 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE, |
423 | |
generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY))); |
424 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
425 | |
+ TRANSCRIPT_TITLE, |
426 | |
generateMessageInfo(LUUIConstants.SHORT_TITLE_LABEL_KEY))); |
427 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + SUBJECT_AREA, |
428 | |
generateMessageInfo(LUUIConstants.SUBJECT_CODE_LABEL_KEY))); |
429 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
430 | |
+ COURSE_NUMBER_SUFFIX, |
431 | |
generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY))); |
432 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + INSTRUCTORS, |
433 | |
generateMessageInfo(LUUIConstants.INSTRUCTORS_LABEL_KEY), null, |
434 | |
null, null, new KeyListModelWigetBinding("personId"), false)); |
435 | |
|
436 | |
|
437 | |
|
438 | |
|
439 | |
|
440 | |
|
441 | |
|
442 | 0 | return block; |
443 | |
} |
444 | |
|
445 | |
@SuppressWarnings("unchecked") |
446 | |
public SummaryTableFieldBlock generateCourseInformationForProposalCrossListed() { |
447 | 0 | SummaryTableFieldBlock block = new SummaryTableFieldBlock(); |
448 | 0 | block.addEditingHandler(new EditHandler(CourseSections.COURSE_INFO)); |
449 | 0 | block.setTitle("Cross Listed Courses"); |
450 | |
|
451 | 0 | block.addSummaryMultiplicity(getMultiplicityConfig( |
452 | |
COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS, |
453 | |
LUUIConstants.CROSS_LISTED_ITEM_LABEL_KEY, Arrays.asList(Arrays |
454 | |
.asList(SUBJECT_AREA, |
455 | |
LUUIConstants.SUBJECT_CODE_LABEL_KEY), Arrays |
456 | |
.asList(COURSE_NUMBER_SUFFIX, |
457 | |
LUUIConstants.COURSE_NUMBER_LABEL_KEY)))); |
458 | |
|
459 | 0 | block.addSummaryMultiplicity(getMultiplicityConfig( |
460 | |
COURSE + QueryPath.getPathSeparator() + JOINTS, |
461 | |
LUUIConstants.JOINT_OFFER_ITEM_LABEL_KEY, |
462 | |
Arrays.asList(Arrays.asList( |
463 | |
CreditCourseJointsConstants.COURSE_ID, |
464 | |
LUUIConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY)))); |
465 | |
|
466 | 0 | block.addSummaryMultiplicity(getMultiplicityConfig( |
467 | |
COURSE + QueryPath.getPathSeparator() + VERSIONS, |
468 | |
LUUIConstants.VERSION_CODE_LABEL_KEY, Arrays.asList(Arrays |
469 | |
.asList("variationCode", |
470 | |
LUUIConstants.VERSION_CODE_LABEL_KEY), |
471 | |
Arrays.asList("variationTitle", |
472 | |
LUUIConstants.TITLE_LABEL_KEY)))); |
473 | |
|
474 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
475 | |
+ PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN, |
476 | |
generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY))); |
477 | 0 | block.addSummaryTableFieldRow(getFieldRow("proposal/rationale", |
478 | |
generateMessageInfo(LUUIConstants.PROPOSAL_RATIONALE_LABEL_KEY))); |
479 | |
|
480 | 0 | return block; |
481 | |
} |
482 | |
|
483 | |
public SummaryTableFieldBlock generateCourseInformation() { |
484 | 0 | SummaryTableFieldBlock block = new SummaryTableFieldBlock(); |
485 | 0 | block.addEditingHandler(new EditHandler(CourseSections.COURSE_INFO)); |
486 | 0 | block.setTitle(getLabel(LUUIConstants.INFORMATION_LABEL_KEY)); |
487 | |
|
488 | |
|
489 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE, |
490 | |
generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY))); |
491 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
492 | |
+ TRANSCRIPT_TITLE, |
493 | |
generateMessageInfo(LUUIConstants.SHORT_TITLE_LABEL_KEY))); |
494 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + SUBJECT_AREA, |
495 | |
generateMessageInfo(LUUIConstants.SUBJECT_CODE_LABEL_KEY))); |
496 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
497 | |
+ COURSE_NUMBER_SUFFIX, |
498 | |
generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY))); |
499 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + INSTRUCTORS, |
500 | |
generateMessageInfo(LUUIConstants.INSTRUCTORS_LABEL_KEY), null, |
501 | |
null, null, new KeyListModelWigetBinding("personId"), false)); |
502 | 0 | SummaryTableFieldBlock aRow = new SummaryTableFieldBlock(); |
503 | 0 | aRow.setTitle("Fixing it"); |
504 | |
|
505 | 0 | aRow.addSummaryMultiplicity(getMultiplicityConfig( |
506 | |
COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS, |
507 | |
LUUIConstants.CROSS_LISTED_ITEM_LABEL_KEY, Arrays.asList(Arrays |
508 | |
.asList(SUBJECT_AREA, |
509 | |
LUUIConstants.SUBJECT_CODE_LABEL_KEY), Arrays |
510 | |
.asList(COURSE_NUMBER_SUFFIX, |
511 | |
LUUIConstants.COURSE_NUMBER_LABEL_KEY)))); |
512 | |
|
513 | 0 | block.addSummaryMultiplicity(getMultiplicityConfig( |
514 | |
COURSE + QueryPath.getPathSeparator() + JOINTS, |
515 | |
LUUIConstants.JOINT_OFFER_ITEM_LABEL_KEY, |
516 | |
Arrays.asList(Arrays.asList( |
517 | |
CreditCourseJointsConstants.COURSE_ID, |
518 | |
LUUIConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY)))); |
519 | 0 | block.addSummaryMultiplicity(getMultiplicityConfig( |
520 | |
COURSE + QueryPath.getPathSeparator() + VERSIONS, |
521 | |
LUUIConstants.VERSION_CODE_LABEL_KEY, Arrays.asList(Arrays |
522 | |
.asList("variationCode", |
523 | |
LUUIConstants.VERSION_CODE_LABEL_KEY), |
524 | |
Arrays.asList("variationTitle", |
525 | |
LUUIConstants.TITLE_LABEL_KEY)))); |
526 | |
|
527 | |
|
528 | |
|
529 | |
|
530 | |
|
531 | 0 | return block; |
532 | |
} |
533 | |
|
534 | |
public SummaryTableFieldBlock generateCourseInformationCrossListing() { |
535 | 0 | SummaryTableFieldBlock block = new SummaryTableFieldBlock(); |
536 | 0 | block.addEditingHandler(new EditHandler(CourseSections.COURSE_INFO)); |
537 | 0 | block.setTitle("Cross Listings"); |
538 | |
|
539 | 0 | block.addSummaryMultiplicity(getMultiplicityConfig( |
540 | |
COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS, |
541 | |
LUUIConstants.CROSS_LISTED_ITEM_LABEL_KEY, Arrays.asList(Arrays |
542 | |
.asList(SUBJECT_AREA, |
543 | |
LUUIConstants.SUBJECT_CODE_LABEL_KEY), Arrays |
544 | |
.asList(COURSE_NUMBER_SUFFIX, |
545 | |
LUUIConstants.COURSE_NUMBER_LABEL_KEY)))); |
546 | |
|
547 | 0 | block.addSummaryMultiplicity(getMultiplicityConfig( |
548 | |
COURSE + QueryPath.getPathSeparator() + JOINTS, |
549 | |
LUUIConstants.JOINT_OFFER_ITEM_LABEL_KEY, |
550 | |
Arrays.asList(Arrays.asList( |
551 | |
CreditCourseJointsConstants.COURSE_ID, |
552 | |
LUUIConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY)))); |
553 | 0 | block.addSummaryMultiplicity(getMultiplicityConfig( |
554 | |
COURSE + QueryPath.getPathSeparator() + VERSIONS, |
555 | |
LUUIConstants.VERSION_CODE_LABEL_KEY, Arrays.asList(Arrays |
556 | |
.asList("variationCode", |
557 | |
LUUIConstants.VERSION_CODE_LABEL_KEY), |
558 | |
Arrays.asList("variationTitle", |
559 | |
LUUIConstants.TITLE_LABEL_KEY)))); |
560 | |
|
561 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
562 | |
+ PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN, |
563 | |
generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY))); |
564 | |
|
565 | 0 | return block; |
566 | |
} |
567 | |
|
568 | |
public SummaryTableFieldBlock generateGovernanceSection() { |
569 | 0 | SummaryTableFieldBlock block = new SummaryTableFieldBlock(); |
570 | 0 | block.addEditingHandler(new EditHandler(CourseSections.GOVERNANCE)); |
571 | 0 | block.setTitle(getLabel(LUUIConstants.GOVERNANCE_LABEL_KEY)); |
572 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
573 | |
+ CAMPUS_LOCATIONS, |
574 | |
generateMessageInfo(LUUIConstants.CAMPUS_LOCATION_LABEL_KEY))); |
575 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
576 | |
+ CURRICULUM_OVERSIGHT_ORGS_, |
577 | |
generateMessageInfo(LUUIConstants.ACADEMIC_SUBJECT_ORGS_KEY))); |
578 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + ADMIN_ORGS, |
579 | |
generateMessageInfo(LUUIConstants.ADMIN_ORG_LABEL_KEY))); |
580 | 0 | return block; |
581 | |
} |
582 | |
|
583 | |
@SuppressWarnings("unchecked") |
584 | |
public SummaryTableFieldBlock generateCourseLogisticsSection() { |
585 | 0 | SummaryTableFieldBlock block = new SummaryTableFieldBlock(); |
586 | 0 | block.addEditingHandler(new EditHandler(CourseSections.COURSE_LOGISTICS)); |
587 | 0 | block.setTitle(getLabel(LUUIConstants.LOGISTICS_LABEL_KEY)); |
588 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TERMS_OFFERED, |
589 | |
generateMessageInfo(LUUIConstants.TERMS_OFFERED_LABEL_KEY))); |
590 | 0 | block.addSummaryTableFieldRow(getFieldRow( |
591 | |
COURSE + "/" + GRADING_OPTIONS, |
592 | |
generateMessageInfo(LUUIConstants.LEARNING_RESULT_ASSESSMENT_SCALE_LABEL_KEY))); |
593 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
594 | |
+ CreditCourseConstants.DURATION + "/" + "atpDurationTypeKey", |
595 | |
generateMessageInfo(LUUIConstants.DURATION_TYPE_LABEL_KEY))); |
596 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
597 | |
+ CreditCourseConstants.DURATION + "/" + "timeQuantity", |
598 | |
generateMessageInfo(LUUIConstants.DURATION_QUANTITY_LABEL_KEY))); |
599 | 0 | block.addSummaryTableFieldRow(getFieldRow( |
600 | |
COURSE + "/" + PASS_FAIL, |
601 | |
generateMessageInfo(LUUIConstants.LEARNING_RESULT_PASS_FAIL_LABEL_KEY))); |
602 | 0 | block.addSummaryTableFieldRow(getFieldRow( |
603 | |
COURSE + "/" + AUDIT, |
604 | |
generateMessageInfo(LUUIConstants.LEARNING_RESULT_AUDIT_LABEL_KEY))); |
605 | |
|
606 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
607 | |
+ CreditCourseConstants.FINAL_EXAM, |
608 | |
generateMessageInfo(LUUIConstants.FINAL_EXAM_STATUS_LABEL_KEY))); |
609 | 0 | block.addSummaryTableFieldRow(getFieldRow( |
610 | |
COURSE + "/" + CreditCourseConstants.FINAL_EXAM_RATIONALE, |
611 | |
generateMessageInfo(LUUIConstants.FINAL_EXAM_RATIONALE_LABEL_KEY), |
612 | |
true)); |
613 | |
|
614 | |
|
615 | 0 | Map<String, ModelWidgetBinding> customBindings = new HashMap<String, ModelWidgetBinding>(); |
616 | 0 | ListToTextBinding resultValuesBinding = new ListToTextBinding(); |
617 | 0 | customBindings.put("resultValues", resultValuesBinding); |
618 | 0 | String outcomesKey = COURSE + QueryPath.getPathSeparator() |
619 | |
+ CREDIT_OPTIONS; |
620 | 0 | MultiplicityConfiguration outcomesConfig = getMultiplicityConfig( |
621 | |
outcomesKey, |
622 | |
LUUIConstants.LEARNING_RESULT_OUTCOME_LABEL_KEY, |
623 | |
Arrays.asList( |
624 | |
Arrays.asList( |
625 | |
CreditCourseConstants.TYPE, |
626 | |
LUUIConstants.LEARNING_RESULT_OUTCOME_TYPE_LABEL_KEY), |
627 | |
Arrays.asList(CREDIT_OPTION_FIXED_CREDITS, |
628 | |
LUUIConstants.CREDIT_VALUE_LABEL_KEY, OPTIONAL), |
629 | |
Arrays.asList( |
630 | |
CREDIT_OPTION_MIN_CREDITS, |
631 | |
LUUIConstants.CREDIT_OPTION_MIN_CREDITS_LABEL_KEY, |
632 | |
OPTIONAL), |
633 | |
Arrays.asList( |
634 | |
CREDIT_OPTION_MAX_CREDITS, |
635 | |
LUUIConstants.CREDIT_OPTION_MAX_CREDITS_LABEL_KEY, |
636 | |
OPTIONAL), |
637 | |
Arrays.asList( |
638 | |
"resultValues", |
639 | |
LUUIConstants.CREDIT_OPTION_FIXED_CREDITS_LABEL_KEY, |
640 | |
OPTIONAL)), customBindings); |
641 | |
|
642 | |
|
643 | |
|
644 | |
|
645 | |
|
646 | |
|
647 | |
|
648 | |
|
649 | 0 | tableSection.addShowRowCallback(new ShowRowConditionCallback() { |
650 | |
@Override |
651 | |
public void processShowConditions(SummaryTableFieldRow row, |
652 | |
DataModel column1, DataModel column2) { |
653 | 0 | if (row.getFieldDescriptor1() != null |
654 | |
&& row.getFieldDescriptor1().getFieldKey() |
655 | |
.contains(CREDIT_OPTIONS) |
656 | |
&& row.getFieldDescriptor1().getFieldKey() |
657 | |
.contains("resultValues")) { |
658 | 0 | String type = row |
659 | |
.getFieldDescriptor1() |
660 | |
.getFieldKey() |
661 | |
.replace("resultValues", CreditCourseConstants.TYPE); |
662 | 0 | Object data1 = null; |
663 | 0 | Object data2 = null; |
664 | 0 | if (column1 != null) { |
665 | 0 | data1 = column1.get(type); |
666 | |
} |
667 | 0 | if (column2 != null) { |
668 | 0 | data2 = column2.get(type); |
669 | |
} |
670 | |
|
671 | 0 | if (data1 != null && data1 instanceof String) { |
672 | 0 | if (!((String) data1) |
673 | |
.equals("kuali.resultComponentType.credit.degree.multiple")) { |
674 | 0 | row.setShown(false); |
675 | |
} |
676 | 0 | } else if (data2 != null && data2 instanceof String) { |
677 | 0 | if (!((String) data2) |
678 | |
.equals("kuali.resultComponentType.credit.degree.multiple")) { |
679 | 0 | row.setShown(false); |
680 | |
} |
681 | |
} |
682 | |
} |
683 | 0 | } |
684 | |
}); |
685 | |
|
686 | 0 | block.addSummaryMultiplicity(outcomesConfig); |
687 | |
|
688 | |
|
689 | 0 | MultiplicityConfiguration formatsConfig = getMultiplicityConfig(COURSE |
690 | |
+ QueryPath.getPathSeparator() + FORMATS, |
691 | |
LUUIConstants.FORMAT_LABEL_KEY, null); |
692 | 0 | MultiplicityConfiguration activitiesConfig = getMultiplicityConfig( |
693 | |
COURSE + QueryPath.getPathSeparator() + FORMATS |
694 | |
+ QueryPath.getPathSeparator() |
695 | |
+ QueryPath.getWildCard() |
696 | |
+ QueryPath.getPathSeparator() + ACTIVITIES, |
697 | |
LUUIConstants.ACTIVITY_LITERAL_LABEL_KEY, |
698 | |
Arrays.asList(Arrays.asList(ACTIVITY_TYPE, |
699 | |
LUUIConstants.ACTIVITY_TYPE_LABEL_KEY), Arrays.asList( |
700 | |
CONTACT_HOURS + "/" + "unitQuantity", |
701 | |
LUUIConstants.CONTACT_HOURS_LABEL_KEY), Arrays.asList( |
702 | |
CONTACT_HOURS + "/" + "unitType", |
703 | |
LUUIConstants.CONTACT_HOURS_FREQUENCY_LABEL_KEY), |
704 | |
Arrays.asList(CreditCourseActivityConstants.DURATION |
705 | |
+ "/" + "atpDurationTypeKey", |
706 | |
LUUIConstants.DURATION_TYPE_LABEL_KEY), |
707 | |
Arrays.asList(CreditCourseActivityConstants.DURATION |
708 | |
+ "/" + "timeQuantity", |
709 | |
LUUIConstants.DURATION_LITERAL_LABEL_KEY), |
710 | |
Arrays.asList(DEFAULT_ENROLLMENT_ESTIMATE, |
711 | |
LUUIConstants.CLASS_SIZE_LABEL_KEY))); |
712 | 0 | formatsConfig.setNestedConfig(activitiesConfig); |
713 | 0 | block.addSummaryMultiplicity(formatsConfig); |
714 | |
|
715 | 0 | return block; |
716 | |
} |
717 | |
|
718 | |
public SummaryTableFieldBlock generateLearningObjectivesSection() { |
719 | 0 | SummaryTableFieldBlock block = new SummaryTableFieldBlock(); |
720 | 0 | block.addEditingHandler(new EditHandler( |
721 | |
CourseSections.LEARNING_OBJECTIVES)); |
722 | 0 | block.setTitle(getLabel(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY)); |
723 | 0 | SummaryTableFieldRow loRow = getFieldRow( |
724 | |
COURSE + "/" + CreditCourseConstants.COURSE_SPECIFIC_LOS, |
725 | |
generateMessageInfo(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY), |
726 | |
new KSListPanel(), new KSListPanel(), null, |
727 | |
new TreeStringBinding(), false); |
728 | 0 | loRow.addContentCellStyleName("summaryTable-lo-cell"); |
729 | 0 | block.addSummaryTableFieldRow(loRow); |
730 | |
|
731 | 0 | return block; |
732 | |
} |
733 | |
|
734 | |
public SummaryTableFieldBlock generateActiveDatesSection() { |
735 | 0 | SummaryTableFieldBlock block = new SummaryTableFieldBlock(); |
736 | 0 | block.addEditingHandler(new EditHandler(CourseSections.ACTIVE_DATES)); |
737 | 0 | block.setTitle(getLabel(LUUIConstants.ACTIVE_DATES_LABEL_KEY)); |
738 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + START_TERM, |
739 | |
generateMessageInfo(LUUIConstants.START_TERM_LABEL_KEY))); |
740 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + END_TERM, |
741 | |
generateMessageInfo(LUUIConstants.END_TERM_LABEL_KEY))); |
742 | |
|
743 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PILOT_COURSE, |
744 | |
generateMessageInfo(LUUIConstants.PILOT_COURSE_LABEL_KEY))); |
745 | 0 | return block; |
746 | |
} |
747 | |
|
748 | |
public SummaryTableFieldBlock generateFeesSection() { |
749 | 0 | SummaryTableFieldBlock block = new SummaryTableFieldBlock(); |
750 | 0 | block.addEditingHandler(new EditHandler(CourseSections.FINANCIALS)); |
751 | 0 | block.setTitle(getLabel(LUUIConstants.FINANCIALS_LABEL_KEY)); |
752 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
753 | |
+ "feeJustification" + "/" + RichTextInfoConstants.PLAIN, |
754 | |
generateMessageInfo(LUUIConstants.JUSTIFICATION_FEE))); |
755 | |
|
756 | 0 | MultiplicityConfiguration feesConfig = getMultiplicityConfig( |
757 | |
COURSE + QueryPath.getPathSeparator() + FEES, |
758 | |
LUUIConstants.FEE, |
759 | |
Arrays.asList(Arrays.asList("rateType", "Rate Type"), |
760 | |
Arrays.asList("feeType", "Fee Type"))); |
761 | |
|
762 | |
|
763 | 0 | MultiplicityConfiguration amountsConfig = getMultiplicityConfig( |
764 | |
COURSE + QueryPath.getPathSeparator() + FEES |
765 | |
+ QueryPath.getPathSeparator() |
766 | |
+ QueryPath.getWildCard() |
767 | |
+ QueryPath.getPathSeparator() + "feeAmounts", "", |
768 | |
Arrays.asList(Arrays.asList("currencyQuantity", "Amount"))); |
769 | 0 | feesConfig.setNestedConfig(amountsConfig); |
770 | 0 | block.addSummaryMultiplicity(feesConfig); |
771 | |
|
772 | |
|
773 | 0 | MultiplicityConfiguration revenueConfig = getMultiplicityConfig( |
774 | |
COURSE + QueryPath.getPathSeparator() + "revenues", |
775 | |
LUUIConstants.REVENUE, |
776 | |
Arrays.asList(Arrays.asList("affiliatedOrgs/0/orgId", |
777 | |
"Organization"), Arrays.asList( |
778 | |
"affiliatedOrgs/0/percentage", "Percentage"))); |
779 | 0 | block.addSummaryMultiplicity(revenueConfig); |
780 | |
|
781 | |
|
782 | 0 | MultiplicityConfiguration expenditureConfig = getMultiplicityConfig( |
783 | |
COURSE + QueryPath.getPathSeparator() + "expenditure" |
784 | |
+ QueryPath.getPathSeparator() + "affiliatedOrgs", |
785 | |
LUUIConstants.EXPENDITURE, |
786 | |
Arrays.asList(Arrays.asList("orgId", "Organization"), |
787 | |
Arrays.asList("percentage", "Percentage"))); |
788 | 0 | block.addSummaryMultiplicity(expenditureConfig); |
789 | |
|
790 | 0 | return block; |
791 | |
} |
792 | |
|
793 | |
public SummaryTableFieldBlock generateRequirementsSection() { |
794 | |
|
795 | 0 | final SummaryTableFieldBlock block = new SummaryTableFieldBlock(); |
796 | 0 | block.addEditingHandler(new EditHandler( |
797 | |
CourseSections.COURSE_REQUISITES)); |
798 | 0 | block.setTitle(getLabel(LUUIConstants.REQUISITES_LABEL_KEY)); |
799 | |
|
800 | |
|
801 | 0 | for (StatementTypeInfo stmtType : stmtTypes) { |
802 | |
SummaryTableFieldRow arow; |
803 | 0 | if (controller instanceof VersionsController |
804 | |
|| controller instanceof CourseProposalController) |
805 | 0 | arow = new SummaryTableFieldRow(addRequisiteField( |
806 | |
new FlowPanel(), stmtType), addRequisiteFieldComp( |
807 | |
new FlowPanel(), stmtType)); |
808 | |
else |
809 | 0 | arow = new SummaryTableFieldRow(addRequisiteField( |
810 | |
new FlowPanel(), stmtType), addRequisiteField( |
811 | |
new FlowPanel(), stmtType)); |
812 | 0 | block.addSummaryTableFieldRow(arow); |
813 | 0 | } |
814 | |
|
815 | 0 | return block; |
816 | |
} |
817 | |
|
818 | |
private FieldDescriptorReadOnly addRequisiteField(final FlowPanel panel, |
819 | |
final StatementTypeInfo stmtType) { |
820 | |
|
821 | 0 | final ModelWidgetBinding<FlowPanel> widgetBinding = new ModelWidgetBinding<FlowPanel>() { |
822 | |
|
823 | |
@Override |
824 | |
public void setModelValue(FlowPanel panel, DataModel model, |
825 | |
String path) { |
826 | 0 | } |
827 | |
|
828 | |
@Override |
829 | |
public void setWidgetValue(final FlowPanel panel, DataModel model, |
830 | |
String path) { |
831 | 0 | panel.clear(); |
832 | 0 | if (controller instanceof HasRequirements) { |
833 | 0 | HasRequirements requirementsController = (HasRequirements) controller; |
834 | 0 | List<StatementTreeViewInfo> statementTreeViewInfos = requirementsController |
835 | |
.getReqDataModel().getCourseReqInfo( |
836 | |
stmtType.getId()); |
837 | 0 | for (StatementTreeViewInfo rule : statementTreeViewInfos) { |
838 | 0 | SubrulePreviewWidget ruleWidget = new SubrulePreviewWidget( |
839 | |
rule, true, |
840 | |
CourseRequirementsSummaryView |
841 | |
.getCluSetWidgetList(rule)); |
842 | 0 | panel.add(ruleWidget); |
843 | 0 | } |
844 | |
} |
845 | 0 | } |
846 | |
}; |
847 | |
|
848 | 0 | FieldDescriptorReadOnly requisiteField = new FieldDescriptorReadOnly( |
849 | |
COURSE + "/" + CreditCourseConstants.ID, new MessageKeyInfo( |
850 | |
stmtType.getName()), null, panel); |
851 | 0 | requisiteField.setWidgetBinding(widgetBinding); |
852 | |
|
853 | 0 | return requisiteField; |
854 | |
} |
855 | |
|
856 | |
private FieldDescriptorReadOnly addRequisiteFieldComp( |
857 | |
final FlowPanel panel, final StatementTypeInfo stmtType) { |
858 | |
|
859 | 0 | final ModelWidgetBinding<FlowPanel> widgetBinding = new ModelWidgetBinding<FlowPanel>() { |
860 | |
|
861 | |
@Override |
862 | |
public void setModelValue(FlowPanel panel, DataModel model, |
863 | |
String path) { |
864 | 0 | } |
865 | |
|
866 | |
@Override |
867 | |
public void setWidgetValue(final FlowPanel panel, DataModel model, |
868 | |
String path) { |
869 | 0 | panel.clear(); |
870 | 0 | List<StatementTreeViewInfo> statementTreeViewInfos = null; |
871 | |
|
872 | 0 | if (controller instanceof VersionsController) |
873 | 0 | statementTreeViewInfos = ((VersionsController) controller) |
874 | |
.getReqDataModelComp().getCourseReqInfo( |
875 | |
stmtType.getId()); |
876 | 0 | else if (controller instanceof CourseProposalController) |
877 | 0 | statementTreeViewInfos = ((CourseProposalController) controller) |
878 | |
.getReqDataModelComp().getCourseReqInfo( |
879 | |
stmtType.getId()); |
880 | |
|
881 | 0 | for (StatementTreeViewInfo rule : statementTreeViewInfos) { |
882 | 0 | SubrulePreviewWidget ruleWidget = new SubrulePreviewWidget( |
883 | |
rule, true, |
884 | |
CourseRequirementsSummaryView |
885 | |
.getCluSetWidgetList(rule)); |
886 | 0 | panel.add(ruleWidget); |
887 | 0 | } |
888 | 0 | } |
889 | |
}; |
890 | |
|
891 | 0 | FieldDescriptorReadOnly requisiteField = new FieldDescriptorReadOnly( |
892 | |
COURSE + "/" + CreditCourseConstants.ID, new MessageKeyInfo( |
893 | |
stmtType.getName()), null, panel); |
894 | 0 | requisiteField.setWidgetBinding(widgetBinding); |
895 | |
|
896 | 0 | return requisiteField; |
897 | |
} |
898 | |
|
899 | |
private MultiplicityConfiguration getMultiplicityConfig(String path, |
900 | |
String itemLabelMessageKey, List<List<String>> fieldKeysAndLabels) { |
901 | 0 | return getMultiplicityConfig(path, itemLabelMessageKey, |
902 | |
fieldKeysAndLabels, null); |
903 | |
} |
904 | |
|
905 | |
private MultiplicityConfiguration getMultiplicityConfig(String path, |
906 | |
String itemLabelMessageKey, List<List<String>> fieldKeysAndLabels, |
907 | |
Map<String, ModelWidgetBinding> customBindings) { |
908 | 0 | QueryPath parentPath = QueryPath.concat(path); |
909 | 0 | MultiplicityConfiguration config = new MultiplicityConfiguration( |
910 | |
MultiplicityConfiguration.MultiplicityType.TABLE, |
911 | |
MultiplicityConfiguration.StyleType.TOP_LEVEL_GROUP, |
912 | |
modelDefinition.getMetadata(parentPath)); |
913 | 0 | config.setItemLabel(getLabel(itemLabelMessageKey)); |
914 | 0 | config.setUpdateable(false); |
915 | 0 | config.setShowHeaders(true); |
916 | |
|
917 | 0 | FieldDescriptorReadOnly parentFd = buildFieldDescriptor(path, |
918 | |
getLabel(itemLabelMessageKey), null); |
919 | 0 | config.setParent(parentFd); |
920 | |
|
921 | 0 | if (fieldKeysAndLabels != null) { |
922 | 0 | for (List<String> fieldKeyAndLabel : fieldKeysAndLabels) { |
923 | 0 | MultiplicityFieldConfiguration fd = buildMultiplicityFD( |
924 | |
fieldKeyAndLabel.get(0), fieldKeyAndLabel.get(1), |
925 | |
parentPath.toString()); |
926 | 0 | if (fieldKeyAndLabel.size() == 3 |
927 | |
&& fieldKeyAndLabel.get(2).equals(OPTIONAL)) { |
928 | 0 | fd.setOptional(true); |
929 | |
} |
930 | 0 | if (customBindings != null |
931 | |
&& customBindings.containsKey(fieldKeyAndLabel.get(0))) { |
932 | 0 | fd.setModelWidgetBinding(customBindings |
933 | |
.get(fieldKeyAndLabel.get(0))); |
934 | |
} |
935 | 0 | config.addFieldConfiguration(fd); |
936 | 0 | } |
937 | |
} |
938 | |
|
939 | 0 | return config; |
940 | |
} |
941 | |
|
942 | |
|
943 | |
|
944 | |
private MultiplicityFieldConfiguration buildMultiplicityFD(String fieldKey, |
945 | |
String labelKey, String parentPath) { |
946 | |
|
947 | 0 | QueryPath fieldPath = QueryPath.concat(parentPath, |
948 | |
QueryPath.getWildCard(), fieldKey); |
949 | 0 | Metadata meta = modelDefinition.getMetadata(fieldPath); |
950 | |
|
951 | 0 | MultiplicityFieldConfiguration fd = new MultiplicityFieldConfiguration( |
952 | |
fieldPath.toString(), generateMessageInfo(labelKey), meta, null); |
953 | |
|
954 | 0 | return fd; |
955 | |
|
956 | |
} |
957 | |
|
958 | |
private FieldDescriptorReadOnly buildFieldDescriptor(String fieldKey, |
959 | |
String messageKey, String parentPath) { |
960 | 0 | return buildFieldDescriptor(fieldKey, messageKey, parentPath, null, |
961 | |
null); |
962 | |
} |
963 | |
|
964 | |
private FieldDescriptorReadOnly buildFieldDescriptor(String fieldKey, |
965 | |
String messageKey, String parentPath, Widget widget, |
966 | |
ModelWidgetBinding<?> binding) { |
967 | |
|
968 | 0 | QueryPath path = QueryPath.concat(parentPath, fieldKey); |
969 | 0 | Metadata meta = modelDefinition.getMetadata(path); |
970 | |
|
971 | 0 | FieldDescriptorReadOnly fd = new FieldDescriptorReadOnly( |
972 | |
path.toString(), generateMessageInfo(messageKey), meta); |
973 | 0 | if (widget != null) { |
974 | 0 | fd.setFieldWidget(widget); |
975 | |
} |
976 | 0 | if (binding != null) { |
977 | 0 | fd.setWidgetBinding(binding); |
978 | |
} |
979 | 0 | return fd; |
980 | |
} |
981 | |
|
982 | |
public VerticalSectionView generateCourseBriefSection() { |
983 | 0 | SummaryTableSection courseBriefSection = new SummaryTableSection( |
984 | |
controller); |
985 | 0 | courseBriefSection.setEditable(false); |
986 | 0 | SummaryTableFieldBlock block = new SummaryTableFieldBlock(); |
987 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE, |
988 | |
generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY))); |
989 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + "code", |
990 | |
generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY))); |
991 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + ADMIN_ORGS, |
992 | |
generateMessageInfo(LUUIConstants.ADMIN_ORG_LABEL_KEY))); |
993 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
994 | |
+ PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN, |
995 | |
generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY))); |
996 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
997 | |
+ CURRICULUM_OVERSIGHT_ORGS_, |
998 | |
generateMessageInfo(LUUIConstants.ACADEMIC_SUBJECT_ORGS_KEY))); |
999 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" |
1000 | |
+ CAMPUS_LOCATIONS, |
1001 | |
generateMessageInfo(LUUIConstants.CAMPUS_LOCATION_LABEL_KEY))); |
1002 | |
|
1003 | 0 | Map<String, ModelWidgetBinding> customBindings = new HashMap<String, ModelWidgetBinding>(); |
1004 | 0 | ListToTextBinding resultValuesBinding = new ListToTextBinding(); |
1005 | 0 | customBindings.put("resultValues", resultValuesBinding); |
1006 | 0 | String outcomesKey = COURSE + QueryPath.getPathSeparator() |
1007 | |
+ CREDIT_OPTIONS; |
1008 | 0 | MultiplicityConfiguration outcomesConfig = getMultiplicityConfig( |
1009 | |
outcomesKey, |
1010 | |
LUUIConstants.LEARNING_RESULT_OUTCOME_LABEL_KEY, |
1011 | |
Arrays.asList( |
1012 | |
Arrays.asList( |
1013 | |
CreditCourseConstants.TYPE, |
1014 | |
LUUIConstants.LEARNING_RESULT_OUTCOME_TYPE_LABEL_KEY), |
1015 | |
Arrays.asList(CREDIT_OPTION_FIXED_CREDITS, |
1016 | |
LUUIConstants.CONTACT_HOURS_LABEL_KEY, OPTIONAL), |
1017 | |
Arrays.asList( |
1018 | |
CREDIT_OPTION_MIN_CREDITS, |
1019 | |
LUUIConstants.CREDIT_OPTION_MIN_CREDITS_LABEL_KEY, |
1020 | |
OPTIONAL), |
1021 | |
Arrays.asList( |
1022 | |
CREDIT_OPTION_MAX_CREDITS, |
1023 | |
LUUIConstants.CREDIT_OPTION_MAX_CREDITS_LABEL_KEY, |
1024 | |
OPTIONAL), |
1025 | |
Arrays.asList( |
1026 | |
"resultValues", |
1027 | |
LUUIConstants.CREDIT_OPTION_FIXED_CREDITS_LABEL_KEY, |
1028 | |
OPTIONAL)), customBindings); |
1029 | |
|
1030 | |
|
1031 | |
|
1032 | |
|
1033 | |
|
1034 | |
|
1035 | |
|
1036 | |
|
1037 | 0 | courseBriefSection.addShowRowCallback(new ShowRowConditionCallback() { |
1038 | |
@Override |
1039 | |
public void processShowConditions(SummaryTableFieldRow row, |
1040 | |
DataModel column1, DataModel column2) { |
1041 | 0 | if (row.getFieldDescriptor1() != null |
1042 | |
&& row.getFieldDescriptor1().getFieldKey() |
1043 | |
.contains(CREDIT_OPTIONS) |
1044 | |
&& row.getFieldDescriptor1().getFieldKey() |
1045 | |
.contains("resultValues")) { |
1046 | 0 | String type = row |
1047 | |
.getFieldDescriptor1() |
1048 | |
.getFieldKey() |
1049 | |
.replace("resultValues", CreditCourseConstants.TYPE); |
1050 | 0 | Object data1 = null; |
1051 | 0 | Object data2 = null; |
1052 | 0 | if (column1 != null) { |
1053 | 0 | data1 = column1.get(type); |
1054 | |
} |
1055 | 0 | if (column2 != null) { |
1056 | 0 | data2 = column2.get(type); |
1057 | |
} |
1058 | |
|
1059 | 0 | if (data1 != null && data1 instanceof String) { |
1060 | 0 | if (!((String) data1) |
1061 | |
.equals("kuali.resultComponentType.credit.degree.multiple")) { |
1062 | 0 | row.setShown(false); |
1063 | |
} |
1064 | 0 | } else if (data2 != null && data2 instanceof String) { |
1065 | 0 | if (!((String) data2) |
1066 | |
.equals("kuali.resultComponentType.credit.degree.multiple")) { |
1067 | 0 | row.setShown(false); |
1068 | |
} |
1069 | |
} |
1070 | |
} |
1071 | 0 | } |
1072 | |
}); |
1073 | 0 | block.addSummaryMultiplicity(outcomesConfig); |
1074 | |
|
1075 | 0 | block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TERMS_OFFERED, |
1076 | |
generateMessageInfo(LUUIConstants.TERMS_OFFERED_LABEL_KEY))); |
1077 | 0 | block.addSummaryTableFieldRow(getFieldRow( |
1078 | |
COURSE + "/" + GRADING_OPTIONS, |
1079 | |
generateMessageInfo(LUUIConstants.LEARNING_RESULT_ASSESSMENT_SCALE_LABEL_KEY))); |
1080 | 0 | block.addSummaryTableFieldRow(getFieldRow( |
1081 | |
COURSE + "/" + PASS_FAIL, |
1082 | |
generateMessageInfo(LUUIConstants.LEARNING_RESULT_PASS_FAIL_LABEL_KEY), |
1083 | |
true)); |
1084 | 0 | block.addSummaryTableFieldRow(getFieldRow( |
1085 | |
COURSE + "/" + AUDIT, |
1086 | |
generateMessageInfo(LUUIConstants.LEARNING_RESULT_AUDIT_LABEL_KEY), |
1087 | |
true)); |
1088 | 0 | MultiplicityConfiguration formatsConfig = getMultiplicityConfig(COURSE |
1089 | |
+ QueryPath.getPathSeparator() + FORMATS, |
1090 | |
LUUIConstants.FORMAT_LABEL_KEY, null); |
1091 | 0 | MultiplicityConfiguration activitiesConfig = getMultiplicityConfig( |
1092 | |
COURSE + QueryPath.getPathSeparator() + FORMATS |
1093 | |
+ QueryPath.getPathSeparator() |
1094 | |
+ QueryPath.getWildCard() |
1095 | |
+ QueryPath.getPathSeparator() + ACTIVITIES, |
1096 | |
LUUIConstants.ACTIVITY_LITERAL_LABEL_KEY, Arrays.asList(Arrays |
1097 | |
.asList(ACTIVITY_TYPE, |
1098 | |
LUUIConstants.ACTIVITY_TYPE_LABEL_KEY), Arrays |
1099 | |
.asList(CONTACT_HOURS + "/" + "unitQuantity", |
1100 | |
LUUIConstants.CONTACT_HOURS_LABEL_KEY), Arrays |
1101 | |
.asList(CONTACT_HOURS + "/" + "unitType", "per"), |
1102 | |
Arrays.asList(CreditCourseActivityConstants.DURATION |
1103 | |
+ "/" + "atpDurationTypeKey", |
1104 | |
LUUIConstants.DURATION_TYPE_LABEL_KEY), |
1105 | |
Arrays.asList(CreditCourseActivityConstants.DURATION |
1106 | |
+ "/" + "timeQuantity", |
1107 | |
LUUIConstants.DURATION_LITERAL_LABEL_KEY), |
1108 | |
Arrays.asList(DEFAULT_ENROLLMENT_ESTIMATE, |
1109 | |
LUUIConstants.CLASS_SIZE_LABEL_KEY))); |
1110 | 0 | formatsConfig.setNestedConfig(activitiesConfig); |
1111 | 0 | block.addSummaryMultiplicity(formatsConfig); |
1112 | |
|
1113 | 0 | MultiplicityConfiguration feesConfig = getMultiplicityConfig( |
1114 | |
COURSE + QueryPath.getPathSeparator() + FEES, |
1115 | |
LUUIConstants.FEE, |
1116 | |
Arrays.asList(Arrays.asList("rateType", "Rate Type"), |
1117 | |
Arrays.asList("feeType", "Fee Type"))); |
1118 | |
|
1119 | |
|
1120 | 0 | MultiplicityConfiguration amountsConfig = getMultiplicityConfig( |
1121 | |
COURSE + QueryPath.getPathSeparator() + FEES |
1122 | |
+ QueryPath.getPathSeparator() |
1123 | |
+ QueryPath.getWildCard() |
1124 | |
+ QueryPath.getPathSeparator() + "feeAmounts", "", |
1125 | |
Arrays.asList(Arrays.asList("currencyQuantity", "Amount"))); |
1126 | 0 | feesConfig.setNestedConfig(amountsConfig); |
1127 | 0 | block.addSummaryMultiplicity(feesConfig); |
1128 | |
|
1129 | |
|
1130 | |
|
1131 | |
|
1132 | |
|
1133 | |
|
1134 | |
|
1135 | |
|
1136 | |
|
1137 | |
|
1138 | |
|
1139 | |
|
1140 | |
|
1141 | |
|
1142 | |
|
1143 | |
|
1144 | |
|
1145 | |
|
1146 | 0 | courseBriefSection.addSummaryTableFieldBlock(block); |
1147 | 0 | VerticalSectionView verticalSection = new VerticalSectionView( |
1148 | |
ViewCourseSections.BRIEF, "At a Glance", modelId, false); |
1149 | 0 | verticalSection.addSection(courseBriefSection); |
1150 | |
|
1151 | 0 | return verticalSection; |
1152 | |
} |
1153 | |
|
1154 | |
public VerticalSectionView generateCourseCatalogSection() { |
1155 | 0 | VerticalSectionView verticalSection = new VerticalSectionView( |
1156 | |
ViewCourseSections.CATALOG, "Catalog View", modelId, false); |
1157 | 0 | FieldDescriptorReadOnly catalogField = new FieldDescriptorReadOnly("", |
1158 | |
null, null, new HTML()); |
1159 | 0 | catalogField.hideLabel(); |
1160 | 0 | catalogField.setWidgetBinding(new ModelWidgetBinding<HTML>() { |
1161 | |
|
1162 | |
@Override |
1163 | |
public void setModelValue(HTML widget, DataModel model, String path) { |
1164 | |
|
1165 | |
|
1166 | 0 | } |
1167 | |
|
1168 | |
@Override |
1169 | |
public void setWidgetValue(HTML widget, DataModel model, String path) { |
1170 | 0 | String code = model.get("code"); |
1171 | 0 | String title = model.get(COURSE + "/" + COURSE_TITLE); |
1172 | 0 | String credits = ""; |
1173 | 0 | String outcomesKey = COURSE + QueryPath.getPathSeparator() |
1174 | |
+ CREDIT_OPTIONS; |
1175 | 0 | Data outcomes = model.get(outcomesKey); |
1176 | 0 | if (outcomes != null) { |
1177 | 0 | Iterator<Property> iter = outcomes.realPropertyIterator(); |
1178 | 0 | String list = ""; |
1179 | 0 | ListToTextBinding binding = new ListToTextBinding(); |
1180 | 0 | while (iter.hasNext()) { |
1181 | 0 | Property prop = iter.next(); |
1182 | 0 | if (prop.getKey() instanceof Integer) { |
1183 | 0 | Integer number = (Integer) prop.getKey(); |
1184 | 0 | Object value = outcomes.get(number); |
1185 | 0 | if (value instanceof Data) { |
1186 | 0 | list = list |
1187 | |
+ binding.getStringList(model, |
1188 | |
outcomesKey + "/" + number |
1189 | |
+ "/" + "resultValues") |
1190 | |
+ ", "; |
1191 | |
} |
1192 | |
} |
1193 | 0 | } |
1194 | |
|
1195 | 0 | if (!list.isEmpty()) { |
1196 | 0 | list = list.trim(); |
1197 | 0 | list = list.substring(0, list.length() - 1); |
1198 | 0 | credits = "(" + list + ")"; |
1199 | |
} |
1200 | |
} |
1201 | |
|
1202 | 0 | String description = model.get(COURSE + "/" |
1203 | |
+ PROPOSAL_DESCRIPTION + "/" |
1204 | |
+ RichTextInfoConstants.PLAIN); |
1205 | 0 | String catalogText = "<b> " + code + " " + title + " " |
1206 | |
+ credits + "</b> " + description + " "; |
1207 | 0 | catalogText.replace(" null ", ""); |
1208 | 0 | catalogText.trim(); |
1209 | 0 | widget.setHTML(catalogText); |
1210 | |
|
1211 | 0 | } |
1212 | |
}); |
1213 | 0 | verticalSection.addField(catalogField); |
1214 | |
|
1215 | 0 | return verticalSection; |
1216 | |
} |
1217 | |
|
1218 | |
public SummaryTableSection getTableSection() { |
1219 | 0 | return tableSection; |
1220 | |
} |
1221 | |
} |
1222 | |
|