Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryGot a customer "gotta have" - ya.. the ratings thing...Got a customer "gotta have" - ya.. the ratings thing...
Previous
 
Next
New Post
1/29/2008 10:16 PM
 

So...

I whined a week or two ago about the ratings thing and posted a msg about it. (users can multi-vote people into crappy/overblown ratings) I had decided on going with a no ask/no tell strategy until a solution or problem came up.

I had a site walkthru with the client yesterday and Ill be dam if the first thing they asked was (and I quote) "Can people vote more than once?" I did the side-step and said Id check into making it so only one person/item/vote. yay. Site launches (or as Id like to say.. I get paid) on 2/1. Hopefully.

Im actually a pretty decent plain asp/vbscript developer and have quite a few commercial sites going but am brand spanking new to .NET. Ive gone thru quite a few  tutorials @ MS  and downloaded VWD 2008 Express and could probably do some basic development in it if I had to.

I would really really like a little insight into how this module works, just a breadcrumb would be so helpful. I have scoured opened, looked at and pulled my hair out for 2 days now trying to figure out the program flow and associated files and it is so inter-include-connected that my head explodes.

In my un-.NET view.. all I need is where the ratingsform post action lives (the file that processes the ratings addition form), a unique item identifier and to set a cookie. Im not so worried about making it a part of the database, just enough pain to keep most people from doin it and primarily to show my client. They will check this and I will have to lose it if I cant do something.. and it really is an important thing for this site.

Im not asking for a fix.. Im just asking for a little insight as to where I can find the code that posts the ratings. The .vb, .aspx, whatever/wherever.

Any general info about the module would also be very appreciated.

Thanks

C

 

 
New Post
1/30/2008 11:33 AM
 

jeez, it's not THAT inter-include-connected :)

look in Repository.ascx.vb at the listObject_ItemCommand() function.. you'll see the case statement that processes the rating

Case "PostRating"
  Dim objRatingsPanel As Panel
  objRatingsPanel = CType(e.Item.Cells(0).FindControl("pnlRatings"), Panel)
  Dim objRating As RadioButtonList
  objRating = CType(objratingspanel.FindControl("rbRating"), RadioButtonList)
  If objRating.SelectedIndex <> -1 Then
    repository.UpdateRepositoryRating(objRepository.ItemId, objRating.SelectedValue)
  End If
  ...

 The highlighted line is the one that is storing the user's vote... so if you want to write a cookie, that would be the place...

I would suggest including the Repository Item's ItemId in the cookie name so you know which item in which repository module they are voting for. Add the code highlighted in green.

If objRating.SelectedIndex <> -1 Then
  repository.UpdateRepositoryRating(objRepository.ItemId, objRating.SelectedValue)
  Dim cookie As HttpCookie = New HttpCookie("Rated" & objRepository.ItemId.ToString())
  cookie.Expires = "1/1/2999"
  cookie("Rating") = objRating.SelectedValue.ToString()
  Response.Cookies.Add(cookie)

End If

Then, the last thing would be to restrict the user from voting again if they're already voted... In the same file, in the same function, you'll see the case statement for displaying the voting controls

Case "ShowRating"
  If b_CanRate Then
    Dim objRatingsPanel As Panel
    objRatingsPanel = CType(e.Item.Cells(0).FindControl("pnlRatings"), Panel)
    ...

When the user clicks on the ratings image, it checks the user's security roles to see if they are allowed to rate the iitem ( b_CanRate ), if so, then it displays the voting panel. All you need to do is also add a check for the cookie to make sure it doesn't exist. that way

Case "ShowRating"
  If Not Request.Cookies("Rated" & objRepository.ItemId.ToString()) Is Nothing Then
      b_CanRate = False
  End If

  If b_CanRate Then
    Dim objRatingsPanel As Panel
    objRatingsPanel = CType(e.Item.Cells(0).FindControl("pnlRatings"), Panel)
    ...

So, we first check to see if we have a cookie for this item, if it exists, just force b_CanRate to false and the user will not be able to vote again for that particular item.

Let me know if you have any questions or problems implementing this for your client.

 
New Post
1/30/2008 10:53 PM
 

That was **exactly** what I wanted to do. Thank you so much for your reply.

Ok.. I must be building up serious future karma points because in my last couple days of digging into DNN and the repository module I **did** notice a reference to Repository.ascx.vb and looked for that file but did not find it and assumed it was some type of hidden or systemish file maybe created on the fly..wutever... I then went on to pulling my hair out trying to find that code..lol..

Ok anyways..

Tonight, I did a search on my local files for Repository.ascx.vb from the site root and came up with nothing. I did a search for *.ascx.vb and get a laundry list. Repository.ascx.vb is not in that list. I also explorer looked and didnt see it in the root or repository folders.

I then backup my local files and download the entire working repository folder from the server and do the searches again with the same results, no Repository.ascx.vb.

The host is Godaddy.
The DotNetNuke Version 04.08.00
Repository Module Version: 03.01.13

In a perfect world.. where would one find the mystical file? :)

Thank you so much for yor help,

C

 

 

 

 
New Post
1/31/2008 12:55 AM
 

You need to download the source version from the Project Downloads page. Note that the Repository is a .NET 1.1 project so you need Visual Studio 2003 to work on it.

 
New Post
1/31/2008 10:55 AM
 

Clueless n00b strikes again..

Ok, so I downloaded the repository source and viola!! The File!! Inside a resources.zip archive.. hmm..

So I guess my question is, once I modify this file, since it dosent exist in any files on the web server, is it a compile it and upload the whole repository thing, modify and upload thing.. how exactly will these modifications get into the website? Uninstall the module then Re-install a modified re-compiled version?

I really thought I knew about web development and web serving. I am finding out I was apparently wrong.

I do appreciate the patience with my omg what a n00by-ness.

C

 

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryGot a customer "gotta have" - ya.. the ratings thing...Got a customer "gotta have" - ya.. the ratings thing...


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out