@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);
 }
 @Override
 protected void event(UserRequest ureq, Controller source, Event event) {
   if (newMethodCtrl == source) {
     if (event.equals(Event.DONE_EVENT)) {
       OfferAccess newLink = newMethodCtrl.commitChanges();
       newLink = acService.saveOfferAccess(newLink);
       addConfiguration(newLink);
       fireEvent(ureq, Event.CHANGED_EVENT);
     }
     cmc.deactivate();
     cleanUp();
   } else if (editMethodCtrl == source) {
     if (event.equals(Event.DONE_EVENT)) {
       OfferAccess newLink = editMethodCtrl.commitChanges();
       newLink = acService.saveOfferAccess(newLink);
       replace(newLink);
       fireEvent(ureq, Event.CHANGED_EVENT);
     }
     cmc.deactivate();
     cleanUp();
   } else if (cmc == source) {
     cleanUp();
   } else {
     super.event(ureq, source, event);
   }
 }
  @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 (editLink == source) {
     fireEvent(ureq, new QPoolEvent(QPoolEvent.EDIT));
   } else {
     super.formInnerEvent(ureq, source, event);
   }
 }
 /** @param controller The <code>FormBasicController</code> to be displayed in the modal dialog. */
 private void activateModalDialog(final FormBasicController controller) {
   listenTo(controller);
   cmc =
       new CloseableModalController(
           getWindowControl(), translate("close"), controller.getInitialComponent());
   listenTo(cmc);
   cmc.activate();
 }
Example #6
0
  /** {@inheritDoc} */
  @Override
  protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source instanceof TextElement) {
      int i = lTargetInputList.indexOf(source);
      if (i >= 0) {
        String linkValue = ((TextElement) source).getValue();
        if (!linkValue.contains("://")) {
          linkValue = "http://".concat(linkValue.trim());
        }
        boolean selected = lHtmlTargetInputList.get(i).isSelected(0);
        if (selected && linkValue.startsWith(Settings.getServerContextPathURI())) {
          lHtmlTargetInputList.get(i).select(BLANK_KEY, false);
        }
      }
    } else if (source.getComponent() instanceof Link) {
      if (lAddButtonList.contains(source)) {
        // add a new form link
        final LLModel link = (LLModel) ((FormLink) source).getUserObject();
        final LLModel newLink = new LLModel();
        linkList.add(linkList.indexOf(link) + 1, newLink);
        addNewFormLink(linkList.indexOf(link) + 1, newLink);
      } else if (lDelButtonList.contains(source)) {
        // special case: only one line existent
        if (linkList.size() == 1) {
          // clear this line
          lTargetInputList.get(0).setValue("");
          lTargetInputList.get(0).setEnabled(true);
          lDescriptionInputList.get(0).setValue("");
          lCommentInputList.get(0).setValue("");
        } else {
          final LLModel link = (LLModel) ((FormLink) source).getUserObject();
          removeFormLink(link);
        }
      } else if (lCustomMediaButtonList.contains(source)) {
        currentLink = (LLModel) ((FormLink) source).getUserObject();

        removeAsListenerAndDispose(mediaDialogBox);
        removeAsListenerAndDispose(mediaChooserController);

        VFSContainer courseContainer = courseEnv.getCourseFolderContainer();
        mediaChooserController =
            new MediaChooserController(
                ureq, getWindowControl(), courseContainer, null, null, "", null);
        listenTo(mediaChooserController);

        mediaDialogBox =
            new CloseableModalController(
                getWindowControl(),
                translate("choose"),
                mediaChooserController.getInitialComponent());
        mediaDialogBox.activate();
        listenTo(mediaDialogBox);
      }
    }
    super.formInnerEvent(ureq, source, event);
    fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
  }
 @Override
 public void event(UserRequest ureq, Component source, Event event) {
   if (addMethods.contains(source)) {
     AccessMethod method = (AccessMethod) ((Link) source).getUserObject();
     addMethod(ureq, method);
   } else {
     super.event(ureq, source, event);
   }
 }
Example #8
0
 @Override
 protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
   if (allowPseudonymEl == source) {
     fireEvent(ureq, Event.CHANGED_EVENT);
   } else if (allowGuestEl == source) {
     fireEvent(ureq, Event.CHANGED_EVENT);
   }
   super.formInnerEvent(ureq, source, event);
 }
 @Override
 protected void event(UserRequest ureq, Controller source, Event event) {
   if (commentCalloutCtrl == source) {
     cleanUp();
   } else if (editCommentCtrl == source) {
     if (event == Event.DONE_EVENT) {
       table.reset();
     }
     commentCalloutCtrl.deactivate();
     cleanUp();
   }
   super.event(ureq, source, event);
 }
  @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);
      }
    }
  }
 @Override
 protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
   if (source == tableEl) {
     if (event instanceof SelectionEvent) {
       SelectionEvent se = (SelectionEvent) event;
       String cmd = se.getCommand();
       CourseTemplateRow row = model.getObject(se.getIndex());
       if ("select".equals(cmd)) {
         selectedEntry = row;
         fireEvent(ureq, ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED);
       }
     }
   }
   super.formInnerEvent(ureq, source, event);
 }
  @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);
  }
 @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);
   }
 }
 @Override
 protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
   if (addMethods.contains(source)) {
     AccessMethod method = (AccessMethod) source.getUserObject();
     addMethod(ureq, method);
   } else if (source instanceof FormLink) {
     FormLink button = (FormLink) source;
     String cmd = button.getCmd();
     if ("delete".equals(cmd)) {
       AccessInfo infos = (AccessInfo) source.getUserObject();
       acService.deleteOffer(infos.getLink().getOffer());
       confControllers.remove(infos);
     } else if ("edit".equals(cmd)) {
       AccessInfo infos = (AccessInfo) source.getUserObject();
       editMethod(ureq, infos);
     }
   }
   super.formInnerEvent(ureq, source, event);
 }
 @Override
 protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
   if (addSolutionLink == source) {
     doAddSolution(ureq);
   } else if (createSolutionLink == source) {
     doCreateSolution(ureq);
   } else if (solutionTable == source) {
     if (event instanceof SelectionEvent) {
       SelectionEvent se = (SelectionEvent) event;
       SolutionRow row = solutionModel.getObject(se.getIndex());
       if ("edit".equals(se.getCommand())) {
         doEdit(ureq, row.getSolution());
       } else if ("delete".equals(se.getCommand())) {
         doDelete(ureq, row);
       }
     }
   }
   super.formInnerEvent(ureq, source, event);
 }
 @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);
 }
Example #17
0
  @Override
  protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == mediaDialogBox) {
      removeAsListenerAndDispose(mediaDialogBox);
      removeAsListenerAndDispose(mediaChooserController);
      mediaDialogBox = null;
      mediaChooserController = null;
    } else if (source == mediaChooserController) {
      if (event instanceof URLChoosenEvent) {
        URLChoosenEvent choosenEvent = (URLChoosenEvent) event;
        String url = choosenEvent.getURL();
        if (url.startsWith(Settings.getServerContextPathURI())) {
          // doesn't allow absolute path -> the mapper check if the link is in the list!
          url = url.substring(Settings.getServerContextPathURI().length());
        }
        currentLink.setTarget(url);
        currentLink.setIntern(true);
        currentLink.setHtmlTarget(SELF_KEY);
        if (StringHelper.containsNonWhitespace(choosenEvent.getDisplayName())) {
          currentLink.setDescription(choosenEvent.getDisplayName());
        }

        int index = 0;
        for (TextElement targetEl : lTargetInputList) {
          if (currentLink.equals(targetEl.getUserObject())) {
            targetEl.setValue(url);
            targetEl.setEnabled(false);
            lDescriptionInputList.get(index).setValue(currentLink.getDescription());
            lHtmlTargetInputList.get(index).select(SELF_KEY, true);
            break;
          }
          index++;
        }
      }
      mediaDialogBox.deactivate();
      removeAsListenerAndDispose(mediaDialogBox);
      removeAsListenerAndDispose(mediaChooserController);
      mediaDialogBox = null;
      mediaChooserController = null;
    }

    super.event(ureq, source, event);
  }
  @Override
  protected void event(UserRequest ureq, Controller source, Event event) {
    if (addSolutionCtrl == source) {
      if (event == Event.DONE_EVENT) {
        Solution newSolution = addSolutionCtrl.getSolution();
        solutions.getSolutions().add(newSolution);
        fireEvent(ureq, Event.DONE_EVENT);
        updateModel();
      }
      cmc.deactivate();
      cleanUp();
    } else if (editSolutionCtrl == source) {
      if (event == Event.DONE_EVENT) {
        fireEvent(ureq, Event.DONE_EVENT);
        updateModel();
      }
      cmc.deactivate();
      cleanUp();
    } else if (newSolutionCtrl == source) {
      Solution newSolution = newSolutionCtrl.getSolution();
      cmc.deactivate();
      cleanUp();

      if (event == Event.DONE_EVENT) {
        solutions.getSolutions().add(newSolution);
        doCreateSolutionEditor(ureq, newSolution);
        updateModel();
      }
    } else if (newSolutionEditorCtrl == source) {
      if (event == Event.DONE_EVENT) {
        updateModel();
        fireEvent(ureq, Event.DONE_EVENT);
      }
      cmc.deactivate();
      cleanUp();
    } else if (editSolutionEditorCtrl == source) {
      cmc.deactivate();
      cleanUp();
    } else if (cmc == source) {
      cleanUp();
    }
    super.event(ureq, source, event);
  }
 @Override
 protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
   if (addSliderButton == source) {
     doAddSlider();
   } else if (typeEl == source) {
     updateTypeSettings();
     updateSteps();
   } else if (stepsEl == source) {
     updateSteps();
   } else if (saveButton == source) {
     if (validateFormLogic(ureq)) {
       formOK(ureq);
     }
   } else if (source instanceof FormLink) {
     FormLink button = (FormLink) source;
     if ("delete_slider".equals(button.getCmd())) {
       doRemoveSlider((SliderRow) button.getUserObject());
     }
   }
   super.formInnerEvent(ureq, source, event);
 }
 @Override
 protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
   if (standardModeEl == source) {
     updateEnabled();
     updateStandardMode();
   } else if (jsOptionEl == source) {
     updateEnabled();
   } else if (inheritEl == source) {
     if (parentConfig != null) {
       if (inheritEl.isSelected(0)) {
         persistRawOptions(config);
         persistEncoding(config);
         setValues(parentConfig);
       } else {
         setValues(config);
       }
     }
     updateEnabled();
     flc.setDirty(true);
   }
   super.formInnerEvent(ureq, source, event);
 }
Example #21
0
 @Override
 public void event(UserRequest ureq, Component source, Event event) {
   super.event(ureq, source, event);
 }