Examples of RepositoryHandler


Examples of org.olat.repository.handlers.RepositoryHandler

    if (source == searchCtr) {
      if (cmd.equals(RepositoryTableModel.TABLE_ACTION_SELECT_ENTRY)) {
        // user selected entry to get a preview
        selectedRepositoryEntry = searchCtr.getSelectedEntry();
        RepositoryEntry repositoryEntry = searchCtr.getSelectedEntry();
        RepositoryHandler typeToLaunch = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
        if (typeToLaunch == null) {
          StringBuilder sb = new StringBuilder(trans.translate("error.launch"));
          sb.append(": No launcher for repository entry: ");
          sb.append(repositoryEntry.getKey());
          throw new OLATRuntimeException(RepositoryDetailsController.class, sb.toString(), null);
        }
        // do skip the increment launch counter, this is only a preview!
        OLATResourceable ores = repositoryEntry.getOlatResource();
       
        if (previewCtr != null) {
          previewCtr.dispose();
        }
        if (previewModalCtr != null) {
          previewModalCtr.dispose();
        }
        previewCtr = typeToLaunch.getLaunchController(ores, null, ureq, getWindowControl());
        previewModalCtr = new CloseableModalController(getWindowControl(), trans.translate("referencableSearch.preview.close"), previewCtr
            .getInitialComponent());
        previewModalCtr.activate();

      } else if (cmd.equals(RepositoryTableModel.TABLE_ACTION_SELECT_LINK)) {
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

   * @return True upon success, false otherwise.
   *
   */
  public boolean exportDoExportContent() {
    // export resource
    RepositoryHandler rh = RepositoryHandlerFactory.getInstance().getRepositoryHandler(re);
    MediaResource mr = rh.getAsMediaResource(re.getOlatResource());
    FileOutputStream fOut = null;
    try {
      fOut = new FileOutputStream(new File(baseDirectory, CONTENT_FILE));
      FileUtils.copy(mr.getInputStream(), fOut);
    } catch (FileNotFoundException fnfe) {
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

    RepositoryEntry repositoryEntry = node.getReferencedRepositoryEntry();
    if (repositoryEntry == null) {
      // do nothing
      return;
    }
    RepositoryHandler typeToEdit = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
    if (!typeToEdit.supportsEdit()){
      throw new AssertException("Trying to edit repository entry which has no assoiciated editor: "+ typeToEdit);
    }         
    // Open editor in new tab
    OLATResourceable ores = repositoryEntry.getOlatResource();
    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

  /**
   * Initialize form data based on repository entry.
   */
  public void init() {
    RepositoryHandler handler = null;
    String typeName = entry.getOlatResource().getResourceableTypeName();
    if (typeName != null) handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(typeName);
   
    canCopy = new CheckBoxElement("cif.canCopy", entry.getCanCopy());
    addFormElement("cif_canCopy", canCopy);

    canReference = new CheckBoxElement("cif.canReference", entry.getCanReference());
    addFormElement("cif_canReference", canReference);

    if (handler != null && handler.supportsLaunch()) {
      canLaunch = new CheckBoxElement("cif.canLaunch", entry.getCanLaunch());
      addFormElement("cif_canLaunch", canLaunch);
    } else { // launch not supported
      canLaunch = null;
      addFormElement("cif_canLaunch", new StaticHTMLTextElement("cif.canLaunch", translate("cif.canLaunch.na"), 255));
    }

    if (handler != null && handler.supportsDownload()) {
      canDownload = new CheckBoxElement("cif.canDownload", entry.getCanDownload());
      addFormElement("cif_canDownload", canDownload);
    } else { // download not supported
      canDownload = null;
      addFormElement("cif_canDownload", new StaticHTMLTextElement("cif.canDownload", translate("cif.canDownload.na"), 255));
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

        String repoSoftKey = (String)moduleConfiguration.get(CONFIG_KEY_REPOSITORY_SOFTKEY);
        RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repoSoftKey,false);
        if(re==null){
          //not found
        }else{
          RepositoryHandler typeToEdit = RepositoryHandlerFactory.getInstance().getRepositoryHandler(re);
          OLATResourceable ores = re.getOlatResource();
          correctQTIcontroller = typeToEdit.getEditorController(ores, ureq, this.getWindowControl());
          this.getWindowControl().pushToMainArea(correctQTIcontroller.getInitialComponent());         
          this.listenTo(correctQTIcontroller);
        }
      }
    } else if (source == previewLink){
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

      RepositoryEntry repositoryEntry = wikiCourseNode.getReferencedRepositoryEntry();
      if (repositoryEntry == null) {
        // do nothing
        return;
      }
      RepositoryHandler typeToEdit = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
      // Open editor in new tab
      OLATResourceable ores = repositoryEntry.getOlatResource();
      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.getLaunchController(ores, null, 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

  }

  public void deleteRepositoryEntries(UserRequest ureq, WindowControl wControl, List repositoryEntryList) {
    for (Iterator iter = repositoryEntryList.iterator(); iter.hasNext();) {
      RepositoryEntry repositoryEntry = (RepositoryEntry) iter.next();
      RepositoryHandler repositoryHandler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
      File archiveDir = new File(getArchivFilePath());
      if (!archiveDir.exists()) {
        archiveDir.mkdirs();
      }
      String archiveFileName = repositoryHandler.archive(ureq.getIdentity(), getArchivFilePath(), repositoryEntry);
      Tracing.logAudit("Repository-Deletion: archived repositoryEntry=" + repositoryEntry + " , archive-file-name=" + archiveFileName, this.getClass());
      RepositoryManager.getInstance().deleteRepositoryEntryWithAllData( ureq, wControl, repositoryEntry );
      LifeCycleManager.createInstanceFor(repositoryEntry).deleteTimestampFor(SEND_DELETE_EMAIL_ACTION);
      LifeCycleManager.createInstanceFor(repositoryEntry).markTimestampFor(REPOSITORY_DELETED_ACTION, createLifeCycleLogDataFor(repositoryEntry));
      Tracing.logAudit("Repository-Deletion: deleted repositoryEntry=" + repositoryEntry, this.getClass());
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

      importedRepositoryEntry.setSoftkey(importExport.getSoftkey());
   
    // Set the resource on the repository entry.
    OLATResource ores = OLATResourceManager.getInstance().findOrPersistResourceable(resource);
    importedRepositoryEntry.setOlatResource(ores);
    RepositoryHandler rh = RepositoryHandlerFactory.getInstance().getRepositoryHandler(importedRepositoryEntry);
    importedRepositoryEntry.setCanLaunch(rh.supportsLaunch());
   
    // create security group
    Manager securityManager = ManagerFactory.getManager();
    SecurityGroup newGroup = securityManager.createAndPersistSecurityGroup();
    // member of this group may modify member's membership
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

        if (repoEntry == null) throw new AssertException("a leaf did not have a repositoryentry! catalogEntry = key:" + cur.getKey()
            + ", title " + cur.getName());
        // launch entry if launchable, otherwise offer it as download / launch
        // it as non-html in browser
        String displayName = cur.getName();
        RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repoEntry);
        OLATResource ores = repoEntry.getOlatResource();
        if (ores == null) throw new AssertException("repoEntry had no olatresource, repoKey = " + repoEntry.getKey());
        if (repoEntry.getCanLaunch()) {
          // we can create a controller and launch
          // it in OLAT, e.g. if it is a
          // content-packacking or a course

          //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;
            Controller launchController = ControllerFactory.createLaunchController(ores, null, ureq, dt.getWindowControl(), true);
            dt.setController(launchController);
            dts.addDTab(dt);
          }
          dts.activate(ureq, dt, null); // null: start with main entry point of controller
        } else if (repoEntry.getCanDownload()) {
          // else not launchable in olat, but downloadable -> send the document
          // directly to browser but "downloadable" (pdf, word, excel)
          MediaResource mr = handler.getAsMediaResource(ores);
          RepositoryManager.getInstance().incrementDownloadCounter(repoEntry);
          ureq.getDispatchResult().setResultingMediaResource(mr);
          return;
        } else { // neither launchable nor downloadable -> show details         
          //REVIEW:pb:replace EntryChangedEvent with a more specific event
View Full Code Here

Examples of org.olat.repository.handlers.RepositoryHandler

    if (keepSoftkey) importedRepositoryEntry.setSoftkey(importExport.getSoftkey());

    // Set the resource on the repository entry.
    OLATResource ores = OLATResourceManager.getInstance().findOrPersistResourceable(resource);
    importedRepositoryEntry.setOlatResource(ores);
    RepositoryHandler rh = RepositoryHandlerFactory.getInstance().getRepositoryHandler(importedRepositoryEntry);
    importedRepositoryEntry.setCanLaunch(rh.supportsLaunch());

    // create security group
    Manager securityManager = ManagerFactory.getManager();
    SecurityGroup newGroup = securityManager.createAndPersistSecurityGroup();
    // member of this group may modify member's membership
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.