Custom Post Pages for site workflow
We recently had a client who required a custom post page for workflow purposes:
Please create role "DraftPosts" and allow them to create posts in the "Workflow" blog but only save drafts, not publish. Also, please make sure they use the site skin, not the control panel skin
Fairly simple with a few "gotcha" steps.
- Create the new role "DraftPosts"
- Update "Workflow" blog permissions to allow "DraftPosts" to manage content
That's fairly simple, but step 2, which I forgot, can cause quite a bit of headache if missed. The next step is creating your Post Editor page; it's also fairly straight forward.
- From /ControlPanel/Blogs/ copy CreateEditBlogPost.ascx and PostEditor.aspx (and associated .cs & .resx pages) to your new location. You'll want the new location to have access to the appropriate theme, so I put it in /Themes/leanandgreen/common/.
- Update both pages so the class names are unique. I renamed them to DraftPostsPostEditorPage and DraftPostsCreateEditBlogPost respectively.
- Update both ASPX pages: inherit from the updated code behind pages and pointing them to the correct master pages. ex.:
<%@ Page language="c#" Codebehind="DraftPostsPostEditor.aspx.cs" AutoEventWireup="false"
Inherits="CommunityServer.ControlPanel.Blogs.DraftPostsPostEditorPage"
MasterPageFile="~/Themes/leanandgreen/common/master.Master" %> - Assign the Workflow blog section ID to the CSContext:
override protected void OnInit(EventArgs e)
{
.......
MyWeblogSectionID = Weblogs.GetWeblog("Workflow").SectionID; CSContext.Current.SectionID = MyWeblogSectionID;
.......
}
Lastly, remember they only want the user to be able to save, not publish. There are various ways of doing this and by far likely better ways than I chose to. That said, I just hid the "Publish" button!
Good luck, and don't hesitate to let me know if the above steps didn't work for you!