Assign and approve articles

In this topic you will learn how to implement the article assignment and approval process. This is done with two additional buttons that will be displayed next to each list row:

Implementing this process has two parts:

  1. Create and restrict button visibility.

  2. Create the pages that perform the update operations.

Create the list buttons

To create the two buttons, follow the next steps:

  1. Open the admin/list page in Dreamweaver.

  2. Place the mouse cursor after the delete link, and type Assign for review Approve. Make sure you type outside the existing conditional region (select the conditional region and then press the Left Arrow key):


               

  3. Next turn the first text into a link to the assignment page:

  4. To create the second link you need to follow the same steps, but for the name use Approve and make it point to the admin/approve page. Also pass it the article ID as URL parameter. Then make is look like a button.

If you preview the page in a browser, the two buttons will be displayed:

 

Show buttons on condition

The Assign for review button will be displayed only for authors, and only for the articles they have assigned - which are the same they wrote and set as draft. To hide it from all others:

  1. Select the Assign for review link in Dreamweaver.

  2. Go to the Server Behaviors tab > Plus (+) > MX Kollection > Conditional Regions and select the Show If Conditional Region server behavior.

  3. Configure the user interface fields to add the first condition - the assigned_to_art field must match the session stored ID, similar to the list restrictions.

  4. Next click on the Advanced tab of the user interface to add a second condition. Place the cursor in the Expression textarea, after the existing text and type:



    Note:
    The image above was made using the PHP sever model.

  5. Click OK to close the user interface and apply the changes.

If you preview the page in a browser as an author and you do not have any articles, the buttons will not be displayed.

Repeat the steps above for the Approve button as well. In step 4 replace the value of the access level with 2 - the editor level, instead of 1 - the author level.

Before moving on switch to code view and check that the show if conditional regions have been applied properly - each of the link must have a start show if region and an end shod if region comment in front and after them.

Create the article assignment page

In this section you will create the page that allows an author pick an editor to perform the review. The page is accessed by the author through the article list, by clicking on the Assign for review button. The page receives the article ID as an URL parameter.

To build this page you need:

To create this page, follow the next steps:

  1. Open the admin/assign page in Dreamweaver.

  2. Go to the Bindings tab > Plus (+) > Recordset (Query).

  3. Configure the Recordset interface as shown below:


          

  4. Click OK to close the user interface and create the recordset.

  5. To add the update operation, go to the MX Kollection tab of the Insert bar and click the Update Record Form Wizard icon. The wizard is divided into three steps.

  6. In the first step of the wizard specify the table to update information:


                  

  7. In the second step configure the fields to take part in the update transaction:


                        

  8. In the third step of the wizard select the assigned_to_art field and check the Required option:


                     

  9. Click Finish when done to close the user interface and create the update form.

  10. You also need to change the article state - from draft to review. Because this is not a field that the user can work on, you have to set it with the Add Transaction Fields server behavior.

  11. Go to the Server Behaviors tab > Plus (+) > MX Kollection > Forms > Advanced and select the Add Transaction Fields entry.

  12. Configure the user interface as shown below:


                      

Save the page and upload it on the server. When you click the Assign for review button next to one of your articles, the page will load and an editor can be selected.

 

Create the article approval page

The approve page is accessed by editors who have finished the review and deem the article worthy to be published. What it does is automatically change the status_art column to 3 - approved, and return the user back to the list page.

  1. Open the admin/approve page in Dreamweaver.

  2. Go to the Server Behaviors tab > Plus (+) > MX Kollection > Forms > Advanced and select the Update Record Transaction server behavior. The user interface is divided into three tabs. Thanks to the user interface persistence, most of the fields are already filled in.

  3. On the first tab - Basic - configure general options:


                 

  4. On the Fields tab configure the fields to update:


                   

  5. Click OK to apply the update transaction. Save the page.

Now if you login with an editor account and you have an assigned article, by clicking the Approve button, its state will change, you won't be able to edit it anymore, and it will also appear in the site front-end.


 

 

This completes the changes you have to make for the list to be fully functional. Next you have to create the form that allows adding, editing and removing articles.