コード例 #1
0
  public MembersManagementMainController(
      UserRequest ureq, WindowControl wControl, RepositoryEntry re) {
    super(ureq, wControl);
    this.repoEntry = re;
    acModule = CoreSpringFactory.getImpl(AccessControlModule.class);
    acService = CoreSpringFactory.getImpl(ACService.class);

    // logging
    getUserActivityLogger().setStickyActionType(ActionType.admin);
    ICourse course = CourseFactory.loadCourse(re.getOlatResource());
    addLoggingResourceable(LoggingResourceable.wrap(course));

    // ui stuff
    menuTree = new MenuTree("menuTree");
    menuTree.setTreeModel(buildTreeModel());
    menuTree.setRootVisible(false);
    menuTree.addListener(this);

    mainVC = createVelocityContainer("main_members");

    columnLayoutCtr =
        new LayoutMain3ColsController(
            ureq, getWindowControl(), menuTree, null, mainVC, "members-" + repoEntry.getKey());
    listenTo(columnLayoutCtr);
    putInitialPanel(columnLayoutCtr.getInitialComponent());

    selectMenuItem(ureq, CMD_MEMBERS);
  }
コード例 #2
0
  public MoveCopySubtreeController(
      UserRequest ureq,
      WindowControl wControl,
      OLATResourceable ores,
      CourseEditorTreeNode moveCopyFrom,
      boolean copy) {
    super(ureq, wControl);
    this.ores = ores;
    this.moveCopyFrom = moveCopyFrom;
    this.copy = copy;

    ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
    addLoggingResourceable(LoggingResourceable.wrap(course));
    addLoggingResourceable(LoggingResourceable.wrap(moveCopyFrom.getCourseNode()));

    insertTree = new MenuTree(null, "copy_node_selection", this);
    insertTree.enableInsertTool(true);
    insertModel = new InsertTreeModel(course.getEditorTreeModel().getRootNode(), moveCopyFrom);
    insertTree.setTreeModel(insertModel);

    VelocityContainer mainVC = createVelocityContainer("moveCopyNode");

    selectButton = LinkFactory.createButton("insertAtSelectedTreepos", mainVC, this);
    selectButton.setCustomEnabledLinkCSS("btn btn-primary");
    selectButton.setCustomDisabledLinkCSS("btn btn-default");
    selectButton.setEnabled(false);
    cancelButton = LinkFactory.createButton("cancel", mainVC, this);

    int numOfNodes = TreeHelper.totalNodeCount(insertModel.getRootNode());
    if (numOfNodes > CourseModule.getCourseNodeLimit()) {
      String msg =
          getTranslator()
              .translate(
                  "warning.containsXXXormore.nodes",
                  new String[] {
                    String.valueOf(numOfNodes),
                    String.valueOf(CourseModule.getCourseNodeLimit() + 1)
                  });
      Controller tmp = MessageUIFactory.createWarnMessage(ureq, wControl, null, msg);
      listenTo(tmp);
      mainVC.put("nodelimitexceededwarning", tmp.getInitialComponent());
    }

    mainVC.put("selection", insertTree);
    putInitialPanel(mainVC);
  }