Package de.innovationgate.webgate.api

Examples of de.innovationgate.webgate.api.WGContent


        else if (parent instanceof WGContent) {
            entries = ((WGContent) parent).getStructEntry().getChildEntries();
        }

        Iterator entriesIt = entries.iterator();
        WGContent foundContent = null;
        while (entriesIt.hasNext()) {
            WGStructEntry entry = (WGStructEntry) entriesIt.next();
            WGContent content = chooser.selectContentForPage(entry, false);
            if (content != null) {
                if (title.matches(content)) {
                    foundContent = content;
                    break;
                }
View Full Code Here


        if (_contentIndexing) {
            // Search if there are other contents on earlier siblings with identical
            // title
            // If so we must add the sibling index to the path title to make it
            // unique
            WGContent prevContent = content.getPreviousContent();
            while (prevContent != null) {
                if (normalizeURLTitle(prevContent.getTitle()).equals(normalizedTitle)) {
                    index = content.getStructEntry().getSiblingIndex();
                    break;
                }
   
                prevContent = prevContent.getPreviousContent();
            }
        }

        return new URLPathTitle(title, index);
View Full Code Here

        }
        else if (parent instanceof WGContent) {
            entries = ((WGContent) parent).getStructEntry().getChildEntries();
        }

        WGContent foundContent = null;
        Iterator entriesIt = entries.iterator();
       
        // Iterate entries
        while (entriesIt.hasNext()) {
            WGStructEntry entry = (WGStructEntry) entriesIt.next();
           
            WGContent content = null;
           
            // First try the addressed language from the path (if available)
            if (titlePath.getLanguage() != null) {
                 content = LanguageBehaviourTools.getRelevantContent(entry, titlePath.getLanguage(), false);
                 if (content != null && pathTitle.matches(content)) {
View Full Code Here

    }

    private WGContent findSharePathContent(TitlePath titlePathURL, WGLanguageChooser chooser, String mode, WGDocument triggerDoc) throws UnsupportedEncodingException,
            WGAPIException, RemainingPathElementException {
       
        WGContent pathContent = null;
        Iterator pathTitles = titlePathURL.getTitles().iterator();
        WGDocument parent = null;
       
       
        while (pathTitles.hasNext()) {
           
            PathTitle pathTitle = parseSharePathTitle((String) pathTitles.next());
           
            if (pathContent != null) {
                parent = pathContent.getStructEntry();
            }
            else {
                parent = triggerDoc;
            }
           
            WGContent newContent = TitlePathManager.findContent(pathTitle, parent, chooser);
            if (newContent == null) {
                // In JCR mode the last element may address a JCR property. We throw a RemainingPathElementException then
                if (pathTitles.hasNext()) {
                    pathContent = null;
                }
View Full Code Here

   
    public List buildTitlePath(WGContent baseContent, String mediaKey, WGLanguageChooser chooser) throws WGAPIException, UnsupportedEncodingException {
        List path = new ArrayList();
       
        // Build a path of all titles up to the root content
        WGContent content = baseContent;
        while (true) {
           
            String title = createPathTitle(content).toString();
            // Add the language and media key suffix if we are on first level
            String language = content.getLanguage().getName();
            if (!LanguageBehaviourTools.isMultiLanguageDB(content.getDatabase()) && language.equals(content.getDatabase().getDefaultLanguage())) {
                language = WGPDispatcher.DEFAULT_LANGUAGE_TOKEN;
            }
            if (content == baseContent) {
                title += "." + language + "." + mediaKey;
            }
            path.add(title);
           
            if (content.getStructEntry().isRoot()) {
                break;
            }
           
            // Go up in hierarchy
            // If we cannot build a complete hierarchy path (b.c. of no released contents on a node) we must cancel the title path creation
            WGContent parentContent = content.getParentContent(false);
           
            // Fallback to a language chosen by the language chooser
            if (parentContent == null && _allowMixedLang && chooser != null) {
                parentContent = chooser.selectContentForPage(content.getStructEntry().getParentEntry(), false);
            }
View Full Code Here

    }

    public String includeScript(String script) {

        StringBuffer scriptresult = new StringBuffer("");
        WGContent content = this.getTMLContext().content();
        script = script.toLowerCase();

        List includedscripts = (List) getPageContext().getRequest().getAttribute("includedscripts");
        if (includedscripts != null && includedscripts.contains(script))
            return "";
View Full Code Here

        String className = getClass().getName();
        return className.substring(className.lastIndexOf(".") + 1).toLowerCase();
    }
    public void buildHTMLHead(boolean metaOutput, String scripts) throws WGAPIException {
        TMLContext context = this.getTMLContext();
      WGContent content = context.content();
     
      if( content != null ){   
        // Eventually put out meta tags
        this.appendResult("<meta name=\"generator\" content=\"").appendResult(WGACore.getReleaseString()).appendResult("\">\n");   
        if (metaOutput == true ) {
          this.appendResult("<meta name=\"keywords\" content=\"").appendResult(de.innovationgate.utils.WGUtils.serializeCollection(content.getKeywords(), ",")).appendResult("\">\n");
        }       
      }
   
      this.appendResult(includeScript("htmlhead"));
      this.appendResult("<script type=\"text/javascript\">");
      this.appendResult("WGA.contextpath=\"" + getWGPPath() + "\";");    // used by htmlhead.js since wga-4
      this.appendResult("WGA.emptyActionParam =\"" + TMLActionLink.EMPTY_PARAM + "\";");
        this.appendResult("</script>\n");
   
        BaseTagStatus status = getStatus();
      if(status.isBrowserInterface() && status.isBrowserInterface4()){
        // new Content Manager (wga-4-bi) stuff:
        this.appendResult("<script type=\"text/javascript\">");
        this.appendResult("\nWGA.contentinfo={");
        this.appendResult("\n\tdbkey:\"" + content.getDatabase().getDbReference() + "\"");
        if(!content.isDummy()){
          this.appendResult(",");
          WGStructEntry structentry = content.getStructEntry();       
          this.appendResult("\n\tstructkey:\"" + structentry.getStructKey() + "\",");
          this.appendResult("\n\tcontentkey:\"" + content.getContentKey(true) + "\",");     
          //this.appendResult("\n\ttitle:\"" +  WGUtils.strReplace(content.getTitle(), "\"", "\\\"", true));
          this.appendResult("\n\ttitle:\"" +  WGUtils.strReplace(WGUtils.strReplace(content.getTitle(), "\"", "\\\"", true), "script", "sc\"+\"ript", true));
                this.appendResult("\",");
          this.appendResult("\n\tlanguage:\"" + content.getLanguage().getName() + "\"");
        }
        this.appendResult("\n}")
        this.appendResult("\n</script>\n");

        String prefLanguage = content.getLanguage().getName();       
      getPageContext().getSession().setAttribute("PreferredLanguage", prefLanguage);
      }

      // optional includes for input fields   
      if (scripts!=null){
View Full Code Here

        // Try to find a document named "home" in the relevant languages
        db = core.openContentDB(db, request, false);
        if (db.isSessionOpen()) {
           
            LanguageBehaviour langBehaviour = LanguageBehaviourTools.retrieve(db);
            WGContent content = langBehaviour.requestSelectContentForName(db, request, "home", false);
            if (content != null && content.mayBePublished(false, WGContent.DISPLAYTYPE_NONE)) {
                return dispatcher.getPublisherURL(request) + "/" + db.getDbReference().toLowerCase() + "/home";
            }
        }
    return null;
  }
View Full Code Here

   
    if (this.allowdefaultlang != null) {
        addWarning("Attribute \"allowdefaultlang\" is deprecated and inoperable since OpenWGA 5.1");
    }
   
    WGContent relContent = this.getTMLContext().content();
        // IF the relContent is a dummy, use the first released content of this database
        if (relContent.isDummy()) {
            relContent = relContent.getDatabase().getFirstReleasedContent((String) getTMLContext().meta("language"), true);
            if (relContent == null) {
                addWarning("No content in context and cannot find released content of language " +  getTMLContext().meta("language") + " in the current database", true);
                return;
            }
        }
       
    String theRole = this.getRole();
   
    String type = status.navType;
      
    if (type.equals("children")) {
      navigator = createContentNavigator(theRole, WGContent.DISPLAYTYPE_NAVIGATOR);
      WGStructEntryList childEntries = relContent.getStructEntry().getChildEntries();
      status.contentList = WGContentList.create(navigator.collectRelevantContents(childEntries));
    }
    else if (type.equals("siblings")) {
      navigator = createContentNavigator(theRole, WGContent.DISPLAYTYPE_NAVIGATOR);
      WGStructEntryList siblingEntries = relContent.getStructEntry().getSiblingEntries();
      status.contentList = WGContentList.create(navigator.collectRelevantContents(siblingEntries));
    }
    else if (type.equals("parent") || type.equals("parents")) {
      navigator = createContentNavigator(theRole, WGContent.DISPLAYTYPE_NAVIGATOR);
            WGStructEntryList parentEntries = relContent.getStructEntry().getParentEntry().getSiblingEntries();
            status.contentList = WGContentList.create(navigator.collectRelevantContents(parentEntries));
    }
    else if (type.equals("path")) {
      navigator = createContentNavigator(theRole, WGContent.DISPLAYTYPE_NAVIGATOR);
      status.contentList = this.getPathListFor(relContent, navigator);
    }
    else if (type.equals("sitemap")) {
        navigator = createContentNavigator(theRole, WGContent.DISPLAYTYPE_SITEMAP);
        status.contentList = this.getSitemapListFor(relContent, navigator, this.stringToBoolean(this.getAllareas()));
    }
    else if (type.equals("languages")) {
        navigator = createContentNavigator(theRole, WGContent.DISPLAYTYPE_NONE);
        status.contentList = this.getLanguagesListFor(relContent, navigator, this.stringToBoolean(this.getAlllanguages()));
    }
    else if (type.equals("areas")) {
        navigator = createContentNavigator(theRole, WGContent.DISPLAYTYPE_NAVIGATOR);
        status.contentList = this.getAreasListFor(relContent, navigator);
    }
    else if (type.equals("versions")) {
        status.contentList = relContent.getStructEntry().getAllContent(true);
    }
    else {
        throw new TMLException("Unknown navigator type: " + type, true);
    }
   
View Full Code Here

    }
   
    java.util.ArrayList contents = new java.util.ArrayList();
   
    if (allAreas == false) {
      WGContent rootContent;
     
      if (content.isDummy() || !content.hasCompleteRelationships()) {
        rootContent = content.getDatabase().getFirstReleasedContent(content.getLanguage().getName(), true);
      }
      else {
        rootContent = navigator.getRootContent(content.getStructEntry().getArea());
      }
     
      if (rootContent == null) {
          return new WGContentList();
      }
     
      Iterator rootSiblings = navigator.collectRelevantContents(rootContent.getStructEntry().getSiblingEntries()).iterator();
      while (rootSiblings.hasNext()) {
          WGContent siblingContent = (WGContent) rootSiblings.next();
        this.retrieveHierarchy(siblingContent, contents, navigator, 1);
      }
     
    }
    else {

        Iterator areas = content.getDatabase().getAreas().iterator();
      WGArea area;
      while (areas.hasNext()) {
        area = (WGArea) areas.next();
        if (area.isSystemArea()) {
            continue;
        }
       
        WGContent rootContent = navigator.getRootContent(area);
        if (rootContent == null) {
            continue;
        }
       
        Iterator rootSiblings = navigator.collectRelevantContents(rootContent.getStructEntry().getSiblingEntries()).iterator();
              while (rootSiblings.hasNext()) {
                  WGContent siblingContent = (WGContent) rootSiblings.next();
                  this.retrieveHierarchy(siblingContent, contents, navigator, 1);
              }
      }
    }
   
View Full Code Here

TOP

Related Classes of de.innovationgate.webgate.api.WGContent

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.