how to customize publish action - sitecore

北城余情 提交于 2019-12-25 16:02:42

问题


I created a user in sitecore with 2 roles assigned to him i.e author and publisher When this user who is both author and publisher creates any content he shouldn't be able to publish it.

Can i overwrite the publish action? check on the user who submitted the content and the roles he is assigned to and restrict him with a popup message or something like that? Any help is appreciated.

Thanks.


回答1:


Follow the below steps to write custom publish actions

  1. For customizing the publish action, Write a c# class and inherit Sitecore.Shell.Applications.Dialogs.Publish.PublishForm.There are override methods like ActivePageChanged and OnNext. You can basically overwrite those classes and write your own alerts with Sitecore.Web.UI.Sheer.SheerResponse like shown below.
    SheerResponse.Alert("The current item will not be published.Please select both staging and web database to publish the HOME item.");
  2. Copy the Publish.xml file from (your siteroot/)/sitecore\shell\Applications\Dialogs\Publish.
  3. Create "sitecore\shell\Override\Applications\Dialogs\publish" in root of website
  4. Paste publish.xml in the following folder in root of your site "sitecore\shell\Override\Applications\Dialogs\publish"
  5. Open publish.xml file and modify the Wizard tag

    CodeBeside="Sitecore.Shell.Applications.Dialogs.Publish.PublishForm,Sitecore.Cli ent"

    to

    CodeBeside="your Class Name with name space here,your Assembly name"

Here is screenshot of how publishoverride form should look like



来源:https://stackoverflow.com/questions/26475500/how-to-customize-publish-action-sitecore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!