Moving content in EpiserverEpiserver's UI is simple for editors to use but also very powerful. One specific feature I'd like to talk about today is the ability to move pages around in the site tree by simply dragging and dropping them. 

This is great feature and incredibly simple to use. However moving content around a site can have big impacts on the site SEO, site functionality and in the worst case scenario create errors on a site. By default any editor can move pages to other places in the tree (with sufficient access rights) and the moves require no approval.

So I am writing about an idea I had to make publishers approve requests for moving pages in the tree. The idea is to use Episerver's own edit/approval process to approve the move request.

If you don't want to read the technical detail, skip to seeing it in action.

The approach is relatively simple:

  • When a user tries to move a page cancel the move and show a message to the user to let them know it needs to be approved
  • On cancelling the move create a "Page Move Request" page that stores the move request data in a node in the tree
  • When the "Page Move Request" page is published move the original content to the requested location

Most of the the action takes place in an initialisation module. If a page is being moved then the original move is cancelled and an instance of the "PageMoveRequest" page is created. This works for pages only in this example but can easily be extended for any content type.

The module also looks for PageMoveRequest instances being published. Once published the original move is made and the request itself is moved to the recycle bin:

CaptureRequestsInit

Presentation of PageMoveRequest

The model(s), view and controller for the PageMoveRequest can be found below:

We also use an initialisation module to ensure an instance of PageMoveRequestRoot always exists in the content repository root to store our move requests:

Finally some UI descriptors make our content look nice in in the tree:

Seeing it in action

Now when a user moves a page they see this message:

 

Approving the page moves

Users with appropriate publish rights can now look at the page move requests and approve them if they see fit: 

Once they have published the request the source page is moved and the request is marked as complete (by moving it to the recycle bin):

Final note

This also has a side effect that this will work on deletions too as they are just moves in themselves. This may be desirable but you can tweak the code or use built in permissions to prevent deletions as you like.

The source code is available over on Gist.

This is only proof of concept code, if you would like to enhance it further let me know and I can drop it into a proper repo.

Conclusion

Using the built in Episerver features it can be seen that its easy to extend out functionality to match specific customer needs. This was put together as a quick proof a concept, so I'd be happy to hear if there is anything that could be improved.

Is this a challenge you face yourself? Do you do something similar or different if you want content move requests to be approved? I’d be happy to hear feedback in the comments below or on @davidknipe

Updated 14/04/2016

Read part two of this post: Approvals for moving content in the Episerver page tree part 2 - removing the default confirmation dialog


Comments

Recommendations for you