Examples of RepositoryHandler


Examples of org.olat.repository.handlers.RepositoryHandler

        mainPanel.setContent(detailsController.getInitialComponent());
        columnsLayoutCtr.setCol2(toolComp);
        menuTree.setSelectedNodeId(myEntriesNodeId);

        // ask if we should start the editor right now.
        RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(addController.getAddedEntry());
        if (handler.supportsEdit()) { // start Editor
          removeAsListenerAndDispose(launchEditorDialog); // cleanup old                                                          // instance
          launchEditorDialog = activateYesNoDialog(urequest, null, translate("add.launchedit.msg"), launchEditorDialog);
          launchEditorDialog.setUserObject(addController.getAddedEntry());
          return;
        }
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

    // push addtl infos
    main.put("displayform", new DisplayInfoForm("displayform", getTranslator(), repositoryEntry));
    infopanelVC.contextPut("isAuthor", Boolean.valueOf(isAuthor));
    infopanelVC.contextPut("isOwner", Boolean.valueOf(isOwner));
    // init handler details
    RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
    infopanelVC.contextPut("iscourse", new Boolean(handler instanceof CourseHandler));
    main.contextPut("iscourse", new Boolean(handler instanceof CourseHandler));
    //brasato:: review why such a type check was necessary
    if (handler instanceof CourseHandler) {
      infopanelVC
      .put("CourseInfoForm", new DisplayCourseInfoForm("CourseInfoForm", getTranslator(), CourseFactory.loadCourse(repositoryEntry.getOlatResource())));
    }
    Component comp = handler.getDetailsComponent(repositoryEntry.getOlatResource(), ureq);
    if (comp != null) { // push handler specific details view
      infopanelVC.contextPut("hasHandlerDetails", Boolean.valueOf("true"));
      infopanelVC.put("handlerDetails", comp);
    } else {
      infopanelVC.contextRemove("hasHandlerDetails");
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

      detailsToolC = ToolFactory.createToolController(getWindowControl());
      detailsToolC.addControllerListener(this);
      isNewController = true;
    }
    // init handler details
    RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
    if (isNewController) {
      detailsToolC.addHeader(translate("tools.details.header"));
      detailsToolC.addLink(ACTION_LAUNCH, translate("details.launch"), TOOL_LAUNCH, null);
    }
    detailsToolC.setEnabled(TOOL_LAUNCH, checkIsRepositoryEntryLaunchable(ureq));
    if (!isGuestOnly) {
      if (isNewController) {
        //mark as download link
        detailsToolC.addLink(ACTION_DOWNLOAD, translate("details.download"), TOOL_DOWNLOAD, null, true);
        detailsToolC.addLink(ACTION_BOOKMARK, translate("details.bookmark"), TOOL_BOOKMARK, null);
      }
      boolean canDownload = repositoryEntry.getCanDownload() && handler.supportsDownload();
      // disable download for courses if not author or owner
      if (repositoryEntry.getOlatResource().getResourceableTypeName().equals(CourseModule.getCourseTypeName())
        && !(isOwner || isAuthor)) canDownload = false;
      // always enable download for owners
      if (isOwner && handler.supportsDownload()) canDownload = true;
      detailsToolC.setEnabled(TOOL_DOWNLOAD, canDownload);
      boolean canBookmark = true;
      if (BookmarkManager.getInstance().isResourceableBookmarked(ureq.getIdentity(), repositoryEntry) || !repositoryEntry.getCanLaunch())
        canBookmark = false;
      detailsToolC.setEnabled(TOOL_BOOKMARK, canBookmark);
    }
    if (isAuthor || isOwner) {
      boolean canCopy = repositoryEntry.getCanCopy();
      if (isOwner) {
        if (isNewController) {
          detailsToolC.addLink(ACTION_EDIT, translate("details.openeditor"), TOOL_EDIT, null);
          detailsToolC.addLink(ACTION_EDITDESC, translate("details.chdesc"), TOOL_CHDESC, null);
          detailsToolC.addLink(ACTION_EDITPROP, translate("details.chprop"), TOOL_CHPROP, null);
          detailsToolC.addLink(ACTION_ADD_CATALOG, translate("details.catadd"), TOOL_CATALOG, null);
          if ((OresHelper.isOfType(repositoryEntry.getOlatResource(), CourseModule.class)) && (!RepositoryManager.getInstance().createRepositoryEntryStatus(repositoryEntry.getStatusCode()).isClosed())) {
            detailsToolC.addLink(ACTION_CLOSE_RESSOURCE, translate("details.close.ressoure"), TOOL_CLOSE_RESSOURCE, null);
          }
        }
        // update catalog link
        detailsToolC.setEnabled(TOOL_CATALOG, (repositoryEntry.getAccess() >= RepositoryEntry.ACC_USERS));
      }
      if (isNewController)
        detailsToolC.addLink(ACTION_COPY, translate("details.copy"), TOOL_COPY, null);
      if (isOwner) {
        if (isNewController) {
          detailsToolC.addLink(ACTION_DELETE, translate("details.delete"));
          detailsToolC.addLink(ACTION_GROUPS, translate("details.groups"));
        }
        // enable
        detailsToolC.setEnabled(TOOL_EDIT, handler.supportsEdit());
        detailsToolC.setEnabled(TOOL_CHDESC, true);
        detailsToolC.setEnabled(TOOL_CHPROP, true);
        canCopy = true;
      }
      detailsToolC.setEnabled(TOOL_COPY, canCopy);
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

   * Also used by RepositoryMainController
   *
   * @param ureq
   */
  void doLaunch(UserRequest ureq) {
    RepositoryHandler typeToLaunch = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
    if (typeToLaunch == null){
      StringBuilder sb = new StringBuilder(translate("error.launch"));
      sb.append(": No launcher for repository entry: ");
      sb.append(repositoryEntry.getKey());
      throw new OLATRuntimeException(RepositoryDetailsController.class,sb.toString(), null);
    }
    if (RepositoryManager.getInstance().lookupRepositoryEntry(repositoryEntry.getKey()) == null) {
      showInfo("info.entry.deleted");
      return;
    }
   
    RepositoryManager.getInstance().incrementLaunchCounter(repositoryEntry);
    OLATResourceable ores = repositoryEntry.getOlatResource();
    String displayName = getDisplayName(ureq.getLocale());

    //was brasato:: DTabs dts = getWindowControl().getDTabs();
    DTabs dts = (DTabs)Windows.getWindows(ureq).getWindow(ureq).getAttribute("DTabs");
    DTab dt = dts.getDTab(ores);
    if (dt == null) {
      // does not yet exist -> create and add
      dt = dts.createDTab(ores, displayName);
      if (dt == null) return;
     
      // build up the context path
      OLATResourceable businessOres = repositoryEntry;
      ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(businessOres);
      WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, dt.getWindowControl());
     
      Controller ctrl = typeToLaunch.getLaunchController(ores, null, ureq, bwControl);
      // if resource is an image, PDF or eq. (e.g. served by resulting media request), no controller is returned.
      // FIXME:fj:test this
      if (ctrl == null) return;
      dt.setController(ctrl);
      dts.addDTab(dt);
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

     */
    fireEvent(ureq, Event.DONE_EVENT);
  }

  private boolean checkIsRepositoryEntryLaunchable(UserRequest ureq) {
    RepositoryHandler type = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
    RepositoryManager rm = RepositoryManager.getInstance();
   
    if (rm.isAllowedToLaunch(ureq, repositoryEntry) || (type.supportsLaunch() && ureq.getUserSession().getRoles().isOLATAdmin())) {
      return true;
    } else if(!rm.isAllowedToLaunch(ureq, repositoryEntry)){
      return false;
    }   
    if (type instanceof CourseHandler) {
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

    }
    return repositoryEntry.getCanLaunch();
  }

  private boolean checkIsRepositoryEntryTypeLaunchable() {
    RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
    return handler.supportsLaunch();
  }
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

   * Also used by RepositoryMainController
   *
   * @param ureq
   */
  void doDownload(UserRequest ureq) {
    RepositoryHandler typeToDownload = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);

    if (typeToDownload == null){
      StringBuilder sb = new StringBuilder(translate("error.download"));
      sb.append(": No download handler for repository entry: ");
      sb.append(repositoryEntry.getKey());
      throw new OLATRuntimeException(RepositoryDetailsController.class, sb.toString(), null);
    }
    OLATResource ores = OLATResourceManager.getInstance().findResourceable(repositoryEntry.getOlatResource());
    if (ores == null) {
      showError("error.download");
      return;
    }   
    boolean isAlreadyLocked = typeToDownload.isLocked(ores);
    try {     
      lockResult = typeToDownload.acquireLock(ores, ureq.getIdentity());
      if(lockResult==null || (lockResult!=null && lockResult.isSuccess() && !isAlreadyLocked)) {
        MediaResource mr = typeToDownload.getAsMediaResource(ores);
        if(mr!=null) {
          RepositoryManager.getInstance().incrementDownloadCounter(repositoryEntry);
          ureq.getDispatchResult().setResultingMediaResource(mr);
        } else {
          showError("error.export");
          fireEvent(ureq, Event.FAILED_EVENT);     
        }
      } else if(lockResult!=null && lockResult.isSuccess() && isAlreadyLocked) {
        showInfo("warning.course.alreadylocked.bySameUser", lockResult.getOwner().getName());
        lockResult = null; //invalid lock, it was already locked
      } else {
        showInfo("warning.course.alreadylocked", lockResult.getOwner().getName());
      }
    }
    finally
      if((lockResult!=null && lockResult.isSuccess() && !isAlreadyLocked)) {
        typeToDownload.releaseLock(lockResult);   
        lockResult = null;
      }
    }
  }
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

   *
   * @param ureq
   */
  void doEdit(UserRequest ureq) {
    if (!isOwner) throw new OLATSecurityException("Trying to launch editor, but not allowed: user = " + ureq.getIdentity());
    RepositoryHandler typeToEdit = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
    if (!typeToEdit.supportsEdit()){
      throw new AssertException("Trying to edit repository entry which has no assoiciated editor: "+ typeToEdit);
    }
       

    OLATResourceable ores = repositoryEntry.getOlatResource();
   
    //was brasato:: DTabs dts = getWindowControl().getDTabs();
    DTabs dts = (DTabs)Windows.getWindows(ureq).getWindow(ureq).getAttribute("DTabs");
    DTab dt = dts.getDTab(ores);
    if (dt == null) {
      // does not yet exist -> create and add
      dt = dts.createDTab(ores, repositoryEntry.getDisplayname());
      if (dt == null){
        //null means DTabs are full -> warning is shown
        return;
      }
      //user activity logger is set by course factory
      Controller editorController = typeToEdit.getEditorController(ores, ureq, dt.getWindowControl());
      if(editorController == null){
        //editor could not be created -> warning is shown
        return;
      }
      dt.setController(editorController);
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

    } else if (source == repositoryEditPropertiesController) {
      if (event == Event.CHANGED_EVENT || event.getCommand().equals("courseChanged")) {
        // RepositoryEntry changed
        this.repositoryEntry = repositoryEditPropertiesController.getRepositoryEntry();
        updateView(ureq);
        RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
        boolean canDownload = repositoryEntry.getCanDownload() && handler.supportsDownload();
        detailsToolC.setEnabled(TOOL_DOWNLOAD, canDownload);
        if (checkIsRepositoryEntryTypeLaunchable()) {
          detailsToolC.setEnabled(TOOL_LAUNCH, checkIsRepositoryEntryLaunchable(ureq));
        }       
        if(event.getCommand().equals("courseChanged")) {
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

  /**
   * @param ureq
   */
  private void doCloseResource(UserRequest ureq) {
    removeAsListenerAndDispose(wc);
    RepositoryHandler repoHandler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
    wc = repoHandler.getCloseResourceController(ureq, getWindowControl(), repositoryEntry);
    wc.startWorkflow();
    wc.addControllerListener(this);
    cmc = new CloseableModalController(getWindowControl(), translate("close"), wc.getInitialComponent());
    cmc.activate();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.