public ReturnValue columnInfo(double id) { ReturnValue err = new ReturnValue(); ColumnInfo info = ColumnClass.get(id); if (info == null) { err.errNo = -1; err.errMsg = "没有找到指定id数据"; } else { Permissions p = this.loginInfo.value.getColumnPermissions(info.id); if (p.read) { err.userData = info; } else { err.errNo = -1; err.errMsg = "没有查看该栏目的权限"; } } return(err); }
public ReturnValue columnEdit(double classId, double moduleId, string maxIco, double skinId, double contentSkinId, double _skinId, double _contentSkinId, string className, string dirName, int type, double saveDataType, string custom, int watermark, int thumbnailWidth = 0, int thumbnailHeight = 0, int thumbnailForce = 0, double id = 0, int saveRemoteImages = 0, int inherit = 0, string _domainName = "", string domainName = "", string keyword = "", string info = "", int titleRepeat = 0) { ColumnInfo columnInfo = new ColumnInfo(); columnInfo.id = id; columnInfo.className = className; columnInfo.classId = classId; columnInfo.moduleId = moduleId; columnInfo.dirName = dirName; columnInfo.keyword = keyword; columnInfo.maxIco = maxIco; columnInfo.saveDataType = saveDataType; columnInfo.skinId = skinId; columnInfo.contentSkinId = contentSkinId; columnInfo._skinId = _skinId; columnInfo._contentSkinId = _contentSkinId; columnInfo.info = info; columnInfo.watermark = watermark; columnInfo.custom = custom; columnInfo.thumbnailWidth = thumbnailWidth; columnInfo.thumbnailHeight = thumbnailHeight; columnInfo.thumbnailForce = thumbnailForce; columnInfo.saveRemoteImages = saveRemoteImages; columnInfo.inherit = inherit; columnInfo.domainName = domainName; columnInfo._domainName = _domainName; columnInfo.titleRepeat = titleRepeat; ReturnValue err = new ReturnValue(); Permissions p = null; if (columnInfo.classId == 7) { p = loginInfo.value.getModulePermissions(columnInfo.moduleId);//获取上线栏目权限 } else { ColumnInfo parentColumn = ColumnClass.get(columnInfo.classId); columnInfo.rootId = parentColumn.rootId; p = this.loginInfo.value.getColumnPermissions(parentColumn);//获取上线栏目权限 } if (!p.all) { err.errNo = -1; err.errMsg = "没有编辑该栏目的权限"; return(err); } ColumnClass.edit(columnInfo, this.loginInfo.value); Config.loadDomain(); return(err); }
/// <summary> /// 保存模板 /// </summary> public void Save() { if (TemplateType == TemplateType.自定义页 && this.CustomPageExist()) { throw new Exception("页面“" + this.TemplateName + "”已存在请不要重复创建"); } Dictionary <string, object> fields = new Dictionary <string, object>(); fields["id"] = this.TemplateId; fields["title"] = this.TemplateName; fields["u_content"] = SetContent(this.TemplateContent); fields["u_type"] = (int)this.TemplateType; fields["u_defaultFlag"] = this.IsDefault ? 1 : 0; fields["classId"] = this.ColumnId; fields["u_datatypeId"] = this.DatatypeId; fields["u_editboxStatus"] = (int)this.EditMode; fields["u_parameterValue"] = this.ParameterValue; fields["u_webFAid"] = this.IsMobile ? 1 : 0; fields["createDate"] = System.DateTime.Now; fields["updateDate"] = System.DateTime.Now; int u_layer = 0; ModuleInfo moduleInfo = ModuleClass.get(ColumnId); if (moduleInfo == null) { ColumnInfo columnInfo = ColumnClass.get(ColumnId); if (columnInfo != null) { u_layer = 2; fields["url"] = @"/" + columnInfo.dirName + "/" + TemplateName; } else { fields["url"] = @"/" + TemplateName; } } else { u_layer = 1; if (moduleInfo.type) { fields["url"] = @"/" + moduleInfo.dirName + "/" + TemplateName; } } fields["u_layer"] = u_layer; this.TemplateId = Save(fields); Build(true); }
public ReturnValue templateList(double classId, int type, int isMobile) { ColumnInfo info = ColumnClass.get(classId); ReturnValue err = new ReturnValue(); if (info != null) { err.userData = info.getTemplateList(type, isMobile == 1); } else { err.errNo = -1; err.errMsg = "栏目不存在"; } return(err); }
public ReturnValue addColumn(double moduleId, double classId, double dataTypeId, string list) { ReturnValue errinfo = new ReturnValue(); Permissions p = null; if (classId < 8) { classId = 7; p = loginInfo.value.getModulePermissions(moduleId); } else { p = loginInfo.value.getColumnPermissions(classId); } if (!p.all) { errinfo.errNo = -1; errinfo.errMsg = "没有编辑该栏目的权限"; return(errinfo); } string [] _list = list.Split('\n'); string msg = ""; double[] parentid = new double[] { classId, -1, -1, -1, -1, -1, -1 }; for (int i = 0; i < _list.Length; i++) { if (_list[i].Trim() != "") { int layer = Regex.Split(_list[i], " ").Length - 1; classId = parentid[layer]; string[] temp = _list[i].Trim().Split('\t'); string classname = temp[0].Trim(), dirname = "", keyword = ""; if (temp.Length > 1) { dirname = temp[1]; } else { dirname = classname.GetPinYin(); if (dirname.Length > 15) { dirname = classname.GetPinYin('2'); } dirname = Regex.Replace(dirname, "[ " + @"\-_" + "`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]", ""); } if (temp.Length > 2) { keyword = temp[2]; } ColumnInfo info = new ColumnInfo(); info.className = classname; info.classId = classId; info.keyword = keyword; if (classId != 7) { ColumnInfo parent = ColumnClass.get(classId); if (parent != null) { info.rootId = parent.rootId; } } info.moduleId = moduleId; info.dirName = dirname; info.saveDataType = dataTypeId; ReturnValue err = new ReturnValue(); if (classId < 1) { err.errNo = -1; err.errMsg = "上级栏目不存在"; } else { ColumnClass.edit(info, loginInfo.value); } if (err.errNo > -1) { double newId = Convert.ToDouble(err.userData); if (newId > 0) { parentid[layer + 1] = newId; } } else { msg += "[" + classname + "]"; //errinfo.errNo = -1; //errinfo.errMsg += classname+"添加失败 "+err.errMsg + "<br>"; } } } errinfo.userData = msg; return(errinfo); }