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 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 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 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, "索引号重新生成失败!"); } } }
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 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 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); } }
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 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 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()); }