7/19/2011 9:13:15 PM
15993
Reputation
2214
Total posts
Hi,
I have checked and the "open" comments feature for MonoX News is not planed in next release so I'll provide you with the workaround.
Please follow these steps to get the desired functionality
1. Copy the "/MonoX/ModuleGallery/News/SingleNewsModule.ascx" to your location
2. Modify the following code
<
tr
>
<
td
>
<
MonoX:Comments
ID
=
"comments"
runat
=
"server"
PagingEnabled
=
"true"
CommentTextBoxVisibleOnInit
=
"true"
></
MonoX:Comments
>
</
td
>
</
tr
>
to the following
<
tr
>
<
td
>
<
MonoX:Comments
ID
=
"comments"
runat
=
"server"
PagingEnabled
=
"true"
CommentTextBoxVisibleOnInit
=
"true"
></
MonoX:Comments
>
<!-- Add your "comments require registration / login" message here -->
<
asp:LoginStatus
ID
=
"loginStatus"
runat
=
"server"
CssClass
=
"login-nav-loginstatus"
/>
</
td
>
</
tr
>
3. You need to add the new class that will be used for a code-behind for the "
SingleNewsModule.ascx" called "
SingleNewsModule.ascx.cs" and you need to change the following code in your "
SingleNewsModule.ascx" mark-up:
<%@ Control
Language="C#"
AutoEventWireup="true"
Inherits="YourNameSpace.SingleNewsModule" Codebehind="SingleNewsModule.ascx.cs" %>
4. In the newly added code-behind you need to add the following code
protected
void
Page_PreRender(
object
sender, EventArgs e)
{
loginStatus.LoginText =
"Text displayed to unauthenticated user"
;
loginStatus.LogoutText =
"Text displayed to authenticated user"
;
}
Note that comments will be automatically displayed if user is authenticated, and unregistered users can register by following the
Register link on the
Login page.
Edit:
To fetch the comment count you can use the following code:
MonoSoftware.MonoX.Repositories.CommentRepository.GetInstance().GetCommentCount(parentId, entityType)
/// <summary>
/// Gets a number of comments for give parent entity type and id.
/// </summary>
/// <param name="parentId">Parent id.</param>
/// <param name="entityType">Parent entity type.</param>
/// <returns>Number of comments that satisfy the given criteria.</returns>
public
virtual
int
GetCommentCount(Guid parentId, SnEntityType entityType)
Where
ParentId is News item Id and
SnEntityType is
SnEntityType.NewsItem
If you need further assistance let us know.
Regards
Rating history (Content is rated 0.00 of 0 vote(s).)
Shows who have rated the content, and the rating score.