@Override
  protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    super.formInnerEvent(ureq, source, event);
    if (source == cancelButton) {
      fireEvent(ureq, Event.CANCELLED_EVENT);

    } else if (source == importFile) {
      if (importFile.isUploadSuccess()) {
        File tmpJar = importFile.getUploadFile();
        Set<String> importLangKeys =
            I18nManager.getInstance().sarchForAvailableLanguagesInJarFile(tmpJar, true);
        if (importLangKeys.size() == 0) {
          showError("configuration.management.package.import.failure.empty");
          return;
        }
        //
        // enable language key selection
        String[] langKeys = ArrayHelper.toArray(importLangKeys);
        importKeys.setKeysAndValues(langKeys, langKeys);
        importKeys.selectAll();
        importKeys.setVisible(true);
        // In language adaption mode the import is done as a package - can't deselect anything
        importKeys.setEnabled(false);
      }
    }
  }
 @Override
 protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
   if (applyToAllEl == source) {
     boolean allGroup = applyToAllEl.isAtLeastSelected(1);
     table.setVisible(!allGroup);
     if (groupPassedEl != null) {
       groupPassedEl.setVisible(allGroup);
     }
     if (groupScoreEl != null) {
       groupScoreEl.setVisible(allGroup);
     }
     if (groupCommentEl != null) {
       groupCommentEl.setVisible(allGroup);
     }
   } else if (source == saveAndDoneButton) {
     if (validateFormLogic(ureq)) {
       applyChanges(true);
       fireEvent(ureq, Event.CLOSE_EVENT);
     }
   } else if (source instanceof FormLink) {
     FormLink link = (FormLink) source;
     if ("comment".equals(link.getCmd())) {
       AssessmentRow row = (AssessmentRow) link.getUserObject();
       doEditComment(ureq, row);
     }
   }
   super.formInnerEvent(ureq, source, event);
 }
Ejemplo n.º 3
0
  private MultipleSelectionElement initTreeRec(
      int level, VFSItem item, FormLayoutContainer layoutcont) {
    SelectNodeObject node = new SelectNodeObject(item, UUID.randomUUID().toString(), level);

    String[] singleKey = new String[] {node.getId()};
    String[] singleValue = new String[] {node.getName()};
    String[] css = new String[] {"b_with_small_icon_left " + node.getIconCssClass()};
    MultipleSelectionElement nodeSelection =
        uifactory.addCheckboxesVertical(
            "print.node.list." + nodeSelections.size(), layoutcont, singleKey, singleValue, css, 1);
    nodeSelection.setLabel("multi.sps.file", null);

    nodeSelection.setUserObject(node);
    nodeSelection.addActionListener(this, FormEvent.ONCLICK);
    nodeSelections.add(nodeSelection);
    identToSelectionMap.put(node.getId(), nodeSelection);
    layoutcont.add(nodeSelection.getComponent().getComponentName(), nodeSelection);

    if (item instanceof VFSContainer) {
      VFSContainer container = (VFSContainer) item;
      for (VFSItem subItem : container.getItems(new MultiSPVFSItemFilter())) {
        MultipleSelectionElement sel = initTreeRec(level + 1, subItem, layoutcont);
        node.getChildren().add(sel);
      }
    }

    return nodeSelection;
  }
 private MultipleSelectionElement createSelection(String name) {
   MultipleSelectionElement selection =
       new MultipleSelectionElementImpl(
           name, MultipleSelectionElementImpl.createVerticalLayout("checkbox", 1));
   selection.setKeysAndValues(new String[] {"on"}, new String[] {""}, null);
   tableCont.add(name, selection);
   return selection;
 }
Ejemplo n.º 5
0
  /**
   * @param nodeSelection The node that should be selected recursively
   * @param select true: select the node and its children; false: deselect the node and its children
   */
  private void selectRec(MultipleSelectionElement nodeSelection, boolean select) {
    SelectNodeObject userObject = (SelectNodeObject) nodeSelection.getUserObject();
    String id = userObject.getId();
    if (nodeSelection.isMultiselect()) {
      nodeSelection.select(id, select);
    }

    for (MultipleSelectionElement childSelection : userObject.getChildren()) {
      selectRec(childSelection, select);
    }
  }
Ejemplo n.º 6
0
  @Override
  protected boolean validateFormLogic(UserRequest ureq) {
    boolean allOk = true;

    acknowledgeEl.clearError();
    if (!acknowledgeEl.isAtLeastSelected(1)) {
      acknowledgeEl.setErrorKey("details.read.only.acknowledge.error", null);
      allOk &= false;
    }

    return allOk & super.validateFormLogic(ureq);
  }
  private void updateGUI(ModelInfos modelInfos) {
    if (modelInfos.isSame()) {
      applyToAllEl.select(onKeys[0], true);
      table.setVisible(false);

      if (groupPassedEl != null) {
        groupPassedEl.setVisible(true);
        Boolean passed = modelInfos.getPassed();
        groupPassedEl.select(onKeys[0], passed != null && passed.booleanValue());
      }
      if (groupScoreEl != null) {
        groupScoreEl.setVisible(true);
        Float score = modelInfos.getScore();
        if (score != null) {
          String scoreVal = AssessmentHelper.getRoundedScore(score);
          groupScoreEl.setValue(scoreVal);
        } else {
          groupScoreEl.setValue("");
        }
      }
      if (groupCommentEl != null) {
        groupCommentEl.setVisible(true);
        String comment = modelInfos.getComment();
        if (comment != null) {
          groupCommentEl.setValue(comment);
        }
      }
    } else {
      applyToAllEl.select(onKeys[0], false);
      table.setVisible(true);
      if (groupPassedEl != null) {
        groupPassedEl.setVisible(false);
      }
      if (groupScoreEl != null) {
        groupScoreEl.setVisible(false);
      }
      if (groupCommentEl != null) {
        groupCommentEl.setVisible(false);
      }
    }

    if (StringHelper.containsNonWhitespace(modelInfos.getDuplicates())) {
      String warning =
          translate(
              "error.duplicate.memberships",
              new String[] {gtaNode.getShortTitle(), modelInfos.getDuplicates()});
      flc.contextPut("duplicateWarning", warning);
    } else {
      flc.contextRemove("duplicateWarning");
    }
  }
Ejemplo n.º 8
0
  @Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {

    // options
    String[] optionKeys = new String[] {OPTION_GUEST_ACCESS};
    String[] optionVals = new String[] {translate(OPTION_GUEST_ACCESS)};
    multiSelectOptions =
        uifactory.addCheckboxesVertical(
            "vc.options", "vc.options.label", formLayout, optionKeys, optionVals, 1);
    multiSelectOptions.select(OPTION_GUEST_ACCESS, config.isGuestAccessAllowed());
    multiSelectOptions.showLabel(false);

    submit = new FormSubmit("subm", "submit");

    formLayout.add(submit);
  }
 private void persistValues(DeliveryOptions options) {
   options.setInherit(Boolean.FALSE);
   if (standardModeEl.isSelected(0)) {
     // standard mode
     options.setStandardMode(Boolean.TRUE);
     options.setjQueryEnabled(Boolean.FALSE);
     options.setPrototypeEnabled(Boolean.FALSE);
     options.setGlossaryEnabled(Boolean.FALSE);
     options.setHeight(heightEl.getSelectedKey());
     options.setOpenolatCss(Boolean.FALSE);
   } else {
     options.setStandardMode(Boolean.FALSE);
     // js
     if (jsOptionEl.isSelected(0)) {
       options.setjQueryEnabled(Boolean.FALSE);
       options.setPrototypeEnabled(Boolean.FALSE);
       options.setGlossaryEnabled(Boolean.FALSE);
     } else {
       options.setjQueryEnabled(jsOptionEl.isSelected(1));
       options.setPrototypeEnabled(jsOptionEl.isSelected(2));
       options.setGlossaryEnabled(glossarEl.isAtLeastSelected(1));
     }
     // css
     options.setHeight(heightEl.getSelectedKey());
     options.setOpenolatCss(cssOptionEl.isSelected(1));
   }
   persistEncoding(config);
 }
 private void persistRawOptions(DeliveryOptions options) {
   options.setStandardMode(standardModeEl.isSelected(0));
   options.setjQueryEnabled(jsOptionEl.isSelected(1));
   options.setPrototypeEnabled(jsOptionEl.isSelected(2));
   options.setGlossaryEnabled(glossarEl.isAtLeastSelected(1));
   options.setHeight(heightEl.getSelectedKey());
 }
  @Override
  protected void formOK(UserRequest ureq) {
    if (importKeys.isVisible() && importKeys.getSelectedKeys().size() > 0) {
      Collection<String> importLangKeys = importKeys.getSelectedKeys();
      Set<String> alreadyInstalledLangs = new HashSet<String>();
      for (String langKey : importLangKeys) {
        if (I18nModule.getAvailableLanguageKeys().contains(langKey)) {
          alreadyInstalledLangs.add(langKey);
        }
      }
      if (I18nModule.isTransToolEnabled()) {
        // In translation mode importing will copy the language package
        // over an existing language or create a new language
        File tmpJar = importFile.getUploadFile();
        I18nManager.getInstance().copyLanguagesFromJar(tmpJar, importLangKeys);
        logAudit("Uploaded languages from jar::" + importFile.getUploadFileName(), null);
        showInfo("configuration.management.package.import.success", importLangKeys.toString());

      } else {
        // In language adaption mode: import is copied to user managed i18n package space in
        // olatdata
        if (alreadyInstalledLangs.size() == importLangKeys.size()) {
          showError("configuration.management.package.import.failure.installed");
          return;
        }
        // Ok, contains at least one language, copy to lang pack dir
        importFile.moveUploadFileTo(I18nModule.LANG_PACKS_DIRECTORY);
        logAudit("Uploaded language pack::" + importFile.getUploadFileName(), null);

        if (alreadyInstalledLangs.size() > 0) {
          getWindowControl()
              .setWarning(
                  getTranslator()
                      .translate(
                          "configuration.management.package.import.success.with.existing",
                          new String[] {
                            importLangKeys.toString(), alreadyInstalledLangs.toString()
                          }));
        } else {
          showInfo("configuration.management.package.import.success", importLangKeys.toString());
        }
      }
      // Reset i18n system
      I18nModule.reInitializeAndFlushCache();
      fireEvent(ureq, Event.DONE_EVENT);
    }
  }
  @Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    // Add the "accept" checkbox to the form.
    acceptCheckbox =
        uifactory.addCheckboxesVertical(
            ACKNOWLEDGE_CHECKBOX_NAME,
            null,
            formLayout,
            new String[] {DCL_CHECKBOX_KEY},
            new String[] {translate(NLS_DISCLAIMER_ACKNOWLEDGED)},
            null,
            1);
    acceptCheckbox.setEscapeHtml(false);
    acceptCheckbox.setMandatory(false);
    acceptCheckbox.select(DCL_CHECKBOX_KEY, readOnly);

    // Add the additional checkbox to the form (depending on the configuration)
    if (CoreSpringFactory.getImpl(RegistrationModule.class).isDisclaimerAdditionalCheckbox()) {
      String additionalCheckboxText = translate("disclaimer.additionalcheckbox");
      if (additionalCheckboxText != null) {
        additionalCheckbox =
            uifactory.addCheckboxesVertical(
                ADDITIONAL_CHECKBOX_NAME,
                null,
                formLayout,
                new String[] {DCL_CHECKBOX_KEY2},
                new String[] {additionalCheckboxText},
                null,
                1);
        additionalCheckbox.setEscapeHtml(false);
        additionalCheckbox.select(DCL_CHECKBOX_KEY2, readOnly);
      }
    }

    if (readOnly) {
      // Disable when set to read only
      formLayout.setEnabled(!readOnly);
    } else {
      // Create submit and cancel buttons
      final FormLayoutContainer buttonLayout =
          FormLayoutContainer.createButtonLayout("buttonLayout", getTranslator());
      formLayout.add(buttonLayout);
      buttonLayout.setElementCssClass("o_sel_disclaimer_buttons");
      uifactory.addFormSubmitButton(DCL_ACCEPT, NLS_DISCLAIMER_OK, buttonLayout);
      uifactory.addFormCancelButton(NLS_DISCLAIMER_NOK, buttonLayout, ureq, getWindowControl());
    }
  }
  @Override
  protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source instanceof MultipleSelectionElement) {
      MultipleSelectionElement publishCheckbox = (MultipleSelectionElement) source;
      if (publishCheckbox.isEnabled()) {
        boolean enabled = publishCheckbox.isAtLeastSelected(1);
        String propName = (String) publishCheckbox.getUserObject();

        // load and update config
        HomePageConfig conf = hpcm.loadConfigFor(identityToModify.getName());
        conf.setEnabled(propName, enabled);
        hpcm.saveConfigTo(identityToModify.getName(), conf);
        updatePreview(ureq, conf);
      }
    }
    super.formInnerEvent(ureq, source, event);
  }
Ejemplo n.º 14
0
 private void savePreferences(UserRequest ureq, String val) {
   // check if checkbox (dont askagain) is checked
   if (askagainCheckbox.isSelected(0)) {
     Preferences prefs = ureq.getUserSession().getGuiPreferences();
     prefs.put(WindowManager.class, "resume-prefs", val);
     prefs.save();
   }
 }
Ejemplo n.º 15
0
 @Override
 protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
   if (source == enabled) {
     boolean on = enabled.isAtLeastSelected(1);
     restModule.setEnabled(on);
     docLinkFlc.setVisible(on);
     getWindowControl().setInfo("saved");
   } else if (source == managedGroupsEl) {
     boolean enable = managedGroupsEl.isAtLeastSelected(1);
     groupModule.setManagedBusinessGroups(enable);
   } else if (source == managedRepoEl) {
     boolean enable = managedRepoEl.isAtLeastSelected(1);
     repositoryModule.setManagedRepositoryEntries(enable);
   } else if (source == managedCalendarEl) {
     boolean enable = managedCalendarEl.isAtLeastSelected(1);
     calendarModule.setManagedCalendars(enable);
   }
   super.formInnerEvent(ureq, source, event);
 }
Ejemplo n.º 16
0
  @Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormTitle("rest.title");
    setFormContextHelp("REST API");

    if (formLayout instanceof FormLayoutContainer) {
      FormLayoutContainer layoutContainer = (FormLayoutContainer) formLayout;

      boolean restEnabled = restModule.isEnabled();
      docLinkFlc =
          FormLayoutContainer.createCustomFormLayout(
              "doc_link", getTranslator(), velocity_root + "/docLink.html");
      layoutContainer.add(docLinkFlc);
      docLinkFlc.setVisible(restEnabled);

      String link =
          Settings.getServerContextPathURI() + RestSecurityHelper.SUB_CONTEXT + "/api/doc";
      docLinkFlc.contextPut("docLink", link);

      FormLayoutContainer accessDataFlc =
          FormLayoutContainer.createDefaultFormLayout("flc_access_data", getTranslator());
      layoutContainer.add(accessDataFlc);

      String[] values = new String[] {getTranslator().translate("rest.on")};
      enabled = uifactory.addCheckboxesHorizontal("rest.enabled", accessDataFlc, keys, values);
      enabled.select(keys[0], restEnabled);
      enabled.addActionListener(FormEvent.ONCHANGE);

      accessDataFlc.setVisible(true);
      formLayout.add(accessDataFlc);

      FormLayoutContainer managedFlc =
          FormLayoutContainer.createDefaultFormLayout("flc_managed", getTranslator());
      layoutContainer.add(managedFlc);

      String[] valueGrps = new String[] {getTranslator().translate("rest.on")};
      managedGroupsEl =
          uifactory.addCheckboxesHorizontal("managed.group", managedFlc, keys, valueGrps);
      managedGroupsEl.addActionListener(FormEvent.ONCHANGE);
      managedGroupsEl.select(keys[0], groupModule.isManagedBusinessGroups());

      String[] valueRes = new String[] {getTranslator().translate("rest.on")};
      managedRepoEl = uifactory.addCheckboxesHorizontal("managed.repo", managedFlc, keys, valueRes);
      managedRepoEl.addActionListener(FormEvent.ONCHANGE);
      managedRepoEl.select(keys[0], repositoryModule.isManagedRepositoryEntries());

      String[] valueCal = new String[] {getTranslator().translate("rest.on")};
      managedCalendarEl =
          uifactory.addCheckboxesHorizontal("managed.cal", managedFlc, keys, valueCal);
      managedCalendarEl.addActionListener(FormEvent.ONCHANGE);
      managedCalendarEl.select(keys[0], calendarModule.isManagedCalendars());
    }
  }
 private void updateStandardMode() {
   boolean standard = standardModeEl.isSelected(0);
   if (standard) {
     jsOptionEl.select(jsKeys[0], true);
     cssOptionEl.select(cssKeys[0], true);
     glossarEl.select("on", false);
     if (heightEl.isSelected(0)) {
       heightEl.select("600", true);
     }
   }
 }
  private void updateEnabled() {
    boolean inherit = (inheritEl.isVisible() && inheritEl.isSelected(0));

    encodingContentEl.setEnabled(!inherit);
    encodingJSEl.setEnabled(!inherit);
    standardModeEl.setEnabled(!inherit);
    heightEl.setEnabled(!inherit);
    if (inherit) {
      // disabled all
      jsOptionEl.setEnabled(false);
      cssOptionEl.setEnabled(false);
      glossarEl.setEnabled(false);
      // set inherited values
    } else {
      boolean standard = standardModeEl.isSelected(0);
      boolean jQueryEnabled = jsOptionEl.isSelected(1);
      jsOptionEl.setEnabled(!standard);
      cssOptionEl.setEnabled(!standard);
      glossarEl.setEnabled(!standard && jQueryEnabled);
    }
  }
  private void setValues(DeliveryOptions cfg) {
    Boolean mode = (cfg == null ? null : cfg.getStandardMode());
    if (mode == null || mode.booleanValue()) {
      standardModeEl.select("standard", true);
    } else {
      standardModeEl.select("configured", true);
    }

    if (cfg != null) {
      if (cfg.getjQueryEnabled() != null && cfg.getjQueryEnabled().booleanValue()) {
        jsOptionEl.select(jsKeys[1], true); // jQuery
      } else if (cfg.getPrototypeEnabled() != null && cfg.getPrototypeEnabled().booleanValue()) {
        jsOptionEl.select(jsKeys[2], true); // prototype
      } else {
        jsOptionEl.select(jsKeys[0], true); // default is none
      }
    } else {
      jsOptionEl.select(jsKeys[0], true); // default is none
    }

    Boolean glossarEnabled = (cfg == null ? null : cfg.getGlossaryEnabled());
    if (glossarEnabled != null && glossarEnabled.booleanValue()) {
      glossarEl.select("on", true);
    }

    String height = cfg == null ? null : cfg.getHeight();
    if (height != null && Arrays.asList(keys).contains(height)) {
      heightEl.select(height, true);
    } else {
      heightEl.select(DeliveryOptions.CONFIG_HEIGHT_AUTO, true);
    }

    if (cfg != null && cfg.getOpenolatCss() != null && cfg.getOpenolatCss().booleanValue()) {
      cssOptionEl.select(cssKeys[1], true);
    } else {
      cssOptionEl.select(cssKeys[0], false); // default none
    }

    String encodingContent = (cfg == null ? null : cfg.getContentEncoding());
    if (encodingContent != null && Arrays.asList(encodingContentKeys).contains(encodingContent)) {
      encodingContentEl.select(encodingContent, true);
    } else {
      encodingContentEl.select(NodeEditController.CONFIG_CONTENT_ENCODING_AUTO, true);
    }

    String encodingJS = (cfg == null ? null : cfg.getJavascriptEncoding());
    if (encodingJS != null && Arrays.asList(encodingJSKeys).contains(encodingJS)) {
      encodingJSEl.select(encodingJS, true);
    } else {
      encodingJSEl.select(NodeEditController.CONFIG_JS_ENCODING_AUTO, true);
    }
  }
Ejemplo n.º 20
0
  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 boolean validateFormLogic(UserRequest ureq) {
    boolean allOk = true;

    if (!isInherit()) {
      glossarEl.clearError();
      if (glossarEl.isAtLeastSelected(1)) {
        if (!jsOptionEl.isSelected(1)) {
          allOk &= false;
          glossarEl.setErrorKey("glossary.need.jQuery", null);
        }
      }

      heightEl.clearError();
      if (heightEl.isSelected(0) && (standardModeEl.isSelected(0) || jsOptionEl.isSelected(0))) {
        heightEl.setErrorKey("automatic.need.js", null);
        allOk = false;
      }
    }

    return allOk & super.validateFormLogic(ureq);
  }
 /**
  * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
  *     org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
  */
 @Override
 public void event(UserRequest ureq, Controller source, Event event) {
   if (source == dialogCtr) {
     if (DialogBoxUIFactory.isYesEvent(event)) {
       // Yes case, delete now
       for (String deleteLangPack : deleteLangPackSelection.getSelectedKeys()) {
         File file = new File(I18nModule.LANG_PACKS_DIRECTORY, deleteLangPack);
         if (file.exists()) file.delete();
         logAudit("Deleted language pack::" + deleteLangPack, null);
       }
       // Reset i18n system
       I18nModule.reInitializeAndFlushCache();
       // wow, everything worked fine
       showInfo(
           "configuration.management.package.delete.success",
           deleteLangPackSelection.getSelectedKeys().toString());
       fireEvent(ureq, Event.DONE_EVENT);
     } else {
       // No case, do nothing.
     }
   }
 }
 protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
   if (source == selectionMaxMembers) {
     if (selectionMaxMembers.isSelected(0)) {
       maxMembers.setVisible(true);
       maxMembers.setIntValue(MAX_MEMBERS_DEFAULT);
     } else {
       maxMembers.setVisible(false);
       maxMembers.setIntValue(Project.MAX_MEMBERS_UNLIMITED);
     }
   } else if (source == removeAttachmentLink) {
     attachmentFileName.setInitialFile(null);
   }
   this.flc.setDirty(true);
 }
 /**
  * @see
  *     org.olat.core.gui.components.form.flexible.impl.FormBasicController#formOK(org.olat.core.gui.UserRequest)
  */
 @Override
 protected void formOK(UserRequest ureq) {
   Set<String> toDelete = deleteLangPackSelection.getSelectedKeys();
   if (toDelete.size() == 0) {
     // should not happen since button disabled
     return;
   }
   dialogCtr =
       activateYesNoDialog(
           ureq,
           translate("configuration.management.package.delete.confirm.title"),
           translate("configuration.management.package.delete.confirm", toDelete.toString()),
           dialogCtr);
 }
  @Override
  protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    super.formInnerEvent(ureq, source, event);
    if (source == cancelButton) {
      fireEvent(ureq, Event.CANCELLED_EVENT);
      showInfo("configuration.management.package.delete.cancel");

    } else if (source == deleteLangPackSelection) {
      if (deleteLangPackSelection.getSelectedKeys().size() == 0) {
        submitButton.setEnabled(false);
      } else {
        submitButton.setEnabled(true);
      }
    }
  }
Ejemplo n.º 26
0
  @Override
  protected boolean validateFormLogic(UserRequest ureq) {
    boolean allOk = true;

    if (withScore) {
      if (applyToAllEl.isAtLeastSelected(1)) {
        allOk &= validateScore(groupScoreEl);
      } else {
        List<AssessmentRow> rows = model.getObjects();
        for (AssessmentRow row : rows) {
          allOk &= validateScore(row.getScoreEl());
        }
      }
    }

    return allOk & super.validateFormLogic(ureq);
  }
 @Override
 protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
   // A title, displayed in fieldset
   setFormTitle("configuration.management.package.import.title");
   if (I18nModule.isTransToolEnabled()) {
     setFormDescription("configuration.management.package.import.description.transserver");
   } else {
     setFormDescription("configuration.management.package.import.description");
   }
   //
   // The import file upload
   importFile =
       uifactory.addFileElement("configuration.management.package.import.file", formLayout);
   importFile.setLabel("configuration.management.package.import.file", null);
   importFile.setMandatory(true, "configuration.management.package.import.file.error.mandatory");
   // Limit to jar files and set upload limit to 50 MB
   importFile.setMaxUploadSizeKB(
       50000, "configuration.management.package.import.file.error.size", null);
   Set<String> mimeTypes = new HashSet<String>();
   mimeTypes.add("application/java-archive");
   mimeTypes.add("application/x-jar");
   mimeTypes.add("application/x-java-jar");
   importFile.limitToMimeType(
       mimeTypes, "configuration.management.package.import.file.error.type", null);
   importFile.addActionListener(FormEvent.ONCHANGE); // trigger auto-upload	
   //
   // Add checkboxes for the found languages - hide so far
   String[] langKeys = new String[] {};
   importKeys =
       uifactory.addCheckboxesVertical(
           "configuration.management.package.import.select", flc, langKeys, langKeys, 1);
   importKeys.setVisible(false);
   //
   // Add cancel and submit in button group layout
   FormLayoutContainer buttonGroupLayout =
       FormLayoutContainer.createButtonLayout("buttonGroupLayout", getTranslator());
   formLayout.add(buttonGroupLayout);
   cancelButton = uifactory.addFormLink("cancel", buttonGroupLayout, Link.BUTTON);
   uifactory.addFormSubmitButton("configuration.management.package.import", buttonGroupLayout);
 }
Ejemplo n.º 28
0
  @Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormTitle("settings.title");
    formLayout.setElementCssClass("o_sel_course_forum_settings");

    if (forumModule.isAnonymousPostingWithPseudonymEnabled()) {
      String[] allowPseudonymValues = new String[] {translate("allow.pseudonym.post")};
      allowPseudonymEl =
          uifactory.addCheckboxesHorizontal(
              "allow.pseudonym", formLayout, allowKeys, allowPseudonymValues);
      allowPseudonymEl.setElementCssClass("o_sel_course_forum_allow_pseudo");
      allowPseudonymEl.setLabel(null, null);
      allowPseudonymEl.addActionListener(FormEvent.ONCHANGE);

      if ("true"
          .equals(
              foNode
                  .getModuleConfiguration()
                  .getStringValue(FOCourseNodeEditController.PSEUDONYM_POST_ALLOWED))) {
        allowPseudonymEl.select(allowKeys[0], true);
      }
    }

    String[] allowGuestValues = new String[] {translate("allow.guest.post")};
    allowGuestEl =
        uifactory.addCheckboxesHorizontal("allow.guest", formLayout, allowKeys, allowGuestValues);
    allowGuestEl.setElementCssClass("o_sel_course_forum_allow_guest");
    allowGuestEl.setLabel(null, null);
    allowGuestEl.addActionListener(FormEvent.ONCHANGE);
    if ("true"
        .equals(
            foNode
                .getModuleConfiguration()
                .getStringValue(FOCourseNodeEditController.GUEST_POST_ALLOWED))) {
      allowGuestEl.select(allowKeys[0], true);
    }
  }
Ejemplo n.º 29
0
 @Override
 protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
   if (nodeSelections.contains(source)) {
     MultipleSelectionElement nodeSelection = (MultipleSelectionElement) source;
     if (nodeSelection.isMultiselect()) {
       selectRec(nodeSelection, nodeSelection.isSelected(0));
     }
   } else if (source == selectAll) {
     for (MultipleSelectionElement nodeSelection : nodeSelections) {
       if (nodeSelection.isMultiselect() && !nodeSelection.isSelected(0)) {
         SelectNodeObject treeNode = (SelectNodeObject) nodeSelection.getUserObject();
         String id = treeNode.getId();
         nodeSelection.select(id, true);
       }
     }
   } else if (source == deselectAll) {
     for (MultipleSelectionElement nodeSelection : nodeSelections) {
       if (nodeSelection.isMultiselect() && nodeSelection.isSelected(0)) {
         SelectNodeObject treeNode = (SelectNodeObject) nodeSelection.getUserObject();
         String id = treeNode.getId();
         nodeSelection.select(id, false);
       }
     }
   } else if (source == asChild) {
     position = -1;
     ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
     create(rootSelection, course, selectedNode.getCourseNode());
     fireEvent(ureq, Event.CHANGED_EVENT);
   } else if (source == sameLevel) {
     ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
     CourseEditorTreeNode parentNode = (CourseEditorTreeNode) selectedNode.getParent();
     position = 0;
     for (position = parentNode.getChildCount(); position-- > 0; ) {
       if (selectedNode.getIdent().equals(parentNode.getChildAt(position).getIdent())) {
         position++;
         break;
       }
     }
     create(rootSelection, course, parentNode.getCourseNode());
     fireEvent(ureq, Event.CHANGED_EVENT);
   } else {
     super.formInnerEvent(ureq, source, event);
   }
 }
 /** @return */
 public boolean isWaitingListEnabled() {
   return enableWaitingList.isEnabled() && enableWaitingList.getSelectedKeys().size() != 0;
 }