【发布时间】:2021-03-16 03:54:39
【问题描述】:
我目前正在尝试找出一种方法来禁用 Alfresco 4.2.b 中的系统范围内的快速共享功能,或者如果不可能,至少从文档库和文档详细信息页面中删除快速共享链接。
我尝试的第一件事是利用 alfresco-global.properties 文件中可配置的 system.quickshare.enabled 属性。它根本无法抛出下一个异常:
我发现了一个与此相关的问题:https://issues.alfresco.com/jira/browse/ALF-16233。
由于这似乎是一个错误,并且会在后续版本中得到修复,因此我专注于尽可能从 UI 中删除快速共享链接。顺便说一句,我发现了一个相关的帖子:https://forums.alfresco.com/en/viewtopic.php?f=48&t=46659。通过创建下一个扩展,我已成功删除文档详细信息页面中的 document-links 区域:
<extension>
<modules>
<module>
<id>Removes from document-details page the Share region.</id>
<auto-deploy>true</auto-deploy>
<components>
<component>
<scope>template</scope>
<region-id>document-links</region-id>
<source-id>document-details</source-id>
<sub-components>
<sub-component id="default">
<evaluations>
<evaluation id="hideDocumentLinks">
<render>false</render>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
</components>
</module>
</modules>
</extension>
没关系。我还有来自文档详细信息页面的快速共享链接,该链接在 share-config.xml 文件中执行了一些更改,特别是在社交部分中将标签留空:
<config evaluator="string-compare" condition="Social">
<!-- Alfresco QuickShare social widget - for creating public url that can be shared -->
<quickshare>
<!--
Will be available as Alfresco.constants.QUICKSHARE_URL using javascrip in the browser.
If changing this, make sure this url matches the quickshare rule in urlrewrite.xml
-->
<url>{context}/s/{sharedId}</url>
</quickshare>
<!-- Alfresco LinkShare social widget - share a link to social sites -->
<linkshare>
<!--
These actions will be available as Alfresco.constants.LINKSHARE_ACTIONS using javascript in the browser.
Labels will be retrieved from msg key "linkshare.action.<id>.label" unless explicitly provided as an
attribute to the action element.
Each param value accepts the following input: {shareUrl}, {displayName} or a msg key that will be prefixed.
I.e. {body} for the email action's href param will be retrieved using "linkshare.action.email.body".
-->
<action id="email" type="link" index="10">
<param name="href">mailto:?subject={subject}&body={body}</param>
<param name="target">new</param>
</action>
<action id="facebook" type="link" index="20">
<param name="href">https://www.facebook.com/sharer/sharer.php?u={shareUrl}&t={message}</param>
<param name="target">new</param>
</action>
<action id="twitter" type="link" index="30">
<param name="href">https://twitter.com/intent/tweet?text={message}&url={shareUrl}</param>
<param name="target">new</param>
</action>
<action id="google-plus" type="link" index="40">
<param name="href">https://plus.google.com/share?url={shareUrl}</param>
<param name="target">new</param>
</action>
</linkshare>
</config>
因为这个逻辑是在 node-header.get.js webscript 中定义的:
model.showQuickShare = (!model.isContainer && model.showQuickShare && config.scoped["Social"]["quickshare"].getChildValue("url") != null).toString();
尽管如此,快速共享链接仍保留在文档库页面中,这让我感到惊讶。我相信存在与上述类似的逻辑来显示或不显示文档库页面中的链接,但事实并非如此。所以,现在我想知道我还能做什么......正如我所看到的,该链接是在客户端使用文档库小部件 (documentlist.js) 生成的:
if (!record.node.isContainer)
{
html += '<span class="item item-social item-separator">' + Alfresco.DocumentList.generateQuickShare(this, record) + '</span>';
}
我正在考虑创建一个扩展来自定义文档库小部件,类似地在这里描述:[url]http://blogs.alfresco.com/wp/ddraper/2012/05/22/customizing-share-javascript-widget -instantiation-part-1/[/url]。这可能吗?
我想知道在开始自定义小部件之前是否有更简单的方法来完成我需要做的事情。如果不存在那种“神奇”的方式,我想知道所描述的方法是否正确。
提前致谢。
【问题讨论】:
-
您已经声明有 JIRA 票证(我已经看过了),但它仍然无法正常工作。因此,您唯一的选择是等待修复或从字面上破解您的方式。做起来又快又脏。只需使用 CSS 隐藏 item-social 类并将 share-config-custom 中的 URL 更改为不工作的 URL,以保持安全。
-
非常有用的塔希尔。实际上我已经从文档库和文档详细信息页面中删除了快速共享链接,只需添加这个覆盖为链接计算的样式的 CSS 条目:
.item-social a.quickshare-action { visibility: hidden; } -
顺便说一句,如果您愿意,可以将您的评论作为答案发布,我会将其标记为已接受的答案。
-
没问题,我有点忙没来得及发:)
标签: customization share alfresco