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