public void Verify() { String ID = $V("ID"); String Type = $V("Type"); String IDs = $V("IDs"); if ((XString.isNotEmpty(ID)) && (XString.isEmpty(IDs))) { ZCCommentSchema comment = new ZCCommentSchema(); comment.setID(ID); comment.fill(); if (Type.equals("Pass")) comment.setVerifyFlag("Y"); else if (Type.equals("NoPass")) { comment.setVerifyFlag("N"); } comment.setVerifyUser(User.getUserName()); comment.setVerifyTime(new Date()); if (comment.update()) this.response.setLogInfo(1, "审核成功"); else this.response.setLogInfo(0, "审核失败"); } else if ((XString.isNotEmpty(IDs)) && (XString.isEmpty(ID))) { ZCCommentSchema comment = new ZCCommentSchema(); ZCCommentSet set = comment.query(new QueryBuilder("where ID in (" + IDs + ")")); Transaction trans = new Transaction(); for (int i = 0; i < set.size(); i++) { comment = set.get(i); if (Type.equals("Pass")) comment.setVerifyFlag("Y"); else if (Type.equals("NoPass")) { comment.setVerifyFlag("N"); } comment.setVerifyUser(User.getUserName()); comment.setVerifyTime(new Date()); trans.add(comment, OperateType.UPDATE); } if (trans.commit()) this.response.setLogInfo(1, "审核成功"); else this.response.setLogInfo(0, "审核失败"); } }
public static void dg1DataBind(DataListAction dla) { String CatalogID = dla.getParam("CatalogID"); String CatalogType = dla.getParam("CatalogType"); String VerifyStatus = dla.getParam("VerifyStatus"); QueryBuilder qb = new QueryBuilder( "select ZCComment.*,(select Name from zccatalog where zccatalog.ID=ZCComment.CatalogID) as CatalogName,"); if (XString.isEmpty(CatalogType)) { CatalogType = "1"; } if (XString.isEmpty(VerifyStatus)) { VerifyStatus = "X"; } if (CatalogType.equals("1")) qb.append("(select Title from ZCArticle where ZCArticle.ID = ZCComment.RelaID) as Name"); else if (CatalogType.equals("4")) qb.append("(select Name from ZCImage where ZCImage.ID = ZCComment.RelaID) as Name"); else if (CatalogType.equals("5")) qb.append("(select Name from ZCVideo where ZCVideo.ID = ZCComment.RelaID) as Name"); else if (CatalogType.equals("6")) qb.append("(select Name from ZCAudio where ZCAudio.ID = ZCComment.RelaID) as Name"); else if (CatalogType.equals("7")) { qb.append("(select Name from ZCAttachment where ZCAttachment.ID = ZCComment.RelaID) as Name"); } qb.append(" from ZCComment where SiteID=?", ApplicationPage.getCurrentSiteID()); qb.append(" and CatalogType=?", CatalogType); if (XString.isNotEmpty(CatalogID)) { qb.append(" and CatalogID=?", CatalogID); } if (!VerifyStatus.equals("All")) { qb.append(" and VerifyFlag=?", VerifyStatus); } qb.append(" order by VerifyFlag asc, ID desc"); dla.setTotal(qb); DataTable dt = qb.executePagedDataTable(dla.getPageSize(), dla.getPageIndex()); dt.insertColumn("PreLink"); dt.insertColumn("FlagColor"); for (int i = 0; i < dt.getRowCount(); i++) { if (dt.getString(i, "CatalogType").equals("1")) dt.set(i, "PreLink", "../Document/Preview.jsp?ArticleID=" + dt.getString(i, "RelaID")); else { dt.set(i, "PreLink", "#;"); } if (dt.getString(i, "VerifyFlag").equals("Y")) dt.set(i, "FlagColor", "#00ff00"); else if (dt.getString(i, "VerifyFlag").equals("X")) dt.set(i, "FlagColor", "#ff7700"); else { dt.set(i, "FlagColor", "#ff0000"); } } dt.decodeColumn("VerifyFlag", CacheManager.getMapx("Code", "Comment.Status")); if (dt.getRowCount() == 0) { // dt.insertRow(null); dt.set(0, "ID", "0"); } dla.bindData(dt); }
public void addAntiCount() { String ip = this.request.getClientIP(); String id = $V("ID"); Transaction trans = new Transaction(); ZCCommentSchema task = new ZCCommentSchema(); task.setID(id); task.fill(); String supportAntiIP = task.getSupportAntiIP(); if ((XString.isNotEmpty(supportAntiIP)) && (supportAntiIP.indexOf(ip) >= 0)) { this.response.setMessage("您已经评论过,谢谢支持!"); this.response.put("count", task.getAntiCount()); return; } long count = task.getAntiCount(); task.setAntiCount(count + 1L); task.setSupportAntiIP((XString.isEmpty(supportAntiIP) ? "" : supportAntiIP) + ip); trans.add(task, OperateType.UPDATE); if (trans.commit()) { this.response.setStatus(1); this.response.setMessage("您的评论提交成功!"); this.response.put("count", count + 1L); } else { this.response.setLogInfo(0, "审核失败"); } }
public boolean addOneJob(long configID, boolean immediate) { ZCDeployJobSchema job = new ZCDeployJobSchema(); ZCDeployConfigSchema config = new ZCDeployConfigSchema(); config.setID(configID); if (!config.fill()) { return false; } String staticDir = Config.getContextRealPath() + Config.getValue("Statical.TargetDir").replace('\\', '/'); String sourcePath = staticDir + "/" + ApplicationPage.getCurrentSiteAlias() + config.getSourceDir(); job.setID(NoUtil.getMaxID("DeployJobID")); job.setConfigID(config.getID()); job.setSource(sourcePath); job.setMethod(config.getMethod()); String targetDir = config.getTargetDir(); if (XString.isEmpty(targetDir)) { targetDir = "/"; } else if (!targetDir.endsWith("/")) { targetDir = targetDir + "/"; } job.setTarget(targetDir); job.setSiteID(config.getSiteID()); job.setHost(config.getHost()); job.setPort(config.getPort()); job.setUserName(config.getUserName()); job.setPassword(config.getPassword()); job.setStatus(0L); job.setAddTime(new Date()); job.setAddUser(User.getUserName()); Transaction trans = new Transaction(); trans.add(job, OperateType.INSERT); if (trans.commit()) { if (immediate) { executeJob(config, job); } return true; } LogUtil.getLogger().info("添加部署任务时,数据库操作失败"); return false; }
public void add() { Transaction tran = new Transaction(); ZCFullTextSchema ft = new ZCFullTextSchema(); if (XString.isEmpty($V("ID"))) { ft.setValue(this.request); ft.setID(NoUtil.getMaxID("FullTextID")); ft.setSiteID(ApplicationPage.getCurrentSiteID()); ft.setAddTime(new Date()); ft.setAddUser(User.getUserName()); tran.add(ft, OperateType.INSERT); } else { ft.setID(Long.parseLong($V("ID"))); ft.fill(); ft.setValue(this.request); ft.setModifyTime(new Date()); ft.setModifyUser(User.getUserName()); tran.add(ft, OperateType.UPDATE); } if (tran.commit()) this.response.setMessage("保存成功"); else this.response.setError("发生错误,保存失败"); }
public static Mapx initDialog(Mapx params) { String Code = params.getString("Code"); if (XString.isEmpty(Code)) { params.put("VerifyType", HtmlUtil.mapxToOptions(VerifyTypeMap)); params.put("InputType", HtmlUtil.mapxToOptions(InputTypeMap)); params.put("IsMandatory", HtmlUtil.codeToRadios("IsMandatory", "YesOrNo", "N")); params.put("MaxLength", "100"); params.put("Cols", "265"); params.put("Rows", "90"); } else { ZDMemberFieldSchema field = new ZDMemberFieldSchema(); field.setCode(Code); field.setSiteID(ApplicationPage.getCurrentSiteID()); field.fill(); params = field.toMapx(); params.put("VerifyType", HtmlUtil.mapxToOptions(VerifyTypeMap, field.getVerifyType())); params.put("InputType", HtmlUtil.mapxToOptions(InputTypeMap, field.getInputType())); params.put( "IsMandatory", HtmlUtil.codeToRadios("IsMandatory", "YesOrNo", field.getIsMandatory())); } return params; }
public ZCDeployJobSet getJobs(long siteID, ArrayList list, String operation) { ZCDeployJobSet jobSet = new ZCDeployJobSet(); for (int j = 0; j < list.size(); j++) { String srcPath = (String) list.get(j); if (XString.isEmpty(srcPath)) { continue; } srcPath = srcPath.replace('\\', '/').replaceAll("///", "/").replaceAll("//", "/"); String baseDir = Config.getContextRealPath() + Config.getValue("Statical.TargetDir").replace('\\', '/'); baseDir = baseDir + "/" + SiteUtil.getAlias(siteID); baseDir = baseDir.replaceAll("///", "/"); baseDir = baseDir.replaceAll("//", "/"); srcPath = srcPath.replaceAll(baseDir, ""); ZCDeployConfigSchema config = new ZCDeployConfigSchema(); QueryBuilder qb = new QueryBuilder( " where UseFlag =1 and siteid=? and ? like concat(sourcedir,'%')", siteID, srcPath); if (Config.isSQLServer()) { qb.setSQL(" where siteid=? and charindex(sourcedir,?)=0"); } if (Config.isDB2()) { qb.setSQL(" where siteid=? and locate(sourcedir,'" + srcPath + "')=0"); qb.getParams().remove(qb.getParams().size() - 1); } ZCDeployConfigSet set = config.query(qb); for (int i = 0; i < set.size(); i++) { config = set.get(i); String target = config.getTargetDir(); if (XString.isEmpty(target)) { target = "/"; } else if (!target.endsWith("/")) { target = target + "/"; } String filePath = srcPath; if (!config.getSourceDir().equals("/")) { filePath = srcPath.replaceAll(config.getSourceDir(), ""); } target = dealFileName(target, filePath); ZCDeployJobSchema job = new ZCDeployJobSchema(); job.setID(NoUtil.getMaxID("DeployJobID")); job.setConfigID(config.getID()); job.setSource(baseDir + srcPath); job.setMethod(config.getMethod()); job.setTarget(target); job.setSiteID(config.getSiteID()); job.setHost(config.getHost()); job.setPort(config.getPort()); job.setUserName(config.getUserName()); job.setPassword(config.getPassword()); job.setRetryCount(0L); job.setStatus(0L); job.setOperation(operation); job.setAddTime(new Date()); if (User.getCurrent() != null) job.setAddUser(User.getUserName()); else { job.setAddUser("SYS"); } jobSet.add(job); } } return jobSet; }
public static void treeDataBind(TreeAction ta) { String id = ta.getParam("ID"); ZCFullTextSchema ft = new ZCFullTextSchema(); ft.setID(id); if (XString.isEmpty(id)) { ta.getParams().put("CatalogType", OperateType.INSERT); Catalog.treeDataBind(ta); } else { ft.fill(); if (!ft.getRelaText().equalsIgnoreCase("-1")) { ta.getParams().put("IDs", ft.getRelaText()); } } if ("Article".equals(ta.getParam("Type"))) { ta.getParams().put("CatalogType", OperateType.INSERT); Catalog.treeDataBind(ta); } if ("Image".equals(ta.getParam("Type"))) { ta.getParams().put("CatalogType", 4); ImageLib.treeDataBind(ta); } if ("Video".equals(ta.getParam("Type"))) { ta.getParams().put("CatalogType", OperateType.DELETE_AND_BACKUP); VideoLib.treeDataBind(ta); } if ("Audio".equals(ta.getParam("Type"))) { ta.getParams().put("CatalogType", 6); AudioLib.treeDataBind(ta); } if ((ta.getDataSource() != null) && (XString.isEmpty(ta.getParam("ParentID")))) { DataTable dt = ta.getDataSource(); dt.insertRow(new Object[dt.getColCount()], 0); dt.set(0, 0, "-1"); dt.set(0, 1, "0"); dt.set(0, 2, "1"); dt.set(0, 3, "<font class='red'>全部</font>"); DataRow dr = dt.getDataRow(0); TreeItem root = ta.getItem(0); TreeItem item = new TreeItem(); item.setData(dr); item.setAction(ta); item.setID(dr.getString(ta.getIdentifierColumnName())); item.setParentID(root.getID()); item.setLevel(root.getLevel() + 1); item.setParent(root); item.setIcon("Icons/treeicon09.gif"); item.setLast(false); try { item.parseHtml(ta.getItemInnerHtml(dr)); } catch (Exception e) { e.printStackTrace(); } ta.getItemList().add(1, item); if ("Article".equals(ta.getParam("Type"))) { List items = ta.getItemList(); for (int i = 1; i < items.size(); i++) { item = (TreeItem) items.get(i); if ("Y".equals(item.getData().getString("SingleFlag"))) item.setIcon("Icons/treeicon11.gif"); } } } }
private static String getColumn(DataRow dr, ZDMemberSchema member, String realField) { String columnName = dr.getString("Name"); String columnCode = dr.getString("Code"); String inputType = dr.getString("InputType"); String verifyType = dr.getString("VerifyType"); String listOption = dr.getString("ListOption"); String defaultValue = dr.getString("DefaultValue"); String isMandatory = dr.getString("IsMandatory"); String maxLength = dr.getString("MaxLength"); String HTML = dr.getString("HTML"); String verifyStr = "verify='" + columnName + "|"; if ("Y".equals(isMandatory)) { verifyStr = verifyStr + "NotNull"; } if (!STRING.equals(verifyType)) { if (NUMBER.equals(verifyType)) verifyStr = verifyStr + "&&Number"; else if (INT.equals(verifyType)) verifyStr = verifyStr + "&&Int"; else if (EMAIL.equals(verifyType)) verifyStr = verifyStr + "&&Email"; } if ((XString.isNotEmpty(maxLength)) && (!"0".equals(maxLength))) verifyStr = verifyStr + "&&Length<" + maxLength + "'"; else { verifyStr = verifyStr + "'"; } if ((member != null) && (realField != null)) { Mapx map = member.toMapx(); defaultValue = map.getString(realField); if (XString.isEmpty(defaultValue)) { defaultValue = ""; } } columnCode = "_MC_" + columnCode; StringBuffer sb = new StringBuffer(); sb.append("<tr><td height='25' align='right' >"); sb.append(columnName); sb.append(":</td><td align='left' >"); if (inputType.equals(Input)) { sb.append( "<input type='text' size='26' id='" + columnCode + "' name='" + columnCode + "' value='" + defaultValue + "' " + verifyStr + " />"); } if (inputType.equals(Text)) { sb.append( "<textarea style='width:" + dr.getString("ColSize") + "px;height:" + dr.getString("RowSize") + "px' id='" + columnCode + "' name='" + columnCode + "' " + verifyStr + ">" + defaultValue + "</textarea>"); } if (inputType.equals(Selecter)) { SelectTag select = new SelectTag(); select.setId(columnCode); if ("Y".equals(isMandatory)) { select.setVerify(columnName + "|NotNull"); } String[] array = listOption.split("\\n"); sb.append(select.getHtml(HtmlUtil.arrayToOptions(array, defaultValue, true))); } if (inputType.equals(Radio)) { String[] array = listOption.split("\\n"); if ((XString.isEmpty(defaultValue)) && (array.length > 0)) { defaultValue = array[0]; } sb.append(HtmlUtil.arrayToRadios(columnCode, array, defaultValue)); } if (inputType.equals(Checkbox)) { String[] array = listOption.split("\\n"); defaultValue = defaultValue.replaceAll(" ", ","); defaultValue = defaultValue.replaceAll(" ", ","); defaultValue = defaultValue.replaceAll(" ", ","); defaultValue = defaultValue.replaceAll(" ", ","); defaultValue = defaultValue.replaceAll(",,", ","); defaultValue = defaultValue.replaceAll(",,", ","); defaultValue = defaultValue.replaceAll(",", ","); String[] checkedArray = defaultValue.split(","); sb.append(HtmlUtil.arrayToCheckboxes(columnCode, array, checkedArray)); } if (inputType.equals(DateInput)) { sb.append( "<input name='" + columnCode + "' id='" + columnCode + "' value='" + defaultValue + "' type='text' size='20' xtype='Date' " + verifyStr + " />"); } if (inputType.equals(TimeInput)) { sb.append( "<input name='" + columnCode + "' id='" + columnCode + "' value='" + defaultValue + "' type='text' size='10' xtype='Time' " + verifyStr + " />"); } if (inputType.equals(HTMLInput)) { sb.append(HTML); } sb.append("</td></tr>"); return sb.toString(); }
public void add() { String hCode = $V("hCode"); boolean update = false; int FieldCount = new QueryBuilder( "select count(*) from ZDMemberField where SiteID = ?", ApplicationPage.getCurrentSiteID()) .executeInt(); ZDMemberFieldSchema field = new ZDMemberFieldSchema(); field.setCode($V("Code").trim()); field.setSiteID(ApplicationPage.getCurrentSiteID()); if ((XString.isEmpty(hCode)) && (field.fill())) { this.response.setLogInfo(0, "已有相同字段"); return; } if ((XString.isNotEmpty(hCode)) && (field.fill())) { update = true; } if (!update) { if (FieldCount < 20) { int index = 1; for (int i = 1; i <= 20; i++) { if (new QueryBuilder( "select count(*) from ZDMemberField where SiteID = ? and RealField = 'Prop" + i + "'", ApplicationPage.getCurrentSiteID()) .executeInt() == 0) { index = i; break; } } field.setRealField("Prop" + index); } else { this.response.setLogInfo(0, "达到扩展字段上限"); return; } } field.setValue(this.request); field.setName($V("Name")); field.setCode($V("Code")); field.setAddUser(User.getUserName()); field.setAddTime(new Date()); String defaultValue = field.getDefaultValue(); defaultValue = defaultValue.replaceAll(" ", ","); defaultValue = defaultValue.replaceAll(" ", ","); defaultValue = defaultValue.replaceAll(" ", ","); defaultValue = defaultValue.replaceAll(" ", ","); defaultValue = defaultValue.replaceAll(",,", ","); defaultValue = defaultValue.replaceAll(",,", ","); defaultValue = defaultValue.replaceAll(",", ","); if (XString.isEmpty(defaultValue)) { defaultValue = ""; } field.setDefaultValue(defaultValue); if (Input.equals(field.getInputType())) { field.setColSize(null); field.setRowSize(null); field.setListOption(""); } else if (Text.equals(field.getInputType())) { field.setListOption(""); } else if (Selecter.equals(field.getInputType())) { field.setColSize(null); field.setRowSize(null); field.setMaxLength(null); field.setVerifyType(STRING); } else if (Radio.equals(field.getInputType())) { field.setIsMandatory("N"); field.setColSize(null); field.setRowSize(null); field.setMaxLength(null); field.setVerifyType(STRING); } else if (Checkbox.equals(field.getInputType())) { field.setIsMandatory("N"); field.setColSize(null); field.setRowSize(null); field.setMaxLength(null); field.setVerifyType(STRING); } else if ((DateInput.equals(field.getInputType())) || (TimeInput.equals(field.getInputType()))) { field.setColSize(null); field.setRowSize(null); field.setMaxLength(null); field.setListOption(""); field.setVerifyType(STRING); } else if (HTMLInput.equals(field.getInputType())) { field.setIsMandatory("N"); field.setColSize(null); field.setRowSize(null); field.setMaxLength(null); field.setListOption(""); field.setVerifyType(STRING); } Transaction trans = new Transaction(); if (update) trans.add(field, OperateType.UPDATE); else { trans.add(field, OperateType.INSERT); } if (trans.commit()) this.response.setLogInfo(1, "保存会员扩展字段成功!"); else this.response.setLogInfo(0, "发生错误!"); }