Opens the direct edit tag, if manual mode is set then the next
start HTML for the direct edit buttons is printed to the page.<p>

@return {@link #EVAL_BODY_INCLUDE}

@throws JspException in case something goes wrong
427922
@Override
    public int doStartTag() throws JspException {

        ServletRequest req = pageContext.getRequest();

        // This will always be true if the page is called through OpenCms
        if (!CmsFlexController.isCmsRequest(req)) {
            return SKIP_BODY;
        }
        if (getJs() == null) {
            if (isDynamic()) {
                // in case we want to include the needed js functions
                try {
                    pageContext.getOut().print("<script type='text/javascript' src='"
                        + CmsWorkplace.getSkinUri()
                        + VFS_PATH_LOAD_JS
                        + "' ></script>");
                } catch (Exception ex) {
                    if (LOG.isErrorEnabled()) {
                        LOG.error(Messages.get().getBundle().key(Messages.ERR_PROCESS_TAG_1, "jquery"), ex);
                    }
                    throw new JspException(ex);
                }
            }
            return SKIP_BODY;
        }

        // get the server prefix
        CmsObject cms = CmsFlexController.getCmsObject(req);

        // first handle js file
        String path = VFS_PATH_JQUERY;
        if (cms.getRequestContext().getCurrentProject().isOnlineProject()) {
            // online
            path += VFS_PATH_PACKED;
        } else {
            // offline
            path += VFS_PATH_UNPACKED;
        }
        String file = path + getJs() + EXTENSION_JS;
        try {
            cms.readResource(CmsWorkplace.VFS_PATH_RESOURCES + file);
            if (isDynamic()) {
                pageContext.getOut().print("<script type='text/javascript'>load_script('"
                    + CmsWorkplace.getSkinUri()
                    + file
                    + "', 'js');</script>");
            } else {
                pageContext.getOut().print(
                    "<script type='text/javascript' src='" + CmsWorkplace.getSkinUri() + file + "' ></script>");
            }
        } catch (Exception ex) {
            if (LOG.isErrorEnabled()) {
                LOG.error(Messages.get().getBundle().key(Messages.ERR_PROCESS_TAG_1, "jquery"), ex);
            }
            throw new JspException(ex);
        }
        if (getCss() == null) {
            return SKIP_BODY;
        }

        // now handle css file
        path = VFS_PATH_CSS;
        file = path + getCss() + EXTENSION_CSS;
        try {
            cms.readResource(CmsWorkplace.VFS_PATH_RESOURCES + file);
            pageContext.getOut().println();
            if (isDynamic()) {
                pageContext.getOut().print("<script type='text/javascript'>load_script('"
                    + CmsWorkplace.getSkinUri()
                    + file
                    + "', 'css');</script>");
            } else {
                pageContext.getOut().print(
                    "<link href='" + CmsWorkplace.getSkinUri() + file + "' rel='stylesheet' type='text/css' >");
            }
        } catch (Exception ex) {
            if (LOG.isErrorEnabled()) {
                LOG.error(Messages.get().getBundle().key(Messages.ERR_PROCESS_TAG_1, "jquery"), ex);
            }
            throw new JspException(ex);
        }
        return SKIP_BODY;
    }
446039
public int doEndTag() throws JspException
    {
        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
        HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
        ServletContext context = pageContext.getServletContext();

        try {
            boolean encoded = false;
            UrlConfig urlConfig = ConfigUtil.getConfig().getUrlConfig();
            if (urlConfig != null) {
                encoded = !urlConfig.isUrlEncodeUrls();
            }

            FreezableMutableURI uri = new FreezableMutableURI();
            uri.setEncoding(response.getCharacterEncoding());
            uri.setURI(url, encoded);
            boolean needsToBeSecure = false;
            if (_params != null) {
                uri.addParameters(_params, false );
            }
            if (!uri.isAbsolute() && PageFlowUtils.needsToBeSecure(context, request, url, true)) {
                needsToBeSecure = true;
            }

            URLRewriterService.rewriteURL(context, request, response, uri, URLType.ACTION, needsToBeSecure);
            String key = PageFlowUtils.getURLTemplateKey(URLType.ACTION, needsToBeSecure);
            boolean forXML = TagRenderingBase.Factory.isXHTML(request);
            URIContext uriContext = URIContextFactory.getInstance(forXML);
            String uriString = URLRewriterService.getTemplatedURL(context, request, uri, key, uriContext);
            write(response.encodeURL(uriString));
        }
        catch (URISyntaxException e) {
            // report the error...
            String s = Bundle.getString("Tags_RewriteURL_URLException",
                    new Object[]{url, e.getMessage()});
            registerTagError(s, e);
            reportErrors();
        }

        localRelease();
        return EVAL_PAGE;
    }
610220
@Override
    public int doEndTag() throws JspException {

        // only execute action for the first "ade" tag on the page (include file)
        enableAdeTagAction(pageContext);

        if (OpenCms.getSystemInfo().getServletContainerSettings().isReleaseTagsAfterEnd()) {
            // need to release manually, JSP container may not call release as required (happens with Tomcat)
            release();
        }

        return EVAL_PAGE;
    }
1164310
@Override
    public int doEndTag() throws JspException {

        ServletRequest req = pageContext.getRequest();
        A_CmsConfiguredHtmlParser parser;
        if (m_allowInlineEdit && CmsJspTagEditable.isEditableRequest(req)) {
            // during inline editing the content should not be parsed
            try {
                getBodyContent().writeOut(pageContext.getOut());
                release();
            } catch (Exception ex) {
                release();
                if (LOG.isErrorEnabled()) {
                    LOG.error(Messages.get().getBundle().key(Messages.ERR_PROCESS_TAG_1, TAG_NAME), ex);
                }
                // this is severe
                throw new JspException(ex);
            }
        } else {
            // This will always be true if the page is called through OpenCms
            if (CmsFlexController.isCmsRequest(req)) {
                String content = "";
                try {
                    if (CmsStringUtil.isEmpty(m_configuredParserClassname)) {
                        if (LOG.isErrorEnabled()) {
                            LOG.error(
                                Messages.get().getBundle().key(
                                    Messages.GUI_ERR_TAG_ATTRIBUTE_MISSING_2,
                                    new Object[] {TAG_NAME, ATT_VISITOR_CLASS}));
                        }

                    }
                    // wrong attribute visitorClass -> content will remain empty, but no exception is
                    // thrown
                    try {
                        // load
                        Class<?> cl = Class.forName(m_configuredParserClassname);
                        // Instantiate
                        Object instance = cl.newInstance();
                        // cast
                        parser = (A_CmsConfiguredHtmlParser)instance;
                        parser.setParam(m_param);
                        // cms object:
                        CmsFlexController controller = CmsFlexController.getController(req);
                        CmsObject cms = controller.getCmsObject();
                        parser.setCmsObject(cms);
                        content = parseTagAction(getBodyContent().getString(), pageContext, parser);

                    } catch (Exception e) {
                        if (LOG.isErrorEnabled()) {
                            LOG.error(
                                Messages.get().getBundle().key(
                                    Messages.GUI_ERR_TAG_ATTRIBUTE_INVALID_3,
                                    new Object[] {
                                        TAG_NAME,
                                        ATT_VISITOR_CLASS,
                                        A_CmsConfiguredHtmlParser.class.getName()}),
                                e);
                        }
                        e.printStackTrace(System.err);
                    }

                } finally {
                    try {
                        getBodyContent().clear();
                        getBodyContent().print(content);
                        getBodyContent().writeOut(pageContext.getOut());
                        release();

                    } catch (Exception ex) {
                        release();
                        if (LOG.isErrorEnabled()) {
                            LOG.error(Messages.get().getBundle().key(Messages.ERR_PROCESS_TAG_1, TAG_NAME), ex);
                        }
                        // this is severe
                        throw new JspException(ex);
                    }

                }

            }
        }
        return EVAL_PAGE;
    }
110351
@Override
    public int doStartTag() throws JspException {
        final ParameterizableTag parameterizableTag =
                (ParameterizableTag)
                        TagSupport.findAncestorWithClass(this, ParameterizableTag.class);

        if (parameterizableTag == null) {
            throw new JspException(
                    "the 'param' Tag must have a parent tag that implements ParameterizableTag");
        }

        if (this.name != null) {
            parameterizableTag.addParameter(this.name, this.value);
        }

        return SKIP_BODY;
    }
826340
public static void insertDirectEditEnd(PageContext pageContext) {

        try {
            CmsJspTagEditable.endDirectEdit(pageContext);
        } catch (JspException e) {
            LOG.error("Could not print closing direct edit tag.", e);
        }
    }
684879
public int doAfterBody() throws JspException
    {
        String text = bodyContent.getString();
        if (text != null) {
            bodyContent.clearBody();
            text = text.trim();
            if (text.length() > 0)
                _text = text;
        }
        return SKIP_BODY;
    }
688967
@Override
    public int doEndTag() throws JspException {
        Tag t = findAncestorWithClass(this, ParamParent.class);
        if (t == null) {
            throw new JspTagException(
                    Resources.getMessage("PARAM_OUTSIDE_PARENT"));
        }

        // take no action for null or empty names
        if (name == null || name.equals("")) {
            return EVAL_PAGE;
        }

        // send the parameter to the appropriate ancestor
        ParamParent parent = (ParamParent) t;
        String value = this.value;
        if (value == null) {
            if (bodyContent == null || bodyContent.getString() == null) {
                value = "";
            } else {
                value = bodyContent.getString().trim();
            }
        }
        if (encode) {
            String enc = pageContext.getResponse().getCharacterEncoding();
            try {
                parent.addParameter(URLEncoder.encode(name, enc), URLEncoder.encode(value, enc));
            } catch (UnsupportedEncodingException e) {
                throw new JspTagException(e);
            }
        } else {
            parent.addParameter(name, value);
        }
        return EVAL_PAGE;
    }
344814
public static void endDirectEdit(PageContext context) throws JspException {

        // get the direct edit bean from the context
        I_CmsDirectEditProvider eb = getDirectEditProvider(context);

        if (eb != null) {
            // the direct edit bean must be available
            eb.insertDirectEditEnd(context);
        }
    }
1244625
public int doStartTag() throws JspException {

		String string = null;

		if (srcExpr != null) {
			string = (String) ExpressionEvaluatorManager.evaluate("srcExpr", srcExpr, String.class, this, pageContext);
			setSrc(string);
		}

		if (typeExpr != null) {
			string = (String) ExpressionEvaluatorManager.evaluate("typeExpr", typeExpr, String.class, this,
					pageContext);
			setType(string);
		}

		if (asyncExpr != null) {
			string = (String) ExpressionEvaluatorManager.evaluate("asyncExpr", asyncExpr, String.class, this,
					pageContext);
			setAsync(string);
		}

		if (deferExpr != null) {
			string = (String) ExpressionEvaluatorManager.evaluate("deferExpr", deferExpr, String.class, this,
					pageContext);
			setDefer(string);
		}

		if (useRandomParamExpr != null) {
			string = (String) ExpressionEvaluatorManager.evaluate("useRandomParamExpr", useRandomParamExpr,
					String.class, this, pageContext);
			setUseRandomParam(string);
		}

		return super.doStartTag();
	}
1025078
public static void enableAdeTagAction(PageContext context) throws JspException {

        ServletRequest req = context.getRequest();
        if (CmsHistoryResourceHandler.isHistoryRequest(req)) {
            // don't display advanced direct edit buttons on an historical resource
            return;
        }

        CmsFlexController controller = CmsFlexController.getController(req);
        CmsObject cms = controller.getCmsObject();

        if (cms.getRequestContext().getCurrentProject().isOnlineProject()) {
            // advanced direct edit is never enabled in the online project
            return;
        }

        if (CmsResource.isTemporaryFileName(cms.getRequestContext().getUri())) {
            // don't display advanced direct edit buttons if a temporary file is displayed
            return;
        }
        updateDirectEditFlagInSession(req);
        if (isDirectEditDisabled(req)) {
            try {
                String buttonLeft = null;
                Integer left = (Integer)((HttpServletRequest)req).getSession().getAttribute(
                    CmsGwtConstants.PARAM_BUTTON_LEFT);

                if (left != null) {
                    buttonLeft = left.toString() + "px";
                } else {
                    buttonLeft = "20%";
                }
                String titleMessage = Messages.get().getBundle(
                    OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key(Messages.GUI_TOOLBAR_ENABLE_EDIT_MODE_0);
                context.getOut().print(getPreviewInclude(buttonLeft, titleMessage));
            } catch (IOException e) {
                throw new JspException(e);
            }
        } else {

            I_CmsDirectEditProvider eb = new CmsAdvancedDirectEditProvider();
            eb.init(cms, CmsDirectEditMode.TRUE, "");
            CmsJspTagEditable.setDirectEditProvider(context, eb);

            try {
                CmsContainerpageActionElement actionEl = new CmsContainerpageActionElement(
                    context,
                    (HttpServletRequest)req,
                    (HttpServletResponse)context.getResponse());
                context.getOut().print(actionEl.exportAll());
            } catch (Exception e) {
                throw new JspException(e);
            }
        }
    }
1291092
public int doEndTag()
            throws JspException {

        if(hasErrors())
            reportErrors();
        else if(_contentBuffer != null)
            write(_contentBuffer.toString());

        return EVAL_PAGE;
    }
174772
@Override
	public int doStartTag() throws JspException {

		String string = null;
		Boolean bool = null;

		if (srcExpr != null) {
			string = (String) ExpressionEvaluatorManager.evaluate("srcExpr", srcExpr, String.class, this, pageContext);
			setSrc(string);
		}

		if (useRandomParamExpr != null) {
			string = (String) ExpressionEvaluatorManager.evaluate("useRandomParamExpr", useRandomParamExpr,
					String.class, this, pageContext);
			setUseRandomParam(string);
		}

		if (mediaExpr != null) {
			string = (String) ExpressionEvaluatorManager.evaluate("mediaExpr", mediaExpr, String.class, this,
					pageContext);
			setMedia(string);
		}

		if (titleExpr != null) {
			string = (String) ExpressionEvaluatorManager.evaluate("titleExpr", titleExpr, String.class, this,
					pageContext);
			setTitle(string);
		}

		if (alternateExpr != null) {
			bool = (Boolean) ExpressionEvaluatorManager.evaluate("alternateExpr", alternateExpr, Boolean.class, this,
					pageContext);
			setAlternate(bool);
		}

		if (displayAlternateExpr != null) {
			bool = (Boolean) ExpressionEvaluatorManager.evaluate("displayAlternateExpr", displayAlternateExpr,
					Boolean.class, this, pageContext);
			setAlternate(bool);
		}

		return super.doStartTag();
	}
439995
protected String defaultActionHtmlStart() throws JspException {

        StringBuffer result = new StringBuffer(2048);
        result.append(htmlStart("administration/index.html"));
        result.append("<script type=\"text/javascript\" src=\"").append(getResourceUri()).append(
            "editors/xmlcontent/edit.js\"></script>\n");
        result.append("<script type=\"text/javascript\" src=\"").append(getResourceUri()).append(
            "editors/xmlcontent/help.js\"></script>\n");
        result.append(getWidgetIncludes());
        result.append("<script type=\"text/javascript\">\n<!--\n");
        result.append("// flag indicating if form initialization is finished\n");
        result.append("var initialized = false;\n");
        result.append("// the OpenCms context path\n");
        result.append("var contextPath = \"").append(OpenCms.getSystemInfo().getOpenCmsContext()).append("\";\n\n");
        result.append("// action parameters of the form\n");
        result.append("var actionAddElement = \"").append(EDITOR_ACTION_ELEMENT_ADD).append("\";\n");
        result.append("var actionRemoveElement = \"").append(EDITOR_ACTION_ELEMENT_REMOVE).append("\";\n");
        result.append("function init() {\n");
        result.append(getWidgetInitCalls());
        result.append("\tsetTimeout(\"scrollForm();\", 200);\n");
        result.append("\tinitialized = true;\n");
        result.append("\twindow.onbeforeunload=exitEditor;\n");
        result.append("}\n\n");
        result.append("window.exitEditorCalled = false;\n");
        result.append("function exitEditor() {\n");
        result.append("\tif (window.exitEditorCalled) return;\n");
        result.append("\twindow.exitEditorCalled = true; \n");
        result.append("\ttry {\n");
        result.append("\t\t// close file selector popup if present\n");
        result.append("\t\tcloseTreeWin();\n");
        result.append("\t} catch (e) {}\n");
        result.append("}\n");
        result.append(getWidgetInitMethods());
        result.append("\n// -->\n</script>\n");
        result.append(bodyStart(null, "onload='init();'  onunload='exitEditor();'"));
        result.append(dialogStart());
        return result.toString();
    }
1214289
public int doEndTag()
            throws JspException
    {

        popIdScope();

        // writeout the script.
        WriteRenderAppender writer = new WriteRenderAppender(pageContext);

        // if we wrote out the scopeId then we end it.
        if (_idScope != null) {
            writer.append("</div>");
        }

        writeFrameworkScript(writer);
        writeAfterBlocks(writer);
        localRelease();
        return EVAL_PAGE;
    }
163056
public int doEndTag() throws JspException
    {
        Tag parent = getParent();
        if (parent instanceof CheckBoxGroup)
            registerTagError(Bundle.getString("Tags_CheckBoxGroupChildError"), null);

        Object val = evaluateDataSource();
        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        String hiddenParamName = _state.name + OLDVALUE_SUFFIX;
        ServletRequest req = pageContext.getRequest();

        if (val instanceof String) {
            if (val != null && Boolean.valueOf(val.toString()).booleanValue())
                _state.checked = true;
            else
                _state.checked = false;
        }
        else if (val instanceof Boolean) {
            _state.checked = ((Boolean) val).booleanValue();
        }
        else {
            String oldCheckBoxValue = req.getParameter(hiddenParamName);
            if (oldCheckBoxValue != null) {
                _state.checked = new Boolean(oldCheckBoxValue).booleanValue();
            }
            else {
                _state.checked = evaluateDefaultValue();
            }
        }
        _state.disabled = isDisabled();

        //Create a hidden field to store the CheckBox oldValue
        String oldValue = req.getParameter(_state.name);
        WriteRenderAppender writer = new WriteRenderAppender(pageContext);

        // if the checkbox is disabled we need to not write out the hidden
        // field because it can cause the default state to change from
        // true to false.  Disabled check boxes do not postback.
        if (!_state.disabled) {
            _hiddenState.name = hiddenParamName;
            if (oldValue == null) {
                _hiddenState.value = "false";
            }
            else {
                _hiddenState.value = oldValue;
            }
            TagRenderingBase hiddenTag = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_HIDDEN_TAG, req);
            hiddenTag.doStartTag(writer, _hiddenState);
            hiddenTag.doEndTag(writer);
        }

        _state.type = INPUT_CHECKBOX;

        TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_BOOLEAN_TAG, req);
        br.doStartTag(writer, _state);

        if (!ref.isNull())
            write((String) ref.getRef());

        // Continue processing this page
        localRelease();
        return EVAL_PAGE;
    }
642628
@Override
    public int doEndTag() throws JspException {
        // produce a Document by parsing whatever the attributes tell us to use
        Object xmlText = this.xml;
        if (xmlText == null) {
            // if the attribute was specified, use the body as 'xml'
            if (bodyContent != null && bodyContent.getString() != null) {
                xmlText = bodyContent.getString().trim();
            } else {
                xmlText = "";
            }
        }
        if (xmlText instanceof String) {
            xmlText = new StringReader((String) xmlText);
        }
        if (!(xmlText instanceof Reader)) {
            throw new JspTagException(Resources.getMessage("PARSE_INVALID_SOURCE"));
        }
        InputSource source = XmlUtil.newInputSource(((Reader) xmlText), systemId);

        Document d;
        if (filter != null) {
            d = parseInputSourceWithFilter(source, filter);
        } else {
            d = parseInputSource(source);
        }

        // we've got a Document object; store it out as appropriate
        // (let any exclusivity or other constraints be enforced by TEI/TLV)
        if (var != null) {
            pageContext.setAttribute(var, d, scope);
        }
        if (varDom != null) {
            pageContext.setAttribute(varDom, d, scopeDom);
        }

        return EVAL_PAGE;
    }