예제 #1
0
        public string RenderView(Hashtable pModelResult)
        {
            List <ClientVersionData> clidata              = (List <ClientVersionData>)pModelResult["ClientData"];
            int       totalclients                        = (int)pModelResult["Total"];
            Hashtable regionTotals                        = (Hashtable)pModelResult["RegionTotals"];
            List <ClientVersionData> cliRegData           = (List <ClientVersionData>)pModelResult["ClientRegionData"];
            List <Scene>             m_scenes             = (List <Scene>)pModelResult["Scenes"];
            Dictionary <string, IStatsController> reports = (Dictionary <string, IStatsController>)pModelResult["Reports"];

            const string STYLESHEET =
                @"
<STYLE>
body
{
    font-size:15px; font-family:Helvetica, Verdana; color:Black;
}
TABLE.defaultr { }
TR.defaultr { padding: 5px; }
TD.header { font-weight:bold; padding:5px; }
TD.content {}
TD.contentright { text-align: right; }
TD.contentcenter { text-align: center; }
TD.align_top { vertical-align: top; }
</STYLE>
";

            StringBuilder output = new StringBuilder();

            HTMLUtil.HtmlHeaders_O(ref output);
            output.Append(STYLESHEET);
            HTMLUtil.HtmlHeaders_C(ref output);

            HTMLUtil.AddReportLinks(ref output, reports, "");

            HTMLUtil.TABLE_O(ref output, "defaultr");
            HTMLUtil.TR_O(ref output, "");
            HTMLUtil.TD_O(ref output, "header");
            output.Append("ClientVersion");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, "header");
            output.Append("Count/%");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, "header");
            output.Append("SimFPS");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TR_C(ref output);

            foreach (ClientVersionData cvd in clidata)
            {
                HTMLUtil.TR_O(ref output, "");
                HTMLUtil.TD_O(ref output, "content");
                string linkhref = "sessions.report?VersionString=" + cvd.version;
                HTMLUtil.A(ref output, cvd.version, linkhref, "");
                HTMLUtil.TD_C(ref output);
                HTMLUtil.TD_O(ref output, "content");
                output.Append(cvd.count);
                output.Append("/");
                if (totalclients > 0)
                {
                    output.Append((((float)cvd.count / (float)totalclients) * 100).ToString());
                }
                else
                {
                    output.Append(0);
                }

                output.Append("%");
                HTMLUtil.TD_C(ref output);
                HTMLUtil.TD_O(ref output, "content");
                output.Append(cvd.fps);
                HTMLUtil.TD_C(ref output);
                HTMLUtil.TR_C(ref output);
            }
            HTMLUtil.TABLE_C(ref output);

            if (cliRegData.Count > 0)
            {
                HTMLUtil.TABLE_O(ref output, "defaultr");
                HTMLUtil.TR_O(ref output, "");
                HTMLUtil.TD_O(ref output, "header");
                output.Append("Region");
                HTMLUtil.TD_C(ref output);
                HTMLUtil.TD_O(ref output, "header");
                output.Append("ClientVersion");
                HTMLUtil.TD_C(ref output);
                HTMLUtil.TD_O(ref output, "header");
                output.Append("Count/%");
                HTMLUtil.TD_C(ref output);
                HTMLUtil.TD_O(ref output, "header");
                output.Append("SimFPS");
                HTMLUtil.TD_C(ref output);
                HTMLUtil.TR_C(ref output);

                foreach (ClientVersionData cvd in cliRegData)
                {
                    HTMLUtil.TR_O(ref output, "");
                    HTMLUtil.TD_O(ref output, "content");
                    output.Append(regionNamefromUUID(m_scenes, cvd.region_id));
                    HTMLUtil.TD_C(ref output);
                    HTMLUtil.TD_O(ref output, "content");
                    output.Append(cvd.version);
                    HTMLUtil.TD_C(ref output);
                    HTMLUtil.TD_O(ref output, "content");
                    output.Append(cvd.count);
                    output.Append("/");
                    if ((int)regionTotals[cvd.region_id] > 0)
                    {
                        output.Append((((float)cvd.count / (float)((int)regionTotals[cvd.region_id])) * 100).ToString());
                    }
                    else
                    {
                        output.Append(0);
                    }

                    output.Append("%");
                    HTMLUtil.TD_C(ref output);
                    HTMLUtil.TD_O(ref output, "content");
                    output.Append(cvd.fps);
                    HTMLUtil.TD_C(ref output);
                    HTMLUtil.TR_C(ref output);
                }
                HTMLUtil.TABLE_C(ref output);
            }

            output.Append("</BODY>");
            output.Append("</HTML>");
            return(output.ToString());
        }
예제 #2
0
        public string rep_Default_report_view(stats_default_page_values values)
        {
            StringBuilder output = new StringBuilder();



            const string TableClass    = "defaultr";
            const string TRClass       = "defaultr";
            const string TDHeaderClass = "header";
            const string TDDataClass   = "content";
            //const string TDDataClassRight = "contentright";
            const string TDDataClassCenter = "contentcenter";

            const string STYLESHEET =
                @"
<STYLE>
body
{
    font-size:15px; font-family:Helvetica, Verdana; color:Black;
}
TABLE.defaultr { }
TR.defaultr { padding: 5px; }
TD.header { font-weight:bold; padding:5px; }
TD.content {}
TD.contentright { text-align: right; }
TD.contentcenter { text-align: center; }
TD.align_top { vertical-align: top; }
</STYLE>
";

            HTMLUtil.HtmlHeaders_O(ref output);

            HTMLUtil.InsertProtoTypeAJAX(ref output);
            string[] ajaxUpdaterDivs            = new string[3];
            int[]    ajaxUpdaterSeconds         = new int[3];
            string[] ajaxUpdaterReportFragments = new string[3];

            ajaxUpdaterDivs[0]            = "activeconnections";
            ajaxUpdaterSeconds[0]         = 10;
            ajaxUpdaterReportFragments[0] = "activeconnectionsajax.html";

            ajaxUpdaterDivs[1]            = "activesimstats";
            ajaxUpdaterSeconds[1]         = 20;
            ajaxUpdaterReportFragments[1] = "simstatsajax.html";

            ajaxUpdaterDivs[2]            = "activelog";
            ajaxUpdaterSeconds[2]         = 5;
            ajaxUpdaterReportFragments[2] = "activelogajax.html";

            HTMLUtil.InsertPeriodicUpdaters(ref output, ajaxUpdaterDivs, ajaxUpdaterSeconds, ajaxUpdaterReportFragments);

            output.Append(STYLESHEET);
            HTMLUtil.HtmlHeaders_C(ref output);
            HTMLUtil.AddReportLinks(ref output, values.stats_reports, "");
            HTMLUtil.TABLE_O(ref output, TableClass);
            HTMLUtil.TR_O(ref output, TRClass);
            HTMLUtil.TD_O(ref output, TDHeaderClass);
            output.Append("# Users Total");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, TDHeaderClass);
            output.Append("# Sessions Total");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, TDHeaderClass);
            output.Append("Avg Client FPS");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, TDHeaderClass);
            output.Append("Avg Client Mem Use");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, TDHeaderClass);
            output.Append("Avg Sim FPS");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, TDHeaderClass);
            output.Append("Avg Ping");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, TDHeaderClass);
            output.Append("KB Out Total");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, TDHeaderClass);
            output.Append("KB In Total");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TR_C(ref output);
            HTMLUtil.TR_O(ref output, TRClass);
            HTMLUtil.TD_O(ref output, TDDataClass);
            output.Append(values.total_num_users);
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, TDDataClass);
            output.Append(values.total_num_sessions);
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, TDDataClassCenter);
            output.Append(values.avg_client_fps);
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, TDDataClassCenter);
            output.Append(values.avg_client_mem_use);
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, TDDataClassCenter);
            output.Append(values.avg_sim_fps);
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, TDDataClassCenter);
            output.Append(values.avg_ping);
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, TDDataClassCenter);
            output.Append(values.total_kb_out);
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, TDDataClassCenter);
            output.Append(values.total_kb_in);
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TR_C(ref output);
            HTMLUtil.TABLE_C(ref output);

            HTMLUtil.HR(ref output, "");
            HTMLUtil.TABLE_O(ref output, "");
            HTMLUtil.TR_O(ref output, "");
            HTMLUtil.TD_O(ref output, "align_top");
            output.Append("<DIV id=\"activeconnections\">Active Connections loading...</DIV>");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, "align_top");
            output.Append("<DIV id=\"activesimstats\">SimStats loading...</DIV>");
            output.Append("<DIV id=\"activelog\">ActiveLog loading...</DIV>");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TR_C(ref output);
            HTMLUtil.TABLE_C(ref output);
            output.Append("</BODY></HTML>");
            // TODO: FIXME: template
            return(output.ToString());
        }
예제 #3
0
        public string RenderView(Hashtable pModelResult)
        {
            List <SessionList> lstSession = (List <SessionList>)pModelResult["SessionData"];
            Dictionary <string, IStatsController> reports = (Dictionary <string, IStatsController>)pModelResult["Reports"];

            const string STYLESHEET =
                @"
<STYLE>
body
{
    font-size:15px; font-family:Helvetica, Verdana; color:Black;
}
TABLE.defaultr { }
TR.defaultr { padding: 5px; }
TD.header { font-weight:bold; padding:5px; }
TD.content {}
TD.contentright { text-align: right; }
TD.contentcenter { text-align: center; }
TD.align_top { vertical-align: top; }
</STYLE>
";

            StringBuilder output = new StringBuilder();

            HTMLUtil.HtmlHeaders_O(ref output);
            output.Append(STYLESHEET);
            HTMLUtil.HtmlHeaders_C(ref output);

            HTMLUtil.AddReportLinks(ref output, reports, "");

            HTMLUtil.TABLE_O(ref output, "defaultr");
            HTMLUtil.TR_O(ref output, "defaultr");
            HTMLUtil.TD_O(ref output, "header");
            output.Append("FirstName");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, "header");
            output.Append("LastName");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, "header");
            output.Append("SessionEnd");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, "header");
            output.Append("SessionLength");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TD_O(ref output, "header");
            output.Append("Client");
            HTMLUtil.TD_C(ref output);
            HTMLUtil.TR_C(ref output);
            if (lstSession.Count == 0)
            {
                HTMLUtil.TR_O(ref output, "");
                HTMLUtil.TD_O(ref output, "align_top", 1, 5);
                output.Append("No results for that query");
                HTMLUtil.TD_C(ref output);
                HTMLUtil.TR_C(ref output);
            }
            foreach (SessionList ssnlst in lstSession)
            {
                int cnt = 0;
                foreach (ShortSessionData sesdata in ssnlst.sessions)
                {
                    HTMLUtil.TR_O(ref output, "");
                    if (cnt++ == 0)
                    {
                        HTMLUtil.TD_O(ref output, "align_top", ssnlst.sessions.Count, 1);
                        output.Append(ssnlst.firstname);
                        HTMLUtil.TD_C(ref output);
                        HTMLUtil.TD_O(ref output, "align_top", ssnlst.sessions.Count, 1);
                        output.Append(ssnlst.lastname);
                        HTMLUtil.TD_C(ref output);
                    }
                    HTMLUtil.TD_O(ref output, "content");
                    output.Append(sesdata.last_update.ToShortDateString());
                    output.Append(" - ");
                    output.Append(sesdata.last_update.ToShortTimeString());
                    HTMLUtil.TD_C(ref output);
                    HTMLUtil.TD_O(ref output, "content");
                    TimeSpan dtlength = sesdata.last_update.Subtract(sesdata.start_time);
                    if (dtlength.Days > 0)
                    {
                        output.Append(dtlength.Days);
                        output.Append(" Days ");
                    }
                    if (dtlength.Hours > 0)
                    {
                        output.Append(dtlength.Hours);
                        output.Append(" Hours ");
                    }
                    if (dtlength.Minutes > 0)
                    {
                        output.Append(dtlength.Minutes);
                        output.Append(" Minutes");
                    }
                    HTMLUtil.TD_C(ref output);
                    HTMLUtil.TD_O(ref output, "content");
                    output.Append(sesdata.client_version);
                    HTMLUtil.TD_C(ref output);
                    HTMLUtil.TR_C(ref output);
                }
                HTMLUtil.TR_O(ref output, "");
                HTMLUtil.TD_O(ref output, "align_top", 1, 5);
                HTMLUtil.HR(ref output, "");
                HTMLUtil.TD_C(ref output);
                HTMLUtil.TR_C(ref output);
            }
            HTMLUtil.TABLE_C(ref output);
            output.Append("</BODY>\n</HTML>");
            return(output.ToString());
        }