Package org.olat.core.commons.modules.glossary

Examples of org.olat.core.commons.modules.glossary.GlossaryItemManager


   * @param repositoryEntry
   * @param searchResourceContext
   * @return Document the index document
   */
  public Document getIndexerDocument(RepositoryEntry repositoryEntry, SearchResourceContext searchResourceContext) {
    GlossaryItemManager gIMgr = GlossaryItemManager.getInstance();
    VFSContainer glossaryFolder = getGlossaryRootFolder(repositoryEntry.getOlatResource());
    VFSLeaf glossaryFile = gIMgr.getGlossaryFile(glossaryFolder);
    if (glossaryFile == null) { return null; }
    String glossaryContent = gIMgr.getGlossaryContent(glossaryFolder);
    // strip all html tags
    Filter htmlTagsFilter = FilterFactory.getHtmlTagsFilter();
    glossaryContent = htmlTagsFilter.filter(glossaryContent);
   
    // create standard olat index document with this data
View Full Code Here


   */
  @Override
  protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if(source==regOnOff){
      String regOnOffSelected = regOnOff.getSelectedKey();
      GlossaryItemManager gIM = GlossaryItemManager.getInstance();
      Properties glossProps = gIM.getGlossaryConfig(glossaryFolder);
      glossProps.put(GlossaryItemManager.REGISTER_ONOFF, regOnOffSelected);
      gIM.setGlossaryConfig(glossaryFolder, glossProps);
    }
  }
View Full Code Here

  /**
   * @see org.olat.core.dispatcher.mapper.Mapper#handle(java.lang.String,
   *      javax.servlet.http.HttpServletRequest)
   */
  public MediaResource handle(String relPath, HttpServletRequest request) {
    GlossaryItemManager gIM = GlossaryItemManager.getInstance();
    // security checks are done by MapperRegistry
    String[] parts = relPath.split("/");
    String glossaryId = parts[1];

    String glossaryFolderString = FolderConfig.getCanonicalRoot() + FolderConfig.getRepositoryHome() + "/" + glossaryId + "/"
        + GlossaryMarkupItemController.INTERNAL_FOLDER_NAME;
    File glossaryFolderFile = new File(glossaryFolderString);
    if (!glossaryFolderFile.isDirectory()) {
      logWarn("GlossaryTerms delivery failed; path to glossaryFolder not existing: " + relPath, null);
      return new NotFoundMediaResource(relPath);
    }
    VFSContainer glossaryFolder = new LocalFolderImpl(glossaryFolderFile);
    if (!gIM.isFolderContainingGlossary(glossaryFolder)) {
      logWarn("GlossaryTerms delivery failed; glossaryFolder doesn't contain a valid Glossary: " + glossaryFolder, null);
      return new NotFoundMediaResource(relPath);
    }

    // Create a media resource
    StringMediaResource resource = new StringMediaResource() {
      @Override
      public void prepare(HttpServletResponse hres) {
      // don't use normal string media headers which prevent caching,
      // use standard browser caching based on last modified timestamp
      }
    };

    resource.setLastModified(gIM.getGlossaryLastModifiedTime(glossaryFolder));
    resource.setContentType("text/javascript");
    // Get data
    String glossaryArrayData = TextMarkerJsGenerator.loadGlossaryItemListAsJSArray(glossaryFolder);

    resource.setData(glossaryArrayData);
View Full Code Here

  /**
   * @see org.olat.core.dispatcher.mapper.Mapper#handle(java.lang.String,
   *      javax.servlet.http.HttpServletRequest)
   */
  public MediaResource handle(String relPath, HttpServletRequest request) {
    GlossaryItemManager gIM = GlossaryItemManager.getInstance();

    String[] parts = relPath.split("/");
    String glossaryId = parts[1];
    String glossaryFolderString = FolderConfig.getCanonicalRoot() + FolderConfig.getRepositoryHome() + "/" + glossaryId + "/"
        + GlossaryMarkupItemController.INTERNAL_FOLDER_NAME;
    File glossaryFolderFile = new File(glossaryFolderString);
    if (!glossaryFolderFile.isDirectory()) {
      logWarn("GlossaryDefinition delivery failed; path to glossaryFolder not existing: " + relPath, null);
      return new NotFoundMediaResource(relPath);
    }
    VFSContainer glossaryFolder = new LocalFolderImpl(glossaryFolderFile);
    if (!gIM.isFolderContainingGlossary(glossaryFolder)) {
      logWarn("GlossaryDefinition delivery failed; glossaryFolder doesn't contain a valid Glossary: " + glossaryFolder, null);
      return new NotFoundMediaResource(relPath);
    }

    // cut away ".html"
    String glossaryMainTerm = parts[2].substring(0, parts[2].length() - 5).replace("+", " ");

    // Create a media resource
    StringMediaResource resource = new StringMediaResource() {
      @Override
      public void prepare(HttpServletResponse hres) {
      // don't use normal string media headers which prevent caching,
      // use standard browser caching based on last modified timestamp
      }
    };
    resource.setLastModified(gIM.getGlossaryLastModifiedTime(glossaryFolder));
    resource.setContentType("text/html");

    ArrayList<GlossaryItem> glossItems = gIM.getGlossaryItemListByVFSItem(glossaryFolder);
    String description = "<dd><dt>" + glossaryMainTerm + "</dt>";
    // FIXME: have a way not to loop over all items, but get by Term
    boolean foundADescription = false;
    for (Iterator<GlossaryItem> iterator = glossItems.iterator(); iterator.hasNext();) {
      GlossaryItem glossaryItem = iterator.next();
View Full Code Here

TOP

Related Classes of org.olat.core.commons.modules.glossary.GlossaryItemManager

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.