/// <summary>
        /// Used to process the current request.
        /// </summary>
        public override void ProcessRequest()
        {
            //Assemble page parts.
            RootElement.RemoveAll();
            if (InputContext.ViewingUser.IsSuperUser == false && InputContext.ViewingUser.IsEditor == false)
            {
                SerialiseAndAppend(new Error { Type = "Access Denied", ErrorMessage = "Access denied" }, "");
                return;
            }
            GetQueryParameters();

            if (_modClassId == 0)
            {
                if(_siteId == 0)
                {
                    AddErrorXml("NoSites", "No site data available", null);
                return;
                }
                //get moderator stats
                _modClassId = InputContext.TheSiteList.GetSite(_siteId).ModClassID;
            }
            ModerationClass modClass = ModerationClassListCache.GetObject().ModClassList.FirstOrDefault(x => x.ClassId == _modClassId);

            ModifyUserModerationStatus(modClass);

            var userRep = UserReputation.GetUserReputation(AppContext.ReaderCreator, modClass, _userId);
            SerialiseAndAppend(userRep, "");

            var userEventList = UserEventList.GetUserEventList(modClass, _startIndex,
                _itemsPerPage, _startDate, _endDate, AppContext.ReaderCreator, _userId);
            SerialiseAndAppend(userEventList, "");

            //get sitelist
            SiteXmlBuilder siteXml = new SiteXmlBuilder(InputContext);
            siteXml.CreateXmlSiteList(InputContext.TheSiteList);
            RootElement.AppendChild(ImportNode(siteXml.RootElement.FirstChild));


            SerialiseAndAppend(SiteTypeEnumList.GetSiteTypes(), "");


        }
Beispiel #2
0
        /// <summary>
        /// Used to process the current request.
        /// </summary>
        public override void ProcessRequest()
        {
            //Assemble page parts.
            RootElement.RemoveAll();
            if (InputContext.ViewingUser.IsSuperUser == false && InputContext.ViewingUser.IsEditor == false)
            {
                SerialiseAndAppend(new Error { Type = "Access Denied", ErrorMessage = "Access denied" }, "");
                return;
            }
            GetQueryParameters();

            

            //get site stats
            DateTime startDate = DateTime.MinValue, endDate = DateTime.MinValue;
            GetDateRange(_days, ref startDate, ref endDate);

            //get moderator stats
            var moderatorInfo = ModeratorInfo.GetModeratorInfo(AppContext.ReaderCreator, _userId, InputContext.TheSiteList);
            var modStats = new ModStats(){Moderator = moderatorInfo};
            SiteSummaryStats stats;
            if (_siteId != 0)
            {
                modStats = ModStats.FetchModStatsBySite(AppContext.ReaderCreator, _userId, _siteId,
                    moderatorInfo, true, true);

                stats = SiteSummaryStats.GetStatsBySite(AppContext.ReaderCreator, _siteId, startDate, endDate);
            }
            else
            {
                modStats = ModStats.FetchModStatsBySiteType(AppContext.ReaderCreator, _userId, _type,
                   moderatorInfo, true, true);

                var statsUserId = _userId;
                if (InputContext.ViewingUser.IsSuperUser && statsUserId == InputContext.ViewingUser.UserID)
                {//use default user
                    statsUserId = 0;
                }

                stats = SiteSummaryStats.GetStatsByType(AppContext.ReaderCreator, _type, statsUserId, startDate, endDate);
            }
            SerialiseAndAppend(modStats, "");
            SerialiseAndAppend(stats, "");

            //check if only one site - then redirect note looking for 2 as all editors are editors of the moderation site for access...
            if (moderatorInfo.Sites.Count == 2 && _siteId == 0)
            {
                RedirectToSoleSite(moderatorInfo);
                return;
            }

            //get sitelist
            SiteXmlBuilder siteXml = new SiteXmlBuilder(InputContext);
            siteXml.CreateXmlSiteList(InputContext.TheSiteList);
            RootElement.AppendChild(ImportNode(siteXml.RootElement.FirstChild));


            SerialiseAndAppend(SiteTypeEnumList.GetSiteTypes(), "");


        }