public static Dictionary <string, object> ContentToDictionary(ContentInfo contentInfo, string tableName, List <int> relatedIdentities) { var dict = TranslateUtils.ObjectToDictionary(contentInfo); dict.Remove("Attributes"); var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableName, relatedIdentities); foreach (var styleInfo in styleInfoList) { if (!dict.ContainsKey(styleInfo.AttributeName)) { dict[styleInfo.AttributeName] = contentInfo.GetString(styleInfo.AttributeName); } if (styleInfo.InputType == InputType.Image) { var extendName = ContentAttribute.GetExtendAttributeName(styleInfo.AttributeName); var extendValue = contentInfo.GetString(extendName); if (!string.IsNullOrEmpty(extendValue)) { dict[extendName] = extendValue; } } } return(dict); }
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 IDictionary GetDictionary(SiteInfo siteInfo, int channelId) { var dictionary = new ListDictionary { { ChannelId, "栏目ID" }, { Year, "年份" }, { Month, "月份" }, { Day, "日期" }, { Hour, "小时" }, { Minute, "分钟" }, { Second, "秒钟" }, { Sequence, "顺序数" }, { ParentRule, "父级命名规则" }, { ChannelName, "栏目名称" }, { LowerChannelName, "栏目名称(小写)" }, { ChannelIndex, "栏目索引" }, { LowerChannelIndex, "栏目索引(小写)" } }; var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(siteInfo.Id, channelId); var styleInfoList = TableStyleManager.GetTableStyleInfoList(DataProvider.ChannelDao.TableName, relatedIdentities); foreach (var styleInfo in styleInfoList) { if (styleInfo.InputType == InputType.Text) { dictionary.Add($@"{{@{StringUtils.LowerFirst(styleInfo.AttributeName)}}}", styleInfo.DisplayName); dictionary.Add($@"{{@lower{styleInfo.AttributeName}}}", styleInfo.DisplayName + "(小写)"); } } return(dictionary); }
public static IDictionary GetDictionary(PublishmentSystemInfo publishmentSystemInfo, int nodeId) { var dictionary = new ListDictionary { { ChannelId, "栏目ID" }, { ChannelIndex, "栏目索引" }, { Year, "年份" }, { Month, "月份" }, { Day, "日期" }, { Hour, "小时" }, { Minute, "分钟" }, { Second, "秒钟" }, { Sequence, "顺序数" }, { ParentRule, "父级命名规则" }, { ChannelName, "栏目名称" } }; //继承父级设置 20151113 sessionliang var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, nodeId); var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.Channel, DataProvider.NodeDao.TableName, relatedIdentities); foreach (var styleInfo in styleInfoList) { if (EInputTypeUtils.Equals(styleInfo.InputType, EInputType.Text)) { dictionary.Add($@"{{@{styleInfo.AttributeName}}}", styleInfo.DisplayName); } } return(dictionary); }
public static List <TableStyleInfo> GetTableStyleInfoList(SiteInfo siteInfo, int channelId) { List <int> relatedIdentities = GetChannelRelatedIdentities(siteInfo.Id, channelId); var tableName = ChannelManager.GetTableName(siteInfo, channelId); return(TableStyleManager.GetTableStyleInfoList(tableName, relatedIdentities)); }
public static List <TableStyleInfo> GetTableStyleInfoList(PublishmentSystemInfo publishmentSystemInfo, ETableStyle tableStyle, int relatedIdentity) { List <int> relatedIdentities; if (tableStyle == ETableStyle.BackgroundContent || tableStyle == ETableStyle.Channel || tableStyle == ETableStyle.GovInteractContent || tableStyle == ETableStyle.GovPublicContent || tableStyle == ETableStyle.VoteContent || tableStyle == ETableStyle.JobContent || tableStyle == ETableStyle.UserDefined) { relatedIdentities = GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, relatedIdentity); } else { relatedIdentities = GetRelatedIdentities(relatedIdentity); } var tableName = GetTableName(publishmentSystemInfo, tableStyle, relatedIdentity); return(TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities)); }
public static void AddValuesToAttributes(ETableStyle tableStyle, string tableName, PublishmentSystemInfo publishmentSystemInfo, List <int> relatedIdentities, NameValueCollection formCollection, NameValueCollection attributes, bool isBackground) { var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities); foreach (var styleInfo in styleInfoList) { if (styleInfo.IsVisible == false) { continue; } var theValue = GetValueByForm(styleInfo, publishmentSystemInfo, formCollection); 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); } }
public static void AddValuesToAttributes(ETableStyle tableStyle, string tableName, PublishmentSystemInfo publishmentSystemInfo, List <int> relatedIdentities, NameValueCollection formCollection, NameValueCollection attributes, List <string> dontAddAttributes, bool isSaveImage) { var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities); foreach (var styleInfo in styleInfoList) { if (styleInfo.IsVisible == false || dontAddAttributes.Contains(styleInfo.AttributeName.ToLower())) { continue; } var theValue = GetValueByForm(styleInfo, publishmentSystemInfo, formCollection, isSaveImage); 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); if (styleInfo.Additional.IsFormatString) { var formatString = TranslateUtils.ToBool(formCollection[styleInfo.AttributeName + "_formatStrong"]); var formatEm = TranslateUtils.ToBool(formCollection[styleInfo.AttributeName + "_formatEM"]); var formatU = TranslateUtils.ToBool(formCollection[styleInfo.AttributeName + "_formatU"]); var formatColor = formCollection[styleInfo.AttributeName + "_formatColor"]; var theFormatString = ContentUtility.GetTitleFormatString(formatString, formatEm, formatU, formatColor); ExtendedAttributes.SetExtendedAttribute(attributes, ContentAttribute.GetFormatStringAttributeName(styleInfo.AttributeName), theFormatString); } if (EInputTypeUtils.EqualsAny(styleInfo.InputType, EInputType.Image, EInputType.Video, EInputType.File)) { var attributeName = ContentAttribute.GetExtendAttributeName(styleInfo.AttributeName); ExtendedAttributes.SetExtendedAttribute(attributes, attributeName, formCollection[attributeName]); } } }