@Override protected void event(final UserRequest ureq, final Controller source, final Event event) { if (source == accessibilityCondContr) { if (event == Event.CHANGED_EVENT) { final Condition cond = accessibilityCondContr.getCondition(); courseNode.setPreConditionAccess(cond); fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT); } } else if (source == configForm) { if (event == Event.DONE_EVENT) { configForm.getUpdatedConfig(); fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT); } } else if (source == textForm) { if (event == Event.DONE_EVENT) { textForm.getUpdatedConfig(); configForm.setDirtyFromOtherForm(false); fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT); } else if (event == Event.CHANGED_EVENT) { // disable modification in other forms! configForm.setDirtyFromOtherForm(true); } } else if (source == scoringController) { if (event == Event.CANCELLED_EVENT) { if (hasLogEntries) { scoringController.setDisplayOnly(true); } configContent.contextPut("isOverwriting", new Boolean(false)); return; } else if (event == Event.DONE_EVENT) { scoringController.updateModuleConfiguration(config); fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT); } } }
public PortfolioCourseNodeEditController( final UserRequest ureq, final WindowControl wControl, final ICourse course, final PortfolioCourseNode node, final ModuleConfiguration config, final UserCourseEnvironment euce) { super(ureq, wControl); this.config = config; this.courseNode = node; configForm = new PortfolioConfigForm(ureq, wControl, course, node); listenTo(configForm); scoringController = new MSEditFormController(ureq, wControl, config); scoringContent = scoringController.getInitialComponent(); listenTo(scoringController); textForm = new PortfolioTextForm(ureq, wControl, course, node); listenTo(textForm); configContent = createVelocityContainer("edit"); configContent.put("configForm", configForm.getInitialComponent()); configContent.put("textForm", textForm.getInitialComponent()); // Accessibility precondition final CourseGroupManager groupMgr = course.getCourseEnvironment().getCourseGroupManager(); final CourseEditorTreeModel editorModel = course.getEditorTreeModel(); final Condition accessCondition = node.getPreConditionAccess(); accessibilityCondContr = new ConditionEditController( ureq, getWindowControl(), groupMgr, accessCondition, "accessabilityConditionForm", AssessmentHelper.getAssessableNodes(editorModel, node), euce); listenTo(accessibilityCondContr); // if there is already user data available, make for read only final UserNodeAuditManager am = course.getCourseEnvironment().getAuditManager(); hasLogEntries = am.hasUserNodeLogs(node); configContent.contextPut("hasLogEntries", new Boolean(hasLogEntries)); if (hasLogEntries) { scoringController.setDisplayOnly(true); } // Initialstate configContent.contextPut("isOverwriting", new Boolean(false)); }