123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace OpenSim.Region.UserStatistics
- {
- public static class HTMLUtil
- {
- public static void TR_O(ref StringBuilder o, string pclass)
- {
- o.Append("<tr");
- if (pclass.Length > 0)
- {
- GenericClass(ref o, pclass);
- }
- o.Append(">\n\t");
- }
- public static void TR_C(ref StringBuilder o)
- {
- o.Append("</tr>\n");
- }
- public static void TD_O(ref StringBuilder o, string pclass)
- {
- TD_O(ref o, pclass, 0, 0);
- }
- public static void TD_O(ref StringBuilder o, string pclass, int rowspan, int colspan)
- {
- o.Append("<td");
- if (pclass.Length > 0)
- {
- GenericClass(ref o, pclass);
- }
- if (rowspan > 1)
- {
- o.Append(" rowspan=\"");
- o.Append(rowspan);
- o.Append("\"");
- }
- if (colspan > 1)
- {
- o.Append(" colspan=\"");
- o.Append(colspan);
- o.Append("\"");
- }
- o.Append(">");
- }
- public static void TD_C(ref StringBuilder o)
- {
- o.Append("</td>");
- }
- public static void TABLE_O(ref StringBuilder o, string pclass)
- {
- o.Append("<table");
- if (pclass.Length > 0)
- {
- GenericClass(ref o, pclass);
- }
- o.Append(">\n\t");
- }
- public static void TABLE_C(ref StringBuilder o)
- {
- o.Append("</table>\n");
- }
-
- public static void BLOCKQUOTE_O(ref StringBuilder o, string pclass)
- {
- o.Append("<blockquote");
- if (pclass.Length > 0)
- {
- GenericClass(ref o, pclass);
- }
- o.Append(" />\n");
- }
- public static void BLOCKQUOTE_C(ref StringBuilder o)
- {
- o.Append("</blockquote>\n");
- }
- public static void BR(ref StringBuilder o)
- {
- o.Append("<br />\n");
- }
- public static void HR(ref StringBuilder o, string pclass)
- {
- o.Append("<hr");
- if (pclass.Length > 0)
- {
- GenericClass(ref o, pclass);
- }
- o.Append(" />\n");
- }
- public static void UL_O(ref StringBuilder o, string pclass)
- {
- o.Append("<ul");
- if (pclass.Length > 0)
- {
- GenericClass(ref o, pclass);
- }
- o.Append(" />\n");
- }
- public static void UL_C(ref StringBuilder o)
- {
- o.Append("</ul>\n");
- }
- public static void OL_O(ref StringBuilder o, string pclass)
- {
- o.Append("<ol");
- if (pclass.Length > 0)
- {
- GenericClass(ref o, pclass);
- }
- o.Append(" />\n");
- }
- public static void OL_C(ref StringBuilder o)
- {
- o.Append("</ol>\n");
- }
- public static void LI_O(ref StringBuilder o, string pclass)
- {
- o.Append("<li");
- if (pclass.Length > 0)
- {
- GenericClass(ref o, pclass);
- }
- o.Append(" />\n");
- }
- public static void LI_C(ref StringBuilder o)
- {
- o.Append("</li>\n");
- }
- public static void GenericClass(ref StringBuilder o, string pclass)
- {
- o.Append(" class=\"");
- o.Append(pclass);
- o.Append("\"");
- }
- public static void InsertProtoTypeAJAX(ref StringBuilder o)
- {
- o.Append("<script type=\"text/javascript\" src=\"prototype.js\"></script>\n");
- o.Append("<script type=\"text/javascript\" src=\"updater.js\"></script>\n");
- }
- public static void InsertPeriodicUpdaters(ref StringBuilder o, string[] divID, int[] seconds, string[] reportfrag)
- {
- o.Append("<script type=\"text/javascript\">\n");
- o.Append(
- @"
- // <![CDATA[
- document.observe('dom:loaded', function() {
- /*
- first arg : div to update
- second arg : interval to poll in seconds
- third arg : file to get data
- */
- ");
- for (int i = 0; i < divID.Length; i++)
- {
-
- o.Append("new updater('");
- o.Append(divID[i]);
- o.Append("', ");
- o.Append(seconds[i]);
- o.Append(", '");
- o.Append(reportfrag[i]);
- o.Append("');\n");
- }
- o.Append(@"
- });
- // ]]>
- </script>");
- }
- public static void HtmlHeaders_O(ref StringBuilder o)
- {
- o.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n");
- o.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"nl\">");
- o.Append("<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />");
- }
- public static void HtmlHeaders_C(ref StringBuilder o)
- {
- o.Append("</HEAD>");
- o.Append("<BODY>");
- }
- public static void AddReportLinks(ref StringBuilder o, Dictionary<string, IStatsController> reports, string pClass)
- {
- int repcount = 0;
- foreach (string str in reports.Keys)
- {
- if (reports[str].ReportName.Length > 0)
- {
- if (repcount > 0)
- {
- o.Append("| ");
- }
- A(ref o, reports[str].ReportName, str, pClass);
- o.Append(" ");
- repcount++;
- }
- }
- }
- public static void A(ref StringBuilder o, string linktext, string linkhref, string pClass)
- {
- o.Append("<A");
- if (pClass.Length > 0)
- {
- GenericClass(ref o, pClass);
- }
- o.Append(" href=\"");
- o.Append(linkhref);
- o.Append("\">");
- o.Append(linktext);
- o.Append("</A>");
- }
- }
- }
|