Search in sources :

Example 6 with Element

use of org.apache.ecs.Element in project adempiere by adempiere.

the class WebDoc method createPopup.

//  create
/**
	 *  Create styled popup Document with Title
	 *  @param title header title and h1 
	 *  @return Document
	 */
public static WebDoc createPopup(String title) {
    WebDoc doc = create(title);
    doc.getHead().addElement(new script((Element) null, "/adempiere/js/window.js"));
    //doc.getHead().addElement(new script((Element)null, "/adempiere/js/Calendar-setup.js"));
    doc.getHead().addElement(new script((Element) null, "/adempiere/js/calendar.js"));
    doc.getHead().addElement(new script((Element) null, "/adempiere/js/table.js"));
    doc.getHead().addElement(new script((Element) null, "/adempiere/lang/calendar-en.js"));
    doc.getHead().addElement(new link("/adempiere/css/window.css", link.REL_STYLESHEET, link.TYPE_CSS));
    doc.getHead().addElement(new link("/adempiere/css/popup.css", link.REL_STYLESHEET, link.TYPE_CSS));
    doc.getHead().addElement(new link("/adempiere/css/table.css", link.REL_STYLESHEET, link.TYPE_CSS));
    doc.getHead().addElement(new link("/adempiere/css/calendar-blue.css", link.REL_STYLESHEET, link.TYPE_CSS));
    doc.setClasses("popupTable", "popupHeader");
    doc.getTable().setCellSpacing(0);
    return doc;
}
Also used : Element(org.apache.ecs.Element) org.apache.ecs.xhtml.link(org.apache.ecs.xhtml.link) org.apache.ecs.xhtml.script(org.apache.ecs.xhtml.script)

Example 7 with Element

use of org.apache.ecs.Element in project adempiere by adempiere.

the class WProcess method createParameterPage.

//  doPost
//Modified by Rob Klein 4/29/07
/**************************************************************************
	 * 	Create Parameter Page
	 * 	@param wsc web session context
	 *	@param AD_Menu_ID Menu
	 *	@return Page
	 */
private MobileDoc createParameterPage(MobileSessionCtx wsc, int processId, int windowID, int tableID, int recordID, int Type, String columnName, GridTab mTab) {
    MProcess process = null;
    if (Type == 0)
        process = MProcess.getFromMenu(wsc.ctx, processId);
    else
        process = MProcess.get(wsc.ctx, processId);
    //	need to check if Role can access
    if (process == null) {
        MobileDoc doc = MobileDoc.createWindow("Process Not Found");
        return doc;
    }
    //Modified by Rob Klein 4/29/07
    MobileDoc doc = MobileDoc.createWindow(process.getName());
    if (process.isWorkflow()) {
        //Modified by Rob Klein 7/01/07
        if (mTab == null) {
            doc = MobileDoc.createWindow("No Tab found");
            return doc;
        }
        //	Pop up Document Action (Workflow)
        if (columnName.toString().equals("DocAction")) {
            readReference();
            option[] Options = dynInit(windowID, tableID, recordID, columnName, mTab);
            fieldset center = new fieldset();
            WebField wField = new WebField(wsc, columnName, columnName, columnName, //	no display length
            17, 22, 22, false, // 	not r/o, ., not error, not dependent
            false, false, false, false, false, processId, 0, 0, 0, 0, null, null, null, null, null);
            if (process.getDescription() != null)
                center.addElement(new p(new i(process.getDescription())));
            if (process.getHelp() != null)
                center.addElement(new p(process.getHelp(), AlignType.LEFT));
            form myForm = new form("WProcess").setName("process" + process.getAD_Process_ID());
            myForm.setTarget("WProcess");
            myForm.setMethod("GET");
            //myForm.setOnSubmit("this.Submit.disabled=true;return true;");
            myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Process_ID", process.getAD_Process_ID()));
            myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Window_ID", windowID));
            myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Table_ID", tableID));
            myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Record_ID", recordID));
            table myTable = new table("0", "0", "5", "100%", null);
            myTable.setID("WProcessParameter");
            myTable.addElement(new tr().addElement(wField.getLabel(true)).addElement(createSelectField(columnName, Options)));
            // Reset
            String text = "Reset";
            if (wsc.ctx != null)
                text = Msg.getMsg(wsc.ctx, "Reset");
            input restbtn = new input(input.TYPE_RESET, text, "  " + text);
            restbtn.setID(text);
            restbtn.setClass("resetbtn");
            //	Submit
            text = "Submit";
            if (wsc.ctx != null)
                text = Msg.getMsg(wsc.ctx, "Submit");
            input submitbtn = new input(input.TYPE_SUBMIT, text, "  " + text);
            submitbtn.setID(text);
            submitbtn.setClass("submitbtn");
            myTable.addElement(new tr().addElement(new td(null, AlignType.RIGHT, AlignType.MIDDLE, false, restbtn)).addElement(new td(null, AlignType.LEFT, AlignType.MIDDLE, false, submitbtn)).addElement(new td(null, AlignType.RIGHT, AlignType.MIDDLE, false, null)));
            myForm.addElement(myTable);
            center.addElement(myForm);
        }
    //	DocAction
    } else {
        form myForm = new form().setName(process.getName());
        myForm.addAttribute("selected", "true");
        myForm.setClass("panel");
        if (process.getDescription() != null)
            myForm.addElement(new p(new i(process.getDescription())));
        if (process.getHelp() != null)
            myForm.addElement(new p(process.getHelp(), AlignType.LEFT));
        //
        myForm.setMethod("get");
        myForm.setAction(MobileEnv.getBaseDirectory("WProcess?AD_Process_ID=" + process.getAD_Process_ID()));
        myForm.setTarget("_self");
        //myForm.setOnSubmit("this.Submit.disabled=true;return true;");
        myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Process_ID", process.getAD_Process_ID()));
        myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Window_ID", windowID));
        myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Table_ID", tableID));
        myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Record_ID", recordID));
        fieldset fs = new fieldset();
        fs.setID("WProcessParameter");
        MProcessPara[] parameter = process.getParameters();
        for (int i = 0; i < parameter.length; i++) {
            MProcessPara para = parameter[i];
            WebField wField = new WebField(wsc, para.getColumnName(), para.getName(), para.getDescription(), //	no display length
            para.getAD_Reference_ID(), para.getFieldLength(), para.getFieldLength(), false, // 	not r/o, ., not error, not dependent
            false, para.isMandatory(), false, false, false, para.getAD_Process_ID(), 0, 0, 0, i, null, null, null, null, null);
            WebField wFieldforRange = null;
            if (para.isRange())
                wFieldforRange = new WebField(wsc, para.getColumnName(), para.getName(), para.getDescription(), //	no display length
                para.getAD_Reference_ID(), para.getFieldLength(), para.getFieldLength(), false, // 	not r/o, ., not error, not dependent
                false, para.isMandatory(), false, false, false, para.getAD_Process_ID(), 0, 0, 0, i + 1, null, null, null, null, null);
            Element toField = para.isRange() ? wFieldforRange.getField(para.getLookup(), para.getDefaultValue2()) : new td(MobileEnv.NBSP);
            div d = new div();
            d.setClass("row");
            //	Add to list
            fs.addElement(d.addElement(wField.getLabel(true)).addElement(wField.getField(para.getLookup(), para.getDefaultValue())).addElement(toField));
        }
        //	Submit
        String text = "Submit";
        if (wsc.ctx != null)
            text = Msg.getMsg(wsc.ctx, "Submit");
        a submitbtn = new a("#", text);
        submitbtn.setClass("whiteButton");
        submitbtn.addAttribute("type", "submit");
        submitbtn.setID(text);
        // submitbtn.setOnClick("popUp('WProcess','WPopup')");
        myForm.addElement(fs);
        myForm.addElement(submitbtn);
        doc.getBody().addElement(myForm);
    }
    return doc;
}
Also used : MPInstancePara(org.compiere.model.MPInstancePara) org.apache.ecs.xhtml.a(org.apache.ecs.xhtml.a) MProcessPara(org.compiere.model.MProcessPara) MProcess(org.compiere.model.MProcess) Element(org.apache.ecs.Element) org.apache.ecs.xhtml.fieldset(org.apache.ecs.xhtml.fieldset) org.apache.ecs.xhtml.i(org.apache.ecs.xhtml.i) org.apache.ecs.xhtml.li(org.apache.ecs.xhtml.li) MProcessPara(org.compiere.model.MProcessPara) org.apache.ecs.xhtml.p(org.apache.ecs.xhtml.p) Timestamp(java.sql.Timestamp) org.apache.ecs.xhtml.td(org.apache.ecs.xhtml.td) org.apache.ecs.xhtml.div(org.apache.ecs.xhtml.div) org.apache.ecs.xhtml.input(org.apache.ecs.xhtml.input) org.apache.ecs.xhtml.form(org.apache.ecs.xhtml.form) org.apache.ecs.xhtml.table(org.apache.ecs.xhtml.table) org.apache.ecs.xhtml.tr(org.apache.ecs.xhtml.tr) org.apache.ecs.xhtml.option(org.apache.ecs.xhtml.option)

Example 8 with Element

use of org.apache.ecs.Element in project adempiere by adempiere.

the class WLogin method createFirstPage.

//  checkLogin
/**************************************************************************
	 *  First Login Page
	 *  @param cProp Login Cookie information for defaults
	 *  @param request request
	 *  @param errorMessage error message
	 *  @return WDoc page
	 */
private MobileDoc createFirstPage(Properties cProp, HttpServletRequest request, String errorMessage) {
    log.info(" - " + errorMessage);
    String AD_Language = (cProp.getProperty(Env.LANGUAGE, Language.getAD_Language(request.getLocale())));
    //
    String windowTitle = Msg.getMsg(AD_Language, "Login");
    String usrText = Msg.getMsg(AD_Language, "User");
    String pwdText = Msg.getMsg(AD_Language, "Password");
    String lngText = Msg.translate(AD_Language, "AD_Language");
    //	Form - post to same URL
    String action = request.getRequestURI();
    form myForm = null;
    myForm = new form(action).setName("Login1");
    myForm.setID(windowTitle);
    myForm.setTitle(windowTitle);
    myForm.addAttribute("selected", "true");
    myForm.setClass("panel");
    myForm.setMethod("post");
    myForm.addAttribute("autocomplete", "off");
    fieldset fs = new fieldset();
    div div1 = new div();
    div1.setClass("row");
    //	Username
    String userData = cProp.getProperty(P_USERNAME, "");
    label usrLabel = new label().setFor(P_USERNAME + "F").addElement(usrText);
    usrLabel.setID(P_USERNAME + "L");
    div1.addElement(usrLabel);
    input usr = new input(input.TYPE_TEXT, P_USERNAME, userData).setSize(20).setMaxlength(30);
    usr.setID(P_USERNAME + "F");
    div1.addElement(usr);
    fs.addElement(div1);
    div1 = new div();
    div1.setClass("row");
    //  Password
    String pwdData = cProp.getProperty(P_PASSWORD, "");
    label pwdLabel = new label().setFor(P_PASSWORD + "F").addElement(pwdText);
    pwdLabel.setID(P_PASSWORD + "L");
    div1.addElement(pwdLabel);
    input pwd = new input(input.TYPE_PASSWORD, P_PASSWORD, pwdData).setSize(20).setMaxlength(30);
    pwd.setID(P_PASSWORD + "F");
    div1.addElement(pwd);
    fs.addElement(div1);
    div1 = new div();
    div1.setClass("row");
    //	Language Pick
    label langLabel = new label().setFor(Env.LANGUAGE + "F").addElement(lngText);
    langLabel.setID(Env.LANGUAGE + "L");
    div1.addElement(langLabel);
    option[] options = new option[Language.getLanguageCount()];
    for (int i = 0; i < Language.getLanguageCount(); i++) {
        Language language = Language.getLanguage(i);
        options[i] = new option(language.getAD_Language()).addElement(Util.maskHTML(language.getName()));
        if (language.getAD_Language().equals(AD_Language))
            options[i].setSelected(true);
        else
            options[i].setSelected(false);
    }
    div1.addElement(new select(Env.LANGUAGE, options).setID(Env.LANGUAGE + "F"));
    fs.addElement(div1);
    div1 = new div();
    div1.setClass("row");
    //  ErrorMessage
    if (errorMessage != null && errorMessage.length() > 0) {
        div1 = new div();
        div1.setClass("row");
        //  color, size
        div1.addElement(new font(HtmlColor.red, 4).addElement(new b(errorMessage)));
        fs.addElement(div1);
    }
    myForm.addElement(fs);
    //<a class="whiteButton" type="submit" href="#">Login</a>
    //  Finish
    a button = new a("#", windowTitle);
    button.addAttribute("type", "submit");
    button.setClass("whiteButton");
    //
    myForm.addElement(button);
    //  Document
    MobileDoc doc = MobileDoc.createWindow(windowTitle);
    div div = new div();
    div.setClass("toolbar");
    h1 header = new h1();
    header.setID("pageTitle");
    div.addElement(header);
    a anchor = new a();
    anchor.setID("backButton");
    anchor.setClass("button");
    div.addElement(anchor);
    doc.getBody().addElement(myForm).addElement(div).setTitle(windowTitle);
    doc.getHead().addElement(new script((Element) null, MobileEnv.getBaseDirectory("/js/login.js")));
    return doc;
}
Also used : org.apache.ecs.xhtml.a(org.apache.ecs.xhtml.a) org.apache.ecs.xhtml.meta(org.apache.ecs.xhtml.meta) org.apache.ecs.xhtml.b(org.apache.ecs.xhtml.b) org.apache.ecs.xhtml.select(org.apache.ecs.xhtml.select) Element(org.apache.ecs.Element) org.apache.ecs.xhtml.fieldset(org.apache.ecs.xhtml.fieldset) org.apache.ecs.xhtml.h1(org.apache.ecs.xhtml.h1) org.apache.ecs.xhtml.label(org.apache.ecs.xhtml.label) org.apache.ecs.xhtml.script(org.apache.ecs.xhtml.script) org.apache.ecs.xhtml.div(org.apache.ecs.xhtml.div) org.apache.ecs.xhtml.input(org.apache.ecs.xhtml.input) org.apache.ecs.xhtml.form(org.apache.ecs.xhtml.form) Language(org.compiere.util.Language) org.apache.ecs.xhtml.option(org.apache.ecs.xhtml.option) org.apache.ecs.xhtml.font(org.apache.ecs.xhtml.font)

Aggregations

Element (org.apache.ecs.Element)8 org.apache.ecs.xhtml.script (org.apache.ecs.xhtml.script)7 org.apache.ecs.xhtml.link (org.apache.ecs.xhtml.link)6 org.apache.ecs.xhtml.a (org.apache.ecs.xhtml.a)4 org.apache.ecs.xhtml.meta (org.apache.ecs.xhtml.meta)4 org.apache.ecs.xhtml.input (org.apache.ecs.xhtml.input)3 org.apache.ecs.xhtml.table (org.apache.ecs.xhtml.table)3 org.apache.ecs.xhtml.td (org.apache.ecs.xhtml.td)3 org.apache.ecs.xhtml.tr (org.apache.ecs.xhtml.tr)3 org.apache.ecs.xhtml.div (org.apache.ecs.xhtml.div)2 org.apache.ecs.xhtml.fieldset (org.apache.ecs.xhtml.fieldset)2 org.apache.ecs.xhtml.form (org.apache.ecs.xhtml.form)2 org.apache.ecs.xhtml.h1 (org.apache.ecs.xhtml.h1)2 org.apache.ecs.xhtml.option (org.apache.ecs.xhtml.option)2 Timestamp (java.sql.Timestamp)1 Enumeration (java.util.Enumeration)1 org.apache.ecs.xhtml.b (org.apache.ecs.xhtml.b)1 org.apache.ecs.xhtml.base (org.apache.ecs.xhtml.base)1 org.apache.ecs.xhtml.body (org.apache.ecs.xhtml.body)1 org.apache.ecs.xhtml.font (org.apache.ecs.xhtml.font)1