Package org.olat.repository.handlers

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


        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

      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

  }

  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

      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

        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

    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

    }

    // Set the resource on the repository entry.
    OLATResource ores = OLATResourceManager.getInstance().findOrPersistResourceable(fileResource);
    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

Related Classes of org.olat.repository.handlers.RepositoryHandler

Copyright © 2018 www.massapicom. 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.