/** {@inheritDoc} */ @Override protected void formOK(UserRequest ureq) { // read data from form elements for (int i = 0; i < lTargetInputList.size(); i++) { LLModel link = (LLModel) lTargetInputList.get(i).getUserObject(); String linkValue = lTargetInputList.get(i).getValue(); if (link.isIntern()) { if (!linkValue.contains("://") && !linkValue.startsWith("/")) { linkValue = "/".concat(linkValue.trim()); lTargetInputList.get(i).setValue(linkValue); } } else if (!linkValue.contains("://")) { linkValue = "http://".concat(linkValue.trim()); lTargetInputList.get(i).setValue(linkValue); } link.setTarget(linkValue); boolean blank = lHtmlTargetInputList.get(i).isSelected(0); if (linkValue.startsWith(Settings.getServerContextPathURI())) { // links to OO pages open in same window blank = false; lHtmlTargetInputList.get(i).select(SELF_KEY, true); } link.setHtmlTarget(blank ? BLANK_KEY : SELF_KEY); link.setDescription(lDescriptionInputList.get(i).getValue()); link.setComment(lCommentInputList.get(i).getValue()); } moduleConfig.set(LLCourseNode.CONF_LINKLIST, linkList); // Inform all listeners about the changes fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT); }
@Override protected void formInnerEvent( final UserRequest ureq, final FormItem source, final FormEvent event) { if (config == null) { throw new AssertException("Try to do updateConfiguration() but module configuration is null"); } config.set( DialogConfigForm.DIALOG_CONFIG_INTEGRATION, select.isSelected(0) ? CONFIG_INTEGRATION_VALUE_POPUP : CONFIG_INTEGRATION_VALUE_INLINE); config.setConfigurationVersion(1); fireEvent(ureq, Event.CHANGED_EVENT); }
/** * Adds to the given module configuration the default configuration for the manual scoring * * @param moduleConfiguration */ public static void initDefaultConfig(final ModuleConfiguration moduleConfiguration) { moduleConfiguration.set(CONFIG_KEY_HAS_SCORE_FIELD, Boolean.FALSE); moduleConfiguration.set(CONFIG_KEY_SCORE_MIN, new Float(0)); moduleConfiguration.set(CONFIG_KEY_SCORE_MAX, new Float(0)); moduleConfiguration.set(CONFIG_KEY_HAS_PASSED_FIELD, Boolean.TRUE); // no preset for passed cut value -> manual setting of passed moduleConfiguration.set(CONFIG_KEY_HAS_COMMENT_FIELD, Boolean.TRUE); moduleConfiguration.set(CONFIG_KEY_INFOTEXT_USER, ""); moduleConfiguration.set(CONFIG_KEY_INFOTEXT_COACH, ""); }
public GTASampleSolutionsEditController( UserRequest ureq, WindowControl wControl, ModuleConfiguration config, File solutionDir, VFSContainer solutionContainer) { super(ureq, wControl, "edit_solution_list"); this.solutionDir = solutionDir; this.solutionContainer = solutionContainer; if (config.get(GTACourseNode.GTASK_SOLUTIONS) == null) { solutions = new SolutionList(); config.set(GTACourseNode.GTASK_SOLUTIONS, solutions); } else { solutions = (SolutionList) config.get(GTACourseNode.GTASK_SOLUTIONS); } initForm(ureq); }
private void create(MultipleSelectionElement selection, ICourse course, CourseNode parentNode) { SelectNodeObject node = (SelectNodeObject) selection.getUserObject(); if (selection.isMultiselect() && selection.isSelected(0)) { VFSItem item = node.getItem(); CourseNode newNode = null; if (item instanceof VFSLeaf) { // create node newNode = createCourseNode(item, "sp"); ModuleConfiguration moduleConfig = newNode.getModuleConfiguration(); String path = getRelativePath(item); moduleConfig.set(SPEditController.CONFIG_KEY_FILE, path); moduleConfig.setBooleanEntry(SPEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS, true); } else if (item instanceof VFSContainer) { // add structure newNode = createCourseNode(item, "st"); } int pos = -1; if (position >= 0 && selectedNode.getCourseNode().getIdent().equals(parentNode.getIdent())) { pos = position++; } if (pos < 0 || pos >= parentNode.getChildCount()) { course.getEditorTreeModel().addCourseNode(newNode, parentNode); } else { course.getEditorTreeModel().insertCourseNodeAt(newNode, parentNode, pos); } if (item instanceof VFSContainer) { parentNode = newNode; } } // recurse for (MultipleSelectionElement childElement : node.getChildren()) { create(childElement, course, parentNode); } }
@Override protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { setFormTitle("fieldset.dropbox.title"); setFormContextHelp("Other#bb_themenvergabe_abgabe"); String sConfirmation = (String) config.get(TACourseNode.CONF_DROPBOX_CONFIRMATION); if (sConfirmation == null || sConfirmation.length() == 0) { // grab standard text sConfirmation = translate("conf.stdtext"); config.set(TACourseNode.CONF_DROPBOX_CONFIRMATION, sConfirmation); } confirmation = uifactory.addTextAreaElement( "confirmation", "form.dropbox.confirmation", 2500, 4, 40, true, sConfirmation != null ? sConfirmation : "", formLayout); Boolean enableMail = (Boolean) config.get(TACourseNode.CONF_DROPBOX_ENABLEMAIL); confirmation.setMandatory(enableMail); enablemail = uifactory.addCheckboxesHorizontal( "enablemail", "form.dropbox.enablemail", formLayout, new String[] {"xx"}, new String[] {null}); enablemail.select("xx", enableMail != null ? enableMail.booleanValue() : true); enablemail.addActionListener(FormEvent.ONCLICK); uifactory.addFormSubmitButton("submit", formLayout); }
@Override public void configure(ICourse course, CourseNode newNode, ModuleConfiguration moduleConfig) { moduleConfig.set(ENCourseNode.CONFIG_GROUPNAME, getGroupNamesToString()); moduleConfig.set(ENCourseNode.CONF_CANCEL_ENROLL_ENABLED, cancelEnabled); }
/** * Update the module configuration to have all mandatory configuration flags set to usefull * default values * * @param isNewNode true: an initial configuration is set; false: upgrading from previous node * configuration version, set default to maintain previous behaviour */ @Override public void updateModuleConfigDefaults(boolean isNewNode) { int CURRENTVERSION = 7; ModuleConfiguration config = getModuleConfiguration(); if (isNewNode) { // use defaults for new course building blocks config.setBooleanEntry(NodeEditController.CONFIG_STARTPAGE, Boolean.FALSE.booleanValue()); config.setBooleanEntry(NodeEditController.CONFIG_COMPONENT_MENU, Boolean.TRUE.booleanValue()); // how to render files (include jquery etc) DeliveryOptions nodeDeliveryOptions = DeliveryOptions.defaultWithGlossary(); nodeDeliveryOptions.setInherit(Boolean.TRUE); config.set(CPEditController.CONFIG_DELIVERYOPTIONS, nodeDeliveryOptions); config.setConfigurationVersion(CURRENTVERSION); } else { config.remove(NodeEditController.CONFIG_INTEGRATION); if (config.getConfigurationVersion() < 2) { // update new configuration options using default values for existing // nodes config.setBooleanEntry(NodeEditController.CONFIG_STARTPAGE, Boolean.TRUE.booleanValue()); Boolean componentMenu = config.getBooleanEntry(NodeEditController.CONFIG_COMPONENT_MENU); if (componentMenu == null) { config.setBooleanEntry( NodeEditController.CONFIG_COMPONENT_MENU, Boolean.TRUE.booleanValue()); } config.setConfigurationVersion(2); } if (config.getConfigurationVersion() < 3) { config.set( NodeEditController.CONFIG_CONTENT_ENCODING, NodeEditController.CONFIG_CONTENT_ENCODING_AUTO); config.set( NodeEditController.CONFIG_JS_ENCODING, NodeEditController.CONFIG_JS_ENCODING_AUTO); config.setConfigurationVersion(3); } // Version 5 was ineffective since the delivery options were not set. We have to redo this and // save it as version 6 if (config.getConfigurationVersion() < 7) { String contentEncoding = (String) config.get(NodeEditController.CONFIG_CONTENT_ENCODING); if (contentEncoding != null && contentEncoding.equals("auto")) { contentEncoding = null; // new style for auto } String jsEncoding = (String) config.get(NodeEditController.CONFIG_JS_ENCODING); if (jsEncoding != null && jsEncoding.equals("auto")) { jsEncoding = null; // new style for auto } CPPackageConfig reConfig = null; DeliveryOptions nodeDeliveryOptions = (DeliveryOptions) config.get(CPEditController.CONFIG_DELIVERYOPTIONS); if (nodeDeliveryOptions == null) { // Update missing delivery options now, inherit from repo by default nodeDeliveryOptions = DeliveryOptions.defaultWithGlossary(); nodeDeliveryOptions.setInherit(Boolean.TRUE); RepositoryEntry re = getReferencedRepositoryEntry(); // Check if delivery options are set for repo entry, if not create default if (re != null) { reConfig = CPManager.getInstance().getCPPackageConfig(re.getOlatResource()); if (reConfig == null) { reConfig = new CPPackageConfig(); } DeliveryOptions repoDeliveryOptions = reConfig.getDeliveryOptions(); if (repoDeliveryOptions == null) { // migrate existing config back to repo entry using the default as a base repoDeliveryOptions = DeliveryOptions.defaultWithGlossary(); reConfig.setDeliveryOptions(repoDeliveryOptions); repoDeliveryOptions.setContentEncoding(contentEncoding); repoDeliveryOptions.setJavascriptEncoding(jsEncoding); CPManager.getInstance().setCPPackageConfig(re.getOlatResource(), reConfig); } else { // see if we have any different settings than the repo. if so, don't use inherit mode if (contentEncoding != repoDeliveryOptions.getContentEncoding() || jsEncoding != repoDeliveryOptions.getJavascriptEncoding()) { nodeDeliveryOptions.setInherit(Boolean.FALSE); nodeDeliveryOptions.setContentEncoding(contentEncoding); nodeDeliveryOptions.setJavascriptEncoding(jsEncoding); } } } // remove old config parameters config.remove(NodeEditController.CONFIG_CONTENT_ENCODING); config.remove(NodeEditController.CONFIG_JS_ENCODING); // replace with new delivery options config.set(CPEditController.CONFIG_DELIVERYOPTIONS, nodeDeliveryOptions); } config.setConfigurationVersion(7); } // else node is up-to-date - nothing to do } if (config.getConfigurationVersion() != CURRENTVERSION) { OLog logger = Tracing.createLoggerFor(CPCourseNode.class); logger.error( "CP course node version not updated to lastest version::" + CURRENTVERSION + ", was::" + config.getConfigurationVersion() + ". Check the code, programming error."); } }