public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); if (Body.IsQueryExists("Delete")) { var modelId = Body.GetQueryString("ModelID"); try { BaiRongDataProvider.ContentModelDao.Delete(modelId, PublishmentSystemId); Body.AddSiteLog(PublishmentSystemId, "删除内容模型", $"内容模型:{modelId}"); SuccessDeleteMessage(); } catch (Exception ex) { FailDeleteMessage(ex); } } if (!IsPostBack) { BreadCrumb(AppManager.Cms.LeftMenu.IdConfigration, AppManager.Cms.LeftMenu.Configuration.IdConfigurationContentModel, "内容模型管理", AppManager.Cms.Permission.WebSite.Configration); dgContents.DataSource = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo); dgContents.ItemDataBound += dgContents_ItemDataBound; dgContents.DataBind(); AddContentModel.Attributes.Add("onclick", ModalContentModelAdd.GetOpenWindowStringToAdd(PublishmentSystemId)); } }
public static bool CreateAccessFileForContents(string filePath, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo, List <int> contentIDArrayList, List <string> displayAttributes, bool isPeriods, string dateFrom, string dateTo, ETriState checkedState) { DirectoryUtils.CreateDirectoryIfNotExists(DirectoryUtils.GetDirectoryPath(filePath)); FileUtils.DeleteFileIfExists(filePath); var sourceFilePath = SiteServerAssets.GetPath(SiteServerAssets.Default.AccessMdb); FileUtils.CopyFile(sourceFilePath, filePath); var relatedidentityes = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId); var modelInfo = ContentModelManager.GetContentModelInfo(publishmentSystemInfo, nodeInfo.ContentModelId); var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo); var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, modelInfo.TableName, relatedidentityes); styleInfoList = ContentUtility.GetAllTableStyleInfoList(publishmentSystemInfo, tableStyle, styleInfoList); var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo); var accessDAO = new AccessDao(filePath); var createTableSqlString = accessDAO.GetCreateTableSqlString(nodeInfo.NodeName, styleInfoList, displayAttributes); accessDAO.ExecuteSqlString(createTableSqlString); bool isExport; var insertSqlArrayList = accessDAO.GetInsertSqlStringArrayList(nodeInfo.NodeName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, tableStyle, tableName, styleInfoList, displayAttributes, contentIDArrayList, isPeriods, dateFrom, dateTo, checkedState, out isExport); foreach (string insertSql in insertSqlArrayList) { accessDAO.ExecuteSqlString(insertSql); } return(isExport); }
public static void CreateExcelFileForContents(string filePath, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo, List <int> contentIdList, List <string> displayAttributes, bool isPeriods, string startDate, string endDate, ETriState checkedState) { DirectoryUtils.CreateDirectoryIfNotExists(DirectoryUtils.GetDirectoryPath(filePath)); FileUtils.DeleteFileIfExists(filePath); var head = new List <string>(); var rows = new List <List <string> >(); var relatedidentityes = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId); var modelInfo = ContentModelManager.GetContentModelInfo(publishmentSystemInfo, nodeInfo.ContentModelId); var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo); var tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, modelInfo.TableName, relatedidentityes); tableStyleInfoList = ContentUtility.GetAllTableStyleInfoList(publishmentSystemInfo, tableStyle, tableStyleInfoList); var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo); foreach (var tableStyleInfo in tableStyleInfoList) { if (displayAttributes.Contains(tableStyleInfo.AttributeName)) { head.Add(tableStyleInfo.DisplayName); } } if (contentIdList == null || contentIdList.Count == 0) { contentIdList = BaiRongDataProvider.ContentDao.GetContentIdList(tableName, nodeInfo.NodeId, isPeriods, startDate, endDate, checkedState); } foreach (var contentId in contentIdList) { var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId); if (contentInfo != null) { var row = new List <string>(); foreach (var tableStyleInfo in tableStyleInfoList) { if (displayAttributes.Contains(tableStyleInfo.AttributeName)) { var value = contentInfo.GetExtendedAttribute(tableStyleInfo.AttributeName); row.Add(StringUtils.StripTags(value)); } } rows.Add(row); } } CsvUtils.Export(filePath, head, rows); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var nodeId = Body.GetQueryInt("NodeID", PublishmentSystemId); _nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId); _modelInfo = ContentModelManager.GetContentModelInfo(PublishmentSystemInfo, _nodeInfo.ContentModelId); _tableStyle = EAuxiliaryTableTypeUtils.GetTableStyle(_modelInfo.TableType); _redirectUrl = GetRedirectUrl(PublishmentSystemId, nodeId); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId); if (!IsPostBack) { BreadCrumb(AppManager.Cms.LeftMenu.IdConfigration, AppManager.Cms.LeftMenu.Configuration.IdConfigurationContentModel, "内容字段管理", AppManager.Cms.Permission.WebSite.Configration); //删除样式 if (Body.IsQueryExists("DeleteStyle")) { DeleteStyle(); } else if (Body.IsQueryExists("SetTaxis")) { SetTaxis(); } InfoMessage( $"在此编辑内容模型字段,子栏目默认继承父栏目字段设置; 辅助表:{BaiRongDataProvider.TableCollectionDao.GetTableCnName(_modelInfo.TableName)}({_modelInfo.TableName}); 内容模型:{_modelInfo.ModelName}"); NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, false, true, true, Body.AdministratorName); ControlUtils.SelectListItems(NodeIDDropDownList, nodeId.ToString()); var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, _modelInfo.TableName, _relatedIdentities); dgContents.DataSource = styleInfoList; dgContents.ItemDataBound += dgContents_ItemDataBound; dgContents.DataBind(); AddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(PublishmentSystemId, 0, _relatedIdentities, _modelInfo.TableName, string.Empty, _tableStyle, _redirectUrl)); AddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(PublishmentSystemId, _relatedIdentities, _modelInfo.TableName, _tableStyle, _redirectUrl)); Import.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_modelInfo.TableName, _tableStyle, PublishmentSystemId, nodeId)); Export.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableStyle, _modelInfo.TableName, PublishmentSystemId, nodeId)); } }
private void LoadDisplayAttributeCheckBoxList() { var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId); var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId); var modelInfo = ContentModelManager.GetContentModelInfo(PublishmentSystemInfo, nodeInfo.ContentModelId); var tableStyle = EAuxiliaryTableTypeUtils.GetTableStyle(modelInfo.TableType); var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, modelInfo.TableName, relatedIdentities); styleInfoList = ContentUtility.GetAllTableStyleInfoList(PublishmentSystemInfo, tableStyle, styleInfoList); foreach (var styleInfo in styleInfoList) { var listItem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); listItem.Selected = styleInfo.IsVisible; cblDisplayAttributes.Items.Add(listItem); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ReturnUrl"); var nodeId = Body.GetQueryInt("NodeID"); _returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl")); if (!IsPostBack) { ContentModelID.Items.Add(new ListItem("<<与父栏目相同>>", string.Empty)); var contentModelInfoList = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo); foreach (var modelInfo in contentModelInfoList) { ContentModelID.Items.Add(new ListItem(modelInfo.ModelName, modelInfo.ModelId)); } ChannelTemplateID.DataSource = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ChannelTemplate); ContentTemplateID.DataSource = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ContentTemplate); ChannelTemplateID.DataBind(); ChannelTemplateID.Items.Insert(0, new ListItem("<未设置>", "0")); ChannelTemplateID.Items[0].Selected = true; ContentTemplateID.DataBind(); ContentTemplateID.Items.Insert(0, new ListItem("<未设置>", "0")); ContentTemplateID.Items[0].Selected = true; divSelectChannel.Attributes.Add("onclick", ModalChannelSelect.GetOpenWindowString(PublishmentSystemId)); ltlSelectChannelScript.Text = $@"<script>selectChannel('{NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeId)}', '{nodeId}');</script>"; } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ReturnUrl"); var nodeId = Body.GetQueryInt("NodeID"); _nodeInfo = NodeManager.GetNodeInfo(1, nodeId); var contentId = Body.GetQueryInt("ID"); string contentType = WebUtils.GetContentType(_nodeInfo.ContentModelId); ReturnUrl = $@"/siteserver/cms/{contentType}.aspx?PublishmentSystemID=1&NodeId={nodeId}"; ReturnPUrl = $@"/siteserver/cms/{contentType}.aspx?PublishmentSystemID=1&NodeId={ (Body.GetQueryInt("PNodeID")==0? nodeId:Body.GetQueryInt("PNodeID"))}"; //ReturnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl")); _isAjaxSubmit = Body.GetQueryBool("isAjaxSubmit"); _isPreview = Body.GetQueryBool("isPreview"); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo); _tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo); //_tableName = "model_content"; _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId); ContentInfo contentInfo = null; if (_isAjaxSubmit == false) { if (contentId == 0) { if (_nodeInfo != null && _nodeInfo.Additional.IsContentAddable == false) { PageUtils.RedirectToErrorPage("此栏目不能添加内容!"); return; } if (!HasChannelPermissions(nodeId, AppManager.Cms.Permission.Channel.ContentAdd)) { if (!Body.IsAdministratorLoggin) { PageUtils.RedirectToLoginPage(); return; } else { PageUtils.RedirectToErrorPage("您无此栏目的添加内容权限!"); return; } } } else { contentInfo = DataProvider.ContentDao.GetContentInfo(_tableStyle, _tableName, contentId); if (!HasChannelPermissions(nodeId, AppManager.Cms.Permission.Channel.ContentEdit)) { if (!Body.IsAdministratorLoggin) { PageUtils.RedirectToLoginPage(); return; } PageUtils.RedirectToErrorPage("您无此栏目的修改内容权限!"); return; } } if (!IsPostBack) { var nodeNames = NodeManager.GetNodeNameNavigation(PublishmentSystemId, _nodeInfo.NodeId); var pageTitle = (contentId == 0) ? $"添加{ContentModelManager.GetContentModelInfo(PublishmentSystemInfo, _nodeInfo.ContentModelId).ModelName}" : $"编辑{ContentModelManager.GetContentModelInfo(PublishmentSystemInfo, _nodeInfo.ContentModelId).ModelName}"; BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdContent, pageTitle, nodeNames, string.Empty); LtlPageTitle.Text = pageTitle; LtlPageTitle.Text += $@" <script language=""javascript"" type=""text/javascript""> var previewUrl = '{PagePreview.GetRedirectUrl(PublishmentSystemId, _nodeInfo.NodeId, contentId, 0, 0)}'; </script> "; if (PublishmentSystemInfo.Additional.IsAutoSaveContent && PublishmentSystemInfo.Additional.AutoSaveContentInterval > 0) { LtlPageTitle.Text += $@" <input type=""hidden"" id=""savedContentID"" name=""savedContentID"" value=""{contentId}""> <script language=""javascript"" type=""text/javascript"">setInterval(""autoSave()"",{PublishmentSystemInfo.Additional.AutoSaveContentInterval*1000});</script> "; } //专题 if (contentId == 0) { var specialParentId = DataProvider.NodeDao.GetSpecialParentId(); NodeIdDic = new Dictionary <NodeInfo, List <NodeInfo> >(); if (nodeId != 0 && nodeId == specialParentId) { PhSpecial.Visible = true; PhCategory.Visible = true; var specialNodeIdList = DataProvider.NodeDao.GetNodeInfoListByParentId(1, specialParentId); List <NodeInfo> secondLevel = new List <NodeInfo>(); foreach (var nodeInfo in specialNodeIdList) { var secondChild = DataProvider.NodeDao.GetNodeInfoListByParentId(1, nodeInfo.NodeId); if (secondChild != null && secondChild.Count > 0) { NodeIdDic.Add(nodeInfo, secondChild); } } if (NodeIdDic != null && NodeIdDic.Count > 0) { KeyValuePair <NodeInfo, List <NodeInfo> > kv = NodeIdDic.First(); var defaultItem = new ListItem(kv.Key.NodeName, kv.Key.NodeId.ToString()); defaultItem.Selected = true; TbSpecial.Items.Add(defaultItem); foreach (var info in kv.Value) { TbCategory.Items.Add(new ListItem(info.NodeName, info.NodeId.ToString())); } foreach (var info in specialNodeIdList) { if (info.NodeId != kv.Key.NodeId) { TbSpecial.Items.Add(new ListItem(info.NodeName, info.NodeId.ToString())); } } } } else { //信息类型 var childSpecial = DataProvider.NodeDao.GetNodeInfoListByParentId(1, nodeId); if (childSpecial != null && childSpecial.Count > 0) { PhCategory.Visible = true; foreach (var nodeInfo in childSpecial) { var item = new ListItem(nodeInfo.NodeName, nodeInfo.NodeId.ToString()); TbCategory.Items.Add(item); } } } } else { PhSpecial.Visible = false; PhCategory.Visible = true; TbCategory.Items.Add(new ListItem(_nodeInfo.NodeName, _nodeInfo.NodeId.ToString())); //if (_nodeInfo.ParentsCount == 1) //{ // PhSpecial.Visible = false; // PhCategory.Visible = true; // TbSpecial.Items.Add(new ListItem(_nodeInfo.NodeName, _nodeInfo.NodeId.ToString())); //}else if(_nodeInfo.ParentsCount == 1) } //转移 if (AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, _nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ContentTranslate)) { PhTranslate.Visible = PublishmentSystemInfo.Additional.IsTranslate; DivTranslateAdd.Attributes.Add("onclick", ModalChannelMultipleSelect.GetOpenWindowString(PublishmentSystemId, true)); ETranslateContentTypeUtils.AddListItems(DdlTranslateType, true); ControlUtils.SelectListItems(DdlTranslateType, ETranslateContentTypeUtils.GetValue(ETranslateContentType.Copy)); } else { PhTranslate.Visible = false; } //内容属性 var excludeAttributeNames = TableManager.GetExcludeAttributeNames(_tableStyle); AcAttributes.AddExcludeAttributeNames(excludeAttributeNames); if (excludeAttributeNames.Count == 0) { PhContentAttributes.Visible = false; } else { PhContentAttributes.Visible = true; foreach (var attributeName in excludeAttributeNames) { var styleInfo = TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, attributeName, _relatedIdentities); if (styleInfo.IsVisible) { var listItem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); if (contentId > 0) { listItem.Selected = TranslateUtils.ToBool(contentInfo?.GetExtendedAttribute(styleInfo.AttributeName)); } else { if (TranslateUtils.ToBool(styleInfo.DefaultValue)) { listItem.Selected = true; } } CblContentAttributes.Items.Add(listItem); } } } //内容组 var contentGroupNameList = DataProvider.ContentGroupDao.GetContentGroupNameList(PublishmentSystemId); if (!PublishmentSystemInfo.Additional.IsGroupContent || contentGroupNameList.Count == 0) { PhContentGroup.Visible = false; } else { foreach (var groupName in contentGroupNameList) { var item = new ListItem(groupName, groupName); if (contentId > 0) { item.Selected = StringUtils.In(contentInfo?.ContentGroupNameCollection, groupName); } CblContentGroupNameCollection.Items.Add(item); } } //标签 if (!PublishmentSystemInfo.Additional.IsRelatedByTags) { PhTags.Visible = false; } else { var tagScript = @" <script type=""text/javascript""> function getTags(tag){ $.get('[url]&tag=' + encodeURIComponent(tag) + '&r=' + Math.random(), function(data) { if(data !=''){ var arr = data.split('|'); var temp=''; for(i=0;i<arr.length;i++) { temp += '<li><a>'+arr[i].replace(tag,'<b>' + tag + '</b>') + '</a></li>'; } var myli='<ul>'+temp+'</ul>'; $('#tagTips').html(myli); $('#tagTips').show(); }else{ $('#tagTips').hide(); } $('#tagTips li').click(function () { var tag = $('#TbTags').val(); var i = tag.lastIndexOf(' '); if (i > 0) { tag = tag.substring(0, i) + ' ' + $(this).text(); }else{ tag = $(this).text(); } $('#TbTags').val(tag); $('#tagTips').hide(); }) }); } $(document).ready(function () { $('#TbTags').keyup(function (e) { if (e.keyCode != 40 && e.keyCode != 38) { var tag = $('#TbTags').val(); var i = tag.lastIndexOf(' '); if (i > 0){ tag = tag.substring(i + 1);} if (tag != '' && tag != ' '){ window.setTimeout(""getTags('"" + tag + ""');"", 200); }else{ $('#tagTips').hide(); } } }).blur(function () { window.setTimeout(""$('#tagTips').hide();"", 200); })}); </script> <div id=""tagTips"" class=""inputTips""></div> "; LtlTags.Text = tagScript.Replace("[url]", AjaxCmsService.GetTagsUrl(PublishmentSystemId)); } if (contentId == 0) { var formCollection = new NameValueCollection(); if (Body.IsQueryExists("isUploadWord")) { var isFirstLineTitle = Body.GetQueryBool("isFirstLineTitle"); var isFirstLineRemove = Body.GetQueryBool("isFirstLineRemove"); var isClearFormat = Body.GetQueryBool("isClearFormat"); var isFirstLineIndent = Body.GetQueryBool("isFirstLineIndent"); var isClearFontSize = Body.GetQueryBool("isClearFontSize"); var isClearFontFamily = Body.GetQueryBool("isClearFontFamily"); var isClearImages = Body.GetQueryBool("isClearImages"); var contentLevel = Body.GetQueryInt("contentLevel"); var fileName = Body.GetQueryString("fileName"); formCollection = WordUtils.GetWordNameValueCollection(PublishmentSystemId, _nodeInfo.ContentModelId, isFirstLineTitle, isFirstLineRemove, isClearFormat, isFirstLineIndent, isClearFontSize, isClearFontFamily, isClearImages, contentLevel, fileName); } AcAttributes.SetParameters(formCollection, PublishmentSystemInfo, _nodeInfo.NodeId, _relatedIdentities, _tableStyle, _tableName, false, IsPostBack); } else { AcAttributes.SetParameters(contentInfo?.Attributes, PublishmentSystemInfo, _nodeInfo.NodeId, _relatedIdentities, _tableStyle, _tableName, true, IsPostBack); TbTags.Text = contentInfo?.Tags; } if (HasChannelPermissions(nodeId, AppManager.Cms.Permission.Channel.ContentCheck)) { PhStatus.Visible = true; int checkedLevel; var isChecked = CheckManager.GetUserCheckLevel(Body.AdministratorName, PublishmentSystemInfo, _nodeInfo.NodeId, out checkedLevel); if (Body.IsQueryExists("contentLevel")) { checkedLevel = TranslateUtils.ToIntWithNagetive(Body.GetQueryString("contentLevel")); if (checkedLevel != LevelManager.LevelInt.NotChange) { isChecked = checkedLevel >= PublishmentSystemInfo.CheckContentLevel; } } LevelManager.LoadContentLevelToEdit(RblContentLevel, PublishmentSystemInfo, nodeId, contentInfo, isChecked, checkedLevel); } else { PhStatus.Visible = false; } BtnSubmit.Attributes.Add("onclick", InputParserUtils.GetValidateSubmitOnClickScript("myForm", true, "autoCheckKeywords()")); //自动检测敏感词 ClientScriptRegisterStartupScript("autoCheckKeywords", WebUtils.GetAutoCheckKeywordsScript(PublishmentSystemInfo)); } else { AcAttributes.SetParameters(Request.Form, PublishmentSystemInfo, _nodeInfo.NodeId, _relatedIdentities, _tableStyle, _tableName, contentId != 0, IsPostBack); } DataBind(); } else { var success = false; string errorMessage; var savedContentId = SaveContentInfo(true, _isPreview, out errorMessage); if (savedContentId > 0) { success = true; } string jsonString = $@"{{success:'{success.ToString().ToLower()}',savedContentID:'{savedContentId}'}}"; PageUtils.ResponseToJson(jsonString); } }
public static List <BackgroundContentInfo> GetContentsByCsvFile(string filePath, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo) { var contentInfoList = new List <BackgroundContentInfo>(); List <string> head; List <List <string> > rows; CsvUtils.Import(filePath, out head, out rows); if (rows.Count > 0) { var relatedidentityes = RelatedIdentities.GetChannelRelatedIdentities( publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId); var modelInfo = ContentModelManager.GetContentModelInfo(publishmentSystemInfo, nodeInfo.ContentModelId); var tableStyle = EAuxiliaryTableTypeUtils.GetTableStyle(modelInfo.TableType); // ArrayList tableStyleInfoArrayList = TableStyleManager.GetTableStyleInfoArrayList(ETableStyle.BackgroundContent, publishmentSystemInfo.AuxiliaryTableForContent, relatedidentityes); var tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, modelInfo.TableName, relatedidentityes); tableStyleInfoList = ContentUtility.GetAllTableStyleInfoList(publishmentSystemInfo, tableStyle, tableStyleInfoList); var nameValueCollection = new NameValueCollection(); foreach (var styleInfo in tableStyleInfoList) { nameValueCollection[styleInfo.DisplayName] = styleInfo.AttributeName.ToLower(); } var attributeNames = new List <string>(); foreach (var columnName in head) { if (!string.IsNullOrEmpty(nameValueCollection[columnName])) { attributeNames.Add(nameValueCollection[columnName]); } else { attributeNames.Add(columnName); } } foreach (var row in rows) { var contentInfo = new BackgroundContentInfo(); if (row.Count != attributeNames.Count) { continue; } for (var i = 0; i < attributeNames.Count; i++) { var attributeName = attributeNames[i]; if (!string.IsNullOrEmpty(attributeName)) { var value = row[i]; contentInfo.SetExtendedAttribute(attributeName, value); } } if (!string.IsNullOrEmpty(contentInfo.Title)) { contentInfo.PublishmentSystemId = publishmentSystemInfo.PublishmentSystemId; contentInfo.NodeId = nodeInfo.NodeId; contentInfo.LastEditDate = DateTime.Now; contentInfoList.Add(contentInfo); } } } return(contentInfoList); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ReturnUrl"); _nodeId = Body.GetQueryInt("NodeID"); _returnUrl = StringUtils.ValueFromUrl(PageUtils.FilterSqlAndXss(Body.GetQueryString("ReturnUrl"))); //if (!base.HasChannelPermissions(this.nodeID, AppManager.CMS.Permission.Channel.ChannelAdd)) //{ // PageUtils.RedirectToErrorPage("您没有添加栏目的权限!"); // return; //} var parentNodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId); if (parentNodeInfo.Additional.IsChannelAddable == false) { PageUtils.RedirectToErrorPage("此栏目不能添加子栏目!"); return; } channelControl = (ChannelAuxiliaryControl)FindControl("ControlForAuxiliary"); if (!IsPostBack) { BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "添加栏目", string.Empty); NodeManager.AddListItems(ParentNodeID.Items, PublishmentSystemInfo, true, true, true, Body.AdministratorName); ControlUtils.SelectListItems(ParentNodeID, _nodeId.ToString()); var contentModelInfoList = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo); foreach (var modelInfo in contentModelInfoList) { ContentModelID.Items.Add(new ListItem(modelInfo.ModelName, modelInfo.ModelId)); } ControlUtils.SelectListItems(ContentModelID, parentNodeInfo.ContentModelId); channelControl.SetParameters(null, false, IsPostBack); NavigationPicPath.Attributes.Add("onchange", GetShowImageScript("preview_NavigationPicPath", PublishmentSystemInfo.PublishmentSystemUrl)); var showPopWinString = ModalFilePathRule.GetOpenWindowString(PublishmentSystemId, _nodeId, true, ChannelFilePathRule.ClientID); CreateChannelRule.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalFilePathRule.GetOpenWindowString(PublishmentSystemId, _nodeId, false, ContentFilePathRule.ClientID); CreateContentRule.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, NavigationPicPath.ClientID); SelectImage.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalUploadImage.GetOpenWindowString(PublishmentSystemId, NavigationPicPath.ClientID); UploadImage.Attributes.Add("onclick", showPopWinString); IsChannelAddable.Items[0].Value = true.ToString(); IsChannelAddable.Items[1].Value = false.ToString(); IsContentAddable.Items[0].Value = true.ToString(); IsContentAddable.Items[1].Value = false.ToString(); ELinkTypeUtils.AddListItems(LinkType); NodeGroupNameCollection.DataSource = DataProvider.NodeGroupDao.GetDataSource(PublishmentSystemId); ChannelTemplateID.DataSource = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ChannelTemplate); ContentTemplateID.DataSource = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ContentTemplate); DataBind(); ChannelTemplateID.Items.Insert(0, new ListItem("<未设置>", "0")); ChannelTemplateID.Items[0].Selected = true; ContentTemplateID.Items.Insert(0, new ListItem("<未设置>", "0")); ContentTemplateID.Items[0].Selected = true; Content.SetParameters(PublishmentSystemInfo, NodeAttribute.Content, null, false, IsPostBack); } else { channelControl.SetParameters(Request.Form, false, IsPostBack); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ReturnUrl"); _nodeId = Body.GetQueryInt("NodeID"); _returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl")); if (Body.GetQueryString("CanNotEdit") == null && Body.GetQueryString("UncheckedChannel") == null) { if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ChannelEdit)) { PageUtils.RedirectToErrorPage("您没有修改栏目的权限!"); return; } } if (Body.IsQueryExists("CanNotEdit")) { Submit.Visible = false; } var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId); if (nodeInfo != null) { channelControl = (ChannelAuxiliaryControl)FindControl("ControlForAuxiliary"); if (!IsPostBack) { BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "编辑栏目", string.Empty); var contentModelInfoList = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo); foreach (var modelInfo in contentModelInfoList) { ContentModelID.Items.Add(new ListItem(modelInfo.ModelName, modelInfo.ModelId)); } ControlUtils.SelectListItems(ContentModelID, nodeInfo.ContentModelId); channelControl.SetParameters(nodeInfo.Additional.Attributes, true, IsPostBack); NavigationPicPath.Attributes.Add("onchange", GetShowImageScript("preview_NavigationPicPath", PublishmentSystemInfo.PublishmentSystemUrl)); var showPopWinString = ModalFilePathRule.GetOpenWindowString(PublishmentSystemId, _nodeId, true, ChannelFilePathRule.ClientID); CreateChannelRule.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalFilePathRule.GetOpenWindowString(PublishmentSystemId, _nodeId, false, ContentFilePathRule.ClientID); CreateContentRule.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, NavigationPicPath.ClientID); SelectImage.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalUploadImage.GetOpenWindowString(PublishmentSystemId, NavigationPicPath.ClientID); UploadImage.Attributes.Add("onclick", showPopWinString); IsChannelAddable.Items[0].Value = true.ToString(); IsChannelAddable.Items[1].Value = false.ToString(); IsContentAddable.Items[0].Value = true.ToString(); IsContentAddable.Items[1].Value = false.ToString(); ELinkTypeUtils.AddListItems(LinkType); NodeGroupNameCollection.DataSource = DataProvider.NodeGroupDao.GetDataSource(PublishmentSystemId); ChannelTemplateID.DataSource = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ChannelTemplate); ContentTemplateID.DataSource = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ContentTemplate); DataBind(); ChannelTemplateID.Items.Insert(0, new ListItem("<未设置>", "0")); ControlUtils.SelectListItems(ChannelTemplateID, nodeInfo.ChannelTemplateId.ToString()); ContentTemplateID.Items.Insert(0, new ListItem("<未设置>", "0")); ControlUtils.SelectListItems(ContentTemplateID, nodeInfo.ContentTemplateId.ToString()); NodeName.Text = nodeInfo.NodeName; NodeIndexName.Text = nodeInfo.NodeIndexName; LinkUrl.Text = nodeInfo.LinkUrl; foreach (ListItem item in NodeGroupNameCollection.Items) { if (CompareUtils.Contains(nodeInfo.NodeGroupNameCollection, item.Value)) { item.Selected = true; } else { item.Selected = false; } } FilePath.Text = nodeInfo.FilePath; ChannelFilePathRule.Text = nodeInfo.ChannelFilePathRule; ContentFilePathRule.Text = nodeInfo.ContentFilePathRule; //NodeProperty ControlUtils.SelectListItems(LinkType, ELinkTypeUtils.GetValue(nodeInfo.LinkType)); ControlUtils.SelectListItems(IsChannelAddable, nodeInfo.Additional.IsChannelAddable.ToString()); ControlUtils.SelectListItems(IsContentAddable, nodeInfo.Additional.IsContentAddable.ToString()); NavigationPicPath.Text = nodeInfo.ImageUrl; var formCollection = new NameValueCollection(); formCollection[NodeAttribute.Content] = nodeInfo.Content; Content.SetParameters(PublishmentSystemInfo, NodeAttribute.Content, formCollection, true, IsPostBack); Keywords.Text = nodeInfo.Keywords; Description.Text = nodeInfo.Description; //this.Content.PublishmentSystemID = base.PublishmentSystemID; //this.Content.Text = StringUtility.TextEditorContentDecode(nodeInfo.Content, ConfigUtils.Instance.ApplicationPath, base.PublishmentSystemInfo.PublishmentSystemUrl); if (nodeInfo.NodeType == ENodeType.BackgroundPublishNode) { LinkURLRow.Visible = false; LinkTypeRow.Visible = false; ChannelTemplateIDRow.Visible = false; FilePathRow.Visible = false; } } else { channelControl.SetParameters(Request.Form, true, IsPostBack); } } }
public override void Submit_OnClick(object sender, EventArgs e) { var isChanged = false; ContentModelInfo modelInfo; if (Body.IsQueryExists("ModelID")) { var modelId = Body.GetQueryString("ModelID"); modelInfo = BaiRongDataProvider.ContentModelDao.GetContentModelInfo(modelId, PublishmentSystemId); modelInfo.ModelName = tbModelName.Text; modelInfo.TableName = ddlTableName.SelectedValue; modelInfo.TableType = EAuxiliaryTableTypeUtils.GetEnumType(rblTableType.SelectedValue); modelInfo.IconUrl = tbIconUrl.Text; modelInfo.Description = tbDescription.Text; } else { modelInfo = new ContentModelInfo { ModelId = tbModelID.Text, SiteId = PublishmentSystemId, ModelName = tbModelName.Text, IsSystem = false, TableName = ddlTableName.SelectedValue, TableType = EAuxiliaryTableTypeUtils.GetEnumType(rblTableType.SelectedValue), IconUrl = tbIconUrl.Text, Description = tbDescription.Text }; } if (Body.IsQueryExists("ModelID")) { try { BaiRongDataProvider.ContentModelDao.Update(modelInfo); Body.AddSiteLog(PublishmentSystemId, "修改内容模型", $"内容模型:{modelInfo.ModelName}"); isChanged = true; } catch (Exception ex) { FailMessage(ex, "内容模型修改失败!"); } } else { var isFail = false; var modelInfoList = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo); foreach (var contentModelInfo in modelInfoList) { if (contentModelInfo.ModelId == tbModelID.Text) { FailMessage("内容模型添加失败,模型标识已存在!"); isFail = true; break; } else if (contentModelInfo.ModelName == tbModelName.Text) { FailMessage("内容模型添加失败,模型名称已存在!"); isFail = true; break; } } if (!isFail) { try { BaiRongDataProvider.ContentModelDao.Insert(modelInfo); Body.AddSiteLog(PublishmentSystemId, "添加内容模型", $"内容模型:{modelInfo.ModelName}"); isChanged = true; } catch (Exception ex) { FailMessage(ex, "内容模型添加失败!"); } } } if (isChanged) { PageUtils.CloseModalPage(Page); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); var permissions = PermissionsManager.GetPermissions(Body.AdministratorName); var nodeId = PublishmentSystemId; _isGovPublic = Body.GetQueryBool("IsGovPublic"); if (_isGovPublic) { nodeId = PublishmentSystemInfo.Additional.GovPublicNodeId; if (nodeId == 0) { nodeId = PublishmentSystemId; } } _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId); _nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId); _tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo); _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, _relatedIdentities); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, nodeId)); if (!IsPostBack) { BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "内容审核", string.Empty); var checkedLevel = 5; var isChecked = true; foreach (var owningNodeId in ProductPermissionsManager.Current.OwningNodeIdList) { int checkedLevelByNodeId; var isCheckedByNodeId = CheckManager.GetUserCheckLevel(Body.AdministratorName, PublishmentSystemInfo, owningNodeId, out checkedLevelByNodeId); if (checkedLevel > checkedLevelByNodeId) { checkedLevel = checkedLevelByNodeId; } if (!isCheckedByNodeId) { isChecked = false; } } LevelManager.LoadContentLevelToList(State, PublishmentSystemInfo, PublishmentSystemId, isChecked, checkedLevel); if (_isGovPublic) { PhContentModel.Visible = false; } else { PhContentModel.Visible = true; var contentModelInfoList = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo); foreach (var modelInfo in contentModelInfoList) { DdlContentModelId.Items.Add(new ListItem(modelInfo.ModelName, modelInfo.ModelId)); } ControlUtils.SelectListItems(DdlContentModelId, _nodeInfo.ContentModelId); //EContentModelTypeUtils.AddListItemsForContentCheck(this.ContentModelID); } if (!string.IsNullOrEmpty(Body.GetQueryString("State"))) { ControlUtils.SelectListItems(State, Body.GetQueryString("State")); } if (!string.IsNullOrEmpty(Body.GetQueryString("ModelID"))) { ControlUtils.SelectListItems(DdlContentModelId, Body.GetQueryString("ModelID")); } SpContents.ControlToPaginate = RptContents; SpContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize; var checkLevelArrayList = new ArrayList(); if (!string.IsNullOrEmpty(Body.GetQueryString("State"))) { checkLevelArrayList.Add(Body.GetQueryString("State")); } else { checkLevelArrayList = LevelManager.LevelInt.GetCheckLevelArrayList(PublishmentSystemInfo, isChecked, checkedLevel); } var tableName = NodeManager.GetTableName(PublishmentSystemInfo, DdlContentModelId.SelectedValue); if (_isGovPublic) { tableName = PublishmentSystemInfo.AuxiliaryTableForGovPublic; } var owningNodeIdList = new List <int>(); if (!permissions.IsSystemAdministrator) { foreach (var owningNodeId in ProductPermissionsManager.Current.OwningNodeIdList) { if (AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, owningNodeId, AppManager.Cms.Permission.Channel.ContentCheck)) { owningNodeIdList.Add(owningNodeId); } } } SpContents.SelectCommand = BaiRongDataProvider.ContentDao.GetSelectedCommendByCheck(tableName, PublishmentSystemId, permissions.IsSystemAdministrator, owningNodeIdList, checkLevelArrayList); SpContents.SortField = ContentAttribute.LastEditDate; SpContents.SortMode = SortMode.DESC; RptContents.ItemDataBound += rptContents_ItemDataBound; SpContents.DataBind(); var showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(PublishmentSystemId, PageUrl); BtnCheck.Attributes.Add("onclick", showPopWinString); LtlColumnHeadRows.Text = ContentUtility.GetColumnHeadRowsHtml(_tableStyleInfoList, _attributesOfDisplay, _tableStyle, PublishmentSystemInfo); LtlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, _tableStyle, PublishmentSystemInfo, _nodeInfo); } if (!HasChannelPermissions(PublishmentSystemId, AppManager.Cms.Permission.Channel.ContentDelete)) { BtnDelete.Visible = false; } else { BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(PublishmentSystemId, false, PageUrl)); } }
public static ArrayList GetContentsByAccessFile(string filePath, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo) { var contentInfoArrayList = new ArrayList(); var accessDao = new AccessDao(filePath); var tableNames = accessDao.GetTableNames(); if (tableNames != null && tableNames.Length > 0) { foreach (var tableName in tableNames) { string sqlString = $"SELECT * FROM [{tableName}]"; var dataset = accessDao.ReturnDataSet(sqlString); var oleDt = dataset.Tables[0]; if (oleDt.Rows.Count > 0) { var relatedidentityes = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId); var modelInfo = ContentModelManager.GetContentModelInfo(publishmentSystemInfo, nodeInfo.ContentModelId); var tableStyle = EAuxiliaryTableTypeUtils.GetTableStyle(modelInfo.TableType); var tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, modelInfo.TableName, relatedidentityes); var nameValueCollection = new NameValueCollection(); foreach (var styleInfo in tableStyleInfoList) { nameValueCollection[styleInfo.DisplayName] = styleInfo.AttributeName.ToLower(); } var attributeNames = new ArrayList(); for (var i = 0; i < oleDt.Columns.Count; i++) { var columnName = oleDt.Columns[i].ColumnName; if (!string.IsNullOrEmpty(nameValueCollection[columnName])) { attributeNames.Add(nameValueCollection[columnName]); } else { attributeNames.Add(columnName); } } foreach (DataRow row in oleDt.Rows) { var contentInfo = new BackgroundContentInfo(); for (var i = 0; i < oleDt.Columns.Count; i++) { var attributeName = attributeNames[i] as string; if (!string.IsNullOrEmpty(attributeName)) { var value = row[i].ToString(); contentInfo.SetExtendedAttribute(attributeName, value); } } if (!string.IsNullOrEmpty(contentInfo.Title)) { contentInfo.PublishmentSystemId = publishmentSystemInfo.PublishmentSystemId; contentInfo.NodeId = nodeInfo.NodeId; contentInfo.LastEditDate = DateTime.Now; contentInfoArrayList.Add(contentInfo); } } } } } return(contentInfoArrayList); }