1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.lum.lu.ui.course.client.controllers; |
17 | |
|
18 | |
import java.text.DateFormat; |
19 | |
import java.util.ArrayList; |
20 | |
import java.util.Date; |
21 | |
import java.util.HashMap; |
22 | |
import java.util.List; |
23 | |
import java.util.Map; |
24 | |
|
25 | |
import org.kuali.student.common.assembly.data.Data; |
26 | |
import org.kuali.student.common.assembly.data.Metadata; |
27 | |
import org.kuali.student.common.assembly.data.QueryPath; |
28 | |
import org.kuali.student.common.rice.StudentIdentityConstants; |
29 | |
import org.kuali.student.common.rice.authorization.PermissionType; |
30 | |
import org.kuali.student.common.ui.client.application.Application; |
31 | |
import org.kuali.student.common.ui.client.application.KSAsyncCallback; |
32 | |
import org.kuali.student.common.ui.client.application.ViewContext; |
33 | |
import org.kuali.student.common.ui.client.configurable.mvc.layouts.MenuEditableSectionController; |
34 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.Section; |
35 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.SectionView; |
36 | |
import org.kuali.student.common.ui.client.event.ActionEvent; |
37 | |
import org.kuali.student.common.ui.client.event.ContentDirtyEvent; |
38 | |
import org.kuali.student.common.ui.client.event.ContentDirtyEventHandler; |
39 | |
import org.kuali.student.common.ui.client.event.SaveActionEvent; |
40 | |
import org.kuali.student.common.ui.client.event.SaveActionHandler; |
41 | |
import org.kuali.student.common.ui.client.mvc.ActionCompleteCallback; |
42 | |
import org.kuali.student.common.ui.client.mvc.Callback; |
43 | |
import org.kuali.student.common.ui.client.mvc.Controller; |
44 | |
import org.kuali.student.common.ui.client.mvc.DataModel; |
45 | |
import org.kuali.student.common.ui.client.mvc.DataModelDefinition; |
46 | |
import org.kuali.student.common.ui.client.mvc.HasCrossConstraints; |
47 | |
import org.kuali.student.common.ui.client.mvc.ModelProvider; |
48 | |
import org.kuali.student.common.ui.client.mvc.ModelRequestCallback; |
49 | |
import org.kuali.student.common.ui.client.mvc.View; |
50 | |
import org.kuali.student.common.ui.client.mvc.WorkQueue; |
51 | |
import org.kuali.student.common.ui.client.mvc.WorkQueue.WorkItem; |
52 | |
import org.kuali.student.common.ui.client.mvc.dto.ReferenceModel; |
53 | |
import org.kuali.student.common.ui.client.mvc.history.HistoryManager; |
54 | |
import org.kuali.student.common.ui.client.security.AuthorizationCallback; |
55 | |
import org.kuali.student.common.ui.client.security.RequiresAuthorization; |
56 | |
import org.kuali.student.common.ui.client.service.DataSaveResult; |
57 | |
import org.kuali.student.common.ui.client.util.ExportElement; |
58 | |
import org.kuali.student.common.ui.client.util.ExportUtils; |
59 | |
import org.kuali.student.common.ui.client.util.WindowTitleUtils; |
60 | |
import org.kuali.student.common.ui.client.validator.ValidatorClientUtils; |
61 | |
import org.kuali.student.common.ui.client.widgets.KSButton; |
62 | |
import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle; |
63 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations.YesNoCancelEnum; |
64 | |
import org.kuali.student.common.ui.client.widgets.dialog.ButtonMessageDialog; |
65 | |
import org.kuali.student.common.ui.client.widgets.field.layout.button.ButtonGroup; |
66 | |
import org.kuali.student.common.ui.client.widgets.field.layout.button.YesNoCancelGroup; |
67 | |
import org.kuali.student.common.ui.client.widgets.notification.KSNotification; |
68 | |
import org.kuali.student.common.ui.client.widgets.notification.KSNotifier; |
69 | |
import org.kuali.student.common.ui.client.widgets.progress.BlockingTask; |
70 | |
import org.kuali.student.common.ui.client.widgets.progress.KSBlockingProgressIndicator; |
71 | |
import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableSection; |
72 | |
import org.kuali.student.common.ui.shared.IdAttributes; |
73 | |
import org.kuali.student.common.ui.shared.IdAttributes.IdType; |
74 | |
import org.kuali.student.common.validation.dto.ValidationResultInfo; |
75 | |
import org.kuali.student.core.statement.dto.StatementTypeInfo; |
76 | |
import org.kuali.student.core.workflow.ui.client.widgets.WorkflowEnhancedNavController; |
77 | |
import org.kuali.student.core.workflow.ui.client.widgets.WorkflowUtilities; |
78 | |
import org.kuali.student.lum.common.client.helpers.RecentlyViewedHelper; |
79 | |
import org.kuali.student.lum.common.client.widgets.AppLocations; |
80 | |
import org.kuali.student.lum.lu.ui.course.client.configuration.CourseConfigurer; |
81 | |
import org.kuali.student.lum.lu.ui.course.client.configuration.CourseConfigurer.CourseSections; |
82 | |
import org.kuali.student.lum.lu.ui.course.client.requirements.CourseRequirementsDataModel; |
83 | |
import org.kuali.student.lum.lu.ui.course.client.requirements.HasRequirements; |
84 | |
import org.kuali.student.lum.lu.ui.course.client.service.CourseRpcService; |
85 | |
import org.kuali.student.lum.lu.ui.course.client.service.CourseRpcServiceAsync; |
86 | |
import org.kuali.student.lum.lu.ui.course.client.service.CreditCourseProposalRpcService; |
87 | |
import org.kuali.student.lum.lu.ui.course.client.service.CreditCourseProposalRpcServiceAsync; |
88 | |
|
89 | |
import com.google.gwt.core.client.GWT; |
90 | |
import com.google.gwt.event.dom.client.ClickEvent; |
91 | |
import com.google.gwt.event.dom.client.ClickHandler; |
92 | |
import com.google.gwt.user.client.Window; |
93 | |
import com.google.gwt.user.client.rpc.AsyncCallback; |
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | |
|
105 | 0 | public class CourseProposalController extends MenuEditableSectionController implements RequiresAuthorization, WorkflowEnhancedNavController, HasRequirements { |
106 | |
|
107 | |
|
108 | 0 | CreditCourseProposalRpcServiceAsync cluProposalRpcServiceAsync = GWT.create(CreditCourseProposalRpcService.class); |
109 | 0 | CourseRpcServiceAsync courseServiceAsync = GWT.create(CourseRpcService.class); |
110 | |
|
111 | 0 | private final DataModel cluProposalModel = new DataModel("Proposal"); |
112 | 0 | private final DataModel comparisonModel = new DataModel("Original Course"); |
113 | |
|
114 | 0 | CourseConfigurer cfg = GWT.create(CourseConfigurer.class); |
115 | |
|
116 | |
private WorkQueue modelRequestQueue; |
117 | |
|
118 | |
private WorkflowUtilities workflowUtil; |
119 | |
|
120 | 0 | private boolean initialized = false; |
121 | 0 | private boolean isNew = false; |
122 | |
|
123 | |
private static final String UPDATED_KEY = "metaInfo/updateTime"; |
124 | |
private static final String VERSION_KEY = "versionInfo/versionedFromId"; |
125 | |
private static final String MODIFY_TYPE = "kuali.proposal.type.course.modify"; |
126 | |
public static final String CREATE_TYPE = "kuali.proposal.type.course.create"; |
127 | |
public static final String INITIAL_SAVE_VERSION = "1"; |
128 | 0 | private String currentDocType = CREATE_TYPE; |
129 | 0 | private String proposalPath = ""; |
130 | |
private String currentTitle; |
131 | |
|
132 | 0 | private final DateFormat df = DateFormat.getInstance(); |
133 | |
|
134 | 0 | private final BlockingTask initializingTask = new BlockingTask("Loading"); |
135 | 0 | private final BlockingTask loadDataTask = new BlockingTask("Retrieving Data"); |
136 | 0 | private final BlockingTask saving = new BlockingTask("Saving"); |
137 | |
final CourseRequirementsDataModel reqDataModel; |
138 | |
final CourseRequirementsDataModel reqDataModelComp; |
139 | |
|
140 | |
public CourseProposalController(){ |
141 | 0 | super(); |
142 | 0 | reqDataModel = new CourseRequirementsDataModel(this); |
143 | 0 | reqDataModelComp = new CourseRequirementsDataModel(this); |
144 | 0 | initialize(); |
145 | 0 | addStyleName("courseProposal"); |
146 | 0 | } |
147 | |
|
148 | |
@Override |
149 | |
public void setViewContext(ViewContext viewContext) { |
150 | 0 | super.setViewContext(viewContext); |
151 | 0 | if(viewContext.getId() != null && !viewContext.getId().isEmpty()){ |
152 | 0 | if(viewContext.getIdType() != IdType.COPY_OF_OBJECT_ID){ |
153 | 0 | viewContext.setPermissionType(PermissionType.OPEN); |
154 | |
} |
155 | |
else{ |
156 | |
|
157 | 0 | viewContext.setPermissionType(PermissionType.INITIATE); |
158 | |
} |
159 | |
} |
160 | |
else{ |
161 | 0 | viewContext.setPermissionType(PermissionType.INITIATE); |
162 | |
} |
163 | 0 | } |
164 | |
|
165 | |
private void initialize() { |
166 | |
|
167 | 0 | proposalPath = cfg.getProposalPath(); |
168 | 0 | workflowUtil = new WorkflowUtilities(CourseProposalController.this ,proposalPath); |
169 | |
|
170 | 0 | super.setDefaultModelId(cfg.getModelId()); |
171 | 0 | super.registerModel(cfg.getModelId(), new ModelProvider<DataModel>() { |
172 | |
|
173 | |
@Override |
174 | |
public void requestModel(final ModelRequestCallback<DataModel> callback) { |
175 | 0 | if (modelRequestQueue == null){ |
176 | 0 | modelRequestQueue = new WorkQueue(); |
177 | |
} |
178 | |
|
179 | 0 | WorkItem workItem = new WorkItem(){ |
180 | |
@Override |
181 | |
public void exec(Callback<Boolean> workCompleteCallback) { |
182 | 0 | if (cluProposalModel.getRoot() == null || initialized == false){ |
183 | 0 | initModel(callback, workCompleteCallback); |
184 | |
} else { |
185 | 0 | callback.onModelReady(cluProposalModel); |
186 | 0 | workCompleteCallback.exec(true); |
187 | |
} |
188 | 0 | } |
189 | |
}; |
190 | 0 | modelRequestQueue.submit(workItem); |
191 | |
|
192 | 0 | } |
193 | |
|
194 | |
}); |
195 | 0 | super.registerModel("ComparisonModel", new ModelProvider<DataModel>() { |
196 | |
@Override |
197 | |
public void requestModel(final ModelRequestCallback<DataModel> callback) { |
198 | 0 | if(comparisonModel.getRoot() != null && comparisonModel.getRoot().size() != 0){ |
199 | 0 | callback.onModelReady(comparisonModel); |
200 | |
|
201 | |
} |
202 | |
else{ |
203 | 0 | callback.onModelReady(null); |
204 | |
} |
205 | |
|
206 | 0 | } |
207 | |
}); |
208 | 0 | super.addApplicationEventHandler(ContentDirtyEvent.TYPE, new ContentDirtyEventHandler(){ |
209 | |
public void onContentDirty(ContentDirtyEvent event) { |
210 | 0 | setContentWarning("You have unsaved changes"); |
211 | 0 | } |
212 | |
}); |
213 | |
|
214 | 0 | addApplicationEventHandler(SaveActionEvent.TYPE, new SaveActionHandler(){ |
215 | |
public void doSave(SaveActionEvent saveAction) { |
216 | 0 | GWT.log("CluProposalController received save action request.", null); |
217 | 0 | doSaveAction(saveAction); |
218 | 0 | } |
219 | |
}); |
220 | 0 | } |
221 | |
|
222 | |
private void initModel(final ModelRequestCallback<DataModel> callback, Callback<Boolean> workCompleteCallback){ |
223 | 0 | if(getViewContext().getIdType() == IdType.DOCUMENT_ID){ |
224 | 0 | getCluProposalFromWorkflowId(callback, workCompleteCallback); |
225 | 0 | } else if (getViewContext().getIdType() == IdType.KS_KEW_OBJECT_ID){ |
226 | 0 | getCluProposalFromProposalId(getViewContext().getId(), callback, workCompleteCallback); |
227 | 0 | } else if (getViewContext().getIdType() == IdType.COPY_OF_OBJECT_ID){ |
228 | 0 | createModifyCluProposalModel("versionComment", callback, workCompleteCallback); |
229 | |
} else{ |
230 | 0 | createNewCluProposalModel(callback, workCompleteCallback); |
231 | |
} |
232 | 0 | } |
233 | |
|
234 | |
private void getCurrentModel(final ModelRequestCallback<DataModel> callback, Callback<Boolean> workCompleteCallback){ |
235 | 0 | if (cluProposalModel.getRoot() != null && cluProposalModel.getRoot().size() > 0){ |
236 | 0 | String id = cluProposalModel.get(cfg.getProposalPath()+"/id"); |
237 | 0 | if(id != null){ |
238 | 0 | getCluProposalFromProposalId(id, callback, workCompleteCallback); |
239 | |
} |
240 | |
else{ |
241 | 0 | initModel(callback, workCompleteCallback); |
242 | |
} |
243 | 0 | } |
244 | |
else{ |
245 | 0 | initModel(callback, workCompleteCallback); |
246 | |
} |
247 | 0 | } |
248 | |
|
249 | |
private void init(final Callback<Boolean> onReadyCallback) { |
250 | 0 | if (initialized) { |
251 | 0 | onReadyCallback.exec(true); |
252 | |
} else { |
253 | 0 | initialized = true; |
254 | 0 | KSBlockingProgressIndicator.addTask(initializingTask); |
255 | 0 | setContentWarning(""); |
256 | 0 | this.requestModel(new ModelRequestCallback<DataModel>(){ |
257 | |
|
258 | |
@Override |
259 | |
public void onModelReady(DataModel model) { |
260 | |
|
261 | 0 | String idType = null; |
262 | 0 | String viewContextId = ""; |
263 | 0 | if(getViewContext().getIdType() != null){ |
264 | 0 | idType = getViewContext().getIdType().toString(); |
265 | 0 | viewContextId = getViewContext().getId(); |
266 | 0 | if(getViewContext().getIdType()==IdAttributes.IdType.COPY_OF_OBJECT_ID){ |
267 | 0 | viewContextId = null; |
268 | |
} |
269 | |
|
270 | |
} |
271 | 0 | HashMap<String, String> idAttributes = new HashMap<String, String>(); |
272 | 0 | if(idType != null){ |
273 | 0 | idAttributes.put(IdAttributes.ID_TYPE, idType); |
274 | |
} |
275 | 0 | if(cluProposalModel.get(VERSION_KEY) != null && !((String)cluProposalModel.get(VERSION_KEY)).equals("")){ |
276 | 0 | currentDocType = MODIFY_TYPE; |
277 | |
} |
278 | 0 | idAttributes.put(StudentIdentityConstants.DOCUMENT_TYPE_NAME, currentDocType); |
279 | |
|
280 | |
|
281 | 0 | cluProposalRpcServiceAsync.getMetadata(viewContextId, idAttributes, new KSAsyncCallback<Metadata>(){ |
282 | |
@Override |
283 | |
public void handleTimeout(Throwable caught) { |
284 | 0 | initializeFailed(); |
285 | 0 | } |
286 | |
|
287 | |
@Override |
288 | |
public void handleFailure(Throwable caught) { |
289 | 0 | initializeFailed(); |
290 | 0 | throw new RuntimeException("Failed to get model definition.", caught); |
291 | |
} |
292 | |
|
293 | |
public void initializeFailed(){ |
294 | 0 | initialized = false; |
295 | 0 | onReadyCallback.exec(false); |
296 | 0 | KSBlockingProgressIndicator.removeTask(initializingTask); |
297 | 0 | } |
298 | |
|
299 | |
public void onSuccess(Metadata result) { |
300 | 0 | DataModelDefinition def = new DataModelDefinition(result); |
301 | 0 | cluProposalModel.setDefinition(def); |
302 | 0 | comparisonModel.setDefinition(def); |
303 | |
|
304 | 0 | configureScreens(def, onReadyCallback); |
305 | |
|
306 | 0 | } |
307 | |
}); |
308 | |
|
309 | 0 | } |
310 | |
|
311 | |
@Override |
312 | |
public void onRequestFail(Throwable cause) { |
313 | 0 | GWT.log("Failed to get modeld for proposal controller init"); |
314 | 0 | onReadyCallback.exec(false); |
315 | 0 | } |
316 | |
}); |
317 | |
|
318 | |
} |
319 | 0 | } |
320 | |
|
321 | |
private void configureScreens(final DataModelDefinition modelDefinition, final Callback<Boolean> onReadyCallback){ |
322 | 0 | workflowUtil.requestAndSetupModel(); |
323 | |
|
324 | 0 | CourseRequirementsDataModel.getStatementTypes(new Callback<List<StatementTypeInfo>>() { |
325 | |
|
326 | |
@Override |
327 | |
public void exec(List<StatementTypeInfo> stmtTypes) { |
328 | 0 | List<StatementTypeInfo> stmtTypesOut = new ArrayList<StatementTypeInfo>(); |
329 | 0 | if (stmtTypes != null) { |
330 | 0 | for (StatementTypeInfo stmtType : stmtTypes) { |
331 | 0 | if (stmtType.getId().contains("kuali.statement.type.course.enrollmentEligibility") || |
332 | |
stmtType.getId().contains("kuali.statement.type.course.creditConstraints")) { |
333 | 0 | continue; |
334 | |
} |
335 | 0 | stmtTypesOut.add(stmtType); |
336 | |
} |
337 | |
} |
338 | |
|
339 | 0 | cfg.setStatementTypes(stmtTypesOut); |
340 | 0 | cfg.setModelDefinition(modelDefinition); |
341 | 0 | cfg.configure(CourseProposalController.this); |
342 | |
|
343 | |
|
344 | 0 | onReadyCallback.exec(true); |
345 | 0 | KSBlockingProgressIndicator.removeTask(initializingTask); |
346 | 0 | } |
347 | |
}); |
348 | 0 | } |
349 | |
|
350 | |
@Override |
351 | |
@SuppressWarnings("unchecked") |
352 | |
public void requestModel(Class modelType, final ModelRequestCallback callback) { |
353 | 0 | if(modelType == ReferenceModel.class){ |
354 | 0 | if (cluProposalModel != null){ |
355 | 0 | ReferenceModel ref = new ReferenceModel(); |
356 | |
|
357 | 0 | if(cluProposalModel.get(cfg.getProposalPath()) != null){ |
358 | 0 | ref.setReferenceId((String)cluProposalModel.get(cfg.getProposalPath()+"/id")); |
359 | |
} else { |
360 | 0 | ref.setReferenceId(null); |
361 | |
} |
362 | |
|
363 | |
|
364 | 0 | if(cluProposalModel.get(cfg.getProposalPath()) != null){ |
365 | 0 | Map<String, String> attributes = new HashMap<String, String>(); |
366 | 0 | attributes.put("name", (String)cluProposalModel.get(cfg.getProposalPath()+"/name")); |
367 | 0 | ref.setReferenceAttributes(attributes); |
368 | 0 | } else { |
369 | 0 | ref.setReferenceAttributes(null); |
370 | |
} |
371 | |
|
372 | 0 | ref.setReferenceTypeKey(cfg.getProposalReferenceTypeKey()); |
373 | 0 | ref.setReferenceType(cfg.getProposalReferenceObjectType()); |
374 | 0 | ref.setReferenceState(getViewContext().getState()); |
375 | |
|
376 | 0 | callback.onModelReady(ref); |
377 | 0 | } |
378 | 0 | } else if (modelType == Data.class){ |
379 | 0 | requestModel(cfg.getModelId(), callback); |
380 | |
} else { |
381 | 0 | super.requestModel(modelType, callback); |
382 | |
} |
383 | |
|
384 | 0 | } |
385 | |
|
386 | |
@SuppressWarnings("unchecked") |
387 | |
private void getCluProposalFromWorkflowId(final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){ |
388 | 0 | KSBlockingProgressIndicator.addTask(loadDataTask); |
389 | 0 | workflowUtil.getDataIdFromWorkflowId(getViewContext().getId(), new KSAsyncCallback<String>(){ |
390 | |
@Override |
391 | |
public void handleFailure(Throwable caught) { |
392 | 0 | Window.alert("Error loading Proposal from Workflow Document: "+caught.getMessage()); |
393 | 0 | createNewCluProposalModel(callback, workCompleteCallback); |
394 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
395 | 0 | } |
396 | |
|
397 | |
@Override |
398 | |
public void onSuccess(String proposalId) { |
399 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
400 | 0 | getCluProposalFromProposalId(proposalId, callback, workCompleteCallback); |
401 | 0 | } |
402 | |
}); |
403 | 0 | } |
404 | |
|
405 | |
@SuppressWarnings("unchecked") |
406 | |
private void getCluProposalFromProposalId(String id, final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){ |
407 | 0 | KSBlockingProgressIndicator.addTask(loadDataTask); |
408 | 0 | cluProposalRpcServiceAsync.getData(id, new KSAsyncCallback<Data>(){ |
409 | |
|
410 | |
@Override |
411 | |
public void handleFailure(Throwable caught) { |
412 | 0 | Window.alert("Error loading Proposal: "+caught.getMessage()); |
413 | 0 | createNewCluProposalModel(callback, workCompleteCallback); |
414 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
415 | 0 | } |
416 | |
|
417 | |
@Override |
418 | |
public void onSuccess(Data result) { |
419 | 0 | cluProposalModel.setRoot(result); |
420 | 0 | setProposalHeaderTitle(); |
421 | 0 | setLastUpdated(); |
422 | 0 | reqDataModel.retrieveStatementTypes(cluProposalModel.<String>get("id"), new Callback<Boolean>() { |
423 | |
@Override |
424 | |
public void exec(Boolean result) { |
425 | 0 | if(result){ |
426 | 0 | getCourseComparisonModel(callback, workCompleteCallback); |
427 | |
} |
428 | 0 | } |
429 | |
}); |
430 | 0 | } |
431 | |
|
432 | |
}); |
433 | 0 | } |
434 | |
|
435 | |
@SuppressWarnings("unchecked") |
436 | |
private void getCourseComparisonModel(final ModelRequestCallback proposalModelRequestCallback, final Callback<Boolean> workCompleteCallback){ |
437 | 0 | if(cluProposalModel.get(VERSION_KEY) != null && !((String)cluProposalModel.get(VERSION_KEY)).equals("")){ |
438 | 0 | courseServiceAsync.getData((String)cluProposalModel.get(VERSION_KEY), new KSAsyncCallback<Data>(){ |
439 | |
|
440 | |
@Override |
441 | |
public void handleFailure(Throwable caught) { |
442 | 0 | Window.alert("Error loading Proposal: "+caught.getMessage()); |
443 | 0 | createNewCluProposalModel(proposalModelRequestCallback, workCompleteCallback); |
444 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
445 | 0 | } |
446 | |
|
447 | |
@Override |
448 | |
public void onSuccess(Data result) { |
449 | 0 | if (result != null) { |
450 | 0 | comparisonModel.setRoot(result); |
451 | 0 | reqDataModelComp.retrieveStatementTypes(comparisonModel.<String>get("id"), new Callback<Boolean>() { |
452 | |
@Override |
453 | |
public void exec(Boolean result) { |
454 | 0 | if (result) { |
455 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
456 | |
} |
457 | 0 | } |
458 | |
}); |
459 | |
} |
460 | 0 | proposalModelRequestCallback.onModelReady(cluProposalModel); |
461 | 0 | workCompleteCallback.exec(true); |
462 | 0 | reqDataModel.retrieveStatementTypes(cluProposalModel.<String>get("id"), new Callback<Boolean>() { |
463 | |
@Override |
464 | |
public void exec(Boolean result) { |
465 | 0 | if (result) { |
466 | |
|
467 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
468 | |
} |
469 | 0 | } |
470 | |
}); |
471 | |
|
472 | 0 | } |
473 | |
}); |
474 | |
} else { |
475 | 0 | proposalModelRequestCallback.onModelReady(cluProposalModel); |
476 | 0 | workCompleteCallback.exec(true); |
477 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
478 | |
} |
479 | 0 | } |
480 | |
|
481 | |
@SuppressWarnings("unchecked") |
482 | |
private void createNewCluProposalModel(final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){ |
483 | 0 | cluProposalModel.setRoot(new Data()); |
484 | 0 | isNew = true; |
485 | 0 | setProposalHeaderTitle(); |
486 | 0 | setLastUpdated(); |
487 | 0 | callback.onModelReady(cluProposalModel); |
488 | 0 | workCompleteCallback.exec(true); |
489 | 0 | } |
490 | |
|
491 | |
@SuppressWarnings("unchecked") |
492 | |
private void createModifyCluProposalModel(String versionComment, final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){ |
493 | 0 | Data data = new Data(); |
494 | |
|
495 | 0 | Data proposalData = new Data(); |
496 | 0 | proposalData.set(new Data.StringKey("type"), MODIFY_TYPE); |
497 | 0 | data.set(new Data.StringKey("proposal"), proposalData); |
498 | |
|
499 | 0 | Data versionData = new Data(); |
500 | 0 | versionData.set(new Data.StringKey("versionIndId"), getViewContext().getId()); |
501 | 0 | versionData.set(new Data.StringKey("versionComment"), versionComment); |
502 | 0 | data.set(new Data.StringKey("versionInfo"), versionData); |
503 | |
|
504 | 0 | cluProposalModel.setRoot(data); |
505 | 0 | cluProposalRpcServiceAsync.saveData(cluProposalModel.getRoot(), new AsyncCallback<DataSaveResult>() { |
506 | |
public void onSuccess(DataSaveResult result) { |
507 | 0 | cluProposalModel.setRoot(result.getValue()); |
508 | 0 | setProposalHeaderTitle(); |
509 | 0 | setLastUpdated(); |
510 | |
|
511 | 0 | ViewContext docContext = new ViewContext(); |
512 | 0 | docContext.setId((String) cluProposalModel.get(cfg.getProposalPath()+"/id")); |
513 | 0 | docContext.setIdType(IdType.KS_KEW_OBJECT_ID); |
514 | 0 | RecentlyViewedHelper.addDocument(getProposalTitle(), |
515 | |
HistoryManager.appendContext(AppLocations.Locations.COURSE_PROPOSAL.getLocation(), docContext) |
516 | |
+ "/SUMMARY"); |
517 | 0 | getCourseComparisonModel(callback, workCompleteCallback); |
518 | |
|
519 | |
|
520 | |
|
521 | 0 | getViewContext().setIdType(docContext.getIdType()); |
522 | 0 | getViewContext().setId(docContext.getId()); |
523 | |
|
524 | 0 | } |
525 | |
|
526 | |
public void onFailure(Throwable caught) { |
527 | 0 | Window.alert("Error loading Proposal: "+caught.getMessage()); |
528 | 0 | createNewCluProposalModel(callback, workCompleteCallback); |
529 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
530 | 0 | } |
531 | |
}); |
532 | 0 | } |
533 | |
|
534 | |
public void doSaveAction(final SaveActionEvent saveActionEvent){ |
535 | 0 | requestModel(new ModelRequestCallback<DataModel>() { |
536 | |
@Override |
537 | |
public void onModelReady(DataModel model) { |
538 | 0 | CourseProposalController.this.updateModelFromCurrentView(); |
539 | |
|
540 | 0 | if (isStartViewShowing()){ |
541 | |
|
542 | |
|
543 | 0 | getStartPopupView().updateModel(); |
544 | |
} |
545 | |
|
546 | 0 | model.validate(new Callback<List<ValidationResultInfo>>() { |
547 | |
@Override |
548 | |
public void exec(List<ValidationResultInfo> result) { |
549 | |
|
550 | 0 | boolean isSectionValid = isValid(result, true); |
551 | |
|
552 | 0 | if(isSectionValid){ |
553 | 0 | if (startSectionRequired()){ |
554 | 0 | showStartPopup(NO_OP_CALLBACK); |
555 | 0 | saveActionEvent.doActionComplete(); |
556 | |
} |
557 | |
else{ |
558 | 0 | saveProposalClu(saveActionEvent); |
559 | |
} |
560 | |
} |
561 | |
else{ |
562 | |
|
563 | 0 | KSNotifier.add(new KSNotification("Unable to save, please check fields for errors.", false, true, 5000)); |
564 | |
} |
565 | |
|
566 | 0 | } |
567 | |
}); |
568 | 0 | } |
569 | |
|
570 | |
@Override |
571 | |
public void onRequestFail(Throwable cause) { |
572 | 0 | saveActionEvent.doActionComplete(); |
573 | 0 | GWT.log("Unable to retrieve model for validation and save", cause); |
574 | 0 | } |
575 | |
|
576 | |
}); |
577 | |
|
578 | 0 | } |
579 | |
|
580 | |
public boolean startSectionRequired(){ |
581 | 0 | String proposalId = cluProposalModel.get(cfg.getProposalPath()+"/id"); |
582 | |
|
583 | |
|
584 | |
|
585 | 0 | String proposalTitle = cluProposalModel.get(cfg.getProposalTitlePath()); |
586 | 0 | String courseTitle = cluProposalModel.get(cfg.getCourseTitlePath()); |
587 | 0 | if (proposalTitle == null || proposalTitle.isEmpty()){ |
588 | 0 | cluProposalModel.set(QueryPath.parse(cfg.getProposalTitlePath()), courseTitle); |
589 | |
} |
590 | |
|
591 | 0 | return proposalId==null && !CourseProposalController.this.isStartViewShowing() && !hasTitles(proposalTitle, courseTitle); |
592 | |
} |
593 | |
|
594 | |
private boolean hasTitles(String proposalTitle, String courseTitle){ |
595 | 0 | return (proposalTitle != null && !proposalTitle.isEmpty()) && (courseTitle != null && !courseTitle.isEmpty()); |
596 | |
} |
597 | |
|
598 | |
public void saveProposalClu(final SaveActionEvent saveActionEvent){ |
599 | 0 | KSBlockingProgressIndicator.addTask(saving); |
600 | 0 | final Callback<Throwable> saveFailedCallback = new Callback<Throwable>() { |
601 | |
|
602 | |
@Override |
603 | |
public void exec(Throwable caught) { |
604 | 0 | GWT.log("Save Failed.", caught); |
605 | 0 | KSBlockingProgressIndicator.removeTask(saving); |
606 | 0 | KSNotifier.add(new KSNotification("Save Failed on server. Please try again.", false, true, 5000)); |
607 | 0 | } |
608 | |
|
609 | |
}; |
610 | |
try { |
611 | 0 | cluProposalRpcServiceAsync.saveData(cluProposalModel.getRoot(), new KSAsyncCallback<DataSaveResult>(){ |
612 | |
@Override |
613 | |
public void handleFailure(Throwable caught) { |
614 | 0 | saveFailedCallback.exec(caught); |
615 | 0 | } |
616 | |
|
617 | |
public void onSuccess(DataSaveResult result) { |
618 | 0 | KSBlockingProgressIndicator.removeTask(saving); |
619 | |
|
620 | 0 | Application.getApplicationContext().clearValidationWarnings(); |
621 | 0 | Application.getApplicationContext().addValidationWarnings(result.getValidationResults()); |
622 | |
|
623 | 0 | if(ValidatorClientUtils.hasErrors(result.getValidationResults())){ |
624 | 0 | isValid(result.getValidationResults(), false, true); |
625 | 0 | saveActionEvent.setGotoNextView(false); |
626 | 0 | saveActionEvent.doActionComplete(); |
627 | 0 | KSNotifier.show("Save Failed. There were validation errors."); |
628 | |
}else{ |
629 | |
|
630 | 0 | saveActionEvent.setSaveSuccessful(true); |
631 | 0 | cluProposalModel.setRoot(result.getValue()); |
632 | 0 | String title = getProposalTitle(); |
633 | |
|
634 | 0 | View currentView = getCurrentView(); |
635 | 0 | if (currentView instanceof SectionView){ |
636 | 0 | ((SectionView)currentView).updateView(cluProposalModel); |
637 | 0 | ((SectionView) currentView).resetDirtyFlags(); |
638 | |
} |
639 | 0 | saveActionEvent.doActionComplete(); |
640 | |
|
641 | 0 | ViewContext context = CourseProposalController.this.getViewContext(); |
642 | 0 | context.setId((String)cluProposalModel.get(proposalPath+"/id")); |
643 | 0 | context.setIdType(IdType.KS_KEW_OBJECT_ID); |
644 | |
|
645 | |
|
646 | |
|
647 | 0 | String proposalVersion = cluProposalModel.get(proposalPath+"/metaInfo/versionInd"); |
648 | 0 | if (INITIAL_SAVE_VERSION.equals(proposalVersion)){ |
649 | 0 | workflowUtil.refresh(); |
650 | |
} |
651 | |
|
652 | 0 | setProposalHeaderTitle(); |
653 | 0 | setLastUpdated(); |
654 | 0 | HistoryManager.logHistoryChange(); |
655 | 0 | if(isNew){ |
656 | 0 | RecentlyViewedHelper.addCurrentDocument(title); |
657 | |
} |
658 | 0 | else if(!currentTitle.equals(title)){ |
659 | 0 | RecentlyViewedHelper.updateTitle(currentTitle, title, (String)cluProposalModel.get(proposalPath+"/id")); |
660 | |
} |
661 | 0 | isNew = false; |
662 | |
|
663 | 0 | if(saveActionEvent.gotoNextView()){ |
664 | 0 | CourseProposalController.this.showNextViewOnMenu(); |
665 | |
} |
666 | |
|
667 | 0 | if (ValidatorClientUtils.hasWarnings(result.getValidationResults())){ |
668 | |
|
669 | 0 | KSNotifier.show("Saved with Warnings"); |
670 | |
} else { |
671 | 0 | KSNotifier.show("Save Successful"); |
672 | |
} |
673 | |
} |
674 | 0 | } |
675 | |
}); |
676 | 0 | } catch (Exception e) { |
677 | 0 | saveFailedCallback.exec(e); |
678 | 0 | } |
679 | |
|
680 | 0 | } |
681 | |
|
682 | |
public void setLastUpdated(){ |
683 | 0 | Date lastUpdated = (Date)cluProposalModel.get(UPDATED_KEY); |
684 | 0 | if(lastUpdated != null){ |
685 | 0 | setContentInfo("Last Updated: " + df.format(lastUpdated)); |
686 | |
} |
687 | |
else{ |
688 | 0 | setContentInfo(""); |
689 | |
} |
690 | 0 | } |
691 | |
|
692 | |
@Override |
693 | |
public void beforeShow(final Callback<Boolean> onReadyCallback){ |
694 | 0 | Application.getApplicationContext().clearCrossConstraintMap(null); |
695 | 0 | Application.getApplicationContext().clearPathToFieldMapping(null); |
696 | 0 | Application.getApplicationContext().setParentPath(""); |
697 | |
|
698 | 0 | init(onReadyCallback); |
699 | 0 | } |
700 | |
|
701 | |
|
702 | |
|
703 | |
|
704 | |
@Override |
705 | |
public <V extends Enum<?>> void showView(final V viewType, |
706 | |
final Callback<Boolean> onReadyCallback) { |
707 | 0 | Callback<Boolean> finalizeView = new Callback<Boolean>(){ |
708 | |
public void exec(Boolean result) { |
709 | |
|
710 | 0 | for(HasCrossConstraints crossConstraint:Application.getApplicationContext().getCrossConstraints(null)){ |
711 | 0 | crossConstraint.reprocessWithUpdatedConstraints(); |
712 | |
} |
713 | |
|
714 | |
|
715 | |
|
716 | 0 | if (viewType == CourseSections.SUMMARY){ |
717 | 0 | KSBlockingProgressIndicator.addTask(initializingTask); |
718 | 0 | courseServiceAsync.validate(cluProposalModel.getRoot(), new KSAsyncCallback<List<ValidationResultInfo>>(){ |
719 | |
@Override |
720 | |
public void onSuccess(List<ValidationResultInfo> result) { |
721 | 0 | Application.getApplicationContext().clearValidationWarnings(); |
722 | 0 | Application.getApplicationContext().addValidationWarnings(result); |
723 | 0 | showWarnings(); |
724 | 0 | KSBlockingProgressIndicator.removeTask(initializingTask); |
725 | 0 | } |
726 | |
}); |
727 | |
} else { |
728 | 0 | showWarnings(); |
729 | |
} |
730 | |
|
731 | 0 | onReadyCallback.exec(result); |
732 | 0 | } |
733 | |
}; |
734 | 0 | super.showView(viewType, finalizeView); |
735 | 0 | } |
736 | |
|
737 | |
|
738 | |
@Override |
739 | |
public void showDefaultView(Callback<Boolean> onReadyCallback) { |
740 | 0 | if(isNew){ |
741 | 0 | super.showFirstView(onReadyCallback); |
742 | |
} |
743 | |
else{ |
744 | 0 | super.showDefaultView(onReadyCallback); |
745 | |
} |
746 | 0 | } |
747 | |
|
748 | |
@Override |
749 | |
public void setParentController(Controller controller) { |
750 | 0 | super.setParentController(controller); |
751 | 0 | } |
752 | |
|
753 | |
@Override |
754 | |
public void checkAuthorization(final PermissionType permissionType, final AuthorizationCallback authCallback) { |
755 | 0 | Map<String,String> attributes = new HashMap<String,String>(); |
756 | |
|
757 | 0 | GWT.log("Attempting Auth Check.", null); |
758 | 0 | if ( (getViewContext().getId() != null) && (!"".equals(getViewContext().getId())) ) { |
759 | 0 | attributes.put(getViewContext().getIdType().toString(), getViewContext().getId()); |
760 | |
} |
761 | |
|
762 | 0 | cluProposalRpcServiceAsync.isAuthorized(permissionType, attributes, new KSAsyncCallback<Boolean>(){ |
763 | |
|
764 | |
@Override |
765 | |
public void handleFailure(Throwable caught) { |
766 | 0 | authCallback.isNotAuthorized("Error checking authorization."); |
767 | 0 | GWT.log("Error checking proposal authorization.", caught); |
768 | 0 | Window.alert("Error Checking Proposal Authorization: "+caught.getMessage()); |
769 | 0 | } |
770 | |
|
771 | |
@Override |
772 | |
public void onSuccess(Boolean result) { |
773 | 0 | GWT.log("Succeeded checking auth for permission type '" + permissionType + "' with result: " + result, null); |
774 | 0 | if (Boolean.TRUE.equals(result)) { |
775 | 0 | authCallback.isAuthorized(); |
776 | |
} |
777 | |
else { |
778 | 0 | authCallback.isNotAuthorized("User is not authorized: " + permissionType); |
779 | |
} |
780 | 0 | } |
781 | |
}); |
782 | 0 | } |
783 | |
|
784 | |
@Override |
785 | |
public boolean isAuthorizationRequired() { |
786 | 0 | return true; |
787 | |
} |
788 | |
|
789 | |
@Override |
790 | |
public void setAuthorizationRequired(boolean required) { |
791 | 0 | throw new UnsupportedOperationException(); |
792 | |
} |
793 | |
|
794 | |
protected void setProposalHeaderTitle(){ |
795 | |
String title; |
796 | 0 | if (cluProposalModel.get(cfg.getProposalTitlePath()) != null){ |
797 | 0 | title = getProposalTitle(); |
798 | |
} |
799 | |
else{ |
800 | 0 | title = "New Course (Proposal)"; |
801 | |
} |
802 | 0 | this.setContentTitle(title); |
803 | 0 | this.setName(title); |
804 | 0 | WindowTitleUtils.setContextTitle(title); |
805 | 0 | currentTitle = title; |
806 | 0 | } |
807 | |
|
808 | |
@Override |
809 | |
public WorkflowUtilities getWfUtilities() { |
810 | 0 | return workflowUtil; |
811 | |
} |
812 | |
|
813 | |
@Override |
814 | |
public void beforeViewChange(final Enum<?> viewChangingTo, final Callback<Boolean> okToChange) { |
815 | |
|
816 | 0 | final Callback<Boolean> reallyOkToChange = new Callback<Boolean>(){ |
817 | |
@Override |
818 | |
public void exec(Boolean result) { |
819 | 0 | if(CourseSections.GOVERNANCE.equals(viewChangingTo)){ |
820 | 0 | getView(CourseSections.COURSE_INFO, new Callback<View>(){ |
821 | |
@Override |
822 | |
public void exec(final View view) { |
823 | 0 | if(view!=null && view instanceof SectionView){ |
824 | 0 | requestModel(new ModelRequestCallback<DataModel>(){ |
825 | |
public void onModelReady(DataModel model) { |
826 | 0 | ((SectionView)view).updateWidgetData(model); |
827 | 0 | okToChange.exec(true); |
828 | 0 | } |
829 | |
public void onRequestFail(Throwable cause) { |
830 | 0 | okToChange.exec(false); |
831 | 0 | } |
832 | |
}); |
833 | |
}else{ |
834 | 0 | okToChange.exec(true); |
835 | |
} |
836 | 0 | }}); |
837 | |
}else{ |
838 | 0 | okToChange.exec(true); |
839 | |
} |
840 | 0 | } |
841 | |
}; |
842 | |
|
843 | |
|
844 | |
|
845 | |
|
846 | |
|
847 | 0 | super.beforeViewChange(viewChangingTo, new Callback<Boolean>(){ |
848 | |
|
849 | |
@Override |
850 | |
public void exec(Boolean result) { |
851 | 0 | if(result){ |
852 | 0 | if(getCurrentView() instanceof SectionView && ((SectionView)getCurrentView()).isDirty()){ |
853 | 0 | ButtonGroup<YesNoCancelEnum> buttonGroup = new YesNoCancelGroup(); |
854 | 0 | final ButtonMessageDialog<YesNoCancelEnum> dialog = new ButtonMessageDialog<YesNoCancelEnum>("Warning", "You may have unsaved changes. Save changes?", buttonGroup); |
855 | 0 | buttonGroup.addCallback(new Callback<YesNoCancelEnum>(){ |
856 | |
|
857 | |
@Override |
858 | |
public void exec(YesNoCancelEnum result) { |
859 | 0 | switch(result){ |
860 | |
case YES: |
861 | 0 | dialog.hide(); |
862 | 0 | final SaveActionEvent e = new SaveActionEvent(); |
863 | 0 | e.setActionCompleteCallback(new ActionCompleteCallback(){ |
864 | |
|
865 | |
@Override |
866 | |
public void onActionComplete(ActionEvent action) { |
867 | 0 | if(e.isSaveSuccessful()){ |
868 | 0 | reallyOkToChange.exec(true); |
869 | |
} |
870 | |
else{ |
871 | 0 | reallyOkToChange.exec(false); |
872 | |
} |
873 | 0 | } |
874 | |
|
875 | |
}); |
876 | 0 | fireApplicationEvent(e); |
877 | 0 | break; |
878 | |
case NO: |
879 | |
|
880 | 0 | getCurrentModel(new ModelRequestCallback<DataModel>(){ |
881 | |
|
882 | |
@Override |
883 | |
public void onModelReady(DataModel model) { |
884 | 0 | if (getCurrentView()instanceof Section){ |
885 | 0 | ((Section) getCurrentView()).resetFieldInteractionFlags(); |
886 | |
} |
887 | 0 | reallyOkToChange.exec(true); |
888 | 0 | dialog.hide(); |
889 | 0 | } |
890 | |
|
891 | |
@Override |
892 | |
public void onRequestFail(Throwable cause) { |
893 | |
|
894 | |
|
895 | 0 | reallyOkToChange.exec(false); |
896 | 0 | dialog.hide(); |
897 | 0 | GWT.log("Unable to retrieve model for data restore on view change with no save", cause); |
898 | 0 | }}, |
899 | |
NO_OP_CALLBACK); |
900 | |
|
901 | 0 | break; |
902 | |
case CANCEL: |
903 | 0 | reallyOkToChange.exec(false); |
904 | 0 | dialog.hide(); |
905 | |
|
906 | 0 | HistoryManager.logHistoryChange(); |
907 | |
break; |
908 | |
} |
909 | 0 | } |
910 | |
}); |
911 | 0 | dialog.show(); |
912 | 0 | } |
913 | |
else{ |
914 | 0 | reallyOkToChange.exec(true); |
915 | |
} |
916 | |
} |
917 | |
else{ |
918 | 0 | reallyOkToChange.exec(false); |
919 | |
} |
920 | 0 | } |
921 | |
}); |
922 | 0 | } |
923 | |
|
924 | |
public KSButton getSaveButton(){ |
925 | 0 | if(currentDocType != MODIFY_TYPE){ |
926 | 0 | return new KSButton("Save and Continue", new ClickHandler(){ |
927 | |
public void onClick(ClickEvent event) { |
928 | 0 | CourseProposalController.this.fireApplicationEvent(new SaveActionEvent(true)); |
929 | 0 | } |
930 | |
}); |
931 | |
} |
932 | |
else{ |
933 | 0 | return new KSButton("Save", new ClickHandler(){ |
934 | |
public void onClick(ClickEvent event) { |
935 | 0 | CourseProposalController.this.fireApplicationEvent(new SaveActionEvent(false)); |
936 | 0 | } |
937 | |
}); |
938 | |
} |
939 | |
} |
940 | |
|
941 | |
public KSButton getCancelButton(final Enum<?> summaryView){ |
942 | |
|
943 | 0 | return new KSButton("Cancel", ButtonStyle.ANCHOR_LARGE_CENTERED, new ClickHandler(){ |
944 | |
public void onClick(ClickEvent event) { |
945 | 0 | if(!isNew){ |
946 | 0 | CourseProposalController.this.showView(summaryView); |
947 | |
} |
948 | |
else{ |
949 | 0 | Application.navigate(AppLocations.Locations.CURRICULUM_MANAGEMENT.getLocation()); |
950 | |
} |
951 | 0 | } |
952 | |
}); |
953 | |
|
954 | |
} |
955 | |
|
956 | |
@Override |
957 | |
public void onHistoryEvent(String historyStack) { |
958 | 0 | super.onHistoryEvent(historyStack); |
959 | |
|
960 | |
|
961 | 0 | if(cluProposalModel.get(cfg.getProposalTitlePath()) != null && |
962 | |
this.getViewContext().getIdType() != IdType.COPY_OF_OBJECT_ID){ |
963 | 0 | RecentlyViewedHelper.addCurrentDocument(getProposalTitle()); |
964 | |
} |
965 | 0 | } |
966 | |
|
967 | |
private String getProposalTitle(){ |
968 | 0 | StringBuffer sb = new StringBuffer(); |
969 | 0 | sb.append(cluProposalModel.get(cfg.getProposalTitlePath())); |
970 | 0 | sb.append(" (Proposal)"); |
971 | 0 | return sb.toString(); |
972 | |
} |
973 | |
|
974 | |
public String getCourseId(){ |
975 | 0 | return cluProposalModel.<String>get("id"); |
976 | |
} |
977 | |
|
978 | |
public boolean isNew() { |
979 | 0 | return isNew; |
980 | |
} |
981 | |
|
982 | |
public CourseRequirementsDataModel getReqDataModel() { |
983 | 0 | return reqDataModel; |
984 | |
} |
985 | |
|
986 | |
public CourseRequirementsDataModel getReqDataModelComp() { |
987 | 0 | return reqDataModelComp; |
988 | |
} |
989 | |
|
990 | |
@Override |
991 | |
public DataModel getExportDataModel() { |
992 | 0 | return cluProposalModel; |
993 | |
} |
994 | |
|
995 | |
|
996 | |
|
997 | |
|
998 | |
|
999 | |
@Override |
1000 | |
public String getExportTemplateName() { |
1001 | 0 | return "proposal.template"; |
1002 | |
} |
1003 | |
|
1004 | |
@Override |
1005 | |
public ArrayList<ExportElement> getExportElementsFromView() { |
1006 | 0 | ArrayList<ExportElement> exportElements = new ArrayList<ExportElement>(); |
1007 | 0 | if (this.getCurrentViewEnum().equals(CourseSections.SUMMARY)) { |
1008 | 0 | SummaryTableSection tableSection = this.cfg.getSummaryConfigurer().getTableSection(); |
1009 | 0 | ExportElement heading = new ExportElement(); |
1010 | 0 | heading.setFieldLabel(""); |
1011 | 0 | heading.setFieldValue(cluProposalModel.getModelName()); |
1012 | 0 | heading.setFieldValue2(comparisonModel.getModelName()); |
1013 | 0 | exportElements.add(heading); |
1014 | 0 | exportElements = ExportUtils.getDetailsForWidget(tableSection, exportElements); |
1015 | |
} |
1016 | 0 | return exportElements; |
1017 | |
} |
1018 | |
|
1019 | |
@Override |
1020 | |
public boolean isExportButtonActive() { |
1021 | 0 | if (this.getCurrentViewEnum() != null && this.getCurrentViewEnum().equals(CourseSections.SUMMARY)) { |
1022 | 0 | return true; |
1023 | |
} else { |
1024 | 0 | return false; |
1025 | |
} |
1026 | |
|
1027 | |
} |
1028 | |
} |