Examples of TMLContext


Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

       
        // determine wgakey for replacement
        int wgakeyAttributeEnd = text.indexOf('"', from + wgaKeyPattern.length());
        String wgakey = text.substring(from + wgaKeyPattern.length(), wgakeyAttributeEnd);
       
        TMLContext targetContext = _context.context("docid:" + wgakey, false);
        if (targetContext != null) {                           
          if (tagStart != -1 && tagEnd != -1) {
            String hrefPattern = "href=\"";
            int hrefStart = text.indexOf(hrefPattern, from);
            if (hrefStart != -1 && hrefStart < tagEnd) {
              // href attribute found behind wgakey-attribute
              int hrefEnd = text.indexOf("\"", hrefStart + hrefPattern.length());
              text = text.substring(0, hrefStart + hrefPattern.length()) + targetContext.contenturl(null, null) + text.substring(hrefEnd);
            } else {
              hrefStart = text.lastIndexOf(hrefPattern, from);
              if (hrefStart != -1 && hrefStart > tagStart) {
                // href attribute found before wgakey-attribute
                int hrefEnd = text.indexOf("\"", hrefStart + hrefPattern.length());
                text = text.substring(0, hrefStart + hrefPattern.length()) + targetContext.contenturl(null, null) + text.substring(hrefEnd);               
              }
            }
          }
        } 
      } catch (Exception e) {
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

        // Restore design db option - must be here so following context change can use it
        status.setOption(OPTION_DESIGNDB, status._ajaxInfo.getDesignDB(), null);
       
        // restore context
        // B00004832
        TMLContext context = getTMLContext().context(ajaxInfo.getContextPath());
        this.setTMLContext(context);
        this.setChildTagContext(context);
       
        // Restore profile store on end flag
        if (getTMLContext().getprofile() != null) {
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

        if (!actionLink.getSessionID().equals(session.getId())) {
            throw new TMLInvalidActionLinkException("The action was registered for a different session ID");
        }
   
      // Try to retrieve action context - defaults to context of this tag
      TMLContext actionContext = getTMLContext();
      if (!actionLink.getContextPath().equals(TMLActionLink.EMPTY_PARAM)) {
        actionContext = actionContext.context(actionLink.getContextPath(), false);
           
            // Could not retrieve context. Too dangerous to execute action under the wrong context.
            if (actionContext == null) {
                throw new TMLActionException("Unable to retrieve action context: " + actionLink.getContextPath());
            }           
      } else {
        //B00004602
       
        // no context path - switch to dummy context of the given db 
        actionContext = getTMLContext().context("db:" + actionLink.getDbKey(), false);
       
        // Could not retrieve dummy context. Too dangerous to execute action under the wrong context.
        if (actionContext == null) {
          throw new TMLActionException("Unable to retrieve action context: db:" + actionLink.getDbKey());
        }
      }
     
      // Temporarily set portlet namespace, WebTML scope
      BaseTagStatus tag = getTMLContext().getDesignContext().getTag();
      TMLOptionPreserver preserver = new TMLOptionPreserver(tag);
       preserver.preserve(Base.OPTION_PORTLET_NAMESPACE, actionLink.getPortletKey());
        preserver.preserve(Base.OPTION_WEBTML_SCOPE, actionLink.getWebtmlScope());
     
        try {
        // Inner call, depends, if this a default action or not
        if (actionLink.isDefaultAction()) {
          actionContext.callDefaultAction(actionLink.getDefaultAction(), params);
          if (actionLink.getPortletmode() != null && actionContext.getportlet() != null) {
            actionContext.getportlet().setmode(actionLink.getPortletmode());
          }
          applyPortletContext(actionLink, actionContext);
          return null;
        }
        else {
          TMLAction tmlAction = (TMLAction) getTMLContext().getActionRegistration().get(actionLink.getActionKeyInteger());
          if (tmlAction == null) {
            throw new TMLActionException("Could not find action for key " + actionLink.getActionKey());
          }
          actionContext.callCustomAction(tmlAction, params);
          if (actionLink.getPortletmode() != null && actionContext.getportlet() != null) {
              if (getTMLContext().isdefined("actionresult")) {
                      ExpressionResult expressionResult = (ExpressionResult) getTMLContext().item("actionresult");
                      if (!expressionResult.isError() && (expressionResult.getResult() == null || expressionResult.getResult() instanceof String || !expressionResult.isFalse())) {
                          actionContext.getportlet().setmode(actionLink.getPortletmode());         
                      }
                  }
          }
                applyPortletContext(actionLink, actionContext);
          return tmlAction;
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

       
        return Design.db(cx, design, args, funObj);
    }
   
    public static String localLabel(Context cx, Scriptable thisObj, java.lang.Object[] args, Function funObj) throws JavaScriptException, WGException {
        TMLContext context = WGAGlobal.fetchInitialContext(cx);
        Arguments parsedArgs = _localLabelVarargs.parse(args);
        WGDatabase localDB = localDB(cx, thisObj, new Object[] {parsedArgs.get("currentObject")}, funObj);
        return context.label(localDB, (String) parsedArgs.get("container"), (String) parsedArgs.get("file"), (String) parsedArgs.get("key"), (List) parsedArgs.get("params"));

    }
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

            if (endContext == -1) {
                context.addwarning("Error executing scriptlet. Context expression not terminated: " + scriptletToken, false);
                return "";
            }
            String contextExpression = scriptletToken.substring(1, endContext);
            TMLContext targetContext = context.context(contextExpression, false);
            if (targetContext == null) {
                context.addwarning("Error executing scriptlet. Context could not be resolved: " + contextExpression, false);
                return "";
            }
            context = targetContext;
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

       
        // First try to fetch target context. When found we return the content url of it
        // If current doc is a remote doc we try a "roundtrip" to see which doc in the current
        // db represents the link target in the source database (B00004D92)
        if (context.db().getBooleanAttribute(WGACore.DBATTRIB_USEREMOTECS, false) && context.content().hasItem("remote_info")) {
            TMLContext remoteTargetContext = traceRemoteDocument(context, contentKey);
            if (remoteTargetContext != null) {
                return remoteTargetContext.contenturl(null, null);
            }
        }
        else {
            String contextExpr = (dbKey != null ? "db:" + dbKey + "/" : "") + "docid:" + contentKey;
            TMLContext targetContext = context.context(contextExpr, false);
            if (targetContext != null) {
                return targetContext.contenturl(null, null);
            }
        }
       
        return createFallBackContentURL(context, dbKey, contentKey);
       
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

          uniqueName = (String) parms.get(0);
        }
       

        String contextExpr = (dbKey != null ? "db:" + dbKey + "/" : "") + "name:" + uniqueName;
        TMLContext targetContext = context.context(contextExpr, false);
        if (targetContext != null) {
            return targetContext.contenturl(null, null);
        }
       
        return createFallBackContentURL(context, dbKey, uniqueName);
                           
    }
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

       
        try {
            WGCSSJSModule mod = db.getCSSJSModule(script, WGScriptModule.CODETYPE_TMLSCRIPT);
            if (mod != null) {
                _log.info("Running connection script of '" + db.getDbReference() + "'");
                TMLContext context = new TMLContext(db.getDummyContent(null), _core, null, null);
                ExpressionResult result = ExpressionEngineFactory.getTMLScriptEngine().evaluateExpression(mod.getCode(), context, ExpressionEngine.TYPE_SCRIPT, null);
                if (result.isError()) {
                    _log.error("Error running connection script '" + csConfig.getConnectionScript() + "' of '" + db.getDbReference() + "'", result.getException());
                }
            }
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

        try {
           
            WGCSSJSModule mod = db.getCSSJSModule(script, WGScriptModule.CODETYPE_TMLSCRIPT);
            if (mod != null) {
                _log.info("Running disconnection script of '" + db.getDbReference() + "'");
                TMLContext context = new TMLContext(db.getDummyContent(null), _core, null, null);
                ExpressionResult result = ExpressionEngineFactory.getTMLScriptEngine().evaluateExpression(mod.getCode(), context, ExpressionEngine.TYPE_SCRIPT, null);
                if (result.isError()) {
                    _log.error("Error running disconnection script '" + script + "' of '" + db.getDbReference() + "'", result.getException());
                }
            }
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

                        if (_info.getCsConfig() != null && !WGUtils.isEmpty(_info.getCsConfig().getInitScript())) {
                            try {
                                WGCSSJSModule mod = _db.getCSSJSModule(_info.getCsConfig().getInitScript(), WGScriptModule.CODETYPE_TMLSCRIPT);
                                if (mod != null) {
                                    _log.info("Running initialisation script of database '" + _db.getDbReference() + "'");
                                    TMLContext context = new TMLContext(_db.getDummyContent(null), _core, null, null);
                                    ExpressionResult result = ExpressionEngineFactory.getTMLScriptEngine().evaluateExpression(mod.getCode(), context, ExpressionEngine.TYPE_SCRIPT, null);
                                    if (result.isError()) {
                                        _log.error("Error running initialisation script '" + _info.getCsConfig().getInitScript() + "' of db '" + _db.getDbReference() + "'", result.getException());
                                    }
                                }
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.