Example #1
0
        /// <summary>
        /// 得到栏目,并且不对(栏目是否可添加内容)进行判断
        /// 提供给触发器页面使用
        /// 使用场景:其他栏目的内容变动之后,设置某个栏目(此栏目不能添加内容)触发生成
        /// </summary>
        public static void AddListItemsForCreateChannel(ListItemCollection listItemCollection, SiteInfo siteInfo, bool isSeeOwning, PermissionsImpl permissionsImpl)
        {
            var list            = GetChannelIdList(siteInfo.Id);
            var nodeCount       = list.Count;
            var isLastNodeArray = new bool[nodeCount];

            foreach (var channelId in list)
            {
                var enabled = true;
                if (isSeeOwning)
                {
                    enabled = permissionsImpl.IsOwningChannelId(channelId);
                }

                var nodeInfo = GetChannelInfo(siteInfo.Id, channelId);

                if (!enabled)
                {
                    continue;
                }

                var listitem = new ListItem(GetSelectText(siteInfo, nodeInfo, permissionsImpl, isLastNodeArray, true), nodeInfo.Id.ToString());
                listItemCollection.Add(listitem);
            }
        }
Example #2
0
        public static void AddListItems(ListItemCollection listItemCollection, SiteInfo siteInfo, bool isSeeOwning, bool isShowContentNum, string contentModelId, PermissionsImpl permissionsImpl)
        {
            var list            = GetChannelIdList(siteInfo.Id);
            var nodeCount       = list.Count;
            var isLastNodeArray = new bool[nodeCount];

            foreach (var channelId in list)
            {
                var enabled = true;
                if (isSeeOwning)
                {
                    enabled = permissionsImpl.IsOwningChannelId(channelId);
                    if (!enabled)
                    {
                        if (!permissionsImpl.IsDescendantOwningChannelId(siteInfo.Id, channelId))
                        {
                            continue;
                        }
                    }
                }
                var nodeInfo = GetChannelInfo(siteInfo.Id, channelId);

                var listitem = new ListItem(GetSelectText(siteInfo, nodeInfo, permissionsImpl, isLastNodeArray, isShowContentNum), nodeInfo.Id.ToString());
                if (!enabled)
                {
                    listitem.Attributes.Add("style", "color:gray;");
                }
                if (!StringUtils.EqualsIgnoreCase(nodeInfo.ContentModelPluginId, contentModelId))
                {
                    listitem.Attributes.Add("disabled", "disabled");
                }
                listItemCollection.Add(listitem);
            }
        }