【问题标题】:How do you show dynamic messages on custom actions?您如何在自定义操作上显示动态消息?
【发布时间】:2015-10-20 16:52:53
【问题描述】:

我在 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

【问题讨论】:

  • 动态消息是什么意思?
  • successMessage 或 failureMessage 的参数指向一个属性文件值,该值在小弹出窗口中显示静态文本。目前他们说“部署到 QA 成功”或“部署到 QA 失败”,但我想显示一条更具描述性的消息,说明为什么它未能帮助用户。
  • @MJSalinas 你能解决这个问题吗?
  • @kgthegreat 不,一位同事创建了一个动态 html,然后在进程运行后弹出。它显示了两种情况的详细信息。
  • @kgthegreat 是的,就是这样。我仍然不认为它是最好的解决方案,但它确实为我们提供了很好的定制。

标签: alfresco alfresco-share


【解决方案1】:

是的,您可以这样做。尝试以下步骤。我给出了您可以在您的案例中应用的通用场景。

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!

【讨论】:

    猜你喜欢
    • 2023-03-23
    • 1970-01-01
    • 2019-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-19
    相关资源
    最近更新 更多