Examples of BaseTagStatus


Examples of de.innovationgate.wgpublisher.webtml.BaseTagStatus

        if (context.getDesignContext().getTag() == null) {
            context.setLastError("Cannot retrieve tag because this script does not run on a WebTML page");
            return errorReturnContext;
        }

        BaseTagStatus refTag = context.getDesignContext().getTag().getTagStatusById(contextExpression);
        if (refTag != null) {
            TMLContext tagContext = refTag.tmlContext;
            if (tagContext != null) {
                return tagContext;
            }
            else {
                context.setLastError("Context of this Tag could not be retrieved: " + contextExpression);
                return errorReturnContext;
            }
        }
        else {
            context.setLastError("Tag could not be retrieved: " + contextExpression);
            return errorReturnContext;
        }
    }

    else if (contextFunction.equals("db") || contextFunction.equals("plugin")) {
       
        if (contextFunction.equals("plugin")) {
            WGAPlugin plugin = context.getwgacore().getPluginSet().getPluginByUniqueName(contextExpression);
            if (plugin != null) {
                contextExpression = plugin.buildDatabaseKey();
            }
            else {
                context.setLastError("Unknown plugin unique name: " + contextExpression);
                return errorReturnContext;
            }
        }
       
        WGDatabase dbTarget = null;
        try {
            dbTarget = context.db(context.resolveDBKey(contextExpression));
        }
        catch (WGUnavailableException e1) {
            context.setLastError("Database '" + contextExpression + "' is currently unavailable");
            return errorReturnContext;
        }
        catch (WGException e) {
            context.setLastError("Unable to open database '" + contextExpression + "'. Exception: " + e.getClass().getName() + " message: " + e.getMessage());
            return errorReturnContext;
        }

        if (dbTarget == null) {
            context.setLastError("No database with key " + contextExpression);
            return errorReturnContext;
        }

        if (dbTarget.isSessionOpen() == false) {
            context.setLastError("User cannot open database '" + contextExpression + "'");
            return errorReturnContext;
        }

        if (dbTarget.getSessionContext().getAccessLevel() <= WGDatabase.ACCESSLEVEL_NOACCESS) {
            context.setLastError("User has no access to database '" + contextExpression + "'");
            return errorReturnContext;
        }

        TMLContext dbContext = context.dbContext(dbTarget);
        if (dbContext == null) {
            context.setLastError("Target database " + contextExpression + " does not support db context changes");
            return errorReturnContext;
        }
        else {
            return dbContext;
        }
    }

    else if (contextFunction.equals("area")) {

        WGArea area = db.getArea(contextExpression);
        if (area == null) {
            context.setLastError("No area of name '" + contextExpression + "'");
            return errorReturnContext;
        }

        WGContent content = navigator.getRootContent(area);
        if (content != null) {
            return context.getTMLContextForDocument(content);
        }
        else {
            context.setLastError("No root content in area '" + contextExpression + "'");
            return errorReturnContext;
        }

    }

    else if (contextFunction.equals("query")) {

        if (context.getDesignContext().getTag() == null) {
            context.setLastError("Cannot retrieve tag because this script does not run on a WebTML page");
            return errorReturnContext;
        }

        BaseTagStatus tag = context.getDesignContext().getTag().getTagStatusById(contextExpression);
        if (tag != null && tag instanceof Query.Status) {
            Query.Status queryTag = (Query.Status) tag;
            WGContent content = queryTag.getFirstContent();
            if (content != null) {
                return context.getTMLContextForDocument(queryTag.getFirstContent());
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.BaseTagStatus

    }


    protected String innerBuildContentURL(TMLContext context, String mediaKey, String layoutKey, boolean ignoreVirtualLink) throws UnsupportedEncodingException, WGAPIException {

        BaseTagStatus tag = context.getDesignContext().getTag();
        if (tag == null) {
            return null;
        }

        String completeUrl = null;
       
        if (mediaKey == null) {
            mediaKey = tag.getMainMediaKey();
        }

        // If content is dummy, return a layout url instead. Use the design of the current request, if none specified.
        if (context.content().isDummy()) {
            if (layoutKey == null || layoutKey.equals("default")) {
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.BaseTagStatus

        return rewriteURL(url, context.getrequest(), context.getwgacore(), false);
    }

    protected String innerBuildLayoutURL(TMLContext context, String dbKey, String mediaKey, String layoutKey) throws UnsupportedEncodingException, WGAPIException {
       
        BaseTagStatus tag = context.getDesignContext().getTag();
        if (tag == null) {
            return null;
        }

        // Defaulting of media and layout key
        if (mediaKey == null) {
            mediaKey = tag.getMainMediaKey();
        }

        if (layoutKey == null) {
            layoutKey = "default";
        }
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.BaseTagStatus

        return rewriteURL(url, context.getrequest(), context.getwgacore(), false);
    }
   
    protected String innerBuildActionURL(TMLContext context, TMLAction action, List params, String portletMode, String portletContext) throws WGAPIException, UnsupportedEncodingException {
       
        BaseTagStatus tag = context.getDesignContext().getTag();
        if (tag == null) {
            return null;
        }
       
       
        TMLActionLink actionLink = action.createActionLink(params, context);
        actionLink.setPortletmode(portletMode);
        if (portletContext != null) {
            actionLink.setPortletContextPath(context, portletContext);
        }
              
        String encodedActionLink = actionLink.getEncodedString(context.getwgacore());

        // Retrieve relevant form.
        String formID = tag.getRelevantForm();

        // Inside a form we use javascript to post the action
        if (formID != null) {
            StringBuffer jsUrl = new StringBuffer();
            jsUrl.append("javascript:document.forms['" + formID + "'].$formaction.value ='" + encodedActionLink + "';");
            jsUrl.append("document.forms['" + formID + "'].submit();");

            return jsUrl.toString();
        }
       
        // Outside we use a simple action link
        else {
            try {
                URLBuilder builder = new URLBuilder(new java.net.URL(tag.getRequestURL()));
                builder.setParameterEncoding(context.getwgacore().getCharacterEncoding());
                builder.setParameter("$action", encodedActionLink);
                return builder.rebuild(false);
            }
            catch (MalformedURLException exc) {
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.BaseTagStatus

    if (!getEnvironment().isPageContextAvailable()) {
      this.setLastError("Cannot retrieve request metadata because this script does not run inside a WebTML page");
      return null;
    }
   
    BaseTagStatus tag = _designContext.getTag();

    if (name.equals("url")) {
      return tag.getRequestURL();
    }
    else if (name.equals("wgaurl")) {
      return getwgacore().getDispatcher().getPublisherURL(getrequest(), false);
    }
    else if (name.equals("absolutewgaurl")) {
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.BaseTagStatus

    return designDocNames;
  }

  public Object taginfo(String tagId, String name) throws WGAPIException {
   
      BaseTagStatus tag = _designContext.getTag();
    if (tag == null) {
      return null;
    }

    if (tagId == null) {
      this.setLastError("No sourceTag attribute given");
      return null;
    }

    BaseTagStatus refTag = tag.getTagStatusById(tagId);
    if (refTag != null) {
      Object result = refTag.getTagInfo(String.valueOf(name).toLowerCase());
      if (result == null) {
        this.setLastError("Tag " + tagId + " did not provide Info " + name);
      }
      return result;
    }
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.BaseTagStatus

  public boolean ismaindocument() throws WGAPIException {
    return (document == getmaincontext().content());
  }

  public boolean isbrowserinterface() {
      BaseTagStatus tag = getDesignContext().getTag();
      if (tag != null) {
          return tag.isBrowserInterface();
      }
      else {
          return false;
      }
  }
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.BaseTagStatus

    }

   
    public String contentdataurl(String mediaKey, String layoutKey, boolean ignoreVirtualLink, String queryString) throws ServletException, IOException, WGAPIException {
       
        BaseTagStatus tag = _designContext.getTag();
        if (tag ==  null) {
            return null;
        }
       
       
        // retrieve standard contenturl
        String url = contenturl(mediaKey, layoutKey, ignoreVirtualLink);
        // cut off WGPath
        url = url.substring(url.indexOf(_environment.getPublisherURL()) + _environment.getPublisherURL().length());
        // append query string
        if (queryString != null) {
            url = url + "?" + queryString;
        }
       
        // determine contentType (mimeType)
        if (mediaKey == null) {
           
            mediaKey = tag.getMainMediaKey();
        }
        MediaKey key = getwgacore().getMediaKey(mediaKey);       
        String contentType = key.getMimeType();
       
        /** this works on WAS - on tomcat the result is an endless loop        
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.BaseTagStatus

    return !this.istrue(varname);
  }

  public Object option(String option, Object defaultValue) {
   
      BaseTagStatus tag = _designContext.getTag();
    if (tag != null) {
        return tag.getOption(option);
    }
    else {
        return defaultValue;
    }
  }
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.BaseTagStatus

      return this.createcalendar(this.createdate());
    }
   
    public void setoption(String name, Object value, String scope) {
       
        BaseTagStatus tag = getDesignContext().getTag();
        if (tag == null) {
            return;
        }
       
        while (tag != null) {
            tag.setOption(name, value, scope);
            if (tag instanceof Root.Status) {
                break;
            }
            tag = tag.getParentTag();
        }
    }
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.