| 1 | |
package org.kuali.student.lum.lu.ui.course.client.configuration; |
| 2 | |
|
| 3 | |
import java.util.ArrayList; |
| 4 | |
import java.util.List; |
| 5 | |
|
| 6 | |
import org.kuali.student.common.assembly.data.QueryPath; |
| 7 | |
import org.kuali.student.common.dto.DtoConstants; |
| 8 | |
import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptor; |
| 9 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.Section; |
| 10 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.SectionView; |
| 11 | |
import org.kuali.student.common.ui.client.mvc.Controller; |
| 12 | |
import org.kuali.student.common.ui.client.mvc.DataModelDefinition; |
| 13 | |
import org.kuali.student.common.ui.client.widgets.KSButton; |
| 14 | |
import org.kuali.student.common.ui.client.widgets.KSCharCount; |
| 15 | |
import org.kuali.student.common.ui.client.widgets.KSLabel; |
| 16 | |
import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle; |
| 17 | |
import org.kuali.student.core.comments.ui.client.widgets.commenttool.CommentTool; |
| 18 | |
import org.kuali.student.core.comments.ui.client.widgets.decisiontool.DecisionPanel; |
| 19 | |
import org.kuali.student.core.document.ui.client.widgets.documenttool.DocumentTool; |
| 20 | |
import org.kuali.student.core.workflow.ui.client.views.CollaboratorSectionView; |
| 21 | |
import org.kuali.student.lum.common.client.lu.LUUIConstants; |
| 22 | |
import org.kuali.student.lum.lu.ui.course.client.configuration.CourseProposalConfigurer.CourseSections; |
| 23 | |
import org.kuali.student.lum.lu.ui.course.client.controllers.CourseAdminRetireController; |
| 24 | |
import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController; |
| 25 | |
|
| 26 | |
import com.google.gwt.core.client.GWT; |
| 27 | |
import com.google.gwt.event.dom.client.ClickEvent; |
| 28 | |
import com.google.gwt.event.dom.client.ClickHandler; |
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | 0 | public class CourseRetireByProposalConfigurer extends CourseProposalConfigurer { |
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
@Override |
| 47 | |
public void configure(final CourseProposalController layout) { |
| 48 | 0 | type = "course"; |
| 49 | 0 | state = DtoConstants.STATE_DRAFT; |
| 50 | 0 | nextState = DtoConstants.STATE_RETIRED; |
| 51 | |
|
| 52 | 0 | groupName = LUUIConstants.COURSE_GROUP_NAME; |
| 53 | |
|
| 54 | 0 | if (modelDefinition.getMetadata().isCanEdit()) { |
| 55 | 0 | addCluStartSection(layout); |
| 56 | 0 | String sections = getLabel(LUUIConstants.COURSE_SECTIONS); |
| 57 | |
|
| 58 | 0 | layout.addMenu(sections); |
| 59 | |
|
| 60 | |
|
| 61 | 0 | layout.addMenuItem(sections, (SectionView)generateRetirementInfoSection(initSectionView(CourseSections.COURSE_INFO, getLabel(LUUIConstants.RETIREMENT_LABEL_KEY)))); |
| 62 | |
|
| 63 | |
|
| 64 | 0 | layout.addMenuItem(sections, new CollaboratorSectionView(CourseSections.PEOPLE_PERMISSONS, getLabel(LUUIConstants.SECTION_AUTHORS_AND_COLLABORATORS), COURSE_PROPOSAL_MODEL)); |
| 65 | |
|
| 66 | |
|
| 67 | 0 | documentTool = new DocumentTool(LUUIConstants.REF_DOC_RELATION_PROPOSAL_TYPE,CourseSections.DOCUMENTS, getLabel(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY)); |
| 68 | 0 | documentTool.setModelDefinition((DataModelDefinition)modelDefinition); |
| 69 | 0 | layout.addMenuItem(sections, documentTool); |
| 70 | |
|
| 71 | |
|
| 72 | 0 | List<Enum<?>> excludedViews = new ArrayList<Enum<?>>(); |
| 73 | 0 | excludedViews.add(CourseSections.DOCUMENTS); |
| 74 | 0 | excludedViews.add(CourseSections.COURSE_REQUISITES); |
| 75 | 0 | layout.addCommonButton(LUUIConstants.COURSE_SECTIONS, layout.getSaveButton(), excludedViews); |
| 76 | 0 | layout.addCommonButton(LUUIConstants.COURSE_SECTIONS, layout.getCancelButton(CourseSections.SUMMARY), excludedViews); |
| 77 | |
|
| 78 | |
|
| 79 | 0 | summaryConfigurer = GWT.create(CourseRetireSummaryConfigurer.class); |
| 80 | 0 | summaryConfigurer.init(type, state, groupName,(DataModelDefinition)modelDefinition, stmtTypes, (Controller)layout, COURSE_PROPOSAL_MODEL); |
| 81 | 0 | layout.addSpecialMenuItem(summaryConfigurer.generateProposalSummarySection(true), "Review and Submit"); |
| 82 | |
|
| 83 | |
|
| 84 | |
|
| 85 | 0 | layout.addButtonForView(CourseSections.DOCUMENTS, getContinueButton(layout)); |
| 86 | 0 | } else { |
| 87 | 0 | summaryConfigurer = GWT.create(CourseRetireSummaryConfigurer.class); |
| 88 | 0 | summaryConfigurer.init(type, state, groupName,(DataModelDefinition)modelDefinition, stmtTypes, (Controller)layout, COURSE_PROPOSAL_MODEL); |
| 89 | 0 | layout.removeMenuNavigation(); |
| 90 | 0 | layout.addView(summaryConfigurer.generateProposalSummarySection(false)); |
| 91 | |
} |
| 92 | |
|
| 93 | |
|
| 94 | 0 | layout.addContentWidget(layout.getWfUtilities().getProposalStatusLabel()); |
| 95 | |
|
| 96 | |
|
| 97 | 0 | final CommentTool commentTool = new CommentTool(CourseSections.COMMENTS, getLabel(LUUIConstants.TOOL_COMMENTS_LABEL_KEY), "kuali.comment.type.generalRemarks", "Proposal Comments"); |
| 98 | 0 | commentTool.setController(layout); |
| 99 | |
|
| 100 | 0 | layout.addContentWidget(new KSButton("Comments", ButtonStyle.DEFAULT_ANCHOR, new ClickHandler() { |
| 101 | |
|
| 102 | |
@Override |
| 103 | |
public void onClick(ClickEvent event) { |
| 104 | 0 | commentTool.show(); |
| 105 | 0 | } |
| 106 | |
})); |
| 107 | |
|
| 108 | |
|
| 109 | 0 | final DecisionPanel decisionPanel = new DecisionPanel(CourseSections.DECISIONS, getLabel(LUUIConstants.TOOL_DECISION_LABEL_KEY), "kuali.comment.type.generalRemarks"); |
| 110 | 0 | layout.addView(decisionPanel); |
| 111 | 0 | layout.addContentWidget(new KSButton("Decisions", ButtonStyle.DEFAULT_ANCHOR, new ClickHandler() { |
| 112 | |
|
| 113 | |
@Override |
| 114 | |
public void onClick(ClickEvent event) { |
| 115 | 0 | decisionPanel.show(); |
| 116 | 0 | } |
| 117 | |
})); |
| 118 | 0 | } |
| 119 | |
|
| 120 | |
protected Section generateRetirementInfoSection(Section section) { |
| 121 | 0 | FieldDescriptor fd = addField(section, PROPOSAL_PATH + "/" + PREV_START_TERM, generateMessageInfo(LUUIConstants.PROPOSAL_PREV_START_TERM)); |
| 122 | 0 | fd.getFieldWidget().setVisible(false); |
| 123 | 0 | fd.hideLabel(); |
| 124 | |
|
| 125 | 0 | addField(section, PROPOSAL_TITLE_PATH, generateMessageInfo(LUUIConstants.PROPOSED_PROPOSAL_TITLE_LABEL_KEY)); |
| 126 | 0 | addField(section, PROPOSAL_PATH + "/" + PROPOSED_RATIONALE, generateMessageInfo(LUUIConstants.RETIREMENT_RATIONALE_LABEL_KEY), |
| 127 | |
new KSCharCount(modelDefinition.getMetadata(QueryPath.parse(PROPOSAL_PATH + "/" + PROPOSED_RATIONALE)))); |
| 128 | 0 | addReadOnlyField(section, COURSE + "/" + START_TERM, generateMessageInfo(LUUIConstants.START_TERM_LABEL_KEY)); |
| 129 | 0 | addField(section, PROPOSAL_PATH + "/" + PROPOSED_END_TERM, generateMessageInfo(LUUIConstants.PROPOSED_END_TERM_LABEL_KEY)); |
| 130 | 0 | addField(section, PROPOSAL_PATH + "/" + PROPOSED_LAST_TERM_OFFERED, generateMessageInfo(LUUIConstants.PROPOSED_LAST_TERM_OFFERED_LABEL_KEY)); |
| 131 | 0 | addField(section, PROPOSAL_PATH + "/" + PROPOSED_LAST_COURSE_CATALOG_YEAR, generateMessageInfo(LUUIConstants.PROPOSED_LAST_COURSE_CATALOG_YEAR_LABEL_KEY)); |
| 132 | 0 | addField(section, PROPOSAL_PATH + "/" + OTHER_COMMENTS, generateMessageInfo(LUUIConstants.OTHER_COMMENTS_LABEL_KEY)); |
| 133 | |
|
| 134 | 0 | return section; |
| 135 | |
} |
| 136 | |
|
| 137 | |
} |