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

            PageUtils.CheckRequestParameter("siteId", "channelId", "ID", "ReturnUrl");

            _channelId = Body.GetQueryInt("channelId");
            var channelInfo = ChannelManager.GetChannelInfo(SiteId, _channelId);

            _tableName = ChannelManager.GetTableName(SiteInfo, channelInfo);
            _contentId = Body.GetQueryInt("ID");
            _returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));

            _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId);

            _contentInfo = DataProvider.ContentDao.GetContentInfo(_tableName, _contentId);

            if (IsPostBack)
            {
                return;
            }

            var styleInfoList        = TableStyleManager.GetTableStyleInfoList(_tableName, _relatedIdentities);
            var myStyleInfoArrayList = new ArrayList();

            if (styleInfoList != null)
            {
                foreach (var styleInfo in styleInfoList)
                {
                    myStyleInfoArrayList.Add(styleInfo);
                }
            }

            RptContents.DataSource     = myStyleInfoArrayList;
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();

            LtlNodeName.Text = ChannelManager.GetChannelName(SiteId, _channelId);

            LtlTags.Text = _contentInfo.Tags;
            if (string.IsNullOrEmpty(LtlTags.Text))
            {
                PhTags.Visible = false;
            }

            LtlContentGroup.Text = _contentInfo.GroupNameCollection;
            if (string.IsNullOrEmpty(LtlContentGroup.Text))
            {
                PhContentGroup.Visible = false;
            }

            LtlLastEditDate.Text     = DateUtils.GetDateAndTimeString(_contentInfo.LastEditDate);
            LtlAddUserName.Text      = AdminManager.GetDisplayName(_contentInfo.AddUserName, true);
            LtlLastEditUserName.Text = AdminManager.GetDisplayName(_contentInfo.LastEditUserName, true);

            LtlContentLevel.Text = CheckManager.GetCheckState(SiteInfo, _contentInfo.IsChecked, _contentInfo.CheckedLevel);

            if (_contentInfo.ReferenceId > 0 && _contentInfo.GetString(ContentAttribute.TranslateContentType) != ETranslateContentType.ReferenceContent.ToString())
            {
                var referenceSiteId      = DataProvider.ChannelDao.GetSiteId(_contentInfo.SourceId);
                var referenceSiteInfo    = SiteManager.GetSiteInfo(referenceSiteId);
                var referenceTableName   = ChannelManager.GetTableName(referenceSiteInfo, _contentInfo.SourceId);
                var referenceContentInfo = DataProvider.ContentDao.GetContentInfo(referenceTableName, _contentInfo.ReferenceId);

                if (referenceContentInfo != null)
                {
                    var pageUrl           = PageUtility.GetContentUrl(referenceSiteInfo, referenceContentInfo, true);
                    var referenceNodeInfo = ChannelManager.GetChannelInfo(referenceContentInfo.SiteId, referenceContentInfo.ChannelId);
                    var addEditUrl        =
                        WebUtils.GetContentAddEditUrl(referenceSiteInfo.Id,
                                                      referenceNodeInfo, _contentInfo.ReferenceId, Body.GetQueryString("ReturnUrl"));

                    LtlScripts.Text += $@"
<div class=""tips"">此内容为对内容 (站点:{referenceSiteInfo.SiteName},栏目:{referenceNodeInfo.ChannelName})“<a href=""{pageUrl}"" target=""_blank"">{_contentInfo.Title}</a>”(<a href=""{addEditUrl}"">编辑</a>) 的引用,内容链接将和原始内容链接一致</div>";
                }
            }

            BtnSubmit.Attributes.Add("onclick", ModalContentCheck.GetOpenWindowString(SiteInfo.Id, _channelId, _contentId, _returnUrl));
            HlPreview.NavigateUrl = ApiRoutePreview.GetContentUrl(SiteId, _contentInfo.ChannelId, _contentInfo.Id);
        }
Пример #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ID", "ReturnUrl");

            _nodeId = Body.GetQueryInt("NodeID");
            var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId);

            _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo);
            _tableName  = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo);
            _contentId  = Body.GetQueryInt("ID");
            _returnUrl  = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));

            _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId);

            _contentInfo = DataProvider.ContentDao.GetContentInfo(_tableStyle, _tableName, _contentId);

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

                var styleInfoList        = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, _relatedIdentities);
                var myStyleInfoArrayList = new ArrayList();
                if (styleInfoList != null)
                {
                    foreach (var styleInfo in styleInfoList)
                    {
                        if (styleInfo.IsVisible)
                        {
                            myStyleInfoArrayList.Add(styleInfo);
                        }
                    }
                }

                MyRepeater.DataSource     = myStyleInfoArrayList;
                MyRepeater.ItemDataBound += MyRepeater_ItemDataBound;
                MyRepeater.DataBind();

                ltlNodeName.Text  = NodeManager.GetNodeName(PublishmentSystemId, _nodeId);
                ltlNodeName.Text += $@"
<script>
function submitPreview(){{
    window.open(""{PagePreview.GetRedirectUrl(PublishmentSystemId, _nodeId, _contentId, 0, 0)}"");
}}
</script>
";

                if (PublishmentSystemInfo.Additional.IsRelatedByTags)
                {
                    ltlTags.Text = _contentInfo.Tags;
                }
                if (string.IsNullOrEmpty(ltlTags.Text))
                {
                    RowTags.Visible = false;
                }

                ltlContentGroup.Text = _contentInfo.ContentGroupNameCollection;
                if (string.IsNullOrEmpty(ltlContentGroup.Text))
                {
                    RowContentGroup.Visible = false;
                }

                ltlLastEditDate.Text     = DateUtils.GetDateAndTimeString(_contentInfo.LastEditDate);
                ltlAddUserName.Text      = AdminManager.GetDisplayName(_contentInfo.AddUserName, true);
                ltlLastEditUserName.Text = AdminManager.GetDisplayName(_contentInfo.LastEditUserName, true);

                ltlContentLevel.Text = LevelManager.GetCheckState(PublishmentSystemInfo, _contentInfo.IsChecked, _contentInfo.CheckedLevel);

                if (_contentInfo.ReferenceId > 0 && _contentInfo.GetExtendedAttribute(ContentAttribute.TranslateContentType) != ETranslateContentType.ReferenceContent.ToString())
                {
                    var referencePublishmentSystemID   = DataProvider.NodeDao.GetPublishmentSystemId(_contentInfo.SourceId);
                    var referencePublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(referencePublishmentSystemID);
                    var referenceTableStyle            = NodeManager.GetTableStyle(referencePublishmentSystemInfo, _contentInfo.SourceId);
                    var referenceTableName             = NodeManager.GetTableName(referencePublishmentSystemInfo, _contentInfo.SourceId);
                    var referenceContentInfo           = DataProvider.ContentDao.GetContentInfo(referenceTableStyle, referenceTableName, _contentInfo.ReferenceId);

                    if (referenceContentInfo != null)
                    {
                        var pageUrl           = PageUtility.GetContentUrl(referencePublishmentSystemInfo, referenceContentInfo);
                        var referenceNodeInfo = NodeManager.GetNodeInfo(referenceContentInfo.PublishmentSystemId, referenceContentInfo.NodeId);
                        var addEditUrl        =
                            WebUtils.GetContentAddEditUrl(referencePublishmentSystemInfo.PublishmentSystemId,
                                                          referenceNodeInfo, _contentInfo.ReferenceId, Body.GetQueryString("ReturnUrl"));

                        ltlScripts.Text += $@"
<div class=""tips"">此内容为对内容 (站点:{referencePublishmentSystemInfo.PublishmentSystemName},栏目:{referenceNodeInfo.NodeName})“<a href=""{pageUrl}"" target=""_blank"">{_contentInfo.Title}</a>”(<a href=""{addEditUrl}"">编辑</a>) 的引用,内容链接将和原始内容链接一致</div>";
                    }
                }

                Submit.Attributes.Add("onclick", ModalContentCheck.GetOpenWindowString(PublishmentSystemInfo.PublishmentSystemId, _nodeId, _contentId, _returnUrl));
            }
        }