コード例 #1
0
ファイル: ContentUtility.cs プロジェクト: zhongqi013/cms
        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);
        }
コード例 #2
0
            public static IDictionary GetDictionary(SiteInfo siteInfo, int channelId)
            {
                var dictionary = new ListDictionary
                {
                    { ChannelId, "栏目ID" },
                    { ContentId, "内容ID" },
                    { Year, "年份" },
                    { Month, "月份" },
                    { Day, "日期" },
                    { Hour, "小时" },
                    { Minute, "分钟" },
                    { Second, "秒钟" },
                    { Sequence, "顺序数" },
                    { ParentRule, "父级命名规则" },
                    { ChannelName, "栏目名称" },
                    { LowerChannelName, "栏目名称(小写)" },
                    { ChannelIndex, "栏目索引" },
                    { LowerChannelIndex, "栏目索引(小写)" }
                };

                var channelInfo   = ChannelManager.GetChannelInfo(siteInfo.Id, channelId);
                var styleInfoList = TableStyleManager.GetContentStyleInfoList(siteInfo, channelInfo);

                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);
            }
コード例 #3
0
ファイル: InputTypeParser.cs プロジェクト: skotbenben/cms
        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);
            //}
        }
コード例 #4
0
ファイル: PathUtility.cs プロジェクト: yankaics/cms-1
            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);
            }
コード例 #5
0
ファイル: RelatedIdentities.cs プロジェクト: zerojuls/cms-3
        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));
        }
コード例 #6
0
        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));
        }
コード例 #7
0
ファイル: InputTypeParser.cs プロジェクト: skotbenben/cms
        public static void AddSingleValueToAttributes(ETableStyle tableStyle, string tableName, PublishmentSystemInfo publishmentSystemInfo, List <int> relatedIdentities, NameValueCollection formCollection, string attributeName, NameValueCollection attributes, bool isSystemContained)
        {
            var metadataInfo = TableManager.GetTableMetadataInfo(tableName, attributeName);

            if (!isSystemContained && metadataInfo.IsSystem)
            {
                return;
            }

            var styleInfo = TableStyleManager.GetTableStyleInfo(tableStyle, tableName, attributeName, relatedIdentities);

            if (styleInfo.IsVisible == false)
            {
                return;
            }

            var theValue = GetValueByForm(styleInfo, publishmentSystemInfo, formCollection);

            ExtendedAttributes.SetExtendedAttribute(attributes, metadataInfo.AttributeName, theValue);
        }
コード例 #8
0
ファイル: InputTypeParser.cs プロジェクト: skotbenben/cms
        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);
            }
        }
コード例 #9
0
ファイル: InputTypeParser.cs プロジェクト: skotbenben/cms
        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]);
                }
            }
        }