Пример #1
0
        private string getAuthorsColoredHTML(bool wiki)
        {
            if ((thisArticleText == null) || (!thisArticleText.ready))
            {
                return("");
            }
            HTMLHelper h = new HTMLHelper(thisArticleText.text);
            string     starttag, endtag;

            foreach (ArticleText.Section s in thisArticleText.sections)
            {
                string color = "";
                if (s.revKnown)
                {
                    if (s.rev.user == comboBoxUserColor1.Text)
                    {
                        color = HTMLHelper.ColorToRGB(comboBoxUserColor1.BackColor);
                    }
                    else if (s.rev.user == comboBoxUserColor2.Text)
                    {
                        color = HTMLHelper.ColorToRGB(comboBoxUserColor2.BackColor);
                    }
                    else if (s.rev.user == comboBoxUserColor3.Text)
                    {
                        color = HTMLHelper.ColorToRGB(comboBoxUserColor3.BackColor);
                    }
                    else if (s.rev.user == comboBoxUserColor4.Text)
                    {
                        color = HTMLHelper.ColorToRGB(comboBoxUserColor4.BackColor);
                    }
                    else if (s.rev.user == comboBoxUserColor5.Text)
                    {
                        color = HTMLHelper.ColorToRGB(comboBoxUserColor5.BackColor);
                    }
                }
                else
                {
                    color = HTMLHelper.ColorToRGB(Color.LightPink);  // TODO: don't needed normally...
                }
                if (s.rev != null)
                {
                    if (color != "")
                    {
                        starttag = "<span style=\"background-color:#" + color + "\" title=\"User: "******"\">";
                    }
                    else
                    {
                        starttag = "<span title=\"User: "******"\">";
                    }
                }
                else
                {
                    starttag = "<span title=\"Unknown User\">";
                }
                endtag = "</span>";
                if (wiki)
                {
                    starttag = "</nowiki>" + starttag + "<nowiki>";
                    endtag   = "</nowiki>" + endtag + "<nowiki>";
                }
                h.SetTag(s.Start - 1, s.Length, starttag, endtag);
            }
            string html = h.GetHTML();

            if (wiki)
            {
                html = "<nowiki>" + html + "</nowiki>";
                html = html.Replace("\n", "</nowiki><br />\n<nowiki>");
            }
            return(html);
        }