如何在自定义操作上显示动态消息?

时间:2015-10-20 16:52:54

标签: alfresco alfresco-share

我在share-config-custom.xml

中设置了这样的自定义操作
<action id="deploy-asset-qa" type="javascript" label="Deploy File to QA..." icon="document-move-to">
    <param name="function">onActionSimpleRepoAction</param>
    <permissions>
        <permission allow="true">Write</permission>
    </permissions>
    <param name="action">deploy-asset-qa</param>
    <param name="successMessage">message.deployment-success-qa</param>
    <param name="failureMessage">message.deployment-failure-qa</param>
</action>

这很好用,但这仅显示硬编码消息,如果它是成功或失败。

我想向用户展示更多动态错误消息,以便提供良好反馈。

如何在自定义操作上显示动态消息?

我正在使用Alfresco Community 5.0.d

1 个答案:

答案 0 :(得分:0)

是的,你可以这样做。尝试以下步骤。我给出了一般情况,你可以在你的情况下申请。

1)From Share UI, I click on custom action
2)This action will call your Repo data webscript to check datatype OR whatever is your logic.
3)You can define specific Success/Failure message as part of your data webscript's JSON response.
4)You can access this response and so this custom message in Share client side js
5)Display this message to users.

For Failure I would suggest You can add, specific template file with failure status code and Failure message.
Ex: customAction.get.json.500.ftl  , customAction.get.json.400.ftl etc..

Hope it helps!