Search in sources :

Example 6 with HtmlCode

use of org.compiere.util.HtmlCode in project adempiere by adempiere.

the class ProductCategoryListTag method doStartTag.

/**
	 *  Start Tag
	 *  @return SKIP_BODY
	 * 	@throws JspException
	 */
public int doStartTag() throws JspException {
    Properties ctx = JSPEnv.getCtx((HttpServletRequest) pageContext.getRequest());
    int AD_Client_ID = Env.getAD_Client_ID(ctx);
    String name = "M_Product_Category_ID";
    option[] options = getCategories(AD_Client_ID);
    select sel = new select(name, options);
    sel.setID("ID_" + name);
    log.fine("AD_Client_ID=" + AD_Client_ID + ", #=" + options.length);
    //	Assemble
    HtmlCode html = new HtmlCode();
    html.addElement(sel);
    JspWriter out = pageContext.getOut();
    html.output(out);
    //
    return (SKIP_BODY);
}
Also used : HtmlCode(org.compiere.util.HtmlCode) org.apache.ecs.xhtml.select(org.apache.ecs.xhtml.select) Properties(java.util.Properties) JspWriter(javax.servlet.jsp.JspWriter) org.apache.ecs.xhtml.option(org.apache.ecs.xhtml.option)

Example 7 with HtmlCode

use of org.compiere.util.HtmlCode in project adempiere by adempiere.

the class WorkflowTag method doStartTag.

//	setActivityID
/**
	 *  Start Tag
	 *  @return SKIP_BODY
	 * 	@throws JspException
	 */
public int doStartTag() throws JspException {
    Properties ctx = JSPEnv.getCtx((HttpServletRequest) pageContext.getRequest());
    //	Activity
    int AD_WF_Activity_ID = 0;
    String info = null;
    try {
        info = (String) ExpressionUtil.evalNotNull("workflow", "activityID", m_activityID_el, String.class, this, pageContext);
        if (info != null && info.length() != 0)
            AD_WF_Activity_ID = Integer.parseInt(info);
    } catch (Exception e) {
        log.severe("doStartTag - Activity" + e);
    }
    MWFActivity act = new MWFActivity(ctx, AD_WF_Activity_ID, null);
    if (AD_WF_Activity_ID == 0 || act == null || act.get_ID() != AD_WF_Activity_ID) {
        log.severe("doStartTag - Activity Not found - " + m_activityID_el + " (" + info + ")");
        return (SKIP_BODY);
    }
    String name = null;
    if (act.isUserApproval())
        name = "IsApproved";
    else if (act.isUserManual())
        name = "IsConfirmed";
    else
        return (SKIP_BODY);
    //	YesNo
    option[] yesNoOptions = new option[3];
    yesNoOptions[0] = new option(" ");
    yesNoOptions[0].addElement(" ");
    yesNoOptions[0].setSelected(true);
    yesNoOptions[1] = new option("Y");
    yesNoOptions[1].addElement(Util.maskHTML(Msg.translate(ctx, "Yes")));
    yesNoOptions[2] = new option("N");
    yesNoOptions[2].addElement(Util.maskHTML(Msg.translate(ctx, "No")));
    select yesNoSelect = new select(name, yesNoOptions);
    yesNoSelect.setID("ID_" + name);
    yesNoSelect.setClass(C_MANDATORY);
    //
    String nameTrl = Msg.translate(ctx, name);
    //	Assemble
    HtmlCode html = new HtmlCode();
    html.addElement(new b(nameTrl));
    html.addElement(yesNoSelect);
    html.addElement(new br());
    JspWriter out = pageContext.getOut();
    html.output(out);
    //
    return (SKIP_BODY);
}
Also used : MWFActivity(org.compiere.wf.MWFActivity) org.apache.ecs.xhtml.br(org.apache.ecs.xhtml.br) HtmlCode(org.compiere.util.HtmlCode) org.apache.ecs.xhtml.b(org.apache.ecs.xhtml.b) org.apache.ecs.xhtml.select(org.apache.ecs.xhtml.select) Properties(java.util.Properties) JspWriter(javax.servlet.jsp.JspWriter) JspException(javax.servlet.jsp.JspException) org.apache.ecs.xhtml.option(org.apache.ecs.xhtml.option)

Example 8 with HtmlCode

use of org.compiere.util.HtmlCode in project adempiere by adempiere.

the class InfoLinkTag method doStartTag.

//	setOneLine
/**
	 *  Start Tag
	 *  @return SKIP_BODY
	 * 	@throws JspException
	 */
public int doStartTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    //	creates wsc/wu
    Properties ctx = JSPEnv.getCtx(request);
    WebSessionCtx wsc = WebSessionCtx.get(request);
    //
    HttpSession session = pageContext.getSession();
    WebUser wu = (WebUser) session.getAttribute(WebUser.NAME);
    if (wu != null && wu.isLoggedIn()) {
        if (ctx != null) {
            WebInfo info = (WebInfo) session.getAttribute(WebInfo.NAME);
            if (info == null || wu.getAD_User_ID() != info.getAD_User_ID()) {
                info = new WebInfo(ctx, wu);
                session.setAttribute(WebInfo.NAME, info);
            }
        }
        //
        //	log.fine("WebUser exists - " + wu);
        //
        JspWriter out = pageContext.getOut();
        HtmlCode html = new HtmlCode();
        //
        if (wu.isCustomer() || wu.isVendor())
            menuBPartner(html, wsc.wstore);
        if (wu.isSalesRep())
            menuSalesRep(html, wsc.wstore);
        if (wu.isEmployee() || wu.isSalesRep())
            menuUser(html, wu.isEmployee(), wsc.wstore);
        menuAll(html, wsc.wstore);
        //
        html.output(out);
    } else {
        if (CLogMgt.isLevelFiner())
            log.fine("No WebUser");
        if (session.getAttribute(WebInfo.NAME) == null)
            session.setAttribute(WebInfo.NAME, WebInfo.getGeneral());
    }
    return (SKIP_BODY);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) HtmlCode(org.compiere.util.HtmlCode) HttpSession(javax.servlet.http.HttpSession) WebUser(org.compiere.util.WebUser) Properties(java.util.Properties) WebSessionCtx(org.compiere.util.WebSessionCtx) JspWriter(javax.servlet.jsp.JspWriter) WebInfo(org.compiere.util.WebInfo)

Example 9 with HtmlCode

use of org.compiere.util.HtmlCode in project adempiere by adempiere.

the class LoginLinkTag method getLoginLink.

//	getWebUser
/**************************************************************************
	 * 	Get Login Link
	 * 	@param	serverContext server context
	 * 	@return link
	 */
private HtmlCode getLoginLink(String serverContext) {
    HtmlCode retValue = new HtmlCode();
    //	Login button
    input button = new input(input.TYPE_BUTTON, "Login", "Login");
    button.setOnClick("window.top.location.replace('./loginServlet');");
    retValue.addElement(button);
    /**	Link
		a a = new a("https://" + serverContext + "/login.jsp");
		a.setClass("menuMain");
		a.addElement("Login");
		retValue.addElement(a);
		**/
    retValue.addElement(" ");
    return retValue;
}
Also used : HtmlCode(org.compiere.util.HtmlCode) org.apache.ecs.xhtml.input(org.apache.ecs.xhtml.input)

Aggregations

HtmlCode (org.compiere.util.HtmlCode)9 JspWriter (javax.servlet.jsp.JspWriter)6 Properties (java.util.Properties)5 org.apache.ecs.xhtml.a (org.apache.ecs.xhtml.a)3 org.apache.ecs.xhtml.input (org.apache.ecs.xhtml.input)3 org.apache.ecs.xhtml.option (org.apache.ecs.xhtml.option)3 org.apache.ecs.xhtml.select (org.apache.ecs.xhtml.select)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 HttpSession (javax.servlet.http.HttpSession)2 org.apache.ecs.xhtml.br (org.apache.ecs.xhtml.br)2 WebUser (org.compiere.util.WebUser)2 JspException (javax.servlet.jsp.JspException)1 org.apache.ecs.xhtml.b (org.apache.ecs.xhtml.b)1 org.apache.ecs.xhtml.hr (org.apache.ecs.xhtml.hr)1 org.apache.ecs.xhtml.img (org.apache.ecs.xhtml.img)1 org.apache.ecs.xhtml.label (org.apache.ecs.xhtml.label)1 org.apache.ecs.xhtml.p (org.apache.ecs.xhtml.p)1 org.apache.ecs.xhtml.script (org.apache.ecs.xhtml.script)1 org.apache.ecs.xhtml.span (org.apache.ecs.xhtml.span)1 MLocation (org.compiere.model.MLocation)1