/**
  * @see
  *     org.olat.course.nodes.CourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
  *     org.olat.core.gui.control.WindowControl,
  *     org.olat.course.run.userview.UserCourseEnvironment,
  *     org.olat.course.run.userview.NodeEvaluation)
  */
 @Override
 public NodeRunConstructionResult createNodeRunConstructionResult(
     final UserRequest ureq,
     final WindowControl wControl,
     final UserCourseEnvironment userCourseEnv,
     final NodeEvaluation ne,
     final String nodecmd) {
   if (ne.isCapabilityAccessible("access")) {
     final WikiRunController wikiController =
         new WikiRunController(wControl, ureq, this, userCourseEnv.getCourseEnvironment(), ne);
     return new NodeRunConstructionResult(wikiController);
   }
   final Controller controller =
       MessageUIFactory.createInfoMessage(ureq, wControl, null, this.getNoAccessExplanation());
   return new NodeRunConstructionResult(controller, null, null, null);
 }
  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);
  }
  /**
   * @see
   *     org.olat.course.nodes.CourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
   *     org.olat.core.gui.control.WindowControl,
   *     org.olat.course.run.userview.UserCourseEnvironment,
   *     org.olat.course.run.userview.NodeEvaluation)
   */
  @Override
  public NodeRunConstructionResult createNodeRunConstructionResult(
      final UserRequest ureq,
      final WindowControl wControl,
      final UserCourseEnvironment userCourseEnv,
      final NodeEvaluation ne,
      final String nodecmd) {
    Controller controller;
    // Do not allow guests to have manual scoring
    final Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
      final Translator trans = new PackageTranslator(PACKAGE, ureq.getLocale());
      final String title = trans.translate("guestnoaccess.title");
      final String message = trans.translate("guestnoaccess.message");
      controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
      controller = new MSCourseNodeRunController(ureq, wControl, userCourseEnv, this, true);
    }

    final Controller wrappedCtrl =
        TitledWrapperHelper.getWrapper(ureq, wControl, controller, this, "o_ms_icon");
    return new NodeRunConstructionResult(wrappedCtrl);
  }