public static string GetCommandItemRowsHtml(ETableStyle tableStyle, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo, ContentInfo contentInfo, string pageUrl, string administratorName) { var builder = new StringBuilder(); var modelType = EContentModelTypeUtils.GetEnumType(nodeInfo.ContentModelId); if (modelType == EContentModelType.Photo) { var contentPhotoUploadUrl = PageContentPhotoUpload.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, contentInfo.Id, pageUrl); builder.Append( $@"<td class=""center"" width=""50""><a href=""{contentPhotoUploadUrl}"">图片</a><span style=""color:gray"">({contentInfo .Photos})</span></td>"); } else if (modelType == EContentModelType.Job) { var resumeNum = DataProvider.ResumeContentDao.GetCount(publishmentSystemInfo.PublishmentSystemId, contentInfo.Id); var urlResume = PageResumeContent.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId, contentInfo.Id, StringUtils.ValueToUrl(pageUrl));; builder.Append( $@"<td class=""center"" width=""50""><a href=""{urlResume}"">简历</a><span style=""color:gray"">({resumeNum})</span></td>"); } if (publishmentSystemInfo.Additional.IsCommentable && modelType != EContentModelType.Job) { if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, AppManager.Cms.Permission.Channel.CommentCheck, AppManager.Cms.Permission.Channel.CommentDelete)) { //var urlComment = PageComment.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemID, contentInfo.NodeId, contentInfo.Id, pageUrl); var urlComment = PageComments.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, contentInfo.Id, pageUrl); builder.Append( $@"<td class=""center"" width=""50""><a href=""{urlComment}"">评论</a><span style=""color:gray"">({contentInfo .Comments})</span></td>"); } } return(builder.ToString()); }
public static ETableStyle GetTableStyle(PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo) { var modelInfo = ContentModelManager.GetContentModelInfo(publishmentSystemInfo, nodeInfo.ContentModelId); if (!string.IsNullOrEmpty(modelInfo?.TableName)) { return(EAuxiliaryTableTypeUtils.GetTableStyle(modelInfo.TableType)); } var tableStyle = ETableStyle.BackgroundContent; if (EContentModelTypeUtils.Equals(EContentModelType.GovPublic, nodeInfo.ContentModelId)) { tableStyle = ETableStyle.GovPublicContent; } else if (EContentModelTypeUtils.Equals(EContentModelType.GovInteract, nodeInfo.ContentModelId)) { tableStyle = ETableStyle.GovInteractContent; } else if (EContentModelTypeUtils.Equals(EContentModelType.Vote, nodeInfo.ContentModelId)) { tableStyle = ETableStyle.VoteContent; } else if (EContentModelTypeUtils.Equals(EContentModelType.Job, nodeInfo.ContentModelId)) { tableStyle = ETableStyle.JobContent; } else if (EContentModelTypeUtils.Equals(EContentModelType.UserDefined, nodeInfo.ContentModelId)) { tableStyle = ETableStyle.UserDefined; } return(tableStyle); }
public static string GetContentAddUploadWordUrl(int publishmentSystemId, NodeInfo nodeInfo, bool isFirstLineTitle, bool isFirstLineRemove, bool isClearFormat, bool isFirstLineIndent, bool isClearFontSize, bool isClearFontFamily, bool isClearImages, int contentLevel, string fileName, string returnUrl) { var modelType = EContentModelTypeUtils.GetEnumType(nodeInfo.ContentModelId); return ($"{GetContentAddUrl(modelType, publishmentSystemId, nodeInfo.NodeId, returnUrl)}&isUploadWord=True&isFirstLineTitle={isFirstLineTitle}&isFirstLineRemove={isFirstLineRemove}&isClearFormat={isClearFormat}&isFirstLineIndent={isFirstLineIndent}&isClearFontSize={isClearFontSize}&isClearFontFamily={isClearFontFamily}&isClearImages={isClearImages}&contentLevel={contentLevel}&fileName={fileName}"); }
public static string GetTableName(PublishmentSystemInfo publishmentSystemInfo, string contentModelId) { var modelInfo = ContentModelManager.GetContentModelInfo(publishmentSystemInfo, contentModelId); if (modelInfo != null && !string.IsNullOrEmpty(modelInfo.TableName)) { return(modelInfo.TableName); } var tableName = publishmentSystemInfo.AuxiliaryTableForContent; if (EContentModelTypeUtils.Equals(EContentModelType.GovPublic, contentModelId)) { tableName = publishmentSystemInfo.AuxiliaryTableForGovPublic; } else if (EContentModelTypeUtils.Equals(EContentModelType.GovInteract, contentModelId)) { tableName = publishmentSystemInfo.AuxiliaryTableForGovInteract; } else if (EContentModelTypeUtils.Equals(EContentModelType.Vote, contentModelId)) { tableName = publishmentSystemInfo.AuxiliaryTableForVote; } else if (EContentModelTypeUtils.Equals(EContentModelType.Job, contentModelId)) { tableName = publishmentSystemInfo.AuxiliaryTableForJob; } else if (EContentModelTypeUtils.Equals(EContentModelType.TeacherLib, contentModelId)) { tableName = "siteserver_teacherlibrary"; } return(tableName); }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var nodeID = TranslateUtils.ToInt(ddlNodeID.SelectedValue); var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeID); if (nodeInfo == null || !EContentModelTypeUtils.Equals(EContentModelType.GovPublic, nodeInfo.ContentModelId)) { FailMessage("索引号生成失败,所选栏目必须为信息公开类型栏目!"); return; } try { var isAll = StringUtils.EqualsIgnoreCase(rblCreateType.SelectedValue, "All"); DataProvider.GovPublicContentDao.CreateIdentifier(PublishmentSystemInfo, nodeID, isAll); Body.AddSiteLog(PublishmentSystemId, "重新生成索引号"); SuccessMessage("索引号重新生成成功!"); } catch (Exception ex) { FailMessage(ex, "索引号重新生成失败!"); } } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var nodeID = TranslateUtils.ToInt(ddlGovPublicNodeID.SelectedValue); var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeID); if (nodeInfo == null || !EContentModelTypeUtils.Equals(EContentModelType.GovPublic, nodeInfo.ContentModelId)) { ddlGovPublicNodeID.Items.Clear(); AddListItemsForGovPublic(ddlGovPublicNodeID.Items); ControlUtils.SelectListItems(ddlGovPublicNodeID, PublishmentSystemInfo.Additional.GovPublicNodeId.ToString()); FailMessage("信息公开设置修改失败,主题分类根栏目必须选择信息公开类型栏目!"); return; } PublishmentSystemInfo.Additional.GovPublicNodeId = nodeID; PublishmentSystemInfo.Additional.GovPublicIsPublisherRelatedDepartmentId = TranslateUtils.ToBool(rblIsPublisherRelatedDepartmentID.SelectedValue); try { DataProvider.PublishmentSystemDao.Update(PublishmentSystemInfo); Body.AddSiteLog(PublishmentSystemId, "修改信息公开设置"); SuccessMessage("信息公开设置修改成功!"); } catch (Exception ex) { FailMessage(ex, "信息公开设置修改失败!"); } } }
public static List <ContentModelInfo> GetContentModelInfoList(PublishmentSystemInfo publishmentSystemInfo) { var list = new List <ContentModelInfo> { EContentModelTypeUtils.GetContentModelInfo(publishmentSystemInfo.PublishmentSystemType, publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.AuxiliaryTableForContent, EContentModelType.Content), EContentModelTypeUtils.GetContentModelInfo(publishmentSystemInfo.PublishmentSystemType, publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.AuxiliaryTableForContent, EContentModelType.Photo) }; if (publishmentSystemInfo.PublishmentSystemType == EPublishmentSystemType.WCM) { list.Add(EContentModelTypeUtils.GetContentModelInfo(publishmentSystemInfo.PublishmentSystemType, publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.AuxiliaryTableForGovPublic, EContentModelType.GovPublic)); list.Add(EContentModelTypeUtils.GetContentModelInfo(publishmentSystemInfo.PublishmentSystemType, publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.AuxiliaryTableForGovInteract, EContentModelType.GovInteract)); } list.Add(EContentModelTypeUtils.GetContentModelInfo(publishmentSystemInfo.PublishmentSystemType, publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.AuxiliaryTableForVote, EContentModelType.Vote)); list.Add(EContentModelTypeUtils.GetContentModelInfo(publishmentSystemInfo.PublishmentSystemType, publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.AuxiliaryTableForJob, EContentModelType.Job)); list.AddRange(ContentModelUtils.GetContentModelInfoList(publishmentSystemInfo.PublishmentSystemId)); return(list); }
public NodeInfo() { NodeId = 0; NodeName = string.Empty; NodeType = ENodeType.BackgroundNormalNode; PublishmentSystemId = 0; _contentModelId = EContentModelTypeUtils.GetValue(EContentModelType.Content); ParentId = 0; ParentsPath = string.Empty; ParentsCount = 0; ChildrenCount = 0; IsLastNode = false; NodeIndexName = string.Empty; NodeGroupNameCollection = string.Empty; Taxis = 0; AddDate = DateTime.Now; ImageUrl = string.Empty; Content = string.Empty; ContentNum = 0; FilePath = string.Empty; ChannelFilePathRule = string.Empty; ContentFilePathRule = string.Empty; LinkUrl = string.Empty; LinkType = ELinkType.LinkNoRelatedToChannelAndContent; ChannelTemplateId = 0; ContentTemplateId = 0; Keywords = string.Empty; Description = string.Empty; _extendValues = string.Empty; }
void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { var nodeId = (int)e.Item.DataItem; var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId); var enabled = EContentModelTypeUtils.Equals(EContentModelType.GovPublic, nodeInfo.ContentModelId); var ltlHtml = (Literal)e.Item.FindControl("ltlHtml"); ltlHtml.Text = ChannelLoading.GetChannelRowHtml(PublishmentSystemInfo, nodeInfo, enabled, ELoadingType.GovPublicChannel, null, Body.AdministratorName); }
public static NameValueCollection GetWordNameValueCollection(int publishmentSystemId, string contentModelId, bool isFirstLineTitle, bool isFirstLineRemove, bool isClearFormat, bool isFirstLineIndent, bool isClearFontSize, bool isClearFontFamily, bool isClearImages, int contentLevel, string fileName) { var formCollection = new NameValueCollection(); var wordContent = Parse(publishmentSystemId, GetWordFilePath(fileName), isClearFormat, isFirstLineIndent, isClearFontSize, isClearFontFamily, isClearImages); if (!string.IsNullOrEmpty(wordContent)) { var title = string.Empty; if (isFirstLineTitle) { title = RegexUtils.GetInnerContent("p", wordContent); title = StringUtils.StripTags(title); if (!string.IsNullOrEmpty(title) && isFirstLineRemove) { wordContent = StringUtils.ReplaceFirst(title, wordContent, string.Empty); } if (!string.IsNullOrEmpty(title)) { title = title.Trim(); title = title.Trim(' ', ' '); title = StringUtils.StripEntities(title); } } if (string.IsNullOrEmpty(title)) { title = PathUtils.GetFileNameWithoutExtension(fileName); } if (!string.IsNullOrEmpty(title) && title.Length > 255) { title = title.Substring(0, 255); } formCollection[ContentAttribute.Title] = title; wordContent = StringUtils.ReplaceFirst("<p></p>", wordContent, string.Empty); if (EContentModelTypeUtils.Equals(contentModelId, EContentModelType.Job)) { formCollection[JobContentAttribute.Responsibility] = wordContent; } else { formCollection[BackgroundContentAttribute.Content] = wordContent; } } return(formCollection); }
public static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, int channelID, string channelIndex, string channelName, string interactName, string inputTemplateString, string successTemplateString, string failureTemplateString) { var parsedContent = string.Empty; pageInfo.AddPageScriptsIfNotExists(PageInfo.Components.Jquery); pageInfo.AddPageScriptsIfNotExists(PageInfo.JQuery.BShowLoading); pageInfo.AddPageScriptsIfNotExists(PageInfo.JQuery.BValidate); var nodeID = channelID; if (!string.IsNullOrEmpty(interactName)) { nodeID = DataProvider.GovInteractChannelDao.GetNodeIdByInteractName(pageInfo.PublishmentSystemId, interactName); } if (nodeID == 0) { nodeID = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, pageInfo.PublishmentSystemId, channelIndex, channelName); } var nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, nodeID); if (nodeInfo == null || !EContentModelTypeUtils.Equals(nodeInfo.ContentModelId, EContentModelType.GovInteract)) { nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, pageInfo.PublishmentSystemInfo.Additional.GovInteractNodeId); } if (nodeInfo != null) { var applyStyleID = DataProvider.GovInteractChannelDao.GetApplyStyleId(nodeInfo.PublishmentSystemId, nodeInfo.NodeId); var styleInfo = TagStyleManager.GetTagStyleInfo(applyStyleID); if (styleInfo == null) { styleInfo = new TagStyleInfo(); } var applyInfo = new TagStyleGovInteractApplyInfo(styleInfo.SettingsXML); var applyTemplate = new GovInteractApplyTemplate(pageInfo.PublishmentSystemInfo, nodeInfo.NodeId, styleInfo, applyInfo); var contentBuilder = new StringBuilder(applyTemplate.GetTemplate(styleInfo.IsTemplate, inputTemplateString, successTemplateString, failureTemplateString)); contentBuilder.Replace("{ChannelID}", nodeInfo.NodeId.ToString()); StlParserManager.ParseTemplateContent(contentBuilder, pageInfo, contextInfo); parsedContent = contentBuilder.ToString(); } return(parsedContent); }
public static List <NodeInfo> GetNodeInfoList(PublishmentSystemInfo publishmentSystemInfo) { var nodeInfoList = new List <NodeInfo>(); if (publishmentSystemInfo != null && publishmentSystemInfo.Additional.GovInteractNodeId > 0) { var nodeIdList = DataProvider.NodeDao.GetNodeIdListForDescendant(publishmentSystemInfo.Additional.GovInteractNodeId); foreach (var nodeId in nodeIdList) { var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, nodeId); if (nodeInfo != null && EContentModelTypeUtils.Equals(nodeInfo.ContentModelId, EContentModelType.GovInteract)) { nodeInfoList.Add(nodeInfo); } } } return(nodeInfoList); }
public static ContentModelInfo GetContentModelInfo(PublishmentSystemInfo publishmentSystemInfo, string contentModelId) { ContentModelInfo retval = null; var list = GetContentModelInfoList(publishmentSystemInfo); foreach (var modelInfo in list) { if (modelInfo.ModelId == contentModelId) { retval = modelInfo; break; } } if (retval == null) { retval = EContentModelTypeUtils.GetContentModelInfo(publishmentSystemInfo.PublishmentSystemType, publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.AuxiliaryTableForContent, EContentModelType.Content); } return(retval); }
public static void PutImagePaths(PublishmentSystemInfo publishmentSystemInfo, BackgroundContentInfo contentInfo, NameValueCollection collection) { if (contentInfo != null) { //如果是图片模型 var nodeInfo = DataProvider.NodeDao.GetNodeInfo(contentInfo.NodeId); if (EContentModelTypeUtils.IsPhoto(nodeInfo.ContentModelId)) { var photoInfoList = DataProvider.PhotoDao.GetPhotoInfoList(publishmentSystemInfo.PublishmentSystemId, contentInfo.Id); foreach (var photoInfo in photoInfoList) { collection[photoInfo.SmallUrl] = PathUtility.MapPath(publishmentSystemInfo, photoInfo.SmallUrl); collection[photoInfo.MiddleUrl] = PathUtility.MapPath(publishmentSystemInfo, photoInfo.MiddleUrl); collection[photoInfo.LargeUrl] = PathUtility.MapPath(publishmentSystemInfo, photoInfo.LargeUrl); } } else { if (!string.IsNullOrEmpty(contentInfo.ImageUrl) && PageUtility.IsVirtualUrl(contentInfo.ImageUrl)) { collection[contentInfo.ImageUrl] = PathUtility.MapPath(publishmentSystemInfo, contentInfo.ImageUrl); } if (!string.IsNullOrEmpty(contentInfo.VideoUrl) && PageUtility.IsVirtualUrl(contentInfo.VideoUrl)) { collection[contentInfo.VideoUrl] = PathUtility.MapPath(publishmentSystemInfo, contentInfo.VideoUrl); } if (!string.IsNullOrEmpty(contentInfo.FileUrl) && PageUtility.IsVirtualUrl(contentInfo.FileUrl)) { collection[contentInfo.FileUrl] = PathUtility.MapPath(publishmentSystemInfo, contentInfo.FileUrl); } } var srcArrayList = RegexUtils.GetOriginalImageSrcs(contentInfo.Content); foreach (string src in srcArrayList) { if (PageUtility.IsVirtualUrl(src)) { collection[src] = PathUtility.MapPath(publishmentSystemInfo, src); } } } }
public static List <NodeInfo> GetWritingNodeInfoList(string adminUserName, int publishmentSystemId) { var nodeInfoList = new List <NodeInfo>(); if (!string.IsNullOrEmpty(adminUserName)) { if (AdminManager.HasChannelPermissionIsConsoleAdministrator(adminUserName) || AdminManager.HasChannelPermissionIsSystemAdministrator(adminUserName))//如果是超级管理员或站点管理员 { var nodeList = DataProvider.NodeDao.GetNodeInfoListByPublishmentSystemId(publishmentSystemId, string.Empty); foreach (var nodeInfo in nodeList) { if (nodeInfo != null && EContentModelTypeUtils.Equals(nodeInfo.ContentModelId, EContentModelType.Content)) { nodeInfoList.Add(nodeInfo); } } } else { var ps = new ProductAdministratorWithPermissions(adminUserName); ICollection nodeIdCollection = ps.ChannelPermissionDict.Keys; foreach (int nodeId in nodeIdCollection) { var nodeIdList = DataProvider.NodeDao.GetNodeIdListForDescendant(nodeId); nodeIdList.Insert(0, nodeId); foreach (int ownNodeId in nodeIdList) { var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemId, ownNodeId); if (nodeInfo != null && EContentModelTypeUtils.Equals(nodeInfo.ContentModelId, EContentModelType.Content)) { nodeInfoList.Add(nodeInfo); } } } } } return(nodeInfoList); }
public static List <ContentModelInfo> GetContentModelInfoList(PublishmentSystemInfo publishmentSystemInfo) { var list = new List <ContentModelInfo> { EContentModelTypeUtils.GetContentModelInfo(publishmentSystemInfo.PublishmentSystemType, publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.AuxiliaryTableForContent, EContentModelType.Content), EContentModelTypeUtils.GetContentModelInfo(publishmentSystemInfo.PublishmentSystemType, publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.AuxiliaryTableForContent, EContentModelType.Photo) }; if (publishmentSystemInfo.PublishmentSystemType == EPublishmentSystemType.WCM) { list.Add(EContentModelTypeUtils.GetContentModelInfo(publishmentSystemInfo.PublishmentSystemType, publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.AuxiliaryTableForGovPublic, EContentModelType.GovPublic)); list.Add(EContentModelTypeUtils.GetContentModelInfo(publishmentSystemInfo.PublishmentSystemType, publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.AuxiliaryTableForGovInteract, EContentModelType.GovInteract)); } list.Add(EContentModelTypeUtils.GetContentModelInfo(publishmentSystemInfo.PublishmentSystemType, publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.AuxiliaryTableForVote, EContentModelType.Vote)); list.Add(EContentModelTypeUtils.GetContentModelInfo(publishmentSystemInfo.PublishmentSystemType, publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.AuxiliaryTableForJob, EContentModelType.Job)); list.AddRange(ContentModelUtils.GetContentModelInfoList(publishmentSystemInfo.PublishmentSystemId)); list.Add(new ContentModelInfo("Study", 1, "学习课件", false, "model_Study", EAuxiliaryTableType.Study, "", "")); list.Add(new ContentModelInfo("TeacherLib", 1, "师资库", false, "siteserver_teacherlibrary", EAuxiliaryTableType.TeacherLib, "", "")); list.Add(new ContentModelInfo("Service", 1, "志愿服务", false, "model_voluntaryservice", EAuxiliaryTableType.Service, "", "")); list.Add(new ContentModelInfo("Box", 1, "领导信箱", false, "siteserver_leadermailbox", EAuxiliaryTableType.Service, "", "")); list.Add(new ContentModelInfo("Wish", 1, "心愿墙", false, "siteserver_wishwall", EAuxiliaryTableType.Wish, "", "")); list.Add(new ContentModelInfo("Organization", 1, "组织活动", false, "model_organizationactivity", EAuxiliaryTableType.Organization, "", "")); list.Add(new ContentModelInfo("Mien", 1, "党员风采", false, "siteserver_partymembermien", EAuxiliaryTableType.Organization, "", "")); list.Add(new ContentModelInfo("Examination", 1, "考题", false, "siteserver_examination", EAuxiliaryTableType.Examination, "", "")); list.Add(new ContentModelInfo("Review", 1, "测评", false, "siteserver_examinationpaper", EAuxiliaryTableType.Review, "", "")); return(list); }
public void Page_Load(object sender, EventArgs e) { PageUtils.CheckRequestParameter("PublishmentSystemID"); if (!IsPostBack) { BreadCrumb(AppManager.Wcm.LeftMenu.IdGovPublic, AppManager.Wcm.LeftMenu.GovPublic.IdGovPublicContentConfiguration, "重新生成索引号", AppManager.Wcm.Permission.WebSite.GovPublicContentConfiguration); var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, PublishmentSystemInfo.Additional.GovPublicNodeId); var listItem = new ListItem("└" + nodeInfo.NodeName, PublishmentSystemInfo.Additional.GovPublicNodeId.ToString()); ddlNodeID.Items.Add(listItem); var nodeIdList = DataProvider.NodeDao.GetNodeIdListByParentId(PublishmentSystemId, PublishmentSystemInfo.Additional.GovPublicNodeId); var index = 1; foreach (int nodeID in nodeIdList) { nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeID); listItem = new ListItem(" ├" + nodeInfo.NodeName, nodeID.ToString()); if (index++ == nodeIdList.Count) { listItem = new ListItem(" └" + nodeInfo.NodeName, nodeID.ToString()); } if (!EContentModelTypeUtils.Equals(nodeInfo.ContentModelId, EContentModelType.GovPublic)) { listItem.Attributes.Add("style", "color:gray;"); listItem.Value = ""; } ddlNodeID.Items.Add(listItem); } listItem = new ListItem("索引号为空的信息", "Empty"); listItem.Selected = true; rblCreateType.Items.Add(listItem); listItem = new ListItem("全部信息", "All"); listItem.Selected = false; rblCreateType.Items.Add(listItem); } }
private void AddListItemsForGovPublic(ListItemCollection listItemCollection) { var nodeIdList = DataProvider.NodeDao.GetNodeIdListByScopeType(PublishmentSystemId, EScopeType.SelfAndChildren, string.Empty, string.Empty); var nodeCount = nodeIdList.Count; var isLastNodeArray = new bool[nodeCount]; foreach (int nodeID in nodeIdList) { var enabled = true; var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeID); if (!EContentModelTypeUtils.Equals(EContentModelType.GovPublic, nodeInfo.ContentModelId)) { enabled = false; } var listitem = new ListItem(NodeManager.GetSelectText(PublishmentSystemInfo, nodeInfo, isLastNodeArray, false, true), nodeInfo.NodeId.ToString()); if (!enabled) { listitem.Attributes.Add("style", "color:gray;"); } listItemCollection.Add(listitem); } }
public static string GetCommandHeadRowsHtml(string administratorName, ETableStyle tableStyle, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo) { var builder = new StringBuilder(); var modelType = EContentModelTypeUtils.GetEnumType(nodeInfo.ContentModelId); if (modelType == EContentModelType.Photo) { builder.Append(@"<td class=""center"" width=""50""> </td>"); } else if (modelType == EContentModelType.Job) { builder.Append(@"<td class=""center"" width=""50""> </td>"); } if (publishmentSystemInfo.Additional.IsCommentable && modelType != EContentModelType.Job) { if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.CommentCheck, AppManager.Cms.Permission.Channel.CommentDelete)) { builder.Append(@"<td class=""center"" width=""50""> </td>"); } } return(builder.ToString()); }
public static void Initialize(PublishmentSystemInfo publishmentSystemInfo) { if (publishmentSystemInfo.Additional.GovPublicNodeId > 0) { if (!DataProvider.NodeDao.IsExists(publishmentSystemInfo.Additional.GovPublicNodeId)) { publishmentSystemInfo.Additional.GovPublicNodeId = 0; } } if (publishmentSystemInfo.Additional.GovPublicNodeId == 0) { var govPublicNodeId = DataProvider.NodeDao.GetNodeIdByContentModelType(publishmentSystemInfo.PublishmentSystemId, EContentModelType.GovPublic); if (govPublicNodeId == 0) { govPublicNodeId = DataProvider.NodeDao.InsertNodeInfo(publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.PublishmentSystemId, "信息公开", string.Empty, EContentModelTypeUtils.GetValue(EContentModelType.GovPublic)); } publishmentSystemInfo.Additional.GovPublicNodeId = govPublicNodeId; DataProvider.PublishmentSystemDao.Update(publishmentSystemInfo); } GovPublicCategoryManager.Initialize(publishmentSystemInfo); if (DataProvider.GovPublicIdentifierRuleDao.GetCount(publishmentSystemInfo.PublishmentSystemId) == 0) { var ruleInfoArrayList = new ArrayList { new GovPublicIdentifierRuleInfo(0, "机构分类代码", publishmentSystemInfo.PublishmentSystemId, EGovPublicIdentifierType.Department, 5, "-", string.Empty, string.Empty, 0, 0, string.Empty), new GovPublicIdentifierRuleInfo(0, "主题分类代码", publishmentSystemInfo.PublishmentSystemId, EGovPublicIdentifierType.Channel, 5, "-", string.Empty, string.Empty, 0, 0, string.Empty), new GovPublicIdentifierRuleInfo(0, "生效日期", publishmentSystemInfo.PublishmentSystemId, EGovPublicIdentifierType.Attribute, 0, "-", "yyyy", GovPublicContentAttribute.EffectDate, 0, 0, string.Empty), new GovPublicIdentifierRuleInfo(0, "顺序号", publishmentSystemInfo.PublishmentSystemId, EGovPublicIdentifierType.Sequence, 5, string.Empty, string.Empty, string.Empty, 0, 0, string.Empty) }; foreach (GovPublicIdentifierRuleInfo ruleInfo in ruleInfoArrayList) { DataProvider.GovPublicIdentifierRuleDao.Insert(ruleInfo); } } }
private int SaveContentInfo(bool isAjaxSubmit, bool isPreview, out string errorMessage) { int savedContentId; errorMessage = string.Empty; var contentId = 0; if (!isPreview) { contentId = isAjaxSubmit ? TranslateUtils.ToInt(Request.Form["savedContentID"]) : Body.GetQueryInt("ID"); } if (contentId == 0) { var contentInfo = ContentUtility.GetContentInfo(_tableStyle); try { int nodeId = 0; //contentInfo.NodeId = _nodeInfo.NodeId; if (PhCategory.Visible == true) { nodeId = Convert.ToInt32(TbCategory.SelectedValue); } else { nodeId = _nodeInfo.NodeId; } contentInfo.NodeId = nodeId; contentInfo.PublishmentSystemId = PublishmentSystemId; contentInfo.AddUserName = Body.AdministratorName; if (contentInfo.AddDate.Year == DateUtils.SqlMinValue.Year) { errorMessage = $"内容添加失败:系统时间不能为{DateUtils.SqlMinValue.Year}年"; return(0); } contentInfo.LastEditUserName = contentInfo.AddUserName; contentInfo.LastEditDate = DateTime.Now; //自动保存的时候,不保存编辑器的图片 var dic = new Dictionary <string, string>(); if (Body.GetQueryInt("ArticleId") > 0) { dic.Add("ExaminationPaperId", Body.GetQueryString("ArticleId")); } InputTypeParser.AddValuesToAttributes(_tableStyle, _tableName, PublishmentSystemInfo, _relatedIdentities, Request.Form, contentInfo.Attributes, ContentAttribute.HiddenAttributes, !_isAjaxSubmit, dic); StringCollection tagCollection; if (isAjaxSubmit) { contentInfo.ContentGroupNameCollection = Request.Form[ContentAttribute.ContentGroupNameCollection]; tagCollection = TagUtils.ParseTagsString(Request.Form[ContentAttribute.Tags]); contentInfo.CheckedLevel = LevelManager.LevelInt.CaoGao; contentInfo.IsChecked = false; } else { contentInfo.ContentGroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(CblContentGroupNameCollection.Items); tagCollection = TagUtils.ParseTagsString(TbTags.Text); if (PhContentAttributes.Visible) { foreach (ListItem listItem in CblContentAttributes.Items) { var value = listItem.Selected.ToString(); var attributeName = listItem.Value; contentInfo.SetExtendedAttribute(attributeName, value); } } contentInfo.CheckedLevel = TranslateUtils.ToIntWithNagetive(RblContentLevel.SelectedValue); contentInfo.IsChecked = contentInfo.CheckedLevel >= PublishmentSystemInfo.CheckContentLevel; } contentInfo.Tags = TranslateUtils.ObjectCollectionToString(tagCollection, " "); if (isPreview) { savedContentId = DataProvider.ContentDao.InsertPreview(_tableName, PublishmentSystemInfo, _nodeInfo, contentInfo); } else { savedContentId = DataProvider.ContentDao.Insert(_tableName, PublishmentSystemInfo, contentInfo); //判断是不是有审核权限 int checkedLevelOfUser; var isCheckedOfUser = CheckManager.GetUserCheckLevel(Body.AdministratorName, PublishmentSystemInfo, contentInfo.NodeId, out checkedLevelOfUser); if (LevelManager.IsCheckable(PublishmentSystemInfo, contentInfo.NodeId, contentInfo.IsChecked, contentInfo.CheckedLevel, isCheckedOfUser, checkedLevelOfUser)) { //添加审核记录 BaiRongDataProvider.ContentDao.UpdateIsChecked(_tableName, PublishmentSystemId, contentInfo.NodeId, new List <int> { savedContentId }, 0, true, Body.AdministratorName, contentInfo.IsChecked, contentInfo.CheckedLevel, ""); } if (PhTags.Visible) { TagUtils.AddTags(tagCollection, PublishmentSystemId, savedContentId); } } contentInfo.Id = savedContentId; } catch (Exception ex) { LogUtils.AddErrorLog(ex); errorMessage = $"内容添加失败:{ex.Message}"; return(0); } if (!isAjaxSubmit) { if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id); } Body.AddSiteLog(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id, "添加内容", $"栏目:{NodeManager.GetNodeNameNavigation(PublishmentSystemId, contentInfo.NodeId)},内容标题:{contentInfo.Title}"); ContentUtility.Translate(PublishmentSystemInfo, _nodeInfo.NodeId, contentInfo.Id, Request.Form["translateCollection"], ETranslateContentTypeUtils.GetEnumType(DdlTranslateType.SelectedValue), Body.AdministratorName); string contentType = WebUtils.GetContentType(_nodeInfo.ContentModelId); if (contentType.Equals("PageExamination")) { PageUtils.Redirect($@"/siteserver/cms/{contentType}.aspx?PublishmentSystemID={Body.GetQueryString("PublishmentSystemID")}&NodeID={(string.IsNullOrEmpty(Body.GetQueryString("PNodeID")) ? Body.GetQueryString("NodeId") : Body.GetQueryString("PNodeID"))}&ArticleId={Body.GetQueryString("ArticleId")}"); } PageUtils.Redirect(EContentModelTypeUtils.Equals(_nodeInfo.ContentModelId, EContentModelType.Photo) ? PageContentPhotoUpload.GetRedirectUrl(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id, Body.GetQueryString("ReturnUrl")) : PageContentAddAfter.GetRedirectUrl(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id, ReturnUrl)); } } else { var contentInfo = DataProvider.ContentDao.GetContentInfo(_tableStyle, _tableName, contentId); try { var tagsLast = contentInfo.Tags; contentInfo.LastEditUserName = Body.AdministratorName; contentInfo.LastEditDate = DateTime.Now; //自动保存的时候,不保存编辑器的图片 InputTypeParser.AddValuesToAttributes(_tableStyle, _tableName, PublishmentSystemInfo, _relatedIdentities, Request.Form, contentInfo.Attributes, ContentAttribute.HiddenAttributes, !_isAjaxSubmit); StringCollection tagCollection; if (isAjaxSubmit) { contentInfo.ContentGroupNameCollection = Request.Form[ContentAttribute.ContentGroupNameCollection]; tagCollection = TagUtils.ParseTagsString(Request.Form[ContentAttribute.Tags]); } else { contentInfo.ContentGroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(CblContentGroupNameCollection.Items); tagCollection = TagUtils.ParseTagsString(TbTags.Text); if (PhContentAttributes.Visible) { foreach (ListItem listItem in CblContentAttributes.Items) { var value = listItem.Selected.ToString(); var attributeName = listItem.Value; contentInfo.SetExtendedAttribute(attributeName, value); } } var checkedLevel = TranslateUtils.ToIntWithNagetive(RblContentLevel.SelectedValue); if (checkedLevel != LevelManager.LevelInt.NotChange) { contentInfo.IsChecked = checkedLevel >= PublishmentSystemInfo.CheckContentLevel; contentInfo.CheckedLevel = checkedLevel; } } contentInfo.Tags = TranslateUtils.ObjectCollectionToString(tagCollection, " "); DataProvider.ContentDao.Update(_tableName, PublishmentSystemInfo, contentInfo); if (PhTags.Visible) { TagUtils.UpdateTags(tagsLast, contentInfo.Tags, tagCollection, PublishmentSystemId, contentId); } if (!isAjaxSubmit) { ContentUtility.Translate(PublishmentSystemInfo, _nodeInfo.NodeId, contentInfo.Id, Request.Form["translateCollection"], ETranslateContentTypeUtils.GetEnumType(DdlTranslateType.SelectedValue), Body.AdministratorName); if (EContentModelTypeUtils.Equals(_nodeInfo.ContentModelId, EContentModelType.Photo)) { PageUtils.Redirect(PageContentPhotoUpload.GetRedirectUrl(PublishmentSystemId, _nodeInfo.NodeId, contentInfo.Id, Body.GetQueryString("ReturnUrl"))); } //更新引用该内容的信息 //如果不是异步自动保存,那么需要将引用此内容的content修改 var sourceContentIdList = new List <int> { contentInfo.Id }; var tableList = BaiRongDataProvider.TableCollectionDao.GetAuxiliaryTableListCreatedInDbByAuxiliaryTableType(EAuxiliaryTableType.BackgroundContent, EAuxiliaryTableType.JobContent, EAuxiliaryTableType.VoteContent); foreach (var table in tableList) { var targetContentIdList = BaiRongDataProvider.ContentDao.GetReferenceIdList(table.TableEnName, sourceContentIdList); foreach (int targetContentId in targetContentIdList) { var targetContentInfo = DataProvider.ContentDao.GetContentInfo(ETableStyleUtils.GetEnumType(table.AuxiliaryTableType.ToString()), table.TableEnName, targetContentId); if (targetContentInfo != null && targetContentInfo.GetExtendedAttribute(ContentAttribute.TranslateContentType) == ETranslateContentType.ReferenceContent.ToString()) { contentInfo.Id = targetContentId; contentInfo.PublishmentSystemId = targetContentInfo.PublishmentSystemId; contentInfo.NodeId = targetContentInfo.NodeId; contentInfo.SourceId = targetContentInfo.SourceId; contentInfo.ReferenceId = targetContentInfo.ReferenceId; contentInfo.Taxis = targetContentInfo.Taxis; contentInfo.SetExtendedAttribute(ContentAttribute.TranslateContentType, targetContentInfo.GetExtendedAttribute(ContentAttribute.TranslateContentType)); BaiRongDataProvider.ContentDao.Update(table.TableEnName, contentInfo); //资源:图片,文件,视频 var targetPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(targetContentInfo.PublishmentSystemId); var bgContentInfo = contentInfo as BackgroundContentInfo; var bgTargetContentInfo = targetContentInfo as BackgroundContentInfo; if (bgTargetContentInfo != null && bgContentInfo != null) { if (bgContentInfo.ImageUrl != bgTargetContentInfo.ImageUrl) { //修改图片 var sourceImageUrl = PathUtility.MapPath(PublishmentSystemInfo, bgContentInfo.ImageUrl); CopyReferenceFiles(targetPublishmentSystemInfo, sourceImageUrl); } else if (bgContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl)) != bgTargetContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl))) { var sourceImageUrls = TranslateUtils.StringCollectionToStringList(bgContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl))); foreach (string imageUrl in sourceImageUrls) { var sourceImageUrl = PathUtility.MapPath(PublishmentSystemInfo, imageUrl); CopyReferenceFiles(targetPublishmentSystemInfo, sourceImageUrl); } } if (bgContentInfo.FileUrl != bgTargetContentInfo.FileUrl) { //修改附件 var sourceFileUrl = PathUtility.MapPath(PublishmentSystemInfo, bgContentInfo.FileUrl); CopyReferenceFiles(targetPublishmentSystemInfo, sourceFileUrl); } else if (bgContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl)) != bgTargetContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl))) { var sourceFileUrls = TranslateUtils.StringCollectionToStringList(bgContentInfo.GetExtendedAttribute(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl))); foreach (string fileUrl in sourceFileUrls) { var sourceFileUrl = PathUtility.MapPath(PublishmentSystemInfo, fileUrl); CopyReferenceFiles(targetPublishmentSystemInfo, sourceFileUrl); } } } } } } } } catch (Exception ex) { LogUtils.AddErrorLog(ex); errorMessage = $"内容修改失败:{ex.Message}"; return(0); } if (!isAjaxSubmit) { if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(PublishmentSystemId, _nodeInfo.NodeId, contentId); } Body.AddSiteLog(PublishmentSystemId, _nodeInfo.NodeId, contentId, "修改内容", $"栏目:{NodeManager.GetNodeNameNavigation(PublishmentSystemId, contentInfo.NodeId)},内容标题:{contentInfo.Title}"); string contentType = WebUtils.GetContentType(_nodeInfo.ContentModelId); PageUtils.Redirect($@"/siteserver/cms/{contentType}.aspx?PublishmentSystemID={Body.GetQueryString("PublishmentSystemID")}&NodeID={(string.IsNullOrEmpty( Body.GetQueryString("PNodeID"))? Body.GetQueryString("NodeId"): Body.GetQueryString("PNodeID"))}"); //PageUtils.Redirect(ReturnUrl); } savedContentId = contentId; } return(savedContentId); }
public override void Submit_OnClick(object sender, EventArgs e) { var isChanged = false; try { if (_channelId == 0) { var parentId = TranslateUtils.ToInt(ParentID.SelectedValue); if (parentId == 0) { parentId = PublishmentSystemInfo.Additional.GovInteractNodeId; } var nodeId = DataProvider.NodeDao.InsertNodeInfo(PublishmentSystemId, parentId, ChannelName.Text, string.Empty, EContentModelTypeUtils.GetValue(EContentModelType.GovInteract)); var channelInfo = new GovInteractChannelInfo(nodeId, PublishmentSystemId, 0, 0, string.Empty, Summary.Text); DataProvider.GovInteractChannelDao.Insert(channelInfo); } else { var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _channelId); nodeInfo.NodeName = ChannelName.Text; DataProvider.NodeDao.UpdateNodeInfo(nodeInfo); var channelInfo = DataProvider.GovInteractChannelDao.GetChannelInfo(PublishmentSystemId, _channelId); if (channelInfo == null) { channelInfo = new GovInteractChannelInfo(_channelId, PublishmentSystemId, 0, 0, string.Empty, Summary.Text); DataProvider.GovInteractChannelDao.Insert(channelInfo); } else { channelInfo.Summary = Summary.Text; DataProvider.GovInteractChannelDao.Update(channelInfo); } } Body.AddAdminLog("维护分类信息"); SuccessMessage("分类设置成功!"); isChanged = true; } catch (Exception ex) { FailMessage(ex, "分类设置失败!"); } if (isChanged) { PageUtils.CloseModalPageAndRedirect(Page, _returnUrl); } }
public int GetNodeIdByInteractName(int publishmentSystemId, string interactName) { string sqlString = $"SELECT wcm_GovInteractChannel.NodeID FROM wcm_GovInteractChannel INNER JOIN siteserver_Node ON wcm_GovInteractChannel.NodeID = siteserver_Node.NodeID and siteserver_Node.PublishmentSystemID = {publishmentSystemId} AND siteserver_Node.ContentModelID = '{EContentModelTypeUtils.GetValue(EContentModelType.GovInteract)}' AND siteserver_Node.NodeName = @NodeName"; var selectParms = new IDataParameter[] { GetParameter("@NodeName", EDataType.NVarChar, 255, interactName) }; return(BaiRongDataProvider.DatabaseDao.GetIntResult(sqlString, selectParms)); }
public static void Initialize(PublishmentSystemInfo publishmentSystemInfo) { if (publishmentSystemInfo.Additional.GovInteractNodeId > 0) { if (!DataProvider.NodeDao.IsExists(publishmentSystemInfo.Additional.GovInteractNodeId)) { publishmentSystemInfo.Additional.GovInteractNodeId = 0; } } if (publishmentSystemInfo.Additional.GovInteractNodeId == 0) { var govInteractNodeId = DataProvider.NodeDao.GetNodeIdByContentModelType(publishmentSystemInfo.PublishmentSystemId, EContentModelType.GovInteract); if (govInteractNodeId == 0) { govInteractNodeId = DataProvider.NodeDao.InsertNodeInfo(publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.PublishmentSystemId, "互动交流", string.Empty, EContentModelTypeUtils.GetValue(EContentModelType.GovInteract)); } publishmentSystemInfo.Additional.GovInteractNodeId = govInteractNodeId; DataProvider.PublishmentSystemDao.Update(publishmentSystemInfo); } }
public static string GetChannelRowHtml(PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo, bool enabled, ELoadingType loadingType, NameValueCollection additional, string administratorName) { var nodeTreeItem = NodeTreeItem.CreateInstance(nodeInfo, enabled, administratorName); var title = nodeTreeItem.GetItemHtml(loadingType, PageChannel.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId), additional); var rowHtml = string.Empty; if (loadingType == ELoadingType.ContentTree) { rowHtml = $@" <tr treeItemLevel=""{nodeInfo.ParentsCount + 1}""> <td align=""left"" nowrap> {title} </td> </tr> "; } else if (loadingType == ELoadingType.Channel) { var upLink = string.Empty; var downLink = string.Empty; var editUrl = string.Empty; var checkBoxHtml = string.Empty; if (enabled) { if (AdminUtility.HasChannelPermissions(administratorName, nodeInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ChannelEdit)) { var urlEdit = PageChannelEdit.GetRedirectUrl(nodeInfo.PublishmentSystemId, nodeInfo.NodeId, PageChannel.GetRedirectUrl(nodeInfo.PublishmentSystemId, nodeInfo.NodeId)); editUrl = $"<a href=\"{urlEdit}\">编辑</a>"; var urlSubtract = PageUtils.GetCmsUrl(nameof(PageChannel), new NameValueCollection { { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() }, { "Subtract", true.ToString() }, { "NodeID", nodeInfo.NodeId.ToString() } }); upLink = $@"<a href=""{urlSubtract}""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升"" /></a>"; var urlAdd = PageUtils.GetCmsUrl(nameof(PageChannel), new NameValueCollection { { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() }, { "Add", true.ToString() }, { "NodeID", nodeInfo.NodeId.ToString() } }); downLink = $@"<a href=""{urlAdd}""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降"" /></a>"; } checkBoxHtml = $"<input type='checkbox' name='ChannelIDCollection' value='{nodeInfo.NodeId}' />"; } rowHtml = $@" <tr treeItemLevel=""{nodeInfo.ParentsCount + 1}""> <td>{title}</td> <td>{nodeInfo.NodeGroupNameCollection}</td> <td><nobr>{nodeInfo.NodeIndexName}</nobr></td> <td class=""center""> {upLink} </td> <td class=""center""> {downLink} </td> <td class=""center""> {editUrl} </td> <td class=""center""> {checkBoxHtml} </td> </tr> "; } else if (loadingType == ELoadingType.SiteAnalysis) { var contentAddNum = string.Empty; var contentUpdateNum = string.Empty; var startDate = TranslateUtils.ToDateTime(additional["StartDate"]); var endDate = TranslateUtils.ToDateTime(additional["EndDate"]); var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo); var num = DataProvider.ContentDao.GetCountOfContentAdd(tableName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, startDate, endDate, string.Empty); contentAddNum = (num == 0) ? "0" : $"<strong>{num}</strong>"; num = DataProvider.ContentDao.GetCountOfContentUpdate(tableName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, startDate, endDate, string.Empty); contentUpdateNum = (num == 0) ? "0" : $"<strong>{num}</strong>"; rowHtml = $@" <tr treeItemLevel=""{nodeInfo.ParentsCount + 1}""> <td> <nobr>{title}</nobr> </td> <td> {contentAddNum} </td> <td> {contentUpdateNum} </td> </tr> "; } else if (loadingType == ELoadingType.TemplateFilePathRule) { var editLink = string.Empty; var filePath = string.Empty; if (enabled) { var showPopWinString = ModalTemplateFilePathRule.GetOpenWindowString(nodeInfo.PublishmentSystemId, nodeInfo.NodeId); editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>"; } filePath = PageUtility.GetInputChannelUrl(publishmentSystemInfo, nodeInfo); rowHtml = $@" <tr treeItemLevel=""{nodeInfo.ParentsCount + 1}""> <td> <nobr>{title}</nobr> </td> <td> <nobr>{filePath}</nobr> </td> <td class=""center""> {editLink} </td> </tr> "; } else if (loadingType == ELoadingType.ConfigurationCreateDetails) { var editChannelLink = string.Empty; var nodeNames = string.Empty; if (enabled) { var showPopWinString = ModalConfigurationCreateChannel.GetOpenWindowString(nodeInfo.PublishmentSystemId, nodeInfo.NodeId); editChannelLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">触发栏目</a>"; } if (nodeInfo.Additional.Attributes.Count > 0) { var nodeNameBuilder = new StringBuilder(); var nodeIDArrayList = TranslateUtils.StringCollectionToIntList(nodeInfo.Additional.CreateChannelIDsIfContentChanged); foreach (int theNodeID in nodeIDArrayList) { var theNodeInfo = NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, theNodeID); if (theNodeInfo != null) { nodeNameBuilder.Append(theNodeInfo.NodeName).Append(","); } } if (nodeNameBuilder.Length > 0) { nodeNameBuilder.Length--; nodeNames = nodeNameBuilder.ToString(); } } rowHtml = $@" <tr treeItemLevel=""{nodeInfo.ParentsCount + 1}""> <td> <nobr>{title}</nobr> </td> <td> {nodeNames} </td> <td class=""center""> {editChannelLink} </td> </tr> "; } else if (loadingType == ELoadingType.ConfigurationCrossSiteTrans) { var editLink = string.Empty; var contribute = string.Empty; if (enabled) { var showPopWinString = ModalCrossSiteTransEdit.GetOpenWindowString(nodeInfo.PublishmentSystemId, nodeInfo.NodeId); editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>"; } contribute = CrossSiteTransUtility.GetDescription(nodeInfo.PublishmentSystemId, nodeInfo); rowHtml = $@" <tr treeItemLevel=""{nodeInfo.ParentsCount + 1}""> <td>{title}</td> <td>{contribute}</td> <td class=""center"" width=""50"">{editLink}</td> </tr> "; } else if (loadingType == ELoadingType.ConfigurationSignin) { var editLink = string.Empty; if (enabled) { var showPopWinString = ModalConfigurationSignin.GetOpenWindowString(nodeInfo.PublishmentSystemId, nodeInfo.NodeId); editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>"; } //string contribute = CrossSiteTransUtility.GetDescription(nodeInfo.PublishmentSystemID, nodeInfo); var isSign = ""; var SignUser = ""; if (nodeInfo.Additional.IsSignin) { isSign = "是"; } else { isSign = "否"; } //if (!string.IsNullOrEmpty(nodeInfo.Additional.SigninUserGroupCollection)) //{ // ArrayList groupIDlist = TranslateUtils.StringCollectionToIntList(nodeInfo.Additional.SigninUserGroupCollection); // UserGroupInfo userGroupInfo = null; // foreach (int groupID in groupIDlist) // { // userGroupInfo = DataProvider.UserGroupDAO.GetUserGroupMessage(groupID); // SignUser += userGroupInfo.GroupName + ','; // } // SignUser = SignUser.TrimEnd(','); //} //else //{ SignUser = nodeInfo.Additional.SigninUserNameCollection; //} rowHtml = $@" <tr treeItemLevel=""{nodeInfo.ParentsCount + 1}""> <td>{title}</td> <td>{SignUser}</td> <td class=""center"">{isSign}</td> <td class=""center"">{editLink}</td> </tr> "; } else if (loadingType == ELoadingType.ChannelSelect || loadingType == ELoadingType.GovPublicChannelAdd || loadingType == ELoadingType.GovPublicChannelTree) { rowHtml = $@" <tr treeItemLevel=""{nodeInfo.ParentsCount + 1}""> <td nowrap>{title}</td> </tr> "; } else if (loadingType == ELoadingType.GovPublicChannel) { var editUrl = string.Empty; var upLink = string.Empty; var downLink = string.Empty; var checkBoxHtml = string.Empty; if (!EContentModelTypeUtils.Equals(EContentModelType.GovPublic, nodeInfo.ContentModelId)) { enabled = false; } if (enabled) { editUrl = $@"<a href=""javascript:;"" onclick=""{ModalGovPublicChannelAdd .GetOpenWindowStringToEdit(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, string.Empty)}"">编辑</a>"; var urlUp = PageUtils.GetWcmUrl(nameof(PageGovPublicChannel), new NameValueCollection { { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() }, { "NodeID", nodeInfo.NodeId.ToString() }, { "Subtract", true.ToString() } }); upLink = $@"<a href=""{urlUp}""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升"" /></a>"; var urlDown = PageUtils.GetWcmUrl(nameof(PageGovPublicChannel), new NameValueCollection { { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() }, { "NodeID", nodeInfo.NodeId.ToString() }, { "Add", true.ToString() } }); downLink = $@"<a href=""{urlDown}""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降"" /></a>"; checkBoxHtml = $"<input type='checkbox' name='ChannelIDCollection' value='{nodeInfo.NodeId}' />"; } var channelCode = DataProvider.GovPublicChannelDao.GetCode(nodeInfo.NodeId); rowHtml = $@" <tr treeItemLevel=""{nodeInfo.ParentsCount + 1}""> <td>{title}</td> <td>{channelCode}</td> <td class=""center"">{upLink}</td> <td class=""center"">{downLink}</td> <td class=""center"">{editUrl}</td> <td class=""center"">{checkBoxHtml}</td> </tr> "; } else if (loadingType == ELoadingType.GovInteractChannel) { var editUrl = string.Empty; var upLink = string.Empty; var downLink = string.Empty; var styleAddUrl = string.Empty; var checkBoxHtml = string.Empty; if (enabled) { var applyStyleId = DataProvider.GovInteractChannelDao.GetApplyStyleId(nodeInfo.PublishmentSystemId, nodeInfo.NodeId); editUrl = $@"<a href=""javascript:;"" onclick=""{ModalGovInteractChannelAdd .GetOpenWindowStringToEdit(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, string.Empty)}"">编辑</a>"; var urlUp = PageUtils.GetWcmUrl(nameof(PageGovInteractChannel), new NameValueCollection { { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() }, { "NodeID", nodeInfo.NodeId.ToString() }, { "Subtract", true.ToString() } }); upLink = $@"<a href=""{urlUp}""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升"" /></a>"; var urlDown = PageUtils.GetWcmUrl(nameof(PageGovInteractChannel), new NameValueCollection { { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() }, { "NodeID", nodeInfo.NodeId.ToString() }, { "Add", true.ToString() } }); downLink = $@"<a href=""{urlDown}""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降"" /></a>"; styleAddUrl = $@"<a href=""javascript:;"" onclick=""{ModalTagStyleGovInteractApplyAdd.GetOpenWindowStringToEdit(publishmentSystemInfo.PublishmentSystemId, applyStyleId)}"">提交设置</a>"; checkBoxHtml = $"<input type='checkbox' name='ChannelIDCollection' value='{nodeInfo.NodeId}' />"; } var summary = DataProvider.GovInteractChannelDao.GetSummary(nodeInfo.NodeId); rowHtml = $@" <tr treeItemLevel=""{nodeInfo.ParentsCount + 1}""> <td>{title}</td> <td>{summary}</td> <td class=""center"">{upLink}</td> <td class=""center"">{downLink}</td> <td class=""center"">{styleAddUrl}</td> <td class=""center"">{editUrl}</td> <td class=""center"">{checkBoxHtml}</td> </tr> "; } else if (loadingType == ELoadingType.GovPublicChannelAdd || loadingType == ELoadingType.GovPublicChannelTree) { rowHtml = $@" <tr treeItemLevel=""{nodeInfo.ParentsCount + 1}""> <td nowrap>{title}</td> </tr> "; } return(rowHtml); }
public static string GetContentCommands(string administratorName, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo, string pageUrl, string currentFileName, bool isCheckPage) { var iconUrl = SiteServerAssets.GetIconUrl(string.Empty); var modelType = EContentModelTypeUtils.GetEnumType(nodeInfo.ContentModelId); var builder = new StringBuilder(); //添加内容 if (!isCheckPage && AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentAdd) && nodeInfo.Additional.IsContentAddable) { var redirectUrl = GetContentAddAddUrl(publishmentSystemInfo.PublishmentSystemId, nodeInfo, pageUrl); var title = "添加内容"; if (modelType == EContentModelType.GovPublic) { title = "采集信息"; } else if (modelType == EContentModelType.GovInteract) { title = "新增办件"; } else if (modelType == EContentModelType.Photo) { title = "添加图片"; } else if (modelType == EContentModelType.Vote) { title = "发起投票"; } builder.Append( $@"<a href=""{redirectUrl}""><img style=""margin-right: 3px"" src=""{iconUrl}/add.gif"" align=""absMiddle"" />{title}</a> <span class=""gray""> | </span> "); builder.Append($@"<a href=""javascript:;"" onclick=""{ModalContentImport.GetOpenWindowString(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId)}"">导入内容</a> <span class=""gray""> | </span> "); if (modelType != EContentModelType.UserDefined && modelType != EContentModelType.Vote && modelType != EContentModelType.Job && modelType != EContentModelType.GovInteract) { builder.Append( $@"<a href=""javascript:;"" onclick=""{ModalUploadWord.GetOpenWindowString( publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, StringUtils.ValueToUrl(pageUrl))}"">导入Word</a> <span class=""gray""> | </span> "); } } //删 除 if (nodeInfo.ContentNum > 0 && AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentDelete)) { builder.Append( $@"<a href=""javascript:;"" onclick=""{PageContentDelete.GetRedirectClickStringForSingleChannel( publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, false, pageUrl)}"">删 除</a> <span class=""gray""> | </span> "); } if (nodeInfo.ContentNum > 0) { builder.Append( $@"<a href=""javascript:;"" onclick=""{ModalContentExport.GetOpenWindowString( publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId)}"">导 出</a> <span class=""gray""> | </span> "); //设置 if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentEdit)) { builder.Append( $@"<a href=""javascript:;"" onclick=""{ModalContentAttributes.GetOpenWindowString( publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId)}"">设置属性</a> <span class=""gray""> | </span> "); builder.Append( $@"<a href=""javascript:;"" onclick=""{ModalAddToGroup.GetOpenWindowStringToContent( publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId)}"">设置内容组</a> <span class=""gray""> | </span> "); } //转 移 if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentTranslate)) { var redirectUrl = PageContentTranslate.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, pageUrl); var clickString = PageUtils.GetRedirectStringWithCheckBoxValue(redirectUrl, "ContentIDCollection", "ContentIDCollection", "请选择需要转移的内容!"); builder.Append( $@"<a href=""javascript:;"" onclick=""{clickString}"">转 移</a> <span class=""gray""> | </span> "); } //排 序 if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentEdit)) { builder.Append( $@"<a href=""javascript:;"" onclick=""{ModalContentTaxis.GetOpenWindowString( publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, pageUrl)}"">排 序</a> <span class=""gray""> | </span> "); } //整理 if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentOrder)) { builder.Append( $@"<a href=""javascript:;"" onclick=""{ModalContentTidyUp.GetOpenWindowString( publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, pageUrl)}"">整 理</a> <span class=""gray""> | </span> "); } //审 核 if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentCheck)) { builder.Append( $@"<a href=""javascript:;"" onclick=""{ModalContentCheck.GetOpenWindowString( publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, pageUrl)}"">审 核</a> <span class=""gray""> | </span> "); } //归 档 if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentArchive)) { builder.Append( $@"<a href=""javascript:;"" onclick=""{ModalContentArchive.GetOpenWindowString( publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, pageUrl)}"">归 档</a> <span class=""gray""> | </span> "); } //跨站转发 if (CrossSiteTransUtility.IsTranslatable(publishmentSystemInfo, nodeInfo)) { builder.Append( $@"<a href=""javascript:;"" onclick=""{ModalContentCrossSiteTrans.GetOpenWindowString( publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId)}"">跨站转发</a> <span class=""gray""> | </span> "); } //生 成 if (!isCheckPage && (AdminUtility.HasWebsitePermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, AppManager.Cms.Permission.WebSite.Create) || AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.CreatePage))) { builder.Append( $@"<a href=""javascript:;"" onclick=""{Cms.ModalProgressBar .GetOpenWindowStringWithCreateContentsOneByOne(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId)}"">生 成</a> <span class=""gray""> | </span> "); } } //选择显示项 //if (nodeInfo.NodeType != ENodeType.BackgroundImageNode) //{ if (AdminUtility.HasChannelPermissions(administratorName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ChannelEdit)) { builder.Append( $@"<a href=""javascript:;"" onclick=""{ModalSelectColumns.GetOpenWindowStringToContent( publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, true)}"">显示项</a> "); } //} if (!isCheckPage && nodeInfo.ContentNum > 0) { if (builder.Length > 0) { builder.Length = builder.Length - 15; } //builder.Append(GetContentLinks(publishmentSystemInfo, nodeInfo, contentType, currentFileName)); builder.Append( $@" <a href=""javascript:;;"" onClick=""$('#contentSearch').toggle(); return false""><img src=""{iconUrl}/search.gif"" align=""absMiddle"" alt=""快速查找"" /></a>"); } //if (builder.Length > 0) //{ // builder.Length = builder.Length - 16; //} return(builder.ToString()); }
public static string GetContentAddEditUrl(int publishmentSystemId, NodeInfo nodeInfo, int id, string returnUrl) { var modelType = EContentModelTypeUtils.GetEnumType(nodeInfo.ContentModelId); return(GetContentEditUrl(modelType, publishmentSystemId, nodeInfo.NodeId, id, returnUrl)); }
public string GetItemHtml(ELoadingType loadingType, string returnUrl, NameValueCollection additional) { var htmlBuilder = new StringBuilder(); var parentsCount = _nodeInfo.ParentsCount; if (loadingType == ELoadingType.GovPublicChannelAdd || loadingType == ELoadingType.GovPublicChannelTree) { parentsCount = parentsCount - 1; } else if (loadingType == ELoadingType.GovPublicChannel || loadingType == ELoadingType.GovInteractChannel) { parentsCount = parentsCount - 2; } for (var i = 0; i < parentsCount; i++) { htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />"); } if (_nodeInfo.ChildrenCount > 0) { if (_nodeInfo.PublishmentSystemId == _nodeInfo.NodeId) { htmlBuilder.Append( $@"<img align=""absmiddle"" style=""cursor:pointer"" onClick=""displayChildren(this);"" isAjax=""false"" isOpen=""true"" id=""{_nodeInfo.NodeId}"" src=""{_iconMinusUrl}"" />"); } else { htmlBuilder.Append( $@"<img align=""absmiddle"" style=""cursor:pointer"" onClick=""displayChildren(this);"" isAjax=""true"" isOpen=""false"" id=""{_nodeInfo.NodeId}"" src=""{_iconPlusUrl}"" />"); } } else { htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />"); } if (!string.IsNullOrEmpty(_iconFolderUrl)) { if (_nodeInfo.NodeId > 0) { htmlBuilder.Append( $@"<a href=""{PageActions.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId)}"" target=""_blank"" title=""浏览页面""><img align=""absmiddle"" border=""0"" src=""{_iconFolderUrl}"" /></a>"); } else { htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconFolderUrl}"" />"); } } htmlBuilder.Append(" "); if (_enabled) { if (loadingType == ELoadingType.ContentTree) { var linkUrl = PageContent.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId); htmlBuilder.Append( $"<a href='{linkUrl}' isLink='true' onclick='fontWeightLink(this)' target='content'>{_nodeInfo.NodeName}</a>"); } else if (loadingType == ELoadingType.ChannelSelect) { var linkUrl = ModalChannelSelect.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId); if (additional != null) { if (!string.IsNullOrEmpty(additional["linkUrl"])) { linkUrl = additional["linkUrl"] + _nodeInfo.NodeId; } else { foreach (string key in additional.Keys) { linkUrl += $"&{key}={additional[key]}"; } } } htmlBuilder.Append($"<a href='{linkUrl}'>{_nodeInfo.NodeName}</a>"); } else if (loadingType == ELoadingType.GovPublicChannelAdd) { if (EContentModelTypeUtils.Equals(_nodeInfo.ContentModelId, EContentModelType.GovPublic)) { htmlBuilder.Append($@"<a href=""{ModalGovPublicCategoryChannelSelect.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId)}"">{_nodeInfo.NodeName}</a>"); } else { htmlBuilder.Append(_nodeInfo.NodeName); } } else if (loadingType == ELoadingType.GovPublicChannelTree) { var linkUrl = PageContent.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId); htmlBuilder.Append( $"<a href='{linkUrl}' isLink='true' onclick='fontWeightLink(this)' target='content'>{_nodeInfo.NodeName}</a>"); } else { if (AdminUtility.HasChannelPermissions(_administratorName, _nodeInfo.PublishmentSystemId, _nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ChannelEdit)) { var onClickUrl = ModalChannelEdit.GetOpenWindowString(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId, returnUrl); htmlBuilder.Append( $@"<a href=""javascript:;;"" onClick=""{onClickUrl}"" title=""快速编辑栏目"">{_nodeInfo.NodeName}</a>"); } else { htmlBuilder.Append($@"<a href=""javascript:;;"">{_nodeInfo.NodeName}</a>"); } } } else { htmlBuilder.Append(_nodeInfo.NodeName); } if (_nodeInfo.PublishmentSystemId != 0) { var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(_nodeInfo.PublishmentSystemId); htmlBuilder.Append(" "); htmlBuilder.Append(NodeManager.GetNodeTreeLastImageHtml(publishmentSystemInfo, _nodeInfo)); if (_nodeInfo.ContentNum >= 0) { htmlBuilder.Append(" "); htmlBuilder.Append( $@"<span style=""font-size:8pt;font-family:arial"" class=""gray"">({_nodeInfo.ContentNum})</span>"); } } return(htmlBuilder.ToString()); }
private int Validate_PublishmentSystemInfo(out string errorMessage) { try { var isHq = TranslateUtils.ToBool(IsHeadquarters.SelectedValue); // 是否主站 var parentPublishmentSystemId = 0; var publishmentSystemDir = string.Empty; if (isHq == false) { if (DirectoryUtils.IsSystemDirectory(PublishmentSystemDir.Text)) { errorMessage = "文件夹名称不能为系统文件夹名称!"; return(0); } parentPublishmentSystemId = TranslateUtils.ToInt(ParentPublishmentSystemID.SelectedValue); publishmentSystemDir = PublishmentSystemDir.Text; var list = DataProvider.NodeDao.GetLowerSystemDirList(parentPublishmentSystemId); if (list.IndexOf(publishmentSystemDir.ToLower()) != -1) { errorMessage = "已存在相同的发布路径!"; return(0); } if (!DirectoryUtils.IsDirectoryNameCompliant(publishmentSystemDir)) { errorMessage = "文件夹名称不符合系统要求!"; return(0); } } var nodeInfo = new NodeInfo(); nodeInfo.NodeName = nodeInfo.NodeIndexName = "首页"; nodeInfo.NodeType = ENodeType.BackgroundPublishNode; nodeInfo.ContentModelId = EContentModelTypeUtils.GetValue(EContentModelTypeUtils.GetEnumTypeByPublishmentSystemType(_publishmentSystemType)); var publishmentSystemUrl = PageUtils.Combine(WebConfigUtils.ApplicationPath, publishmentSystemDir); var psInfo = BaseTable.GetDefaultPublishmentSystemInfo(PageUtils.FilterXss(PublishmentSystemName.Text), _publishmentSystemType, AuxiliaryTableForContent.SelectedValue, AuxiliaryTableForGovPublic.SelectedValue, AuxiliaryTableForGovInteract.SelectedValue, AuxiliaryTableForVote.SelectedValue, AuxiliaryTableForJob.SelectedValue, publishmentSystemDir, publishmentSystemUrl, parentPublishmentSystemId); if (psInfo.ParentPublishmentSystemId > 0) { var parentPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(psInfo.ParentPublishmentSystemId); psInfo.PublishmentSystemUrl = PageUtils.Combine(parentPublishmentSystemInfo.PublishmentSystemUrl, psInfo.PublishmentSystemDir); } psInfo.IsHeadquarters = isHq; psInfo.Additional.Charset = Charset.SelectedValue; psInfo.IsCheckContentUseLevel = TranslateUtils.ToBool(IsCheckContentUseLevel.SelectedValue); if (psInfo.IsCheckContentUseLevel) { psInfo.CheckContentLevel = TranslateUtils.ToInt(CheckContentLevel.SelectedValue); } var thePublishmentSystemId = DataProvider.NodeDao.InsertPublishmentSystemInfo(nodeInfo, psInfo, Body.AdministratorName); if (_permissions.IsSystemAdministrator && !_permissions.IsConsoleAdministrator) { var publishmentSystemIdList = ProductPermissionsManager.Current.PublishmentSystemIdList ?? new List <int>(); publishmentSystemIdList.Add(thePublishmentSystemId); BaiRongDataProvider.AdministratorDao.UpdatePublishmentSystemIdCollection(Body.AdministratorName, TranslateUtils.ObjectCollectionToString(publishmentSystemIdList)); } Body.AddAdminLog($"新建{EPublishmentSystemTypeUtils.GetText(_publishmentSystemType)}站点", $"站点名称:{PageUtils.FilterXss(PublishmentSystemName.Text)}"); //if (isHQ == EBoolean.False) //{ // string configFilePath = PathUtility.MapPath(psInfo, "@/web.config"); // if (FileUtils.IsFileExists(configFilePath)) // { // FileUtility.UpdateWebConfig(configFilePath, psInfo.Additional.Charset); // } // else // { // FileUtility.CreateWebConfig(configFilePath, psInfo.Additional.Charset); // } //} errorMessage = string.Empty; return(thePublishmentSystemId); } catch (Exception e) { errorMessage = e.Message; return(0); } }
public static void Translate(string administratorName, PublishmentSystemInfo publishmentSystemInfo, int nodeId, int contentId, int targetPublishmentSystemId, int targetNodeId, ETranslateContentType translateType) { if (publishmentSystemInfo == null || nodeId <= 0 || contentId <= 0 || targetPublishmentSystemId <= 0 || targetNodeId <= 0) { return; } var targetPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(targetPublishmentSystemId); var targetTableName = NodeManager.GetTableName(targetPublishmentSystemInfo, targetNodeId); var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, nodeId); var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo); var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo); var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId); if (contentInfo == null) { return; } if (translateType == ETranslateContentType.Copy) { FileUtility.MoveFileByContentInfo(publishmentSystemInfo, targetPublishmentSystemInfo, contentInfo); contentInfo.PublishmentSystemId = targetPublishmentSystemId; contentInfo.SourceId = contentInfo.NodeId; contentInfo.NodeId = targetNodeId; contentInfo.Attributes[ContentAttribute.TranslateContentType] = ETranslateContentType.Copy.ToString(); //contentInfo.Attributes.Add(ContentAttribute.TranslateContentType, ETranslateContentType.Copy.ToString()); var theContentId = DataProvider.ContentDao.Insert(targetTableName, targetPublishmentSystemInfo, contentInfo); if (EContentModelTypeUtils.IsPhoto(nodeInfo.ContentModelId)) { var photoInfoList = DataProvider.PhotoDao.GetPhotoInfoList(publishmentSystemInfo.PublishmentSystemId, contentId); if (photoInfoList.Count > 0) { foreach (var photoInfo in photoInfoList) { photoInfo.PublishmentSystemID = targetPublishmentSystemId; photoInfo.ContentID = theContentId; FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.SmallUrl); FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.MiddleUrl); FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.LargeUrl); DataProvider.PhotoDao.Insert(photoInfo); } } } if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(targetPublishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, theContentId); } } else if (translateType == ETranslateContentType.Cut) { FileUtility.MoveFileByContentInfo(publishmentSystemInfo, targetPublishmentSystemInfo, contentInfo); contentInfo.PublishmentSystemId = targetPublishmentSystemId; contentInfo.SourceId = contentInfo.NodeId; contentInfo.NodeId = targetNodeId; contentInfo.Attributes[ContentAttribute.TranslateContentType] = ETranslateContentType.Cut.ToString(); //contentInfo.Attributes.Add(ContentAttribute.TranslateContentType, ETranslateContentType.Cut.ToString()); if (StringUtils.EqualsIgnoreCase(tableName, targetTableName)) { contentInfo.Taxis = DataProvider.ContentDao.GetTaxisToInsert(targetTableName, targetNodeId, contentInfo.IsTop); DataProvider.ContentDao.Update(targetTableName, targetPublishmentSystemInfo, contentInfo); } else { DataProvider.ContentDao.Insert(targetTableName, targetPublishmentSystemInfo, contentInfo); DataProvider.ContentDao.DeleteContents(publishmentSystemInfo.PublishmentSystemId, tableName, TranslateUtils.ToIntList(contentId), nodeId); } DataProvider.NodeDao.UpdateContentNum(publishmentSystemInfo, nodeId, true); DataProvider.NodeDao.UpdateContentNum(targetPublishmentSystemInfo, targetNodeId, true); if (EContentModelTypeUtils.IsPhoto(nodeInfo.ContentModelId)) { var photoInfoList = DataProvider.PhotoDao.GetPhotoInfoList(publishmentSystemInfo.PublishmentSystemId, contentId); if (photoInfoList.Count > 0) { foreach (var photoInfo in photoInfoList) { photoInfo.PublishmentSystemID = targetPublishmentSystemId; FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.SmallUrl); FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.MiddleUrl); FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.LargeUrl); DataProvider.PhotoDao.Update(photoInfo); } } } if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(targetPublishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, contentInfo.Id); } } else if (translateType == ETranslateContentType.Reference) { if (contentInfo.ReferenceId != 0) { return; } contentInfo.PublishmentSystemId = targetPublishmentSystemId; contentInfo.SourceId = contentInfo.NodeId; contentInfo.NodeId = targetNodeId; contentInfo.ReferenceId = contentId; contentInfo.Attributes[ContentAttribute.TranslateContentType] = ETranslateContentType.Reference.ToString(); //contentInfo.Attributes.Add(ContentAttribute.TranslateContentType, ETranslateContentType.Reference.ToString()); DataProvider.ContentDao.Insert(targetTableName, targetPublishmentSystemInfo, contentInfo); } else if (translateType == ETranslateContentType.ReferenceContent) { if (contentInfo.ReferenceId != 0) { return; } FileUtility.MoveFileByContentInfo(publishmentSystemInfo, targetPublishmentSystemInfo, contentInfo); contentInfo.PublishmentSystemId = targetPublishmentSystemId; contentInfo.SourceId = contentInfo.NodeId; contentInfo.NodeId = targetNodeId; contentInfo.ReferenceId = contentId; contentInfo.Attributes[ContentAttribute.TranslateContentType] = ETranslateContentType.ReferenceContent.ToString(); var theContentId = DataProvider.ContentDao.Insert(targetTableName, targetPublishmentSystemInfo, contentInfo); if (EContentModelTypeUtils.IsPhoto(nodeInfo.ContentModelId)) { var photoInfoList = DataProvider.PhotoDao.GetPhotoInfoList(publishmentSystemInfo.PublishmentSystemId, contentId); if (photoInfoList.Count > 0) { foreach (var photoInfo in photoInfoList) { photoInfo.PublishmentSystemID = targetPublishmentSystemId; photoInfo.ContentID = theContentId; FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.SmallUrl); FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.MiddleUrl); FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.LargeUrl); DataProvider.PhotoDao.Insert(photoInfo); } } } if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(targetPublishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, theContentId); } } }