public static int GetRealContentId(ETableStyle tableStyle, string tableName, int contentId) { string linkUrl; var referenceId = BaiRongDataProvider.ContentDao.GetReferenceId(tableStyle, tableName, contentId, out linkUrl); return(referenceId > 0 ? referenceId : contentId); }
public static void AddValuesToAttributes(ETableStyle tableStyle, string tableName, PublishmentSystemInfo publishmentSystemInfo, List <int> relatedIdentities, Control containerControl, NameValueCollection attributes) { var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities); foreach (var styleInfo in styleInfoList) { if (styleInfo.IsVisible == false) { continue; } var theValue = GetValueByControl(styleInfo, publishmentSystemInfo, containerControl); if (!EInputTypeUtils.EqualsAny(styleInfo.InputType, EInputType.TextEditor, EInputType.Image, EInputType.File, EInputType.Video) && styleInfo.AttributeName != BackgroundContentAttribute.LinkUrl) { theValue = PageUtils.FilterSqlAndXss(theValue); } ExtendedAttributes.SetExtendedAttribute(attributes, styleInfo.AttributeName, theValue); } //ArrayList metadataInfoArrayList = TableManager.GetTableMetadataInfoArrayList(tableName); //foreach (TableMetadataInfo metadataInfo in metadataInfoArrayList) //{ // if (!isSystemContained && metadataInfo.IsSystem == EBoolean.True) continue; // TableStyleInfo styleInfo = TableStyleManager.GetTableStyleInfo(tableType, metadataInfo, relatedIdentities); // if (styleInfo.IsVisible == EBoolean.False) continue; // string theValue = InputTypeParser.GetValueByControl(metadataInfo, styleInfo, publishmentSystemInfo, containerControl); // ExtendedAttributes.SetExtendedAttribute(attributes, metadataInfo.AttributeName, theValue); //} }
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 void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _tableStyleId = Body.GetQueryInt("TableStyleID"); _relatedIdentities = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("RelatedIdentities")); if (_relatedIdentities.Count == 0) { _relatedIdentities.Add(0); } _tableName = Body.GetQueryString("TableName"); _attributeName = Body.GetQueryString("AttributeName"); _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); _redirectUrl = StringUtils.ValueFromUrl(Body.GetQueryString("RedirectUrl")); if (_tableStyleId != 0) { _styleInfo = BaiRongDataProvider.TableStyleDao.GetTableStyleInfo(_tableStyleId); } else { _styleInfo = TableStyleManager.GetTableStyleInfo(_tableStyle, _tableName, _attributeName, _relatedIdentities); } if (!IsPostBack) { IsValidate.Items[0].Value = true.ToString(); IsValidate.Items[1].Value = false.ToString(); ControlUtils.SelectListItems(IsValidate, _styleInfo.Additional.IsValidate.ToString()); IsRequired.Items[0].Value = true.ToString(); IsRequired.Items[1].Value = false.ToString(); ControlUtils.SelectListItems(IsRequired, _styleInfo.Additional.IsRequired.ToString()); if (EInputTypeUtils.EqualsAny(_styleInfo.InputType, EInputType.Text, EInputType.TextArea)) { phNum.Visible = true; } else { phNum.Visible = false; } MinNum.Text = _styleInfo.Additional.MinNum.ToString(); MaxNum.Text = _styleInfo.Additional.MaxNum.ToString(); EInputValidateTypeUtils.AddListItems(ValidateType); ControlUtils.SelectListItems(ValidateType, EInputValidateTypeUtils.GetValue(_styleInfo.Additional.ValidateType)); RegExp.Text = _styleInfo.Additional.RegExp; ErrorMessage.Text = _styleInfo.Additional.ErrorMessage; Validate_SelectedIndexChanged(null, EventArgs.Empty); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ContentID", "ReturnUrl"); _nodeId = Body.GetQueryInt("NodeID"); _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeId); _tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeId); _contentId = Body.GetQueryInt("ContentID"); _returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl")); var contentInfo = DataProvider.ContentDao.GetContentInfo(_tableStyle, _tableName, _contentId); var checkedLevel = 0; var isChecked = CheckManager.GetUserCheckLevel(Body.AdministratorName, PublishmentSystemInfo, PublishmentSystemId, out checkedLevel); phCheck.Visible = LevelManager.IsCheckable(PublishmentSystemInfo, _nodeId, contentInfo.IsChecked, contentInfo.CheckedLevel, isChecked, checkedLevel); ltlTitle.Text = contentInfo.Title; ltlState.Text = LevelManager.GetCheckState(PublishmentSystemInfo, contentInfo.IsChecked, contentInfo.CheckedLevel); var checkInfoArrayList = BaiRongDataProvider.ContentCheckDao.GetCheckInfoArrayList(_tableName, _contentId); if (checkInfoArrayList.Count > 0) { phCheckReasons.Visible = true; rpContents.DataSource = checkInfoArrayList; rpContents.ItemDataBound += rpContents_ItemDataBound; rpContents.DataBind(); } }
//relatedIdentities从大到小,最后是0 public static TableStyleInfo GetTableStyleInfo(ETableStyle tableStyle, string tableName, string attributeName, List <int> relatedIdentities) { TableStyleInfo styleInfo = null; if (attributeName == null) { attributeName = string.Empty; } relatedIdentities = GetRelatedIdentities(relatedIdentities); var entries = GetAllTableStyleInfoPairs(); foreach (int relatedIdentity in relatedIdentities) { var key = GetCacheKey(relatedIdentity, tableName, attributeName); if (entries.ContainsKey(key)) { styleInfo = entries.GetValue(key) as TableStyleInfo; if (styleInfo != null) { break; } } } if (styleInfo == null) { if (tableStyle == ETableStyle.BackgroundContent) { styleInfo = GetBackgroundContentTableStyleInfo(tableName, attributeName); } else if (tableStyle == ETableStyle.GovPublicContent) { styleInfo = GetGovPublicContentTableStyleInfo(tableName, attributeName); } else if (tableStyle == ETableStyle.GovInteractContent) { styleInfo = GetGovInteractContentTableStyleInfo(tableName, attributeName); } else if (tableStyle == ETableStyle.VoteContent) { styleInfo = GetVoteContentTableStyleInfo(tableName, attributeName); } else if (tableStyle == ETableStyle.JobContent) { styleInfo = GetJobContentTableStyleInfo(tableName, attributeName); } else if (tableStyle == ETableStyle.UserDefined) { styleInfo = GetUserDefinedTableStyleInfo(tableName, attributeName); } else { styleInfo = GetDefaultTableStyleInfo(tableName, attributeName); } } return(styleInfo); }
public static int GetColumnWidth(ETableStyle tableStyle, string attributeName) { var width = 80; if (StringUtils.EqualsIgnoreCase(attributeName, ContentAttribute.Hits) || StringUtils.EqualsIgnoreCase(attributeName, ContentAttribute.HitsByDay) || StringUtils.EqualsIgnoreCase(attributeName, ContentAttribute.HitsByMonth) || StringUtils.EqualsIgnoreCase(attributeName, ContentAttribute.HitsByWeek)) { width = 50; } else if (StringUtils.EqualsIgnoreCase(attributeName, ContentAttribute.AddUserName) || StringUtils.EqualsIgnoreCase(attributeName, ContentAttribute.LastEditUserName) || StringUtils.EqualsIgnoreCase(attributeName, ContentAttribute.CheckUserName)) { width = 60; } else if (StringUtils.EqualsIgnoreCase(attributeName, ContentAttribute.AddDate) || StringUtils.EqualsIgnoreCase(attributeName, ContentAttribute.LastEditDate)) { width = 70; } else if (StringUtils.EqualsIgnoreCase(attributeName, ContentAttribute.LastHitsDate) || StringUtils.EqualsIgnoreCase(attributeName, ContentAttribute.CheckCheckDate)) { width = 110; } else if (StringUtils.EqualsIgnoreCase(attributeName, BackgroundContentAttribute.Digg) || StringUtils.EqualsIgnoreCase(attributeName, ContentAttribute.CheckReasons)) { width = 110; } return(width); }
/// <summary> /// 得到辅助表tableName数据库中的字段名称的集合 /// </summary> public static List <string> GetAttributeNameList(ETableStyle tableStyle, string tableName, bool toLower) { var attributeNameList = new List <string>(); if (ETableStyleUtils.IsContent(tableStyle)) { var tableMetadataInfoList = GetTableMetadataInfoList(tableName); foreach (var tableMetadataInfo in tableMetadataInfoList) { attributeNameList.Add(tableMetadataInfo.AttributeName); } } if (attributeNameList.Count > 0 && toLower) { var lowerList = new List <string>(); foreach (var attributeName in attributeNameList) { lowerList.Add(attributeName.ToLower()); } return(lowerList); } return(attributeNameList); }
public string GetSelectCommend(ETableStyle tableStyle, string tableName, int publishmentSystemId, int nodeId, bool isSystemAdministrator, List <int> owningNodeIdList, string searchType, string keyword, string dateFrom, string dateTo, bool isSearchChildren, ETriState checkedState, bool isNoDup, bool isTrashContent) { var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemId, nodeId); var nodeIdList = DataProvider.NodeDao.GetNodeIdListByScopeType(nodeInfo, isSearchChildren ? EScopeType.All : EScopeType.Self, string.Empty, string.Empty, nodeInfo.ContentModelId); var list = new List <int>(); if (isSystemAdministrator) { list = nodeIdList; } else { foreach (int theNodeId in nodeIdList) { if (owningNodeIdList.Contains(theNodeId)) { list.Add(theNodeId); } } } return(BaiRongDataProvider.ContentDao.GetSelectCommendByCondition(tableStyle, tableName, publishmentSystemId, list, searchType, keyword, dateFrom, dateTo, checkedState, isNoDup, isTrashContent)); }
public static void SingleExportTableStyles(ETableStyle tableStyle, string tableName, string styleDirectoryPath) { var relatedIdentities = new List <int> { 0 }; DirectoryUtils.DeleteDirectoryIfExists(styleDirectoryPath); DirectoryUtils.CreateDirectoryIfNotExists(styleDirectoryPath); var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities); foreach (var tableStyleInfo in styleInfoList) { var filePath = PathUtils.Combine(styleDirectoryPath, tableStyleInfo.AttributeName + ".xml"); var feed = ExportTableStyleInfo(tableStyleInfo); var styleItems = BaiRongDataProvider.TableStyleDao.GetStyleItemInfoList(tableStyleInfo.TableStyleId); if (styleItems != null && styleItems.Count > 0) { foreach (var styleItemInfo in styleItems) { var entry = ExportTableStyleItemInfo(styleItemInfo); feed.Entries.Add(entry); } } feed.Save(filePath); } }
public static List <string> GetExcludeAttributeNames(ETableStyle tableStyle) { if (tableStyle == ETableStyle.BackgroundContent) { return(BackgroundContentAttribute.ExcludeAttributes); } if (tableStyle == ETableStyle.GovPublicContent) { return(GovPublicContentAttribute.ExcludeAttributes); } if (tableStyle == ETableStyle.GovInteractContent) { return(GovInteractContentAttribute.ExcludeAttributes); } if (tableStyle == ETableStyle.VoteContent) { return(VoteContentAttribute.ExcludeAttributes); } if (tableStyle == ETableStyle.JobContent) { return(JobContentAttribute.ExcludeAttributes); } if (tableStyle == ETableStyle.UserDefined) { return(ContentAttribute.ExcludeAttributes); } return(new List <string>()); }
public static int Insert(TableStyleInfo styleInfo, ETableStyle tableStyle) { var tableStyleId = BaiRongDataProvider.TableStyleDao.Insert(styleInfo, tableStyle); IsChanged = true; return(tableStyleId); }
public ContentInfo GetContentInfo(ETableStyle tableStyle, string tableName, int contentId) { ContentInfo info = null; if (contentId > 0) { if (!string.IsNullOrEmpty(tableName)) { string sqlWhere = $"WHERE ID = {contentId}"; var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(tableName, SqlUtils.Asterisk, sqlWhere); using (var rdr = ExecuteReader(sqlSelect)) { if (rdr.Read()) { info = ContentUtility.GetContentInfo(tableStyle); BaiRongDataProvider.DatabaseDao.ReadResultsToExtendedAttributes(rdr, info); } rdr.Close(); } } } info?.AfterExecuteReader(); return(info); }
public static bool IsContent(ETableStyle tableStyle) { if (tableStyle == ETableStyle.BackgroundContent || tableStyle == ETableStyle.GovPublicContent || tableStyle == ETableStyle.GovInteractContent || tableStyle == ETableStyle.VoteContent || tableStyle == ETableStyle.JobContent || tableStyle == ETableStyle.UserDefined) { return(true); } return(false); }
public static string GetOpenWindowString(string tableName, ETableStyle tableStyle, string redirectUrl) { return(PageUtils.GetOpenWindowString("批量添加显示样式", PageUtils.GetSysUrl(nameof(ModalTableStylesAdd), new NameValueCollection { { "TableName", tableName }, { "TableStyle", ETableStyleUtils.GetValue(tableStyle) }, { "RedirectUrl", StringUtils.ValueToUrl(redirectUrl) } }))); }
public static string GetOpenWindowString(string tableName, ETableStyle tableStyle) { return(PageUtils.GetOpenWindowString("导入表样式", PageUtils.GetSysUrl(nameof(ModalTableStyleImport), new NameValueCollection { { "TableName", tableName }, { "TableStyle", ETableStyleUtils.GetValue(tableStyle) } }), 560, 200)); }
public static void SetDefaultValues(Control containerControl, ETableStyle tableStyle, string tableName, List <int> relatedIdentities) { var tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities); foreach (var styleInfo in tableStyleInfoList) { SetDefaultValue(containerControl, styleInfo); } }
public static string GetOpenWindowStringToSingleTableStyle(ETableStyle tableStyle, string tableName) { return(PageUtils.GetOpenWindowString("导出数据", PageUtils.GetSysUrl(nameof(ModalExportMessage), new NameValueCollection { { "TableStyle", ETableStyleUtils.GetValue(tableStyle) }, { "TableName", tableName }, { "ExportType", ExportTypeSingleTableStyle } }), Width, Height, true)); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _tableName = Body.GetQueryString("TableName"); _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); }
public static ListItem GetListItem(ETableStyle type, bool selected) { var item = new ListItem(GetText(type), GetValue(type)); if (selected) { item.Selected = true; } return(item); }
public static string GetRedirectUrl(int publishmentSystemId, int styleId, ETableStyle tableStyle, int relatedIdentity) { return(PageUtils.GetCmsUrl(nameof(PageTagStyleMailSMS), new NameValueCollection { { "PublishmentSystemID", publishmentSystemId.ToString() }, { "StyleID", styleId.ToString() }, { "TableStyle", ETableStyleUtils.GetValue(tableStyle) }, { "RelatedIdentity", relatedIdentity.ToString() } })); }
public static void InsertOrUpdate(TableStyleInfo styleInfo, ETableStyle tableStyle) { if (styleInfo.TableStyleId == 0) { Insert(styleInfo, tableStyle); } else { Update(styleInfo); } }
public static string GetOpenWindowStringToSingleTableStyle(ETableStyle tableStyle, string tableName, int publishmentSystemId, int relatedIdentity) { return(PageUtils.GetOpenWindowString("导出数据", PageUtils.GetCmsUrl(nameof(ModalExportMessage), new NameValueCollection { { "TableStyle", ETableStyleUtils.GetValue(tableStyle) }, { "TableName", tableName }, { "ExportType", ExportTypeSingleTableStyle }, { "PublishmentSystemID", publishmentSystemId.ToString() }, { "RelatedIdentity", relatedIdentity.ToString() } }), Width, Height, true)); }
public static int GetRealContentID(ETableStyle tableStyle, string tableName, int contentID) { var linkUrl = string.Empty; var referenceID = BaiRongDataProvider.ContentDao.GetReferenceId(tableStyle, tableName, contentID, out linkUrl); if (referenceID > 0) { return(referenceID); } return(contentID); }
public static void ImportTableStyleByZipFile(ETableStyle tableStyle, string tableName, int nodeId, string zipFilePath) { var styleDirectoryPath = PathUtils.GetTemporaryFilesPath("TableStyle"); DirectoryUtils.DeleteDirectoryIfExists(styleDirectoryPath); DirectoryUtils.CreateDirectoryIfNotExists(styleDirectoryPath); ZipUtils.UnpackFiles(zipFilePath, styleDirectoryPath); TableStyleIe.SingleImportTableStyle(tableStyle, tableName, styleDirectoryPath, nodeId); }
private int GetNewStyleInfoTaxis(ETableStyle tableStyle, string attributeName, int relatedIdentity, string tableName) { var taxis = 0; if (!TableStyleManager.IsMetadata(tableStyle, attributeName)) { var maxTaxis = GetMaxTaxisByKeyStart(relatedIdentity, tableName); taxis = maxTaxis + 1; } return(taxis); }
public void SetParameters(NameValueCollection formCollection, PublishmentSystemInfo publishmentSystemInfo, int nodeId, List <int> relatedIdentities, ETableStyle tableStyle, string tableName, bool isEdit, bool isPostBack) { _formCollection = formCollection; _publishmentSystemInfo = publishmentSystemInfo; _nodeId = nodeId; _relatedIdentities = relatedIdentities; _tableStyle = tableStyle; _tableName = tableName; _isEdit = isEdit; _isPostBack = isPostBack; }
public string ExportSingleTableStyle(ETableStyle tableStyle, string tableName, int relatedIdentity) { var filePath = PathUtils.GetTemporaryFilesPath("tableStyle.zip"); var styleDirectoryPath = PathUtils.GetTemporaryFilesPath("TableStyle"); TableStyleIe.SingleExportTableStyles(tableStyle, tableName, Fso.PublishmentSystemId, relatedIdentity, styleDirectoryPath); ZipUtils.PackFiles(filePath, styleDirectoryPath); DirectoryUtils.DeleteDirectoryIfExists(styleDirectoryPath); return(PathUtils.GetFileName(filePath)); }
public static TableStyleInfo GetTableStyleInfoActually(ETableStyle tableStyle, string tableName, string attributeName, List <int> relatedIdentities) { relatedIdentities = GetRelatedIdentities(relatedIdentities); var styleInfo = GetTableStyleInfo(tableStyle, tableName, attributeName, relatedIdentities); if (styleInfo.RelatedIdentity != relatedIdentities[0]) { styleInfo.TableStyleId = 0; styleInfo.RelatedIdentity = relatedIdentities[0]; } return(styleInfo); }
public static string GetOpenWindowString(string tableName, ETableStyle tableStyle, int publishmentSystemId, int relatedIdentity) { return(PageUtils.GetOpenWindowString("导入表样式", PageUtils.GetCmsUrl(nameof(ModalTableStyleImport), new NameValueCollection { { "TableName", tableName }, { "TableStyle", ETableStyleUtils.GetValue(tableStyle) }, { "PublishmentSystemID", publishmentSystemId.ToString() }, { "RelatedIdentity", relatedIdentity.ToString() } }), 560, 200)); }