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 sample Corporate Site.
Creating the community news section
- Open the Pages application and Create a blank page under the Examples page.
- Name the page Community news.
- Switch to the Design tab of the Community news page and add the Repeater web part.
- Set the following properties for the Repeater web part.
- Web part control ID: repeaterNews
- Page types: CMS.News
- Transformation: CMS.News.Preview
- Selected item transformation: CMS.News.Default
Adding the New page button
Add the Contribution list web part to the Community news page and set the following properties for the web part:
- Show for page types: CMS.MenuItem
- Ensures that the web part is displayed only when the list of news is displayed, not on the news detail page.
- Allowed new page types: CMS.News
- Ensures that the users can create only news items under this section.
- Display list of pages: clear the check box
- Ensures that the web part displays only the New page link, without displaying the list of pages.
- Allow editing by users: Authenticated
- Ensures that only authenticated users can edit/delete the page.
The web part displays the New page link. Try to create a new page using the link on the live site.
Adding the editing support
Add the Edit contribution web part to the Community news page and set the following properties for the web part:
- Show for page types: CMS.News
- Ensures that the web part is displayed only on the news details page.
- Allow editing by users: Page owner
- Ensures that only the creator of the news item can edit or delete the page.
The web part displays the Edit and Delete buttons when the author opens a news item they wrote.
Testing the results
- Open the Users application and click New user.
- Set the following properties:
- User name: Test
- Full name: Test user
- Privilege level: None
- Save the user.
- Switch to the Sites tab and assign the user to the sample Corporate Site.
- Sign out and sign in to the Corporate Site as Test.
On the Community news page, Test user can see and use the New page link. Once you save a new page, the Delete button appears. If you go back to the Community news page and click the newly created news item, you can edit or delete the news item.
To set up an approval process for published news, use workflow on the particular site section.