示例#1
0
  public String onDisplay(DataField field, Object value) {
    StringBuffer html = new StringBuffer();

    String values = field.getSave_value();
    int i = 0;
    if (values != null) {
      String[] valueAr = values.split(",");
      for (String v : valueAr) {
        html.append("<input type=\"radio\"");
        html.append(" name=\"");
        html.append(field.getEnglish_name());
        html.append("\" value=\"");
        html.append(i);
        html.append("\"");
        if (value == null && i == 0) {
          html.append(" checked=\"true\"");
        }
        if (value != null && i == Integer.valueOf("" + value)) {
          html.append(" checked=\"true\"");
        }

        html.append(" />");
        html.append(v);
        i++;
      }
    }

    return html.toString();
  }
 /**
  * 覆写数据保存事件默认响应<br>
  * 逻辑为以name为字段为字段名,值为request.getParameter(fieldname);
  */
 @Override
 public void onSave(Map article, DataField field) {
   HttpServletRequest request = ThreadContextHolder.getHttpRequest();
   String value = request.getParameter(field.getEnglish_name());
   if (value != null) {
     // 替换静态服务器域名为本地标识串(fs:)
     value =
         value.replaceAll(
             EopSetting.IMG_SERVER_DOMAIN
                 + EopContext.getContext().getContextPath()
                 + "/attachment/",
             EopSetting.FILE_STORE_PREFIX + "/attachment/");
   }
   article.put(field.getEnglish_name(), value);
 }
  @Override
  public String onDisplay(DataField field, Object value) {
    StringBuffer html = new StringBuffer();
    html.append(
        "<textarea id=\""
            + field.getEnglish_name()
            + "\" name=\""
            + field.getEnglish_name()
            + "\">");
    if (value != null) {
      value = UploadUtil.replacePath(value.toString());
      html.append(value);
    }
    html.append("</textarea>");
    html.append("<script type=\"text/javascript\">");
    html.append("$('#" + field.getEnglish_name() + "' ).ckeditor( );");
    html.append("</script>");

    return html.toString();
  }
示例#4
0
 public Object onShow(DataField field, Object value) {
   if (value != null) {
     int index = Integer.valueOf(value.toString());
     String valueStr = field.getSave_value();
     if (valueStr != null) {
       String[] values = valueStr.split(",");
       return values[index];
     }
     return "";
   } else return "";
 }