Sorry for multiple postings, but I am going round in circles and not even sure there is a solution even by tinkering with the API.
In a nutshell, the requirement is (on an intranet) news articles
some of which any user (not member) can edit,
some of which only admins (or some other way of protecting them for selected users) can edit.
The requirement is that anyone can post a comment against any article (even if they can't edit that particular article). (ie similar to a blog),
Viewing articles in the front end should list their comments underneath.
They don't necessarily need to be able to see the protected articles in the CMS as I am using Frontend Editing package so they can view them in the front end and then use the 'create' button to create child documents - ie the comments. Although this doesn't work if they don't have access to edit the article - and thus my problem.
I would avoid having comments created as content items in Umbraco. You are essentially creating a page for every comment, which is a bad idea. Also you would have to perform a save and publish for every comment which is a bad idea for performance on your site. I would create a comments table in the database and have columns like:
commentid, umbraconodeid, replyto_id, comment
comment_id is the unique record id for a comment.
umbraconodeid is the id of the article
replytoid is the id of the comment being replied to, this could be left null if not a reply to a comment
If you are doing it that way I would create a separate library, so you can have your models and controllers in it and reference it from inside the view. Then when you want to deploy any changes, you are just changing this dll, not the main one for running the site.
How would you do it?
Sorry for multiple postings, but I am going round in circles and not even sure there is a solution even by tinkering with the API.
In a nutshell, the requirement is (on an intranet) news articles
some of which any user (not member) can edit,
some of which only admins (or some other way of protecting them for selected users) can edit.
The requirement is that anyone can post a comment against any article (even if they can't edit that particular article). (ie similar to a blog),
Viewing articles in the front end should list their comments underneath.
They don't necessarily need to be able to see the protected articles in the CMS as I am using Frontend Editing package so they can view them in the front end and then use the 'create' button to create child documents - ie the comments. Although this doesn't work if they don't have access to edit the article - and thus my problem.
How could this be achieved in Umbraco 7?
Regards
I would avoid having comments created as content items in Umbraco. You are essentially creating a page for every comment, which is a bad idea. Also you would have to perform a save and publish for every comment which is a bad idea for performance on your site. I would create a comments table in the database and have columns like:
commentid, umbraconodeid, replyto_id, comment
comment_id is the unique record id for a comment.
umbraconodeid is the id of the article
replytoid is the id of the comment being replied to, this could be left null if not a reply to a comment
comment is the text of the comment
What do you think to this approach?
Paul
I like this approach. Would I use petapoco to save the comments (and retrieve a list of them when displaying the articles)?
I'm think of a web service called from javascript to list the comments.
Re petapoco - do I need to install something to use this with Umbraco?
Nothing special for the poco, just something like this:
I would also add a commentor_id to relate the comment to the id of an umbraco member.
Makes sense, Paul.
However, I am having real trouble using PetaPoco from a class in App_code to be used in my web service
https://our.umbraco.org/forum/extending-umbraco-and-using-the-api/77593-using-petapoco-from-my-own-web-service
Any ideas?
I would do it server side first before trying to put it into a web service to be called from javascript
You mean in a surfacecontroller (sorry, I am little hazy on the mvc stuff) and then call that from @Html.Action?
My problem is working with hosted version of Umbraco, and I think controllers need to be compiled.
I guess I could download Umbraco, add my controller compile with Visual Studio and upload the dll?
(If too many questions - just ignore!!!)
Regards
If you are doing it that way I would create a separate library, so you can have your models and controllers in it and reference it from inside the view. Then when you want to deploy any changes, you are just changing this dll, not the main one for running the site.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.