XmlDocument ShowComments(XmlDocument docToProcess, string code) {

                                                                                                                                               
                XmlNamespaceManager nsmgr = new XmlNamespaceManager(docToProcess.NameTable);
                nsmgr.AddNamespace("default", "http://www.w3.org/1999/xhtml");
                nsmgr.AddNamespace("monodoc", "http://www.go-mono.org/xml/monodoc");
                nsmgr.PushScope();
                                                                                                                                               
                XmlElement root = docToProcess.DocumentElement;
                XmlNode body = root.SelectSingleNode("/default:html/default:body", nsmgr);

		string html   = "<br /><hr /><br />";

		CommentService commentservice = new CommentService();
		Comment[] comments = commentservice.GetCommentsByUrl("monohb@" + code);

		if (comments == null) {
			html += "No comments available.";
		}
		else {

		foreach(Comment comment in comments) {

			if (comment.Title == "")
				comment.Title = "[No Title]";

			html += "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"2\"  bgcolor=\"#efefef\">\n";
			html += "<tr><td valign=\"top\" bgcolor=\"#c0c0c0\" class=\"commenthead\" colspan=\"2\"><b>"
					 + comment.Title + "</b> </td></tr>\n";
			html += "<tr><td width=\"100\" valign=\"top\" class=\"commentcontent\"><b>Author:</b>"
					 + "</td><td valign=\"top\" class=\"commentcontent\">" + comment.Author + "</td></tr>\n";
			html += "<tr><td width=\"100\" valign=\"top\" class=\"commentcontent\"><b>Mail:</b>"
					+ "</td><td valign=\"top\" class=\"commentcontent\">" + comment.Mail + "</td></tr>\n";
			html += "<tr><td width=\"100\" valign=\"top\" class=\"commentcontent\"><b>Date:</b>"
					+ "</td><td valign=\"top\" class=\"commentcontent\">" + comment.Date + "</td></tr>\n";
			html += "<tr><td width=\"100\" valign=\"top\" class=\"commentcontent\"><b>Comment:</b>"
					+ "</td><td valign=\"top\" class=\"commentcontent\">" + comment.Text + "</td></tr>\n";
			html += "</table>\n\n<br /><br />\n"	;

		}
		}
		Console.WriteLine("monohb@" + code);
		body.InnerXml += html;
		return docToProcess;
	}
예제 #2
0
		void OnOkClicked (object sender, EventArgs a)
		{
			CommentService service = new CommentService();
			// todo
			newcomment.Hide ();
		}