Search in sources :

Example 1 with HtmlCode

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

the class CheckOutLinkTag method doStartTag.

//	setOneLine
/**
	 *  Start Tag
	 *  @return SKIP_BODY
	 * 	@throws JspException
	 */
public int doStartTag() throws JspException {
    HttpSession session = pageContext.getSession();
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    WebBasket wb = (WebBasket) session.getAttribute(WebBasket.NAME);
    //	log.fine("WebBasket=" + wb);
    if (wb != null && wb.getLineCount() > 0) {
        log.fine("WebBasket exists");
        //
        JspWriter out = pageContext.getOut();
        HtmlCode html = new HtmlCode();
        //
        if (!m_oneLine)
            html.addElement(new hr("90%", "left"));
        //
        img img = new img("basket.gif");
        img.setBorder(0);
        a a = new a("basket.jsp");
        a.setClass("menuMain");
        if (m_oneLine) {
            a.addElement(img);
            a.addElement("Basket");
            html.addElement(a);
            html.addElement(" - ");
        } else {
            a.addElement("Basket");
            a.addElement(img);
            html.addElement(a);
            //	List Content
            p p = new p();
            p.setClass("Cbasket");
            ArrayList<WebBasketLine> lines = wb.getLines();
            for (int i = 0; i < lines.size(); i++) {
                p.addElement("<br>");
                Object line = lines.get(i);
                p.addElement(line.toString());
            }
            p.addElement("<br><br>");
            html.addElement(p);
        //	html.addElement(new br());
        }
        //
        img = new img("checkout.gif");
        img.setBorder(0);
        String url = CheckOutServlet.NAME;
        if (!request.isSecure())
            url = "./" + CheckOutServlet.NAME;
        a = new a(url);
        a.setClass("menuMain");
        a.addElement("Create Order");
        a.addElement(img);
        html.addElement(a);
        //
        html.output(out);
    }
    //	web basket
    return (SKIP_BODY);
}
Also used : HtmlCode(org.compiere.util.HtmlCode) org.apache.ecs.xhtml.a(org.apache.ecs.xhtml.a) org.apache.ecs.xhtml.img(org.apache.ecs.xhtml.img) HttpSession(javax.servlet.http.HttpSession) org.apache.ecs.xhtml.hr(org.apache.ecs.xhtml.hr) JspWriter(javax.servlet.jsp.JspWriter) HttpServletRequest(javax.servlet.http.HttpServletRequest) org.apache.ecs.xhtml.p(org.apache.ecs.xhtml.p)

Example 2 with HtmlCode

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

the class MobileUtil method getForward.

//  getClearFrame
/**
	 * 	Return a link and script with new location.
	 * 	@param url forward url
	 * 	@param delaySec delay in seconds (default 3)
	 * 	@return html
	 */
public static HtmlCode getForward(String url, int delaySec) {
    if (delaySec <= 0)
        delaySec = 3;
    HtmlCode retValue = new HtmlCode();
    //	Link
    a a = new a(url);
    a.addElement(url);
    retValue.addElement(a);
    //	Java Script	- document.location - 
    script script = new script("setTimeout(\"window.top.location.replace('" + url + "')\"," + (delaySec + 1000) + ");");
    retValue.addElement(script);
    //
    return retValue;
}
Also used : HtmlCode(org.compiere.util.HtmlCode) org.apache.ecs.xhtml.a(org.apache.ecs.xhtml.a) org.apache.ecs.xhtml.script(org.apache.ecs.xhtml.script)

Example 3 with HtmlCode

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

the class LocationTag method doStartTag.

/**
	 *  Start Tag
	 *  @return SKIP_BODY
	 * 	@throws JspException
	 */
public int doStartTag() throws JspException {
    Properties ctx = JSPEnv.getCtx((HttpServletRequest) pageContext.getRequest());
    MLocation loc = new MLocation(ctx, 0, null);
    HtmlCode html = new HtmlCode();
    int C_Country_ID = getCountryID(loc);
    int C_Region_ID = getRegionID(loc);
    option[] countries = getCountries(loc, C_Country_ID);
    //		if (m_country != null) m_country.DisplaySequence;
    String name = null;
    label lbl = null;
    input field = null;
    select sel = null;
    //	City	***********************************************************
    name = "City";
    String city = (String) ExpressionUtil.evalNotNull("location", "city", m_city_el, String.class, this, pageContext);
    lbl = new label();
    lbl.setFor(name);
    lbl.setID("LBL_" + name);
    lbl.addElement(Msg.translate(ctx, name));
    html.addElement(lbl);
    field = new input(input.TYPE_TEXT, name, city);
    field.setSize(40).setMaxlength(60).setID("ID_" + name);
    field.setClass(C_MANDATORY);
    html.addElement(field);
    html.addElement(new br());
    //	Postal	***********************************************************
    name = "Postal";
    String postal = (String) ExpressionUtil.evalNotNull("location", "postal", m_postal_el, String.class, this, pageContext);
    lbl = new label();
    lbl.setFor(name);
    lbl.setID("LBL_" + name);
    lbl.addElement(Msg.translate(ctx, name));
    html.addElement(lbl);
    field = new input(input.TYPE_TEXT, name, postal);
    field.setSize(10).setMaxlength(10).setID("ID_" + name);
    field.setClass(C_MANDATORY);
    html.addElement(field);
    html.addElement(new br());
    //	Region		*******************************************************
    name = "C_Region_ID";
    lbl = new label();
    lbl.setFor(name);
    lbl.setID("LBL_" + name);
    String regionName = (String) ExpressionUtil.evalNotNull("location", "regionName", m_regionName_el, String.class, this, pageContext);
    field = new input(input.TYPE_TEXT, "RegionName", regionName);
    field.setSize(40).setMaxlength(60).setID("ID_RegionName");
    if (m_country != null && m_country.isHasRegion()) {
        sel = new select(name, getRegions(loc, C_Country_ID, C_Region_ID));
        sel.setID("ID_" + name);
        lbl.addElement(m_country.getRegionName());
        html.addElement(lbl);
        html.addElement(sel);
        html.addElement(new span(" - "));
        html.addElement(field);
    } else {
        lbl.addElement(Msg.translate(ctx, name));
        html.addElement(lbl);
        html.addElement(field);
    }
    html.addElement(new br());
    //	Country		*******************************************************
    name = "C_Country_ID";
    lbl = new label();
    lbl.setFor(name);
    lbl.setID("LBL_" + name);
    lbl.addElement(Msg.translate(ctx, name));
    html.addElement(lbl);
    sel = new select(name, countries);
    sel.setID("ID_" + name);
    sel.setClass(C_MANDATORY);
    sel.setOnChange("changeCountry('ID_" + name + "');");
    html.addElement(sel);
    html.addElement(new br());
    log.fine("C_Country_ID=" + C_Country_ID + ", C_Region_ID=" + C_Region_ID + ", RegionName=" + regionName + ", City=" + city + ", Postal=" + postal);
    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) org.apache.ecs.xhtml.label(org.apache.ecs.xhtml.label) Properties(java.util.Properties) JspWriter(javax.servlet.jsp.JspWriter) org.apache.ecs.xhtml.br(org.apache.ecs.xhtml.br) org.apache.ecs.xhtml.input(org.apache.ecs.xhtml.input) MLocation(org.compiere.model.MLocation) org.apache.ecs.xhtml.option(org.apache.ecs.xhtml.option) org.apache.ecs.xhtml.span(org.apache.ecs.xhtml.span)

Example 4 with HtmlCode

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

the class LoginLinkTag method getWelcomeLink.

//	getLoginLink
/**
	 * 	Get Welcome Link
	 * 	@param	serverContext server Context
	 * 	@param wu web user
	 * 	@return link
	 */
private HtmlCode getWelcomeLink(String serverContext, WebUser wu) {
    HtmlCode retValue = new HtmlCode();
    //
    a a = new a("./login.jsp");
    a.setClass("menuMain");
    String msg = "Welcome " + wu.getName();
    a.addElement(msg);
    retValue.addElement(a);
    //
    retValue.addElement(" &nbsp; ");
    if (wu.isLoggedIn()) {
        //	Verify
        if (!wu.isEMailVerified()) {
            input button = new input(input.TYPE_BUTTON, "Verify", "Verify EMail");
            button.setOnClick("window.top.location.replace('emailVerify.jsp');");
            retValue.addElement(button);
            retValue.addElement(" ");
        }
        //	Update
        input button = new input(input.TYPE_BUTTON, "Update", "Update User Info");
        button.setOnClick("window.top.location.replace('update.jsp');");
        retValue.addElement(button);
        retValue.addElement(" ");
        //	Logout
        button = new input(input.TYPE_BUTTON, "Logout", "Logout");
        button.setOnClick("window.top.location.replace('loginServlet?mode=logout');");
        retValue.addElement(button);
    /** Link
			a = new a ("loginServlet?mode=logout");
			a.setClass ("menuMain");
			a.addElement ("Logout");
			retValue.addElement (a);
			**/
    } else {
        input button = new input(input.TYPE_BUTTON, "Login", "Login");
        button.setOnClick("window.top.location.replace('./login.jsp');");
        retValue.addElement(button);
    }
    retValue.addElement(" ");
    //
    return retValue;
}
Also used : HtmlCode(org.compiere.util.HtmlCode) org.apache.ecs.xhtml.a(org.apache.ecs.xhtml.a) org.apache.ecs.xhtml.input(org.apache.ecs.xhtml.input)

Example 5 with HtmlCode

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

the class LoginLinkTag method doStartTag.

/**
	 *  Start Tag
	 *  @return SKIP_BODY
	 * 	@throws JspException
	 */
public int doStartTag() throws JspException {
    Properties ctx = JSPEnv.getCtx((HttpServletRequest) pageContext.getRequest());
    //
    WebUser wu = getWebUser(ctx);
    if (wu == null)
        pageContext.getSession().removeAttribute(WebUser.NAME);
    else
        pageContext.getSession().setAttribute(WebUser.NAME, wu);
    //
    String serverContext = ctx.getProperty(WebSessionCtx.CTX_SERVER_CONTEXT);
    //	log.fine("doStartTag - ServerContext=" + serverContext);
    HtmlCode html = null;
    if (wu != null && wu.isValid())
        html = getWelcomeLink(serverContext, wu);
    else
        html = getLoginLink(serverContext);
    //
    JspWriter out = pageContext.getOut();
    /**
		//	Delete Cookie Call
		if (cookieUser != null && !cookieUser.equals(" "))
		{
			log.fine("- Cookie=" + cookieUser);
			html.addElement(" ");
			a a = new a("loginServlet?mode=deleteCookie");
			a.setClass("menuDetail");
			a.addElement("(Delete&nbsp;Cookie)");
			html.addElement(a);
		}
		**/
    html.output(out);
    //
    return (SKIP_BODY);
}
Also used : HtmlCode(org.compiere.util.HtmlCode) WebUser(org.compiere.util.WebUser) Properties(java.util.Properties) JspWriter(javax.servlet.jsp.JspWriter)

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