void createReplySuccess(CommentStub[] newComments, object userContext, string methodName)
		{
			Misc.HideWaitingCursor();
			if (newComments != null)
			{
				appendNewComments(newComments);
				if (OnCommentPosted != null)
				{
					OnCommentPosted(this, EventArgs.Empty);
				}
				Misc.RedirectToAnchor("Anchor-CommentK-" + newComments[0].k);
			}
		}
		private void appendNewComments(CommentStub[] comments)
		{
			appendComments(comments);
			this.TotalComments += comments.Length;
			this.updateLastKnownCommentK(comments[comments.Length - 1].k);
			loaded();
		}
		void createPublicThreadSuccess(CommentStub newComment, object userContext, string methodName)
		{
			Misc.HideWaitingCursor();
			if (newComment != null)
			{
				if (this.threadK == 0)
					this.threadK = newComment.threadK;

				// must allow these events to modify where appropriate ...
				if (OnCommentPosted != null)
				{
					OnCommentPosted(null, new IntEventArgs(this.threadK));
				}
				if (OnThreadCreated != null)
				{
					OnThreadCreated(null, new IntEventArgs(this.threadK));
				}

				// ... before reloading here
				appendNewComment(newComment);

				//Misc.RedirectToAnchor(CommentsAnchorName);
			}
		}
		internal void appendComments(CommentStub[] newComments)
		{
			for (int i = 0; i < newComments.Length; i++)
			{
				appendComment(newComments[i]);
			}
		}
		private void appendNewComment(CommentStub comment)
		{
			appendNewComments(new CommentStub[] { comment });
		}
Ejemplo n.º 6
0
		private static CommentStub CreateCommentStub(Comment comment, ThreadUsr threadUsr, GroupUsr groupUsr)
		{
			CommentStub c = new CommentStub()
			{
				k = comment.K,
				html = comment.GetHtml(null),
				script = comment.Script,
				usrName = comment.Usr.Name,
				usrPicSrc = comment.Usr.AnyPicPath,
				usrRollover = comment.Usr.RolloverMouseOverTextNoPic,
				usrUrl = comment.Usr.Url(),
				usrK = comment.Usr.K,
				isNew = comment.GetIsNew(threadUsr),
				friendlyTimeNoCaps = comment.FriendlyTimeNoCaps,
				editLinkVisible = Usr.Current != null && (comment.UsrK == Usr.Current.K || Usr.Current.IsAdmin),
				editedHtml = comment.EditedHtml,
				deleteLinkVisible = Usr.Current != null && Usr.Current.CanDelete(comment),
				deleteLinkOnClickConfirmText = Usr.Current == null ? "" :
					(groupUsr != null && groupUsr.Moderator) ? "You are using your group moderator power to delete this comment.\n\nAre you sure?" :
					(comment.UsrK != Usr.Current.K) ? "You are using your moderator power to delete this comment.\n\nAre you sure?" :
					"Are you sure?",

				threadK = comment.ThreadK
			};

			c.lolHtml = comment.LolUsrListHtml(out c.haveAlreadyLold, Usr.Current != null ? Usr.Current.K : -1);
			return c;
		}
		internal void appendComment(CommentStub newComment)
		{
			if (this.PageNumber != this.LastPage)
			{
				this.PageNumber = this.LastPage;
			}

			if (this.threadK == 0)
			{
				this.threadK = newComment.threadK;
			}

			if (this.Comments == null)
			{
				this.Comments = new CommentStub[1] { newComment };
			}
			else if (this.Comments.Length == this.commentsPerPage)
			{
				this.pageNumber++;
				this.LastPage++;
				this.Comments = new CommentStub[1] { newComment };
			}
			else
			{
				// this is fine cos it's a js array!
				this.Comments[this.Comments.Length] = newComment;
			}
		}
Ejemplo n.º 8
0
		/*
<div class="CommentBody">
	<%#CurrentComment.NewHtml%><%#CurrentComment.GetHtml(this)%>
	<div class="CommentAdmin">
		<small>
			<span class="CleanLinks"><asp:PlaceHolder Runat="server" id="LolHtmlPh"></asp:PlaceHolder></span>
			<span runat="server" id="LolDownLevelSpan"><asp:LinkButton ID="LinkButton1" Runat="server" OnClick="LolClick" CausesValidation="False">This made me laugh!</asp:LinkButton><br /></span>
			<a href="#PostComment">Reply</a>
			<a href="" onmousedown="QuoteNow(<%#CurrentComment.Usr.K.ToString()%>);return false;" onclick="FocusNow();return false;">Quote</a>
			<a href="" runat="server" id="CommentEditAnchor">Edit</a>
			<asp:LinkButton Runat="server" ID="DeleteButton" CausesValidation="False" OnCommand="DeleteCommand" CommandName="Delete" CommandArgument="<%#CurrentComment.K%>">Delete</asp:LinkButton><br />
			<span onmouseover="stt('<%#CurrentComment.K.ToString("#,##0")%>');" onmouseout="htm();">Posted <%#CurrentComment.FriendlyTimeNoCaps%></span><%#CurrentComment.EditedHtml%>
		</small>
	</div>
</div>
		*/
		private DivElement createCommentBody(CommentStub comment)
		{
			DivElement div = (DivElement)Document.CreateElement("div");
			div.ClassName = "CommentBody";
			div.InnerHTML = (comment.isNew ? "<a name=\"Unread\"></a><span class=\"Unread\">NEW</span> " : "") + comment.html;

			DivElement admin = (DivElement)Document.CreateElement("div");
			admin.ClassName = "CommentAdmin";
			
			DivElement small = (DivElement)Document.CreateElement("small");

			DivElement lolSpan = (DivElement)Document.CreateElement("span");
			lolSpan.ClassName = "CleanLinks";
			lolSpan.InnerHTML = comment.lolHtml;
			lolSpan.ID = getLolSpanControlID(comment.k);
			small.AppendChild(lolSpan);

			if (comment.haveAlreadyLold == false && bool.Parse(view.uiUsrIsLoggedIn.Value))
			{
				small.AppendChild(Document.CreateTextNode(" "));
				DivElement lolAnchorSpan = (DivElement)Document.CreateElement("div");
				AnchorElement lolAnchor = (AnchorElement)Document.CreateElement("a");
				{
					lolAnchor.Href = "#";
					lolAnchor.InnerHTML = "This made me laugh!";
					lolAnchor.SetAttribute(Properties.CommentK, comment.k);
					DomEvent.AddHandler(lolAnchor, "click", new DomEventHandler(lolClick));
				}
				lolAnchorSpan.AppendChild(lolAnchor);
				lolAnchorSpan.ID = getLolAnchorControlID(comment.k);
				small.AppendChild(lolAnchorSpan);
			}


			small.AppendChild(Document.CreateTextNode(" "));

			AnchorElement reply = (AnchorElement)Document.CreateElement("a");
			reply.Href = "#PostComment";
			reply.InnerHTML = "Reply";
			small.AppendChild(reply);


			small.AppendChild(Document.CreateTextNode(" "));
			AnchorElement quote = (AnchorElement)Document.CreateElement("a");
			quote.InnerHTML = "Quote";
			quote.Href = "#";
			DomEvent.AddHandler(quote, "mousedown", new DomEventHandler(quoteMouseDown));
			DomEvent.AddHandler(quote, "click", new DomEventHandler(quoteClick));
			quote.SetAttribute(Properties.UsrK, comment.usrK);
			small.AppendChild(quote);
			
			

			if (comment.editLinkVisible)
			{
				small.AppendChild(Document.CreateTextNode(" "));
				AnchorElement edit = (AnchorElement)Document.CreateElement("a");
				edit.InnerHTML = "Edit";
				edit.Href = "/pages/commentedit/k-" + comment.k;
				small.AppendChild(edit);
				
			}

			if (comment.deleteLinkVisible)
			{
				small.AppendChild(Document.CreateTextNode(" "));
				AnchorElement deleteAnchor = (AnchorElement)Document.CreateElement("a");
				deleteAnchor.InnerHTML = "Delete";
				deleteAnchor.Href = "#";
				DomEvent.AddHandler(deleteAnchor, "click", new DomEventHandler(deleteClick));

				deleteAnchor.SetAttribute(Properties.DeleteConfirmText, comment.deleteLinkOnClickConfirmText);
				deleteAnchor.SetAttribute(Properties.CommentK, comment.k);

			//	deleteAnchor.Style.MarginLeft = "4px";
				small.AppendChild(deleteAnchor);
			}

			small.AppendChild((DivElement)Document.CreateElement("br"));

			DivElement postDetails = (DivElement)Document.CreateElement("span");
			createMouseOverAndOut(postDetails, "stt('" + comment.k + "');", "htm();");
			postDetails.InnerHTML = "Posted " + comment.friendlyTimeNoCaps;
			small.AppendChild(postDetails);

			if (comment.editedHtml != null && comment.editedHtml.Length > 0)
			{
				DivElement edited = (DivElement)Document.CreateElement("span");
				edited.InnerHTML = comment.editedHtml;
				small.AppendChild(edited);
			}

			
			admin.AppendChild(small);
			div.AppendChild(admin);
			return div;
		}
Ejemplo n.º 9
0
		/*
<div class="CommentLeft">
	<a href="<%#CurrentComment.Usr.Url()%>" <%#CurrentComment.Usr.RolloverNoPic%>><img src="" runat="server" id="PicImg" border="0" width="100" height="100" style="margin-bottom:2px;margin-top:0px;" class="BorderBlack All Block"></a>
	<a href="<%#CurrentComment.Usr.Url()%>"><%#CurrentComment.Usr.NickName%></a>
</div>
		*/
		private DivElement createCommentLeft(CommentStub comment)
		{
			DivElement div = (DivElement)Document.CreateElement("div");
			div.ClassName = "CommentLeft";

			AnchorElement aimg = (AnchorElement)Document.CreateElement("a");
			aimg.Href = comment.usrUrl;
			createMouseOverAndOut(aimg, comment.usrRollover, "htm();");

			ImageElement img = (ImageElement)Document.CreateElement("img");
			img.Src = comment.usrPicSrc;
			img.Style.Width = "100px";
			img.Style.Height = "100px";
			img.Style.MarginBottom = "2px";
			img.Style.MarginTop = "0px";
			img.ClassName = "BorderBlack All Block";
			
			aimg.AppendChild(img);
			div.AppendChild(aimg);
			
			AnchorElement aname = (AnchorElement)Document.CreateElement("a");
			aname.Href = comment.usrUrl;
			aname.InnerHTML = comment.usrName;
			div.AppendChild(aname);

			return div;
		}
Ejemplo n.º 10
0
		/*
<a name="CommentK-<%#CurrentComment.K%>"></a> -??????????????
<div class="CommentOuter ClearAfter">
	/CommentLeft/
	/CommentBody/
</div>
<a name="AfterCommentK-<%#CurrentComment.K%>"></a> -??????????????
		*/

		private DivElement createComment(CommentStub comment)
		{
			DivElement div = (DivElement)Document.CreateElement("div");
			div.ClassName = "CommentOuter ClearAfter";
			div.AppendChild(createCommentLeft(comment));
			div.AppendChild(createCommentBody(comment));
			return div;

			//TableElement table = (TableElement)Document.CreateElement("table");
			//table.ID = getCommentControlID(comment.k);
			//table.ClassName = "CommentTable";

			//table.Style.Border = "0px";
			//table.Style.Width = "582px";

			//TableRowElement tr = (TableRowElement)Document.CreateElement("tr");
			//tr.AppendChild(createCommentLeft(comment));
			//tr.AppendChild(createCommentRight(comment));

			//TableSectionElement tbody = (TableSectionElement)Document.CreateElement("tbody");
			//tbody.AppendChild(tr);
			//table.AppendChild(tbody);

			//return table;
		}
Ejemplo n.º 11
0
		private DOMElement createAnchor(CommentStub comment)
		{
			AnchorElement anchor = (AnchorElement)Document.CreateElement("a");
			anchor.ID = "Anchor-CommentK-" + comment.k;
			return anchor;
		}
Ejemplo n.º 12
0
		private void addComment(CommentStub comment)
		{
			uiCommentsDiv.AppendChild(createAnchor(comment));
			uiCommentsDiv.AppendChild(createComment(comment));
		}