MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

How to add comments to News articles  (Mono Support )

Viewed 68867 time(s), 6 post(s) 7/16/2011 8:35:32 PMby yousaid
yousaid

yousaid

7/16/2011 8:35:32 PM
Greetings,
Questions on Publishing News
Is there a way to add comments to News articles like you currently have in Blogs so that readers can comment on a News article ?

(b) All the News Web Parts display the full article. Is there a webpart that displays only the "Short Content" with a link to the full article.
That is, the short contents are displayed with "Read more " links that point to the article details? This can easily be created with Gridview, but I don't want to reinvent the wheel if it already exsists

Something Like this:
Title: MonoX is a Great ASP.NET CMS [This hyperlinks to the details page ]
Summary: Bla bla bla
Read more [this also hyperlinks to the full details page]


As currently is, displaying about 15 News articles with the current WebParts on the Home page, makes the page very long.

cheers,
yousaid
This content has not been rated yet. 
206 Reputation 36 Total posts
khorvat

khorvat

7/17/2011 8:23:59 AM
Hi,

let's start from b) - not all web parts display the full content, only the Single News module show the full content. Can you please check if you have entered news articles in the full content in the MonoX administration. News articles have short and full content field in the administration where you can do two things:

- enter full content and leave short content empty - news modules will shorten the full content automatically
- enter full content and short content - news modules will show short content and only Single news module will show full content

As for the news example you have post, you can change the way news articles are displayed by changing the news templates that are used for your news categories.

let's move to question a) - You can enable comments on news articles by setting the "EnableComments" property of Single news module that should be used for reading full articles.

Note: By the end of this month we will try to publish a blog article about the MonoX news that will cover the news categories that may help you get a better overview (blog post about the news articles is coming right after that).

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
yousaid

yousaid

7/17/2011 9:32:03 PM
Greetings,
Thanks, for your reply. You answered both questions BUT there are issues (IMO) as currently implemented.

(a) There is no visual cue for the user to know that the article continues on another page. Yes, there's an Image (blue) at the top right of the article that points to the Details page, but there is no way for the user to know the functionality of the image. There is no obvious cue that tells the user that the article continues.

Ideally, this image should have some TEXT on it like "Details..." or "Read more..." Or "Continue .." or anything that points the user to the details page.
OR

This Image or similar Image (with text that indicates the purpose) or Text that Binds to the Article details page should be added at the bottom of the Short Content field. This tells the reader that the article continues on another page. Here in the USA, websites are required to accommodate the visually impaired (most developers ignore this requirement).


(b) The comments field on the Article Details page consists of one multi-line Text field. This single Text Field is only visible to logged in users. Ideally, the comments form should be visible to both authenticated and non authenticated users. Optionally, non authenticated users should then be asked to login when they attempt to post comments. Doing this drives more traffic to the site and article and allows users to read comments already submitted and then decide if they want to add theirs.

The GOOD NEWS is that you already have this accomplished in the Blog Module
So my QUESTION is:
How do I get the same comments functionality you have in the Blogs module in the news module?
That is:
(1). I want the form to be visible to both authenticated and non authenticated users.
(2) At a bare minimum, users should see where they can enter their name and if authenticated (as currently done in blog module) then it should be retrieved from their profile or cookie.
Perfect timing on the articles. I am building 2 websites based on MonoX going live mid next month to be hosted on WinHost.com


cheers,
yousaid
This content has not been rated yet. 
206 Reputation 36 Total posts
denis

denis

7/18/2011 8:33:19 PM
Regarding the blog-like functionality for the comments module, a vast majority of SN projects we've worked on require the user to be logged in to do anything. Standard SN comments Web part follows this logic, and a blog comments Web part is just an exception to this rule (one of the very few modules that allows for anonymous interaction). However, we do recognize the need for the scenario you are describing,and will try to come up with a solution based on the blog comments Web part.
There are quite a few user requests like this waiting to be implemented, so please stay tuned for more details on this.
This content has not been rated yet. 
7207 Reputation 956 Total posts
yousaid

yousaid

7/19/2011 2:18:40 AM
Greetings;
Thanks for your reply.
Not knowing how long it will take to implement the functionality as you envision, in the mean time, is there a way to display a comments icon that alerts the non authenticated reader that they have the ability to add comments? When they click on this icon, it takes them to the login page
OR
Display a count of the existing comments, when clicked, takes the user to the login page to add their own comments? This can serve as a bridge pending full implementation, but if the implementation is arround the corner, then this is a mute point.
YOU GUYS HAVE GREAT SUPPORT !!!

cheers,
yousaid.
This content has not been rated yet. 
206 Reputation 36 Total posts
khorvat

khorvat

7/19/2011 9:13:15 PM
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
This content has not been rated yet. 
15993 Reputation 2214 Total posts