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

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

            PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID");
            var nodeID = Body.GetQueryInt("NodeID");

            relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeID);
            nodeInfo          = NodeManager.GetNodeInfo(PublishmentSystemId, nodeID);
            tableName         = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo);
            tableStyle        = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo);
            styleInfoList     = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities);

            if (nodeInfo.Additional.IsPreviewContents)
            {
                new Action(() =>
                {
                    DataProvider.ContentDao.DeletePreviewContents(PublishmentSystemId, tableName, nodeInfo);
                }).BeginInvoke(null, null);
            }

            if (!HasChannelPermissions(nodeID, AppManager.Cms.Permission.Channel.ContentView, AppManager.Cms.Permission.Channel.ContentAdd, AppManager.Cms.Permission.Channel.ContentEdit, AppManager.Cms.Permission.Channel.ContentDelete, AppManager.Cms.Permission.Channel.ContentTranslate))
            {
                if (!Body.IsAdministratorLoggin)
                {
                    PageUtils.RedirectToLoginPage();
                    return;
                }
                PageUtils.RedirectToErrorPage("您无此栏目的操作权限!");
                return;
            }

            attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, nodeID));

            //this.attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(this.nodeInfo.Additional.ContentAttributesOfDisplay);

            spContents.ControlToPaginate = rptContents;
            rptContents.ItemDataBound   += rptContents_ItemDataBound;
            spContents.ItemsPerPage      = PublishmentSystemInfo.Additional.PageSize;

            var administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdministratorName, PublishmentSystemId, nodeID)
                    ? Body.AdministratorName
                    : string.Empty;

            if (Body.IsQueryExists("SearchType"))
            {
                var owningNodeIdList = new List <int>
                {
                    nodeID
                };
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(tableStyle, tableName, PublishmentSystemId, nodeID, permissions.IsSystemAdministrator, owningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), string.Empty, false, ETriState.All, false, false, false, administratorName);
            }
            else
            {
                spContents.SelectCommand = BaiRongDataProvider.ContentDao.GetSelectCommend(tableName, nodeID, ETriState.All, administratorName);
            }

            spContents.SortField     = BaiRongDataProvider.ContentDao.GetSortFieldName();
            spContents.SortMode      = SortMode.DESC;
            spContents.OrderByString = ETaxisTypeUtils.GetOrderByString(tableStyle, ETaxisType.OrderByTaxisDesc);

            //分页的时候,不去查询总条数,直接使用栏目的属性:ContentNum
            spContents.IsQueryTotalCount = false;
            spContents.TotalCount        = nodeInfo.ContentNum;

            if (!IsPostBack)
            {
                var nodeName = NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeID);
                BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdContent, "内容管理", nodeName, string.Empty);

                ltlContentButtons.Text = WebUtils.GetContentCommands(Body.AdministratorName, PublishmentSystemInfo, nodeInfo, PageUrl, GetRedirectUrl(PublishmentSystemId, nodeInfo.NodeId), false);
                spContents.DataBind();

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

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

                if (Body.IsQueryExists("SearchType"))
                {
                    DateFrom.Text = Body.GetQueryString("DateFrom");
                    ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType"));
                    Keyword.Text            = Body.GetQueryString("Keyword");
                    ltlContentButtons.Text += @"
<script>
$(document).ready(function() {
	$('#contentSearch').show();
});
</script>
";
                }

                ltlColumnHeadRows.Text  = ContentUtility.GetColumnHeadRowsHtml(styleInfoList, attributesOfDisplay, tableStyle, PublishmentSystemInfo);
                ltlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, tableStyle, PublishmentSystemInfo, nodeInfo);
            }
        }
Пример #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var permissions = PermissionsManager.GetPermissions(Body.AdministratorName);
            var mainPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(1);

            PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID");
            var nodeID      = Body.GetQueryInt("NodeID");
            var childNodeId = Body.GetQueryInt("ChildNodeId");

            relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeID);
            nodeInfo          = NodeManager.GetNodeInfo(1, nodeID);
            tableName         = NodeManager.GetTableName(mainPublishmentSystemInfo, nodeInfo);
            tableStyle        = NodeManager.GetTableStyle(mainPublishmentSystemInfo, nodeInfo);
            styleInfoList     = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities);
            var styleInfoList2 = TableStyleManager.GetTableStyleInfoList(tableStyle, "siteserver_Node", relatedIdentities);
            Dictionary <string, string> category = DataProvider.NodeDao.GetNodeIdListLevel(2, nodeID);
            int contentNum = 0;

            if (nodeInfo.Additional.IsPreviewContents)
            {
                new Action(() =>
                {
                    DataProvider.ContentDao.DeletePreviewContents(PublishmentSystemId, tableName, nodeInfo);
                }).BeginInvoke(null, null);
            }

            if (!HasChannelPermissions(nodeID, AppManager.Cms.Permission.Channel.ContentView, AppManager.Cms.Permission.Channel.ContentAdd, AppManager.Cms.Permission.Channel.ContentEdit, AppManager.Cms.Permission.Channel.ContentDelete, AppManager.Cms.Permission.Channel.ContentTranslate))
            {
                if (!Body.IsAdministratorLoggin)
                {
                    PageUtils.RedirectToLoginPage();
                    return;
                }
                PageUtils.RedirectToErrorPage("您无此栏目的操作权限!");
                return;
            }

            attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, nodeID));

            //this.attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(this.nodeInfo.Additional.ContentAttributesOfDisplay);

            spContents.ControlToPaginate = rptContents;
            rptContents.ItemDataBound   += rptContents_ItemDataBound;
            spContents.ItemsPerPage      = PublishmentSystemInfo.Additional.PageSize;

            var administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdministratorName, PublishmentSystemId, nodeID)
                    ? Body.AdministratorName
                    : string.Empty;

            if (Body.IsQueryExists("SearchType") && Body.IsQueryExists("ChildNodeId"))
            {
                List <int> owningNodeIdList = new List <int>
                {
                    nodeID, 3, 4, 6, 9
                };
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(tableStyle, tableName, PublishmentSystemId, nodeID, permissions.IsSystemAdministrator, owningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), string.Empty, false, ETriState.All, false, false, false, administratorName);
            }
            else
            {
                var        test     = tableName;
                List <int> nodeList = new List <int>();
                nodeList.Add(nodeID);
                var firstChildList = DataProvider.NodeDao.GetNodeIdListByParentId(1, nodeID);
                if (firstChildList != null && firstChildList.Count > 0)
                {
                    nodeList.AddRange(firstChildList);
                    foreach (var firstchild in firstChildList)
                    {
                        var secondList = DataProvider.NodeDao.GetNodeIdListByParentId(1, firstchild);
                        if (secondList != null && secondList.Count > 0)
                        {
                            nodeList.AddRange(secondList);
                        }
                    }
                }
                var nodeCollectionIdStr = string.Empty;
                foreach (int nodeId in nodeList)
                {
                    nodeCollectionIdStr = nodeCollectionIdStr + nodeId + ',';
                    contentNum          = contentNum + DataProvider.NodeDao.GetNodeInfo(nodeId).ContentNum;
                }
                nodeCollectionIdStr      = nodeCollectionIdStr.TrimEnd(',');
                spContents.SelectCommand = "select * from model_voluntaryservice where NodeId>0";
            }

            spContents.SortField     = BaiRongDataProvider.ContentDao.GetSortFieldName();
            spContents.SortMode      = SortMode.DESC;
            spContents.OrderByString = "ORDER BY Taxis Desc";

            //分页的时候,不去查询总条数,直接使用栏目的属性:ContentNum
            spContents.IsQueryTotalCount = false;
            spContents.TotalCount        = contentNum;//nodeInfo.ContentNum;

            if (!IsPostBack)
            {
                var nodeName = NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeID);
                //BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdContent, "内容管理", nodeName, string.Empty);

                ltlContentButtons.Text = WebUtils.GetContentCommandsStandard(Body.AdministratorName, PublishmentSystemInfo, nodeInfo, PageUrlReturn, GetRedirectUrl(base.PublishmentSystemId, nodeInfo.NodeId), false);
                spContents.DataBind();

                if (styleInfoList != null)
                {
                    foreach (var styleInfo in styleInfoList)
                    {
                        if (styleInfo.IsVisible)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            SearchType.Items.Add(listitem);
                        }
                    }
                }
                var listitemAll = new ListItem("全部", nodeID.ToString());
                ChannelCategory.Items.Add(listitemAll);
                if (category != null)
                {
                    foreach (var chanelCategory in category)
                    {
                        var listitem = new ListItem(chanelCategory.Key, chanelCategory.Value);
                        ChannelCategory.Items.Add(listitem);
                    }
                }
                //添加隐藏属性
                SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
                SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
                SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));
                SearchType.Items.Add(new ListItem("内容组", ContentAttribute.ContentGroupNameCollection));

                if (Body.IsQueryExists("SearchType"))
                {
                    DateFrom.Text = Body.GetQueryString("DateFrom");
                    ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType"));
                    Keyword.Text            = Body.GetQueryString("Keyword");
                    ltlContentButtons.Text += @"
<script>
$(document).ready(function() {
	$('#contentSearch').show();
});
</script>
";
                }

                ltlColumnHeadRows.Text  = ContentUtility.GetColumnHeadRowsHtml(styleInfoList, attributesOfDisplay, tableStyle, PublishmentSystemInfo);
                ltlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, tableStyle, PublishmentSystemInfo, nodeInfo);
            }
        }
Пример #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

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

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            var nodeId = Body.IsQueryExists("NodeID") ? Body.GetQueryInt("NodeID", PublishmentSystemId) : PublishmentSystemId;

            _nodeInfo            = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId);
            _tableStyle          = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo);
            _tableName           = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo);
            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId);
            _tableStyleInfoList  = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, _relatedIdentities);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, nodeId));

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

            if (Body.IsQueryExists("TheNodeID") && (Body.IsQueryExists("Subtract") || Body.IsQueryExists("Add")))
            {
                var theNodeId = Body.GetQueryInt("TheNodeID");
                if (PublishmentSystemId != theNodeId)
                {
                    var isSubtract = Body.IsQueryExists("Subtract");
                    DataProvider.NodeDao.UpdateTaxis(PublishmentSystemId, theNodeId, isSubtract);

                    Body.AddSiteLog(PublishmentSystemId, theNodeId, 0, "栏目排序" + (isSubtract ? "上升" : "下降"),
                                    $"栏目:{NodeManager.GetNodeName(PublishmentSystemId, theNodeId)}");
                }
            }

            SpContents.ControlToPaginate = RptContents;
            RptContents.ItemDataBound   += rptContents_ItemDataBound;
            SpContents.ItemsPerPage      = PublishmentSystemInfo.Additional.PageSize;

            var administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdministratorName, PublishmentSystemId, nodeId)
                ? Body.AdministratorName
                : string.Empty;

            if (Body.IsQueryExists("SearchType"))
            {
                var owningNodeIdList = new List <int> {
                    nodeId
                };
                SpContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, _tableName, PublishmentSystemId, nodeId, permissions.IsSystemAdministrator, owningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), string.Empty, false, ETriState.All, false, false, false, administratorName);
            }
            else
            {
                SpContents.SelectCommand = BaiRongDataProvider.ContentDao.GetSelectCommend(_tableName, nodeId, ETriState.All, administratorName);
            }

            SpContents.SortField = BaiRongDataProvider.ContentDao.GetSortFieldName();
            SpContents.SortMode  = SortMode.DESC;
            if (Body.IsQueryExists("strDirection"))
            {
                SpContents.SortField = "AddDate";
                SpContents.SortMode  = Body.GetQueryString("strDirection").Equals("0") ? SortMode.ASC : SortMode.DESC;
            }

            //分页的时候,不去查询总条数,直接使用栏目的属性:ContentNum
            SpContents.IsQueryTotalCount = false;
            SpContents.TotalCount        = _nodeInfo.ContentNum;

            RptChannels.DataSource     = DataProvider.NodeDao.GetNodeIdListByScopeType(_nodeInfo, EScopeType.Children, string.Empty, string.Empty);
            RptChannels.ItemDataBound += rptChannels_ItemDataBound;

            if (!IsPostBack)
            {
                var nodeName = NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeId).Replace(">", "/");
                BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdContent, "栏目及内容", nodeName, string.Empty);
                var url = PageUtils.GetCmsUrl(nameof(PageContentChannel), null);
                LtlContentButtons.Text = WebUtils.GetContentCommands(Body.AdministratorName, PublishmentSystemInfo, _nodeInfo, PageUrl, url, false);
                LtlChannelButtons.Text = WebUtils.GetChannelCommands(Body.AdministratorName, PublishmentSystemInfo, _nodeInfo, PageUrl, url);
                SpContents.DataBind();
                RptChannels.DataBind();

                if (_tableStyleInfoList != null)
                {
                    foreach (var styleInfo in _tableStyleInfoList)
                    {
                        if (styleInfo.IsVisible)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            SearchType.Items.Add(listitem);
                        }
                    }
                }
                //添加隐藏属性
                SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
                SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
                SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));
                SearchType.Items.Add(new ListItem("内容组", ContentAttribute.ContentGroupNameCollection));

                if (Body.IsQueryExists("SearchType"))
                {
                    DateFrom.Text = Body.GetQueryString("DateFrom");
                    ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType"));
                    Keyword.Text            = Body.GetQueryString("Keyword");
                    LtlContentButtons.Text += @"
<script>
$(document).ready(function() {
	$('#contentSearch').show();
});
</script>
";
                }

                LtlColumnHeadRows.Text  = ContentUtility.GetColumnHeadRowsHtml(_tableStyleInfoList, _attributesOfDisplay, _tableStyle, PublishmentSystemInfo);
                LtlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, _tableStyle, PublishmentSystemInfo, _nodeInfo);
            }
        }
Пример #4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");

            var permissions = PermissionsManager.GetPermissions(Body.AdministratorName);
            var nodeId      = PublishmentSystemId;

            _isGovPublic = Body.GetQueryBool("IsGovPublic");
            if (_isGovPublic)
            {
                nodeId = PublishmentSystemInfo.Additional.GovPublicNodeId;
                if (nodeId == 0)
                {
                    nodeId = PublishmentSystemId;
                }
            }
            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId);
            _nodeInfo            = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId);
            _tableName           = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo);
            _tableStyle          = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo);
            _tableStyleInfoList  = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, _relatedIdentities);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, nodeId));

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "内容审核", string.Empty);

                var checkedLevel = 5;
                var isChecked    = true;
                foreach (var owningNodeId in ProductPermissionsManager.Current.OwningNodeIdList)
                {
                    int checkedLevelByNodeId;
                    var isCheckedByNodeId = CheckManager.GetUserCheckLevel(Body.AdministratorName, PublishmentSystemInfo, owningNodeId, out checkedLevelByNodeId);
                    if (checkedLevel > checkedLevelByNodeId)
                    {
                        checkedLevel = checkedLevelByNodeId;
                    }
                    if (!isCheckedByNodeId)
                    {
                        isChecked = false;
                    }
                }

                LevelManager.LoadContentLevelToList(State, PublishmentSystemInfo, PublishmentSystemId, isChecked, checkedLevel);

                if (_isGovPublic)
                {
                    PhContentModel.Visible = false;
                }
                else
                {
                    PhContentModel.Visible = true;
                    var contentModelInfoList = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo);
                    foreach (var modelInfo in contentModelInfoList)
                    {
                        DdlContentModelId.Items.Add(new ListItem(modelInfo.ModelName, modelInfo.ModelId));
                    }
                    ControlUtils.SelectListItems(DdlContentModelId, _nodeInfo.ContentModelId);
                    //EContentModelTypeUtils.AddListItemsForContentCheck(this.ContentModelID);
                }

                if (!string.IsNullOrEmpty(Body.GetQueryString("State")))
                {
                    ControlUtils.SelectListItems(State, Body.GetQueryString("State"));
                }
                if (!string.IsNullOrEmpty(Body.GetQueryString("ModelID")))
                {
                    ControlUtils.SelectListItems(DdlContentModelId, Body.GetQueryString("ModelID"));
                }

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

                var checkLevelArrayList = new ArrayList();

                if (!string.IsNullOrEmpty(Body.GetQueryString("State")))
                {
                    checkLevelArrayList.Add(Body.GetQueryString("State"));
                }
                else
                {
                    checkLevelArrayList = LevelManager.LevelInt.GetCheckLevelArrayList(PublishmentSystemInfo, isChecked, checkedLevel);
                }
                var tableName = NodeManager.GetTableName(PublishmentSystemInfo, DdlContentModelId.SelectedValue);
                if (_isGovPublic)
                {
                    tableName = PublishmentSystemInfo.AuxiliaryTableForGovPublic;
                }

                var owningNodeIdList = new List <int>();
                if (!permissions.IsSystemAdministrator)
                {
                    foreach (var owningNodeId in ProductPermissionsManager.Current.OwningNodeIdList)
                    {
                        if (AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, owningNodeId, AppManager.Cms.Permission.Channel.ContentCheck))
                        {
                            owningNodeIdList.Add(owningNodeId);
                        }
                    }
                }

                SpContents.SelectCommand = BaiRongDataProvider.ContentDao.GetSelectedCommendByCheck(tableName, PublishmentSystemId, permissions.IsSystemAdministrator, owningNodeIdList, checkLevelArrayList);

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

                SpContents.DataBind();

                var showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(PublishmentSystemId, PageUrl);
                BtnCheck.Attributes.Add("onclick", showPopWinString);

                LtlColumnHeadRows.Text  = ContentUtility.GetColumnHeadRowsHtml(_tableStyleInfoList, _attributesOfDisplay, _tableStyle, PublishmentSystemInfo);
                LtlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, _tableStyle, PublishmentSystemInfo, _nodeInfo);
            }

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

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

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            if (Body.IsQueryExists("NodeID"))
            {
                _nodeId = Body.GetQueryInt("NodeID");
            }
            else
            {
                _nodeId = PublishmentSystemId;
            }

            _isWritingOnly = Body.GetQueryBool("isWritingOnly");

            var administratorName = string.Empty;

            _isSelfOnly = Body.GetQueryBool("isSelfOnly");
            if (!_isSelfOnly)
            {
                administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdministratorName, PublishmentSystemId, _nodeId) ? Body.AdministratorName : string.Empty;
            }

            _nodeInfo   = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId);
            _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo);
            var tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo);

            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, _nodeId));
            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId);
            _tableStyleInfoList  = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities);

            spContents.ControlToPaginate = rptContents;
            if (string.IsNullOrEmpty(Body.GetQueryString("NodeID")))
            {
                var stateType = ETriStateUtils.GetEnumType(State.SelectedValue);
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateUtils.GetDateString(DateTime.Now.AddMonths(-1)), DateUtils.GetDateString(DateTime.Now), true, stateType, !IsDuplicate.Checked, false, _isWritingOnly, administratorName);
            }
            else
            {
                var stateType = ETriStateUtils.GetEnumType(Body.GetQueryString("State"));
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, stateType, !Body.GetQueryBool("IsDuplicate"), false, _isWritingOnly, administratorName);
            }
            spContents.ItemsPerPage    = PublishmentSystemInfo.Additional.PageSize;
            spContents.SortField       = ContentAttribute.Id;
            spContents.SortMode        = SortMode.DESC;
            spContents.OrderByString   = ETaxisTypeUtils.GetOrderByString(_tableStyle, ETaxisType.OrderByIdDesc);
            rptContents.ItemDataBound += rptContents_ItemDataBound;

            if (!IsPostBack)
            {
                var pageTitle = _isSelfOnly ? "我的内容" : "内容搜索";
                if (_isWritingOnly)
                {
                    pageTitle = "投稿内容";
                }
                BreadCrumb(AppManager.Cms.LeftMenu.IdContent, pageTitle, string.Empty);

                NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, true, Body.AdministratorName);

                if (_tableStyleInfoList != null)
                {
                    foreach (var styleInfo in _tableStyleInfoList)
                    {
                        if (styleInfo.IsVisible && styleInfo.AttributeName != ContentAttribute.AddDate)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            SearchType.Items.Add(listitem);
                        }
                    }
                }

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

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

                if (Body.IsQueryExists("NodeID"))
                {
                    if (PublishmentSystemId != _nodeId)
                    {
                        ControlUtils.SelectListItems(NodeIDDropDownList, _nodeId.ToString());
                    }
                    ControlUtils.SelectListItems(State, Body.GetQueryString("State"));
                    IsDuplicate.Checked = Body.GetQueryBool("IsDuplicate");
                    ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType"));
                    Keyword.Text  = Body.GetQueryString("Keyword");
                    DateFrom.Text = Body.GetQueryString("DateFrom");
                    DateTo.Text   = Body.GetQueryString("DateTo");
                }
                else
                {
                    DateFrom.Text = DateUtils.GetDateString(DateTime.Now.AddMonths(-1));
                    DateTo.Text   = DateUtils.GetDateString(DateTime.Now);
                }

                spContents.DataBind();

                var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(PublishmentSystemId);
                AddToGroup.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectColumns.GetOpenWindowStringToContent(PublishmentSystemId, _nodeId, true);
                SelectButton.Attributes.Add("onclick", showPopWinString);

                if (AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, PublishmentSystemId, AppManager.Cms.Permission.Channel.ContentCheck))
                {
                    showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(PublishmentSystemId, PageUrl);
                    Check.Attributes.Add("onclick", showPopWinString);
                }
                else
                {
                    CheckPlaceHolder.Visible = false;
                }

                ltlColumnHeadRows.Text  = ContentUtility.GetColumnHeadRowsHtml(_tableStyleInfoList, _attributesOfDisplay, _tableStyle, PublishmentSystemInfo);
                ltlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, _tableStyle, PublishmentSystemInfo, _nodeInfo);
            }

            if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentAdd))
            {
                AddContent.Visible = false;
            }
            if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentTranslate))
            {
                Translate.Visible = false;
            }
            else
            {
                Translate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(PublishmentSystemId, PageUrl));
            }

            if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentDelete))
            {
                Delete.Visible = false;
            }
            else
            {
                Delete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(PublishmentSystemId, false, PageUrl));
            }
        }
Пример #6
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

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

            PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID");
            var nodeID = Body.GetQueryInt("NodeID");

            relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeID);
            nodeInfo          = NodeManager.GetNodeInfo(1, nodeID);
            tableName         = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo);
            tableStyle        = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo);
            styleInfoList     = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities);
            Dictionary <string, string> category = DataProvider.NodeDao.GetNodeIdListLevel(2, nodeID);
            int contentNum = 0;

            if (nodeInfo.Additional.IsPreviewContents)
            {
                new Action(() =>
                {
                    DataProvider.ContentDao.DeletePreviewContents(PublishmentSystemId, tableName, nodeInfo);
                }).BeginInvoke(null, null);
            }

            if (!HasChannelPermissions(nodeID, AppManager.Cms.Permission.Channel.ContentView, AppManager.Cms.Permission.Channel.ContentAdd, AppManager.Cms.Permission.Channel.ContentEdit, AppManager.Cms.Permission.Channel.ContentDelete, AppManager.Cms.Permission.Channel.ContentTranslate))
            {
                if (!Body.IsAdministratorLoggin)
                {
                    PageUtils.RedirectToLoginPage();
                    return;
                }
                PageUtils.RedirectToErrorPage("您无此栏目的操作权限!");
                return;
            }

            attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, nodeID));

            //this.attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(this.nodeInfo.Additional.ContentAttributesOfDisplay);

            spContents.ControlToPaginate = rptContents;
            rptContents.ItemDataBound   += rptContents_ItemDataBound;
            spContents.ItemsPerPage      = PublishmentSystemInfo.Additional.PageSize;

            var administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdministratorName, PublishmentSystemId, nodeID)
                    ? Body.AdministratorName
                    : string.Empty;

            if (Body.IsQueryExists("SearchType"))
            {
                string     nodeListString   = Body.GetQueryString("ChildNodeId");
                string[]   nodeArray        = nodeListString.Split(new char[] { ',' });
                List <int> owningNodeIdList = new List <int>();
                foreach (string node in nodeArray)
                {
                    if (!string.IsNullOrEmpty(node))
                    {
                        int nodeId = Convert.ToInt32(node);
                        owningNodeIdList.Add(nodeId);
                        contentNum = contentNum + DataProvider.NodeDao.GetNodeInfo(nodeId).ContentNum;
                    }
                }
                nodeListString           = nodeListString.TrimEnd(',');
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommendForLower(nodeListString, tableStyle, tableName, PublishmentSystemId, nodeID, permissions.IsSystemAdministrator, owningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), string.Empty, false, ETriState.All, false, false, false, administratorName);
            }
            else
            {
                //spContents.SelectCommand = BaiRongDataProvider.ContentDao.GetSelectCommendForLowerLevel(tableName, nodeCollectionIdStr, ETriState.All, administratorName, base.PublishmentSystemId);
                spContents.SelectCommand = $@"select * from siteserver_examination where ExaminationPaperId={PageUtils.FilterSqlAndXss(Body.GetQueryString( "ArticleId"))}  and NodeId={PageUtils.FilterSqlAndXss(Body.GetQueryString("NodeId"))}";
            }

            spContents.SortField     = BaiRongDataProvider.ContentDao.GetSortFieldName();
            spContents.SortMode      = SortMode.DESC;
            spContents.OrderByString = ETaxisTypeUtils.GetOrderByString(tableStyle, ETaxisType.OrderByTaxisDesc);

            //分页的时候,不去查询总条数,直接使用栏目的属性:ContentNum
            spContents.IsQueryTotalCount = false;
            spContents.TotalCount        = nodeInfo.ContentNum;//nodeInfo.ContentNum;

            if (!IsPostBack)
            {
                var nodeName = NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeID);
                //BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdContent, "内容管理", nodeName, string.Empty);

                ltlContentButtons.Text = WebUtils.GetContentCommandsStandardForExamination(Body.AdministratorName, PublishmentSystemInfo, nodeInfo, PageUrlReturn, GetRedirectUrl(base.PublishmentSystemId, nodeInfo.NodeId), false, Body.GetQueryInt("ArticleId"));
                spContents.DataBind();

                if (styleInfoList != null)
                {
                    foreach (var styleInfo in styleInfoList)
                    {
                        if (styleInfo.IsVisible)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            SearchType.Items.Add(listitem);
                        }
                    }
                }
                string NodeIdAll = nodeID + ",";
                if (category != null)
                {
                    foreach (var chanelCategory in category)

                    {
                        NodeIdAll = NodeIdAll + chanelCategory.Value + ",";
                        var nodechildId = DataProvider.NodeDao.GetNodeInfoListByParentId(1, Convert.ToInt32(chanelCategory.Value));
                        if (nodechildId != null && nodechildId.Count > 0)
                        {
                            string chidNodeList = string.Empty;
                            foreach (var child in nodechildId)
                            {
                                NodeIdAll    = NodeIdAll + child.NodeId + ",";
                                chidNodeList = chidNodeList + child.NodeId + ",";
                            }
                            var listitem = new ListItem(chanelCategory.Key, chidNodeList);
                            ChannelCategory.Items.Add(listitem);
                        }
                        else
                        {
                            var listitem = new ListItem(chanelCategory.Key, chanelCategory.Value);
                            NodeIdAll = NodeIdAll + chanelCategory.Value + ",";
                            ChannelCategory.Items.Add(listitem);
                        }
                    }
                }
                var listitemAll = new ListItem("全部", NodeIdAll);
                ChannelCategory.Items.Add(listitemAll);
                ListItem listItemSelect = null;
                foreach (ListItem listItem in ChannelCategory.Items)
                {
                    if (listItem.Value.Equals(Body.GetQueryString("ChildNodeId")))
                    {
                        listItemSelect = listItem;
                    }
                }
                if (listItemSelect != null)
                {
                    listItemSelect.Selected = true;
                }
                else
                {
                    listitemAll.Selected = true;
                }
                //添加隐藏属性
                SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
                SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
                SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));
                SearchType.Items.Add(new ListItem("内容组", ContentAttribute.ContentGroupNameCollection));

                if (Body.IsQueryExists("SearchType"))
                {
                    DateFrom.Text = Body.GetQueryString("DateFrom");
                    ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType"));
                    Keyword.Text            = Body.GetQueryString("Keyword");
                    ltlContentButtons.Text += @"
<script>
$(document).ready(function() {
	$('#contentSearch').show();
});
</script>
";
                }

                ltlColumnHeadRows.Text  = ContentUtility.GetColumnHeadRowsHtml(styleInfoList, attributesOfDisplay, tableStyle, PublishmentSystemInfo);
                ltlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, tableStyle, PublishmentSystemInfo, nodeInfo);
            }
        }