Search in sources :

Example 1 with UrlRecord

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

the class UIHeader method output.

@Override
public void output(HtmlWriter html) {
    if (this.leftBottom.size() > MAX_MENUS)
        throw new RuntimeException(String.format("底部菜单区最多只支持 %d 个菜单项", MAX_MENUS));
    html.println("<header role='header'>");
    if (advertisement != null) {
        html.println("<section role='advertisement'>");
        html.println(advertisement.toString());
        html.println("</section>");
    }
    html.println("<nav role='mainMenu'>");
    // 输出:左边
    html.println("<section role='leftMenu'>");
    if (leftMenus.size() > 0) {
        html.print("<ul>");
        int i = 0;
        for (UrlRecord menu : leftMenus) {
            html.print("<li>");
            if (i > 1)
                html.println("<span>→</span>");
            html.print("<a href=\"%s\">%s</a>", menu.getUrl(), menu.getName());
            i++;
            html.print("</li>");
        }
        html.print("</ul>");
        if (leftBottom.size() > 0) {
            html.println("<div role='headerButtons'>");
            for (UIBottom bottom : leftBottom) {
                bottom.output(html);
            }
            html.println("</div>");
        }
    }
    html.println("</section>");
    // 降序输出:右边
    html.println("<section role='rightMenu'>");
    if (rightMenus.size() > 0) {
        html.print("<ul>");
        int i = rightMenus.size() - 1;
        while (i > -1) {
            UrlRecord menu = rightMenus.get(i);
            html.print("<li>");
            html.print("<a href=\"%s\">%s</a>", menu.getUrl(), menu.getName());
            html.print("</li>");
            i--;
        }
        html.print("</ul>");
    }
    html.println("</section>");
    html.println("</nav>");
    html.println("</header>");
}
Also used : UrlRecord(cn.cerc.jpage.core.UrlRecord)

Example 2 with UrlRecord

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

the class UISheetUrl method output.

@Override
public void output(HtmlWriter html) {
    if (urls.size() == 0 && items.size() == 0)
        return;
    html.println("<section>");
    html.println("<div class=\"title\">%s</div>", this.getCaption());
    html.println("<div class=\"contents\">");
    for (UrlRecord url : urls) {
        html.print("<a href=\"%s\"", url.getUrl());
        if (url.getId() != null) {
            html.print(" id=\"%s\"", url.getId());
        }
        if (url.getTitle() != null) {
            html.print(" title=\"%s\"", url.getTitle());
        }
        if (url.getHintMsg() != null) {
            html.print(" onClick=\"return confirm('%s');\"", url.getHintMsg());
        }
        if (url.getTarget() != null) {
            html.print(" target=\"%s\"", url.getTarget());
        }
        html.println(">%s</a>", url.getName());
    }
    for (String key : items.keySet()) html.println("<a href=\"%s\">%s</a>", key, items.get(key));
    html.println("</div>");
    html.println("</section>");
}
Also used : UrlRecord(cn.cerc.jpage.core.UrlRecord)

Example 3 with UrlRecord

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

the class UISheetUrl method addUrl.

public UrlRecord addUrl() {
    UrlRecord url = new UrlRecord();
    urls.add(url);
    return url;
}
Also used : UrlRecord(cn.cerc.jpage.core.UrlRecord)

Example 4 with UrlRecord

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

the class OperaPanel method addMenu.

public UrlRecord addMenu(String caption, String url) {
    UrlRecord item = new UrlRecord(url, caption);
    addMenu(item);
    return item;
}
Also used : UrlRecord(cn.cerc.jpage.core.UrlRecord)

Example 5 with UrlRecord

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

the class UIPagePhone 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.printf("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>\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", this.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)

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