Exemplo n.º 1
0
        private void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // check VI for null then set information
                if (!this.Page.IsPostBack)
                {
                    // check if the admin settings for AMS have been set, if not load the settings page.
                    if (this.IsAdmin)
                    {
                        // Admin specific stats
                        if (this.UseApprovals)
                        {
                            this.lnkWaitingForApproval.Text = string.Format(
                                Localization.GetString("lnkWaitingForApproval", this.LocalResourceFile),
                                DataProvider.Instance().WaitingForApprovalCount(this.PortalId));
                            this.lnkWaitingForApproval.Visible     = true;
                            this.lnkWaitingForApproval.NavigateUrl = this.EditUrl(Utility.AdminContainer);
                        }
                        else
                        {
                            this.lnkWaitingForApproval.Visible = false;
                        }

                        // Comments always require approval
                        if (this.IsCommentsEnabled && IsPublishCommentTypeForPortal(this.PortalId))
                        {
                            var authorUserId = -1;
                            if (!this.IsAdmin)
                            {
                                authorUserId = this.UserId;
                            }

                            this.lnkCommentsForApproval.Text = string.Format(
                                Localization.GetString("lnkCommentsForApproval", this.LocalResourceFile),
                                Comment.CommentsWaitingForApprovalCount(this.PortalId, authorUserId));
                            this.lnkCommentsForApproval.Visible     = true;
                            this.lnkCommentsForApproval.NavigateUrl = this.EditUrl(
                                string.Empty, string.Empty, Utility.AdminContainer, "&adminType=commentList");
                        }
                        else
                        {
                            this.lnkCommentsForApproval.Visible = false;
                        }
                    }
                    else
                    {
                        // Generate author stats
                        this.lnkWaitingForApproval.Visible  = false;
                        this.lnkCommentsForApproval.Visible = false;
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }