1 | |
package org.kuali.student.lum.program.client.major.proposal; |
2 | |
|
3 | |
import org.kuali.student.common.ui.client.configurable.mvc.Configurer; |
4 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.Section; |
5 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView; |
6 | |
import org.kuali.student.common.ui.client.mvc.Callback; |
7 | |
import org.kuali.student.common.ui.client.mvc.DataModel; |
8 | |
import org.kuali.student.common.ui.client.mvc.ModelRequestCallback; |
9 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.MessageKeyInfo; |
10 | |
import org.kuali.student.core.workflow.ui.client.widgets.WorkflowUtilities; |
11 | |
import org.kuali.student.lum.common.client.configuration.AbstractControllerConfiguration; |
12 | |
import org.kuali.student.lum.common.client.configuration.Configuration; |
13 | |
import org.kuali.student.lum.common.client.configuration.ConfigurationManager; |
14 | |
import org.kuali.student.lum.common.client.lu.LUUIConstants; |
15 | |
import org.kuali.student.lum.program.client.ProgramConstants; |
16 | |
import org.kuali.student.lum.program.client.ProgramSections; |
17 | |
import org.kuali.student.lum.program.client.major.view.CatalogInformationViewConfiguration; |
18 | |
import org.kuali.student.lum.program.client.major.view.LearningObjectivesViewConfiguration; |
19 | |
import org.kuali.student.lum.program.client.major.view.MajorKeyProgramInfoViewConfiguration; |
20 | |
import org.kuali.student.lum.program.client.major.view.ManagingBodiesViewConfiguration; |
21 | |
import org.kuali.student.lum.program.client.major.view.ProgramRequirementsViewConfiguration; |
22 | |
import org.kuali.student.lum.program.client.major.view.SpecializationsViewConfiguration; |
23 | |
import org.kuali.student.lum.program.client.major.view.SupportingDocsViewConfiguration; |
24 | |
import org.kuali.student.lum.program.client.properties.ProgramProperties; |
25 | |
|
26 | |
import com.google.gwt.user.client.ui.Widget; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | 0 | public class MajorProposalSummaryConfiguration extends AbstractControllerConfiguration { |
38 | |
|
39 | 0 | public MajorProposalSummaryConfiguration() { |
40 | 0 | rootSection = new VerticalSectionView(ProgramSections.SUMMARY, ProgramProperties.get().proposal_menu_sections_summary(), ProgramConstants.PROGRAM_MODEL_ID, true); |
41 | 0 | } |
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
@Override |
47 | |
protected void buildLayout() { |
48 | 0 | ConfigurationManager configurationManager = new ConfigurationManager(configurer); |
49 | |
|
50 | |
|
51 | 0 | MajorKeyProgramInfoViewConfiguration majorInfoViewConfig = MajorKeyProgramInfoViewConfiguration.createSpecial(controller); |
52 | 0 | configurationManager.registerConfiguration(majorInfoViewConfig); |
53 | 0 | configurationManager.registerConfiguration(ManagingBodiesViewConfiguration.createSpecial(controller)); |
54 | 0 | configurationManager.registerConfiguration(SpecializationsViewConfiguration.createSpecial(controller)); |
55 | 0 | configurationManager.registerConfiguration(CatalogInformationViewConfiguration.createSpecial(controller)); |
56 | 0 | configurationManager.registerConfiguration(new ProgramRequirementsViewConfiguration(controller)); |
57 | 0 | configurationManager.registerConfiguration(LearningObjectivesViewConfiguration.createSpecial(controller)); |
58 | 0 | configurationManager.registerConfiguration(SupportingDocsViewConfiguration.createSpecial(controller)); |
59 | |
|
60 | |
|
61 | |
|
62 | 0 | if (controller instanceof MajorProposalController){ |
63 | |
|
64 | |
|
65 | 0 | final WorkflowUtilities workflowUtilities = ((MajorProposalController) controller).getWfUtilities(); |
66 | 0 | workflowUtilities.addSubmitCallback(new Callback<Boolean>() { |
67 | |
|
68 | |
@Override |
69 | |
public void exec(Boolean result) { |
70 | 0 | if (result) { |
71 | 0 | ((MajorProposalController) controller).setStatus(); |
72 | |
} |
73 | |
|
74 | 0 | } |
75 | |
}); |
76 | |
|
77 | 0 | if(workflowUtilities!=null){ |
78 | 0 | controller.requestModel(new ModelRequestCallback<DataModel>(){ |
79 | |
public void onModelReady(DataModel model) { |
80 | |
|
81 | 0 | String versionedFromId = model.get("versionInfo/versionedFromId"); |
82 | 0 | if(versionedFromId!=null && !versionedFromId.isEmpty()){ |
83 | |
|
84 | 0 | workflowUtilities.addApproveDialogField("", "startTerm", new MessageKeyInfo(ProgramProperties.get().programInformation_startTerm()), MajorProposalSummaryConfiguration.this.configurer.getModelDefinition(), true, true); |
85 | 0 | workflowUtilities.addApproveDialogField("proposal", "prevEndTerm", new MessageKeyInfo(ProgramProperties.get().majorDiscipline_prevEndTerm()), MajorProposalSummaryConfiguration.this.configurer.getModelDefinition(),false); |
86 | 0 | workflowUtilities.addApproveDialogField("proposal", "prevEndProgramEntryTerm", new MessageKeyInfo(ProgramProperties.get().majorDiscipline_prevEndProgramEntryTerm()), MajorProposalSummaryConfiguration.this.configurer.getModelDefinition(),false); |
87 | 0 | workflowUtilities.addApproveDialogField("proposal", "prevEndInstAdmitTerm", new MessageKeyInfo(ProgramProperties.get().majorDiscipline_prevEndInstAdmitTerm()), MajorProposalSummaryConfiguration.this.configurer.getModelDefinition(),false); |
88 | 0 | workflowUtilities.updateApproveFields(); |
89 | 0 | workflowUtilities.progressiveEnableFields(); |
90 | |
}else{ |
91 | |
|
92 | 0 | workflowUtilities.addIgnoreDialogField("proposal/prevEndTerm"); |
93 | 0 | workflowUtilities.addIgnoreDialogField("proposal/prevEndProgramEntryTerm"); |
94 | 0 | workflowUtilities.addIgnoreDialogField("proposal/prevEndInstAdmitTerm"); |
95 | |
} |
96 | 0 | } |
97 | |
public void onRequestFail(Throwable cause) { |
98 | 0 | } |
99 | |
}); |
100 | |
} |
101 | |
|
102 | |
|
103 | 0 | Widget widget = workflowUtilities.getWorkflowActionsWidget(); |
104 | |
|
105 | |
|
106 | |
|
107 | 0 | workflowUtilities.enableWorkflowActionsWidgets(true); |
108 | |
|
109 | |
|
110 | 0 | rootSection.addWidget(widget); |
111 | |
} |
112 | |
|
113 | |
|
114 | |
|
115 | 0 | for (Configuration configuration : configurationManager.getConfigurations()) { |
116 | 0 | if (configuration instanceof AbstractControllerConfiguration) { |
117 | 0 | ((AbstractControllerConfiguration) configuration).setController(controller); |
118 | |
} |
119 | 0 | rootSection.addSection((Section) configuration.getView()); |
120 | |
} |
121 | 0 | } |
122 | |
} |