Example: Publishing community news

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

In this example, you will create a new section for publishing community news. Each registered site member can create new news items and edit/delete their previously posted news. The example assumes that you are using the Corporate Site sample website. In this topic you will learn how to:

 

Create the community news section
Add the New document button
Add the editing support
Create a testing user
Create your first news item
Approve the news

 

Creating the community news section

 

1. Sign in as administrator to CMS Desk, go to the Content section and click Examples in the content tree. Click NewDocument New and choose to create a new CMS_MenuItem Page (menu item). Enter the name Community and choose to create a blank page using the Simple layout:

 

devguide_clip0655

 

2. Click Save Save. Switch to the Design tab of the newly created page and add the Listings and Viewers/Repeater web part. Set the following properties:

 

Web part control ID: repeaterNews
Document types: cms.news
Transformation: CMS.News.preview
Selected item transformation: CMS.News.default

 

devguide_clip1335

 

3. Click OK.

 

Adding the New document button

 

1. Add a new web part User contributions/Contribution list. It will display the New document link. Set the following values:

 

Show for document types: cms.menuitem
- this ensures that the web part is displayed only when the list of news is displayed, not on the news detail page.
Allowed new document types: CMS.News
- this means that the users will be allowed to create only news items under this section.
Display list of documents: no (unchecked)
- this ensures that the web part displays only the New document link, without displaying the list of documents.
Allow editing by users: Authenticated
- this means that only authenticated users will be able to edit/delete the document. Authenticated users are those who are signed-in to the website (not to the administration interface).

 

2. Leave the other values as they are by default.

 

devguide_clip1336

 

3. Click OK.

 

Adding the editing support

 

1. Add a new web part User contributions/Edit contribution. It will display the Edit/Delete icons when some news item is chosen.

 

Show for document types: cms.news
- this ensures that the web part is displayed only on the news detail page.
Allow editing by users: Document owner

 

Please note that the Edit contribution web part is missing the Allow insert/edit properties.

 

devguide_clip1337

 

2. Click OK.

 

Creating a testing user

 

1. Go to Site Manager -> Administration -> Users and click the AddNewUser New user link to create a new user with user name test1. Please note that to create a user, at least the values of the following two compulsory fields: User name and Full name must be entered.

 

devguide_clip1341

 

2. For the purpose of this example, choose no (uncheck the box) in the Is editor field - test1 is a common site member without access to Kentico CMS Desk.

 

devguide_clip1339

 

Click OK to save the changes.

 

Creating your first news item

 

1. Sign out and go to the Examples -> Community section. You will see a blank page since the user contributions are now enabled only for site members. In order to sign in, click the My account link at the top and sign in as user test1. Then go back to the Examples -> Community section. You will see the New document link:

 

devguide_clip1340

 

2. Click this link and you will be displayed with the news editing form:

 

devguide_clip0735

 

3. Enter some content and click Save Save. Now select Examples -> Community from the main menu at the top. You will see the Community page with your first news item:

 

devguide_clip0737

 

4. Click the news item link to see the details page. The Edit Edit and Delete Delete links are be displayed below the news item:

 

devguide_clip0738

 

5. Choose to Edit Edit the news item and you will be displayed with the editing form where you can edit its content:

 

devguide_clip0740

 

6. Make some modifications and click Save Save. Click the Close edit mode link to see the updated page.

 

Approval process

 

If you need to enforce some approval process for published news, you can simply set up workflow for the given site sections and all news will need to be approved by a site manager. You can find more details on workflow configuration in the Workflow overview chapter.

 

In this example, you have learned how to create a site section where community members can create and edit content without having access to Kentico CMS Desk.

 

Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?example_publishing_community_news.htm