Пример #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");

            _relatedIdentity = Body.GetQueryInt("RelatedIdentity");
            _isList          = Body.GetQueryBool("IsList");

            var nodeInfo  = ChannelManager.GetChannelInfo(SiteId, _relatedIdentity);
            var tableName = ChannelManager.GetTableName(SiteInfo, nodeInfo);

            _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _relatedIdentity);
            var attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(nodeInfo.Additional.ContentAttributesOfDisplay);

            if (IsPostBack)
            {
                return;
            }

            var styleInfoList            = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities);
            var columnTableStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(SiteInfo, styleInfoList);

            foreach (var styleInfo in columnTableStyleInfoList)
            {
                if (styleInfo.AttributeName == ContentAttribute.Title)
                {
                    continue;
                }
                var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);

                if (_isList)
                {
                    if (attributesOfDisplay.Contains(styleInfo.AttributeName))
                    {
                        listitem.Selected = true;
                    }
                }
                else
                {
                    listitem.Selected = true;
                }

                CblDisplayAttributes.Items.Add(listitem);
            }
        }
Пример #2
0
        //public static bool IsComment(SiteInfo siteInfo, int channelId, string administratorName)
        //{
        //    return siteInfo.Additional.IsCommentable && AdminUtility.HasChannelPermissions(administratorName, siteInfo.Id, channelId, ConfigManager.Permissions.Channel.CommentCheck, ConfigManager.Permissions.Channel.CommentDelete);
        //}

        public static string GetColumnsHeadHtml(List<TableStyleInfo> tableStyleInfoArrayList, StringCollection attributesOfDisplay, SiteInfo siteInfo)
        {
            var builder = new StringBuilder();

            var arrayList = ContentUtility.GetColumnTableStyleInfoList(siteInfo, tableStyleInfoArrayList);
            foreach (var styleInfo in arrayList)
            {
                if (attributesOfDisplay.Contains(styleInfo.AttributeName))
                {
                    builder.Append(
                        $@"<th class=""text-nowrap"">{styleInfo.DisplayName}</th>");
                }
            }

            return builder.ToString();
        }
Пример #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");
            _channelId = Body.IsQueryExists("ChannelId") ? Body.GetQueryInt("ChannelId") : SiteId;

            var permissions = PermissionsManager.GetPermissions(Body.AdminName);

            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId);
            _nodeInfo            = ChannelManager.GetChannelInfo(SiteId, _channelId);
            _tableName           = ChannelManager.GetTableName(SiteInfo, _nodeInfo);
            _styleInfoList       = TableStyleManager.GetTableStyleInfoList(_tableName, _relatedIdentities);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId));
            _attributesOfDisplayStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(SiteInfo, _styleInfoList);
            _pluginLinks = PluginContentManager.GetContentLinks(_nodeInfo);
            _isEdit      = TextUtility.IsEdit(SiteInfo, _channelId, Body.AdminName);

            if (IsPostBack)
            {
                return;
            }

            var checkedLevel = 5;
            var isChecked    = true;

            foreach (var owningChannelId in ProductPermissionsManager.Current.OwningChannelIdList)
            {
                int checkedLevelByChannelId;
                var isCheckedByChannelId = CheckManager.GetUserCheckLevel(Body.AdminName, SiteInfo, owningChannelId, out checkedLevelByChannelId);
                if (checkedLevel > checkedLevelByChannelId)
                {
                    checkedLevel = checkedLevelByChannelId;
                }
                if (!isCheckedByChannelId)
                {
                    isChecked = false;
                }
            }

            ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, Body.AdminName);
            CheckManager.LoadContentLevelToList(DdlState, SiteInfo, SiteId, isChecked, checkedLevel);
            var checkLevelList = new List <int>();

            if (!string.IsNullOrEmpty(Body.GetQueryString("channelId")))
            {
                ControlUtils.SelectSingleItem(DdlChannelId, Body.GetQueryString("channelId"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("state")))
            {
                ControlUtils.SelectSingleItem(DdlState, Body.GetQueryString("state"));
                checkLevelList.Add(Body.GetQueryInt("state"));
            }
            else
            {
                checkLevelList = CheckManager.LevelInt.GetCheckLevelList(SiteInfo, isChecked, checkedLevel);
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = SiteInfo.Additional.PageSize;

            var nodeInfo      = ChannelManager.GetChannelInfo(SiteId, _channelId);
            var tableName     = ChannelManager.GetTableName(SiteInfo, nodeInfo);
            var channelIdList = DataProvider.ChannelDao.GetIdListByScopeType(nodeInfo.Id, nodeInfo.ChildrenCount, EScopeType.All, string.Empty, string.Empty, nodeInfo.ContentModelPluginId);
            var list          = new List <int>();

            if (permissions.IsSystemAdministrator)
            {
                list = channelIdList;
            }
            else
            {
                var owningChannelIdList = new List <int>();
                foreach (var owningChannelId in ProductPermissionsManager.Current.OwningChannelIdList)
                {
                    if (AdminUtility.HasChannelPermissions(Body.AdminName, SiteId, owningChannelId, ConfigManager.Permissions.Channel.ContentCheck))
                    {
                        owningChannelIdList.Add(owningChannelId);
                    }
                }
                foreach (var theChannelId in channelIdList)
                {
                    if (owningChannelIdList.Contains(theChannelId))
                    {
                        list.Add(theChannelId);
                    }
                }
            }

            SpContents.SelectCommand = DataProvider.ContentDao.GetSelectedCommendByCheck(tableName, SiteId, list, checkLevelList);

            SpContents.SortField       = ContentAttribute.LastEditDate;
            SpContents.SortMode        = SortMode.DESC;
            RptContents.ItemDataBound += RptContents_ItemDataBound;

            SpContents.DataBind();

            var showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl);

            BtnCheck.Attributes.Add("onclick", showPopWinString);

            LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo);

            if (!HasChannelPermissions(SiteId, ConfigManager.Permissions.Channel.ContentDelete))
            {
                BtnDelete.Visible = false;
            }
            else
            {
                BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl));
            }
        }
Пример #4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var permissions = PermissionsManager.GetPermissions(Body.AdminName);

            PageUtils.CheckRequestParameter("SiteId");
            _channelId = Body.IsQueryExists("ChannelId") ? Body.GetQueryInt("ChannelId") : SiteId;

            _isWritingOnly = Body.GetQueryBool("isWritingOnly");

            var administratorName = string.Empty;

            _isSelfOnly = Body.GetQueryBool("isSelfOnly");
            if (!_isSelfOnly)
            {
                administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdminName, SiteId, _channelId) ? Body.AdminName : string.Empty;
            }

            _nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId);
            var tableName = ChannelManager.GetTableName(SiteInfo, _nodeInfo);

            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId);
            _styleInfoList       = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId));
            _attributesOfDisplayStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(SiteInfo, _styleInfoList);
            _pluginLinks = PluginContentManager.GetContentLinks(_nodeInfo);
            _isEdit      = TextUtility.IsEdit(SiteInfo, _channelId, Body.AdminName);

            var stateType   = Body.IsQueryExists("state") ? ETriStateUtils.GetEnumType(Body.GetQueryString("state")) : ETriState.All;
            var searchType  = Body.IsQueryExists("searchType") ? Body.GetQueryString("searchType") : ContentAttribute.Title;
            var dateFrom    = Body.IsQueryExists("dateFrom") ? Body.GetQueryString("dateFrom") : string.Empty;
            var dateTo      = Body.IsQueryExists("dateTo") ? Body.GetQueryString("dateTo") : string.Empty;
            var isDuplicate = Body.IsQueryExists("isDuplicate") && Body.GetQueryBool("isDuplicate");
            var keyword     = Body.IsQueryExists("keyword") ? Body.GetQueryString("keyword") : string.Empty;

            SpContents.ControlToPaginate = RptContents;
            SpContents.SelectCommand     = DataProvider.ContentDao.GetSqlString(tableName, SiteId, _channelId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningChannelIdList, searchType, keyword, dateFrom, dateTo, true, stateType, !isDuplicate, false, _isWritingOnly, administratorName);
            SpContents.ItemsPerPage      = SiteInfo.Additional.PageSize;
            SpContents.SortField         = ContentAttribute.Id;
            SpContents.SortMode          = SortMode.DESC;
            SpContents.OrderByString     = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc);
            RptContents.ItemDataBound   += RptContents_ItemDataBound;

            if (!IsPostBack)
            {
                ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, Body.AdminName);

                DdlSearchType.Items.Add(new ListItem("标题", ContentAttribute.Title));
                if (_styleInfoList != null)
                {
                    foreach (var styleInfo in _styleInfoList)
                    {
                        if (styleInfo.AttributeName != ContentAttribute.AddDate)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            DdlSearchType.Items.Add(listitem);
                        }
                    }
                }
                DdlSearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
                DdlSearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
                DdlSearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));

                ETriStateUtils.AddListItems(DdlState, "全部", "已审核", "待审核");

                if (SiteId != _channelId)
                {
                    ControlUtils.SelectSingleItem(DdlChannelId, _channelId.ToString());
                }
                ControlUtils.SelectSingleItem(DdlState, Body.GetQueryString("State"));
                CbIsDuplicate.Checked = isDuplicate;
                ControlUtils.SelectSingleItem(DdlSearchType, searchType);
                TbKeyword.Text  = keyword;
                TbDateFrom.Text = dateFrom;
                TbDateTo.Text   = dateTo;

                SpContents.DataBind();

                var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(SiteId);
                BtnAddToGroup.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectColumns.GetOpenWindowString(SiteId, _channelId, true);
                BtnSelect.Attributes.Add("onclick", showPopWinString);

                if (AdminUtility.HasChannelPermissions(Body.AdminName, SiteId, SiteId, ConfigManager.Permissions.Channel.ContentCheck))
                {
                    showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl);
                    BtnCheck.Attributes.Add("onclick", showPopWinString);
                }
                else
                {
                    PhCheck.Visible = false;
                }

                LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo);
            }

            if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentAdd))
            {
                BtnAddContent.Visible = false;
            }
            if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentTranslate))
            {
                BtnTranslate.Visible = false;
            }
            else
            {
                BtnTranslate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(SiteId, PageUrl));
            }

            if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentDelete))
            {
                BtnDelete.Visible = false;
            }
            else
            {
                BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl));
            }
        }
Пример #5
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");

            _relatedIdentity = Body.GetQueryInt("RelatedIdentity");
            _isList          = Body.GetQueryBool("IsList");
            _isContent       = Body.GetQueryBool("IsContent");

            if (!_isContent)
            {
                var displayAttributes = SiteInfo.Additional.ChannelDisplayAttributes;
                if (!_isList)
                {
                    displayAttributes = SiteInfo.Additional.ChannelEditAttributes;
                }

                if (IsPostBack)
                {
                    return;
                }

                //添加默认属性
                var listitem = new ListItem("栏目名称", ChannelAttribute.ChannelName);
                if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelName))
                {
                    listitem.Selected = true;
                }
                CblDisplayAttributes.Items.Add(listitem);

                listitem = new ListItem("栏目索引", ChannelAttribute.ChannelIndex);
                if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelIndex))
                {
                    listitem.Selected = true;
                }
                CblDisplayAttributes.Items.Add(listitem);

                listitem = new ListItem("生成页面路径", ChannelAttribute.FilePath);
                if (CompareUtils.Contains(displayAttributes, ChannelAttribute.FilePath))
                {
                    listitem.Selected = true;
                }
                CblDisplayAttributes.Items.Add(listitem);

                if (!_isList)
                {
                    listitem = new ListItem("栏目图片地址", ChannelAttribute.ImageUrl);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ImageUrl))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("栏目正文", ChannelAttribute.Content);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.Content))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("外部链接", ChannelAttribute.LinkUrl);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.LinkUrl))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("链接类型", ChannelAttribute.LinkUrl);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.LinkUrl))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("内容默认排序规则", nameof(ChannelInfoExtend.DefaultTaxisType));
                    if (CompareUtils.Contains(displayAttributes, nameof(ChannelInfoExtend.DefaultTaxisType)))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("栏目模版", ChannelAttribute.ChannelTemplateId);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelTemplateId))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("内容模版", ChannelAttribute.ContentTemplateId);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ContentTemplateId))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("关键字列表", ChannelAttribute.Keywords);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.Keywords))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("页面描述", ChannelAttribute.Description);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.Description))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);
                }

                listitem = new ListItem("栏目组", ChannelAttribute.ChannelGroupNameCollection);
                if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelGroupNameCollection))
                {
                    listitem.Selected = true;
                }
                CblDisplayAttributes.Items.Add(listitem);

                var styleInfoList = TableStyleManager.GetTableStyleInfoList(DataProvider.ChannelDao.TableName, _relatedIdentities);

                foreach (var styleInfo in styleInfoList)
                {
                    listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);

                    if (CompareUtils.Contains(displayAttributes, styleInfo.AttributeName))
                    {
                        listitem.Selected = true;
                    }

                    CblDisplayAttributes.Items.Add(listitem);
                }

                if (string.IsNullOrEmpty(displayAttributes))
                {
                    if (!_isList)
                    {
                        foreach (ListItem item in CblDisplayAttributes.Items)
                        {
                            item.Selected = true;
                        }
                    }
                    else
                    {
                        ControlUtils.SelectMultiItems(CblDisplayAttributes, ChannelAttribute.ChannelName, ChannelAttribute.ChannelIndex);
                    }
                }
            }
            else
            {
                var nodeInfo  = ChannelManager.GetChannelInfo(SiteId, _relatedIdentity);
                var tableName = ChannelManager.GetTableName(SiteInfo, nodeInfo);
                _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _relatedIdentity);
                var attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(nodeInfo.Additional.ContentAttributesOfDisplay);

                if (IsPostBack)
                {
                    return;
                }

                var styleInfoList            = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities);
                var columnTableStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(SiteInfo, styleInfoList);
                foreach (var styleInfo in columnTableStyleInfoList)
                {
                    if (styleInfo.AttributeName == ContentAttribute.Title)
                    {
                        continue;
                    }
                    var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);

                    if (_isList)
                    {
                        if (attributesOfDisplay.Contains(styleInfo.AttributeName))
                        {
                            listitem.Selected = true;
                        }
                    }
                    else
                    {
                        listitem.Selected = true;
                    }

                    CblDisplayAttributes.Items.Add(listitem);
                }
            }
        }
Пример #6
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");

            _relatedIdentity = Body.GetQueryInt("RelatedIdentity");
            _isList          = Body.GetQueryBool("IsList");
            if (Body.GetQueryBool("IsContent"))
            {
                var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _relatedIdentity);
                _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo);
            }
            else
            {
                _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
            }

            if (_tableStyle == ETableStyle.Channel)
            {
                var displayAttributes = PublishmentSystemInfo.Additional.ChannelDisplayAttributes;
                if (!_isList)
                {
                    displayAttributes = PublishmentSystemInfo.Additional.ChannelEditAttributes;
                }

                if (!IsPostBack)
                {
                    //添加默认属性
                    var listitem = new ListItem("栏目名称", NodeAttribute.ChannelName);
                    if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelName))
                    {
                        listitem.Selected = true;
                    }
                    DisplayAttributeCheckBoxList.Items.Add(listitem);

                    listitem = new ListItem("栏目索引", NodeAttribute.ChannelIndex);
                    if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelIndex))
                    {
                        listitem.Selected = true;
                    }
                    DisplayAttributeCheckBoxList.Items.Add(listitem);

                    listitem = new ListItem("生成页面路径", NodeAttribute.FilePath);
                    if (CompareUtils.Contains(displayAttributes, NodeAttribute.FilePath))
                    {
                        listitem.Selected = true;
                    }
                    DisplayAttributeCheckBoxList.Items.Add(listitem);

                    if (!_isList)
                    {
                        listitem = new ListItem("栏目图片地址", NodeAttribute.ImageUrl);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.ImageUrl))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("栏目正文", NodeAttribute.Content);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.Content))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("外部链接", NodeAttribute.LinkUrl);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.LinkUrl))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("链接类型", NodeAttribute.LinkUrl);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.LinkUrl))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("栏目模版", NodeAttribute.ChannelTemplateId);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelTemplateId))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("内容模版", NodeAttribute.ContentTemplateId);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.ContentTemplateId))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("关键字列表", NodeAttribute.Keywords);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.Keywords))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);

                        listitem = new ListItem("页面描述", NodeAttribute.Description);
                        if (CompareUtils.Contains(displayAttributes, NodeAttribute.Description))
                        {
                            listitem.Selected = true;
                        }
                        DisplayAttributeCheckBoxList.Items.Add(listitem);
                    }

                    listitem = new ListItem("栏目组", NodeAttribute.ChannelGroupNameCollection);
                    if (CompareUtils.Contains(displayAttributes, NodeAttribute.ChannelGroupNameCollection))
                    {
                        listitem.Selected = true;
                    }
                    DisplayAttributeCheckBoxList.Items.Add(listitem);

                    var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, DataProvider.NodeDao.TableName, _relatedIdentities);

                    foreach (var styleInfo in styleInfoList)
                    {
                        if (styleInfo.IsVisible == false)
                        {
                            continue;
                        }
                        listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);

                        if (CompareUtils.Contains(displayAttributes, styleInfo.AttributeName))
                        {
                            listitem.Selected = true;
                        }

                        DisplayAttributeCheckBoxList.Items.Add(listitem);
                    }

                    if (string.IsNullOrEmpty(displayAttributes))
                    {
                        if (!_isList)
                        {
                            foreach (ListItem item in DisplayAttributeCheckBoxList.Items)
                            {
                                item.Selected = true;
                            }
                        }
                        else
                        {
                            ControlUtils.SelectListItems(DisplayAttributeCheckBoxList, NodeAttribute.ChannelName, NodeAttribute.ChannelIndex);
                        }
                    }
                }
            }
            else if (ETableStyleUtils.IsContent(_tableStyle))
            {
                var nodeInfo  = NodeManager.GetNodeInfo(PublishmentSystemId, _relatedIdentity);
                var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo);
                _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _relatedIdentity);
                var attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(nodeInfo.Additional.ContentAttributesOfDisplay);

                if (!IsPostBack)
                {
                    var styleInfoList            = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities);
                    var columnTableStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(PublishmentSystemInfo, _tableStyle, styleInfoList);
                    foreach (var styleInfo in columnTableStyleInfoList)
                    {
                        if (styleInfo.AttributeName == ContentAttribute.Title)
                        {
                            continue;
                        }
                        var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);

                        if (_isList)
                        {
                            if (attributesOfDisplay.Contains(styleInfo.AttributeName))
                            {
                                listitem.Selected = true;
                            }
                        }
                        else
                        {
                            if (styleInfo.IsVisible)
                            {
                                listitem.Selected = true;
                            }
                        }

                        DisplayAttributeCheckBoxList.Items.Add(listitem);
                    }
                }
            }
            else if (_tableStyle == ETableStyle.InputContent)
            {
                var inputInfo = DataProvider.InputDao.GetInputInfo(_relatedIdentity);
                _relatedIdentities = RelatedIdentities.GetRelatedIdentities(_tableStyle, PublishmentSystemId, _relatedIdentity);

                if (!IsPostBack)
                {
                    var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, DataProvider.InputContentDao.TableName, _relatedIdentities);

                    foreach (var styleInfo in styleInfoList)
                    {
                        var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);

                        if (_isList)
                        {
                            if (styleInfo.IsVisibleInList)
                            {
                                listitem.Selected = true;
                            }
                        }
                        else
                        {
                            if (styleInfo.IsVisible)
                            {
                                listitem.Selected = true;
                            }
                        }

                        DisplayAttributeCheckBoxList.Items.Add(listitem);
                    }
                }
            }
        }
Пример #7
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var permissions = PermissionsManager.GetPermissions(Body.AdminName);

            PageUtils.CheckRequestParameter("siteId", "channelId");
            var channelId = Body.GetQueryInt("channelId");

            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(SiteId, channelId);
            _channelInfo         = ChannelManager.GetChannelInfo(SiteId, channelId);
            _tableName           = ChannelManager.GetTableName(SiteInfo, _channelInfo);
            _styleInfoList       = TableStyleManager.GetTableStyleInfoList(_tableName, _relatedIdentities);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, channelId));
            _attributesOfDisplayStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(SiteInfo, _styleInfoList);
            _pluginLinks = PluginContentManager.GetContentLinks(_channelInfo);
            _isEdit      = TextUtility.IsEdit(SiteInfo, channelId, Body.AdminName);

            if (_channelInfo.Additional.IsPreviewContents)
            {
                new Action(() =>
                {
                    DataProvider.ContentDao.DeletePreviewContents(SiteId, _tableName, _channelInfo);
                }).BeginInvoke(null, null);
            }

            if (!HasChannelPermissions(channelId, ConfigManager.Permissions.Channel.ContentView, ConfigManager.Permissions.Channel.ContentAdd, ConfigManager.Permissions.Channel.ContentEdit, ConfigManager.Permissions.Channel.ContentDelete, ConfigManager.Permissions.Channel.ContentTranslate))
            {
                if (!Body.IsAdminLoggin)
                {
                    PageUtils.RedirectToLoginPage();
                    return;
                }
                PageUtils.RedirectToErrorPage("您无此栏目的操作权限!");
                return;
            }

            SpContents.ControlToPaginate = RptContents;
            RptContents.ItemDataBound   += RptContents_ItemDataBound;
            SpContents.ItemsPerPage      = SiteInfo.Additional.PageSize;

            var administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdminName, SiteId, channelId)
                    ? Body.AdminName
                    : string.Empty;

            if (Body.IsQueryExists("searchType"))
            {
                var owningChannelIdList = new List <int>
                {
                    channelId
                };
                SpContents.SelectCommand = DataProvider.ContentDao.GetSqlString(_tableName, SiteId, channelId, permissions.IsSystemAdministrator, owningChannelIdList, Body.GetQueryString("searchType"), Body.GetQueryString("keyword"), Body.GetQueryString("dateFrom"), string.Empty, false, ETriState.All, false, false, false, administratorName);
            }
            else
            {
                SpContents.SelectCommand = DataProvider.ContentDao.GetSqlString(_tableName, channelId, ETriState.All, administratorName);
            }

            //spContents.SortField = DataProvider.ContentDao.GetSortFieldName();
            //spContents.SortMode = SortMode.DESC;
            //spContents.OrderByString = ETaxisTypeUtils.GetOrderByString(tableStyle, ETaxisType.OrderByTaxisDesc);
            SpContents.OrderByString = ETaxisTypeUtils.GetContentOrderByString(ETaxisTypeUtils.GetEnumType(_channelInfo.Additional.DefaultTaxisType));
            SpContents.TotalCount    = _channelInfo.ContentNum;

            if (IsPostBack)
            {
                return;
            }

            LtlButtons.Text     = WebUtils.GetContentCommands(Body.AdminName, SiteInfo, _channelInfo, PageUrl);
            LtlMoreButtons.Text = WebUtils.GetContentMoreCommands(Body.AdminName, SiteInfo, _channelInfo, PageUrl);

            SpContents.DataBind();

            if (_styleInfoList != null)
            {
                foreach (var styleInfo in _styleInfoList)
                {
                    var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                    DdlSearchType.Items.Add(listitem);
                }
            }

            //添加隐藏属性
            DdlSearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
            DdlSearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
            DdlSearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));
            DdlSearchType.Items.Add(new ListItem("内容组", ContentAttribute.GroupNameCollection));

            if (Body.IsQueryExists("searchType"))
            {
                TbDateFrom.Text = Body.GetQueryString("dateFrom");
                ControlUtils.SelectSingleItem(DdlSearchType, Body.GetQueryString("searchType"));
                TbKeyword.Text = Body.GetQueryString("keyword");
                if (!string.IsNullOrEmpty(Body.GetQueryString("searchType")) || !string.IsNullOrEmpty(TbDateFrom.Text) ||
                    !string.IsNullOrEmpty(TbKeyword.Text))
                {
                    LtlButtons.Text += @"
<script>
$(document).ready(function() {
	$('#contentSearch').show();
});
</script>
";
                }
            }

            LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo);
        }