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);
}
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;
}
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);
}
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(" ");
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;
}
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 Cookie)");
html.addElement(a);
}
**/
html.output(out);
//
return (SKIP_BODY);
}
Aggregations