EWA

[BUG] 修改 ItemBase OpenFrame 参数不全的脚本问题

2016-05-24

包: com.gdxsoft.easyweb.script.display.items.

类:ItemBase

方法: getXItemFrameHtml

参数指定 OpenFrame没有定义 CallMethod参数,这是无效的,会出现 EWA.UI.Dialog.@CallMethod的结果,因此判断并去除

代码段

/**
 * 获取对象的模板文件
 * 
 * @return
 * @throws Exception
 */
String getXItemFrameHtml() throws Exception {
    ...
    HashMap<String, HashMap<String, String>> addParas = this.createItemAddHtml();
    for (String key : addParas.keySet()) {
        ...
            String val = paras.get("---GDX-RST---").trim();
            if(val.indexOf("EWA.UI.Dialog.@CallMethod")>0){
                //参数指定 OpenFrame没有定义 CallMethod参数,这是无效的
            } else {
                sb.append(" " + val);
            }
        ...
    }

    MListStr a = Utils.getParameters(s1, "@");
    if (a.size() > 0) {
        String h1 = s1;
        for (int i = 0; i < _UserXItem.count(); i++) {
            // html参数模板 EwaConfig.Xml定义
            // <XItemParameter Name="Name" Html='name="@Name" id="@Name"'
            // IsJsShow="1">
            UserXItemValues _UserXItemValues = _UserXItem.getItem(i);
            for (int i0 = 0; i0 < _UserXItemValues.count(); i0++) {
                UserXItemValue uv = _UserXItemValues.getItem(i0);
                for (int i1 = 0; i1 < a.size(); i1++) {
                    String key = a.get(i1);
                    if (!uv.testName(key)) {
                        continue;
                    }
                    String v = uv.getItem(key);
                    if (v == null || v.trim().equals("")) {
                        continue;
                    }
                    h1 = h1.replace("@" + key, v);
                }
                if (h1.indexOf("@") < 0) {
                    break;
                }
            }

        }
        s1 = h1;
    }
    String tag = xItem.getName().trim().toLowerCase();

    if (!(tag.equalsIgnoreCase("user") || tag.equalsIgnoreCase("ewaconfigitem") || tag.equalsIgnoreCase("hidden")
            || tag.equalsIgnoreCase("button") || tag.equalsIgnoreCase("submit") || tag.equalsIgnoreCase("span"))) {
        if (tag.equals("select")) {
            String event = "EWA.F.FOS['" + this._HtmlClass.getSysParas().getFrameUnid() + "'].CheckValid(this);";
            sb.append(" onblur=\"" + event + "\"");

            if (this._UserXItem.testName("List") && this._UserXItem.getItem("List").count() > 0) {
                UserXItemValue listXItem = this._UserXItem.getItem("List").getItem(0);
                if (listXItem.testName("ListFilterType")) {
                    String ListFilterType = listXItem.getItem("ListFilterType");
                    String ListFilterField = listXItem.getItem("ListFilterField");
                    if (ListFilterType.trim().length() > 0) {
                        sb.append(" _ListFilterType=\"" + ListFilterType + "\"");
                        sb.append(" _ListFilterField=\"" + ListFilterField + "\"");
                    }
                }
            }
            // 从数据库显示列表信息

        } else {
            String event = "EWA.F.FOS['" + this._HtmlClass.getSysParas().getFrameUnid() + "'].CheckValid(this);";
            sb.append(" onkeyup=\"" + event + "\"");
            sb.append(" onmousedown=\"" + event + "\"");
        }
    }
    if (tag.equalsIgnoreCase("span")) {
        s1 = s1.replace("!!", sb.toString());

    } else {
        s1 = s1.replace("!!", sb.toString());
    }
    _UserXItem.setHtml(s1);
    // if (s1.indexOf("disabled") >= 0) {
    // int z = 1;
    // z++;
    // }
    return s1;
}