public String getHtmlCode(DOIModel aModel) { if (isUsingTemplate) { return super.getHtmlCode(aModel); } DOFormModel property = (DOFormModel) aModel; String areaConfig = property.getInputConfig(); int width = 0; int height = 0; if (areaConfig != null && !areaConfig.equals("")) { String[] configs = areaConfig.split(";"); if (configs != null && configs.length == 2) { if (Integer.parseInt(configs[0]) != 0) { width = Integer.parseInt(configs[0]); } if (Integer.parseInt(configs[1]) != 0) { height = Integer.parseInt(configs[1]); } } } if (property.getValue() != null) { StringBuffer aPath = StringUtil.getAttachMentFile(property.getValue()); StringBuffer buffer = new StringBuffer(); buffer.append("<a class='exedo_link' href='"); buffer.append(aPath).append("'>"); // //////////对picture类型的特殊处理 if (isPic(property.getValue()) && (property.getValue().indexOf(",") == -1)) { buffer.append("<img src='").append(aPath); if (DOGlobals.getInstance().getServletContext().getRequest().getSession() != null) { buffer .append(";jsessionid=") .append( DOGlobals.getInstance().getServletContext().getRequest().getSession().getId()); } buffer.append("' border='0'"); if (width != 0) { buffer.append(" width='").append(width).append("' "); } if (height != 0) { buffer.append(" height='").append(height).append("' "); } buffer.append(">"); } else { buffer.append(property.getValue()); } buffer.append("</a>"); return buffer.toString(); } return " "; }
/** * 获取动态列表形式的Select Form * * @param property TODO * @param db * @return */ String getPopupForm(DOFormModel fm) { /** 可变动态下拉列表, 根据连接的FORMMODEL,一般静态staticlist 确定使用的服务 */ boolean isDyn = false; if (fm.getLinkForms() != null && !fm.getLinkForms().isEmpty() && fm.getInputConfig() != null) { isDyn = true; } if (fm.getLinkService() == null && !isDyn) { return " "; } StringBuffer buffer = new StringBuffer(); String theValue = fm.getValue(); BOInstance data = null; if (fm.getL10n().equals("连接内容")) { System.out.println("isDyn:::::::::::" + isDyn); System.out.println("连接内容:::::::::::" + fm.getLinkForms()); System.out.println("fm.getInputConfig():::::::::::" + fm.getInputConfig()); } if (theValue != null && !"".equals(theValue.trim())) { DOBO corrBO = fm.getLinkBO(); if (corrBO == null && fm.getLinkService() != null) { corrBO = fm.getLinkService().getBo(); } /** 可变动态下拉列表, 根据连接的FORMMODEL,一般静态staticlist 确定使用的服务 */ if (isDyn) { DOFormModel linkFm = (DOFormModel) fm.getLinkForms().get(0); String theLinkValue = fm.getData().getValue(linkFm.getColName()); if (theLinkValue != null) { List list = StringUtil.getStaticList(fm.getInputConfig()); for (Iterator it = list.iterator(); it.hasNext(); ) { String[] halfs = (String[]) it.next(); if ((theLinkValue != null && theLinkValue.equals(halfs[0]))) { DOService theCorrService = DOService.getService(halfs[1]); if (theCorrService != null) { corrBO = theCorrService.getBo(); } break; } } } data = DOValueResultList.getAInstance(null, corrBO, theValue); } else { data = DOValueResultList.getAInstance(fm, corrBO, theValue); } } // if (default_data && data == null && fm.getLinkService() != null) { // data = fm.getLinkService().getBo().getCorrInstance(); // if (data != null) { // theValue = data.getUid(); // } // } buffer .append(" <input type='hidden' class='resultlistpopup' name='") .append(fm.getColName()) .append("' id='") .append(fm.getFullColID()) .append("' serviceName='") .append(fm.getLinkService().getName()) .append("' "); if (theValue != null) { buffer.append(" value='").append(theValue).append("'"); } buffer.append(this.appendValidateConfig(fm)); buffer.append("/>"); buffer .append( "<input type='text' style='border:#B3B3B3 1px solid;margin-top:1px' onchange=\"if(this.value==''){this.previousSibling.value='';}\"'") .append( " onclick=\"this.style.borderColor='#406B9B'\" onmouseover=\"this.style.borderColor='#99E300'\" onmouseout=\"this.style.borderColor='#A1BCA3'\" name='") .append(fm.getFullColID()) .append("_show' id='") .append(fm.getFullColID()) .append("_show' class='") .append(fm.getFullColID()) .append("_show' "); buffer.append(getDecoration(fm)); if (data != null) { buffer.append(" value='").append(data.getName()).append("'"); } // else{ // buffer.append(" value='").append(fm.getL10n()) // .append("'"); // } if (data != null) { buffer.append(" title='").append(data.getName()).append("'"); } else { buffer.append(" title='").append(fm.getL10n()).append("'"); } if (isReadOnly(fm)) { buffer.append(" readonly='readonly' "); } buffer.append(" size='").append(getInputSize(fm)).append("' "); /** 可变动态下拉列表, 根据连接的FORMMODEL,一般静态staticlist 确定使用的服务 */ if (isDyn) { DOFormModel linkFm = (DOFormModel) fm.getLinkForms().get(0); buffer .append("linkformid='") .append(linkFm.getFullColID()) .append("' inputconfig='") .append(fm.getInputConfig()) .append("' "); } buffer.append("/>"); // 若有连接面板,则可弹出面板 if (fm.getLinkPaneModel() != null) { // 下拉列表 buffer .append( "<IMG style='CURSOR: pointer;padding-bottom:2px;margin-left:-41px;' onclick=\"invokePopup(this") .append(",'") .append(fm.getTargetForms()) .append("','"); buffer.append(fm.getLinkService().getBo().getValueCol()).append("',1,").append(max_pagesize); if (fm.getInputConstraint() != null) { buffer.append(",'").append(fm.getInputConstraint()).append("'"); } buffer .append(")\" src='") .append(DOGlobals.PRE_FULL_FOLDER) .append("images/darraw.gif' align=absMiddle "); buffer.append("/>"); // 连接面板 buffer .append("<IMG style='CURSOR: pointer;padding-bottom:2px;margin-left:0px;' id=\"listpm_") .append(fm.getFullColID()) .append("\""); buffer .append(")\" src='") .append(DOGlobals.PRE_FULL_FOLDER) .append("images/darraw2.gif' align=absMiddle "); buffer.append("/>"); } else { buffer .append( "<IMG style='CURSOR: pointer;padding-bottom:2px;margin-left:-21px;' onclick=\"invokePopup(this") .append(",'") .append(fm.getTargetForms()) .append("','"); buffer.append(fm.getLinkService().getBo().getValueCol()).append("',1,").append(max_pagesize); if (fm.getInputConstraint() != null) { buffer.append(",'").append(fm.getInputConstraint()).append("'"); } buffer .append(")\" src='") .append(DOGlobals.PRE_FULL_FOLDER) .append("images/darraw.gif' align=absMiddle "); buffer.append("/>"); } if (fm.getNote() != null && !"".equals(fm.getNote())) { buffer.append(fm.getNote()); } if (fm.isNotNull()) { buffer.append(" <font color='red'>*</font>"); } if (fm.getOnChangeJs() != null && !"".equals(fm.getOnChangeJs())) { buffer.append("<script>"); buffer .append("if($.browser.mozilla) $('#") .append(fm.getFullColID()) .append("')[0].addEventListener('DOMAttrModified',function(){") .append(fm.getOnChangeJs()) .append("},false);"); buffer.append("</script>"); } if (fm.getLinkPaneModel() != null) { buffer.append("<script>"); buffer.append("$('#listpm_").append(fm.getFullColID()).append("').bind('click',function(){"); // 点击执行(确认js),返回true,继续执行弹出面板,否则取消 if (fm.getEchoJs() != null && !"".equals(fm.getEchoJs().trim())) { buffer.append("if(!").append(fm.getEchoJs()).append("){"); buffer.append("return false;"); buffer.append("}"); } buffer.append("loadPml({"); if (fm.getLinkPaneModel().getLinkType() == 5) { buffer .append("'pml':'") .append(fm.getLinkPaneModel().getResource().getResourcePath()) .append("'"); } else { buffer.append("'pml':'").append(fm.getLinkPaneModel().getName()).append("'"); if (fm.getLinkPaneModel().getPaneWidth() != null) { buffer.append(",'pmlWidth':'").append(fm.getLinkPaneModel().getPaneWidth()).append("'"); } if (fm.getLinkPaneModel().getPaneHeight() != null) { buffer.append(",'pmlHeight':'").append(fm.getLinkPaneModel().getPaneHeight()).append("'"); } } if (fm.getLinkPaneModel().getTitle() != null) { buffer.append(",'title':'").append(fm.getLinkPaneModel().getTitle()).append("'"); } if (fm.getGridModel() != null) { buffer.append(",'formName':'a").append(fm.getGridModel().getObjUid()).append("'"); } if (fm.getTargetPaneModel() != null) { buffer.append(",'target':'").append(fm.getTargetPaneModel().getName()).append("'"); } buffer.append("});"); buffer.append("});"); buffer.append("</script>"); } return buffer.toString(); }
public String getHtmlCode(DOIModel iModel) { DOFormModel property = (DOFormModel) iModel; StringBuffer buffer = new StringBuffer(); if (property.getLinkService() != null) { for (Iterator it = property.getLinkService().invokeSelect().iterator(); it.hasNext(); ) { BOInstance instance = (BOInstance) it.next(); buffer.append("<input name=\"").append(property.getFullColName()); buffer.append("\" value=\"").append(instance.getUid()); buffer.append("\" type=\"checkbox\""); buffer.append(getDecoration(property)); if (DOStaticList.isChecked(instance.getUid(), property.getValue())) { buffer.append(" checked "); } if (isReadOnly(property)) { buffer.append(" DISABLED "); } buffer.append("/>"); buffer.append(instance.getThisLink()); // buffer.append(instance.getName()); } } else if (property.getInputConfig() != null) { List list = StringUtil.getStaticList(property.getInputConfig()); for (Iterator it = list.iterator(); it.hasNext(); ) { String[] half = (String[]) it.next(); if (!half[1].contains("其他")) { buffer.append("<input name=\"").append(property.getFullColName()); buffer.append("\" value=\"").append(half[0]); buffer.append("\" type=\"checkbox\""); buffer.append(getDecoration(property)); if (isReadOnly(property)) { buffer.append(" onclick='return false;' "); buffer.append(" DISABLED "); } if (DOStaticList.isChecked(half[0], property.getValue())) { buffer.append(" checked "); } // if (isReadOnly(property)) { // buffer.append(" disable "); // } buffer.append("/>"); buffer.append(half[1]); } else { buffer.append("<input name=\"").append(property.getFullColName()); buffer.append("\" value=\"").append(half[0]); buffer.append("\" type=\"checkbox\""); buffer.append(getDecoration(property)); if (isReadOnly(property)) { buffer.append(" onclick='return false;' "); buffer.append(" DISABLED "); } if (DOStaticList.isChecked(half[0], property.getValue())) { buffer.append(" checked "); } // if (isReadOnly(property)) { // buffer.append(" disable "); // } buffer.append("/>"); buffer.append(half[1]); if (isReadOnly(property)) { if (DOStaticList.isChecked(half[0], property.getValue())) { String[] strs = property.getValue().split(";"); buffer.append( "<span style='text-decoration:underline'>" + strs[strs.length - 1] + "</span>"); } } else { buffer .append( "<input style='border:#B3B3B3 1px solid;' onclick=\"this.style.borderColor='#406B9B'\" onmouseover=\"this.style.borderColor='#99E300'\" onmouseout=\"this.style.borderColor='#A1BCA3'\" type='text' name='") .append(property.getFullColName()) .append("'"); buffer.append(" title='").append("其他").append("'"); if (DOStaticList.isChecked(half[0], property.getValue())) { String[] strs = property.getValue().split(";"); buffer.append(" value='" + strs[strs.length - 1] + "'"); } buffer.append(" size=\"").append("13").append("\"/>"); } } } } return buffer.toString(); }