Search in sources :

Example 11 with UrlRecord

use of cn.cerc.jpage.core.UrlRecord in project summer-mis by cn-cerc.

the class StringField method format.

@Override
public String format(Object value) {
    if (!(value instanceof Record))
        return value.toString();
    Record ds = (Record) value;
    String data = getDefaultText(ds);
    if (this.isReadonly()) {
        if (buildUrl != null) {
            HtmlWriter html = new HtmlWriter();
            UrlRecord url = new UrlRecord();
            buildUrl.buildUrl(ds, url);
            if (!"".equals(url.getUrl())) {
                html.print("<a href=\"%s\"", url.getUrl());
                if (url.getTitle() != null) {
                    html.print(" title=\"%s\"", url.getTitle());
                }
                if (url.getTarget() != null) {
                    html.print(" target=\"%s\"", url.getTarget());
                }
                html.println(">%s</a>", data);
            } else
                html.println(data);
            return html.toString();
        } else
            return data;
    }
    if (!(this.getOwner() instanceof AbstractGridLine))
        return data;
    return getEditor().format(ds);
}
Also used : HtmlWriter(cn.cerc.jpage.core.HtmlWriter) Record(cn.cerc.jdb.core.Record) UrlRecord(cn.cerc.jpage.core.UrlRecord) UrlRecord(cn.cerc.jpage.core.UrlRecord) AbstractGridLine(cn.cerc.jpage.grid.lines.AbstractGridLine)

Example 12 with UrlRecord

use of cn.cerc.jpage.core.UrlRecord in project summer-mis by cn-cerc.

the class DoubleField method format.

@Override
public String format(Object value) {
    if (!(value instanceof Record))
        return value.toString();
    Record ds = (Record) value;
    if (this.isReadonly()) {
        if (buildUrl != null) {
            HtmlWriter html = new HtmlWriter();
            UrlRecord url = new UrlRecord();
            buildUrl.buildUrl(ds, url);
            if (!"".equals(url.getUrl())) {
                html.print("<a href=\"%s\"", url.getUrl());
                if (url.getTitle() != null) {
                    html.print(" title=\"%s\"", url.getTitle());
                }
                if (url.getTarget() != null) {
                    html.print(" target=\"%s\"", url.getTarget());
                }
                html.println(">%s</a>", getText(ds));
            } else
                html.println(getText(ds));
            return html.toString();
        } else
            return getText(ds);
    }
    if (!(this.getOwner() instanceof AbstractGridLine))
        return getText(ds);
    return getEditor().format(ds);
}
Also used : HtmlWriter(cn.cerc.jpage.core.HtmlWriter) Record(cn.cerc.jdb.core.Record) UrlRecord(cn.cerc.jpage.core.UrlRecord) UrlRecord(cn.cerc.jpage.core.UrlRecord) AbstractGridLine(cn.cerc.jpage.grid.lines.AbstractGridLine)

Example 13 with UrlRecord

use of cn.cerc.jpage.core.UrlRecord in project summer-mis by cn-cerc.

the class UIHeader method initHeader.

public void initHeader() {
    IForm form = ((AbstractJspPage) this.getOwner()).getForm();
    // 刷新
    if (this.pageTitle != null) {
        leftMenus.add(new UrlRecord("javascript:location.reload()", this.pageTitle));
    }
    if (leftMenus.size() > 2) {
        if (form.getClient().isPhone()) {
            UrlRecord first = leftMenus.get(0);
            UrlRecord last = leftMenus.get(leftMenus.size() - 1);
            leftMenus.clear();
            leftMenus.add(first);
            leftMenus.add(last);
        }
    }
    if (leftMenus.size() == 0) {
        leftMenus.add(new UrlRecord("/", "首页"));
        leftMenus.add(new UrlRecord("javascript:history.go(-1);", "刷新"));
    }
    // 兼容老的jsp文件使用
    form.getRequest().setAttribute("barMenus", leftMenus);
    form.getRequest().setAttribute("subMenus", rightMenus);
}
Also used : AbstractJspPage(cn.cerc.jmis.page.AbstractJspPage) IForm(cn.cerc.jbean.form.IForm) UrlRecord(cn.cerc.jpage.core.UrlRecord)

Example 14 with UrlRecord

use of cn.cerc.jpage.core.UrlRecord in project summer-mis by cn-cerc.

the class UIPageBill method execute.

@Override
public void execute() throws ServletException, IOException {
    HttpServletRequest request = getRequest();
    IForm form = this.getForm();
    CustomHandle sess = (CustomHandle) form.getHandle().getProperty(null);
    if (sess.logon()) {
        List<UrlRecord> rightMenus = getHeader().getRightMenus();
        RightMenus menus = Application.getBean("RightMenus", RightMenus.class);
        menus.setHandle(form.getHandle());
        for (IMenuBar item : menus.getItems()) item.enrollMenu(form, rightMenus);
    } else {
        getHeader().getHomePage().setSite(Application.getAppConfig().getFormWelcome());
    }
    // 系统通知消息
    Component content = this.getContent();
    if (form instanceof AbstractForm) {
        this.getHeader().initHeader();
        request.setAttribute(content.getId(), content);
        for (Component component : content.getComponents()) {
            request.setAttribute(component.getId(), component);
        }
    }
    // 开始输出
    PrintWriter out = getResponse().getWriter();
    out.println("<!DOCTYPE html>");
    out.println("<html>");
    out.println("<head>");
    out.printf("<title>%s</title>\n", this.getForm().getTitle());
    out.printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n");
    out.println("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=9; IE=8; IE=7;\"/>");
    out.printf("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0\"/>\n");
    out.print(this.getCssHtml());
    out.print(getScriptHtml());
    out.println("<script>");
    out.println("var Application = new TApplication();");
    out.printf("Application.device = '%s';\n", form.getClient().getDevice());
    out.printf("Application.bottom = '%s';\n", getFooter().getId());
    String msg = form.getParam("message", "");
    msg = msg == null ? "" : msg.replaceAll("\r\n", "<br/>");
    out.printf("Application.message = '%s';\n", msg);
    out.printf("Application.searchFormId = '%s';\n", this.searchWaitingId);
    out.println("$(document).ready(function() {");
    out.println("Application.init();");
    out.println("});");
    out.println("</script>");
    out.println("</head>");
    outBody(out);
    out.println("</html>");
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) IMenuBar(cn.cerc.jmis.page.IMenuBar) IForm(cn.cerc.jbean.form.IForm) UrlRecord(cn.cerc.jpage.core.UrlRecord) AbstractForm(cn.cerc.jmis.form.AbstractForm) CustomHandle(cn.cerc.jbean.core.CustomHandle) Component(cn.cerc.jpage.core.Component) RightMenus(cn.cerc.jui.parts.RightMenus) PrintWriter(java.io.PrintWriter)

Example 15 with UrlRecord

use of cn.cerc.jpage.core.UrlRecord in project summer-mis by cn-cerc.

the class UIPageView method execute.

@Override
public void execute() throws ServletException, IOException {
    HttpServletRequest request = getRequest();
    IForm form = this.getForm();
    CustomHandle sess = (CustomHandle) form.getHandle().getProperty(null);
    if (sess.logon()) {
        List<UrlRecord> rightMenus = getHeader().getRightMenus();
        RightMenus menus = Application.getBean("RightMenus", RightMenus.class);
        menus.setHandle(form.getHandle());
        for (IMenuBar item : menus.getItems()) item.enrollMenu(form, rightMenus);
    } else {
        getHeader().getHomePage().setSite(Application.getAppConfig().getFormWelcome());
    }
    // 系统通知消息
    Component content = this.getContent();
    if (form instanceof AbstractForm) {
        this.getHeader().initHeader();
        request.setAttribute(content.getId(), content);
        for (Component component : content.getComponents()) {
            request.setAttribute(component.getId(), component);
        }
    }
    // 开始输出
    PrintWriter out = getResponse().getWriter();
    out.println("<!DOCTYPE html>");
    out.println("<html>");
    out.println("<head>");
    out.printf("<title>%s</title>\n", this.getForm().getTitle());
    out.printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n");
    out.println("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=9; IE=8; IE=7;\"/>");
    out.printf("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0\"/>\n");
    out.print(this.getCssHtml());
    out.print(getScriptHtml());
    out.println("<script>");
    out.println("var Application = new TApplication();");
    out.printf("Application.device = '%s';\n", form.getClient().getDevice());
    out.printf("Application.bottom = '%s';\n", getFooter().getId());
    String msg = form.getParam("message", "");
    msg = msg == null ? "" : msg.replaceAll("\r\n", "<br/>");
    out.printf("Application.message = '%s';\n", msg);
    out.println("$(document).ready(function() {");
    out.println("Application.init();");
    out.println("});");
    out.println("</script>");
    out.println("</head>");
    outBody(out);
    out.println("</html>");
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) IMenuBar(cn.cerc.jmis.page.IMenuBar) IForm(cn.cerc.jbean.form.IForm) UrlRecord(cn.cerc.jpage.core.UrlRecord) AbstractForm(cn.cerc.jmis.form.AbstractForm) CustomHandle(cn.cerc.jbean.core.CustomHandle) Component(cn.cerc.jpage.core.Component) RightMenus(cn.cerc.jui.parts.RightMenus) PrintWriter(java.io.PrintWriter)

Aggregations

UrlRecord (cn.cerc.jpage.core.UrlRecord)17 IForm (cn.cerc.jbean.form.IForm)7 CustomHandle (cn.cerc.jbean.core.CustomHandle)6 AbstractForm (cn.cerc.jmis.form.AbstractForm)6 IMenuBar (cn.cerc.jmis.page.IMenuBar)6 Component (cn.cerc.jpage.core.Component)6 RightMenus (cn.cerc.jui.parts.RightMenus)6 HttpServletRequest (javax.servlet.http.HttpServletRequest)6 PrintWriter (java.io.PrintWriter)5 Record (cn.cerc.jdb.core.Record)3 HtmlWriter (cn.cerc.jpage.core.HtmlWriter)2 AbstractGridLine (cn.cerc.jpage.grid.lines.AbstractGridLine)2 OperaPages (cn.cerc.jpage.other.OperaPages)2 AbstractJspPage (cn.cerc.jmis.page.AbstractJspPage)1 BuildUrl (cn.cerc.jpage.other.BuildUrl)1 UIComponent (cn.cerc.jui.parts.UIComponent)1 UIImage (cn.cerc.jui.vcl.UIImage)1