仅在露天 Doclib 的特定文件夹内显示创建和上传按钮
Show create and upload button only inside specific folder in alfresco Doclib
我正在通过在 alfresco doclib 中创建项目操作来创建一个项目,如下面的屏幕截图所示。我必须只在文档库文件夹中创建该项目。因为我在文档库上设置了一条规则,通过 java 脚本代码创建一些动态的默认项目结构。它工作正常。
但现在我面临着一个巨大的挑战,那就是在每个子文件夹中我都得到了创建项目和上传选项。但我不想让用户在每个子文件夹中创建项目。我只想展示仅在文档库中创建和上传 doclib 操作。和我通过 java 脚本代码创建的内部目录。所以任何人都可以帮助我我该怎么做。
提前致谢。
请参考下面的截图,详细了解我的要求。
在您的 custom-share-config-custom.xml 中,您可以使用评估器来检查 DocLibActions 的条件。
这是一个仅针对 x:myType 类型的节点显示的操作示例:
share-amp-slingshot-application-context.xml :
<bean id="evaluator.doclib.action.myCondition" class="org.alfresco.web.evaluator.NodeTypeEvaluator" >
<property name="types">
<list>
<value>x:myType</value>
</list>
</property>
</bean>
共享配置-custom.xml :
<action id="example-action" type="javascript" label="....">
<evaluator>evaluator.doclib.action.myCondition</evaluator>
</action>
<evaluator>evaluator.doclib.action.myCondition</evaluator
但是这个对像创建内容这样的顶级菜单不起作用。
您可以做的是根据您的需要创建一个特定的角色,例如 this :
<permissionGroup name="SomeUserPermissions" allowFullControl="false" expose="true">
<includePermissionGroup permissionGroup="Collaborator" type="cm:cmobject" />
</permissionGroup>
然后将此特定权限应用于此文件夹上的用户,然后像这样修改您的代码
<config evaluator="string-compare" condition="DocumentLibrary" >
<create-content>
<content id="newFolderId" mimetype="text/plain" icon="folder" label="Create Project" itemid="bd:project">
<param name="page">create-content?destination={nodeRef}&itemId=cm:content&mimeType=text/plain</param>
<permissions>
<permission allow="true">SomeUserPermissions</permission>
</permissions>
<content>
</create-content>
</config>
最后,我建议您在您的分享war中查看名为share-documentlibrary-config.xml的文档,这将有助于您理解它是如何工作的。
例如,有这篇关于标签的文档:
Create Content menu items, can be of 3 types matching the usual doclib action config:
- "link" - accepts a "href" param that will be passed a nodeRef token for substitution, used for external links
- "pagelink" - accepts a "page" param that will be passed a nodeRef token for substitution, used for Share links
"javascript" - accepts & "function" param of an action that will get the current folder item as first argument.
I.e.
<content id="plain-text" label="create-content.text" icon="text" type="pagelink">
<param name="page">create-content?destination={nodeRef}&itemId=cm:content&mimeType=text/plain</param>
<permissions>
<permission allow="true">SomeUserPermissions</permission>
</permissions>
</content>
Note that the "CreateChildren" permission is always required and will disable the entire menu if no granted for a folder.
Also note that the old/untyped simple config still is allowed, the config snippet below will automatically be converted to a "pagelink" as in the example above.
<content id="plain-text" label="create-content.text" icon="text" itemid="cm:content" mimetype="text/plain"
permission="SomeUserPermissions"/>
我正在通过在 alfresco doclib 中创建项目操作来创建一个项目,如下面的屏幕截图所示。我必须只在文档库文件夹中创建该项目。因为我在文档库上设置了一条规则,通过 java 脚本代码创建一些动态的默认项目结构。它工作正常。
但现在我面临着一个巨大的挑战,那就是在每个子文件夹中我都得到了创建项目和上传选项。但我不想让用户在每个子文件夹中创建项目。我只想展示仅在文档库中创建和上传 doclib 操作。和我通过 java 脚本代码创建的内部目录。所以任何人都可以帮助我我该怎么做。
提前致谢。
请参考下面的截图,详细了解我的要求。
在您的 custom-share-config-custom.xml 中,您可以使用评估器来检查 DocLibActions 的条件。
这是一个仅针对 x:myType 类型的节点显示的操作示例:
share-amp-slingshot-application-context.xml :
<bean id="evaluator.doclib.action.myCondition" class="org.alfresco.web.evaluator.NodeTypeEvaluator" >
<property name="types">
<list>
<value>x:myType</value>
</list>
</property>
</bean>
共享配置-custom.xml :
<action id="example-action" type="javascript" label="....">
<evaluator>evaluator.doclib.action.myCondition</evaluator>
</action>
<evaluator>evaluator.doclib.action.myCondition</evaluator
但是这个对像创建内容这样的顶级菜单不起作用。 您可以做的是根据您的需要创建一个特定的角色,例如 this :
<permissionGroup name="SomeUserPermissions" allowFullControl="false" expose="true">
<includePermissionGroup permissionGroup="Collaborator" type="cm:cmobject" />
</permissionGroup>
然后将此特定权限应用于此文件夹上的用户,然后像这样修改您的代码
<config evaluator="string-compare" condition="DocumentLibrary" >
<create-content>
<content id="newFolderId" mimetype="text/plain" icon="folder" label="Create Project" itemid="bd:project">
<param name="page">create-content?destination={nodeRef}&itemId=cm:content&mimeType=text/plain</param>
<permissions>
<permission allow="true">SomeUserPermissions</permission>
</permissions>
<content>
</create-content>
</config>
最后,我建议您在您的分享war中查看名为share-documentlibrary-config.xml的文档,这将有助于您理解它是如何工作的。
例如,有这篇关于标签的文档:
Create Content menu items, can be of 3 types matching the usual doclib action config:
- "link" - accepts a "href" param that will be passed a nodeRef token for substitution, used for external links
- "pagelink" - accepts a "page" param that will be passed a nodeRef token for substitution, used for Share links
"javascript" - accepts & "function" param of an action that will get the current folder item as first argument.
I.e. <content id="plain-text" label="create-content.text" icon="text" type="pagelink"> <param name="page">create-content?destination={nodeRef}&itemId=cm:content&mimeType=text/plain</param> <permissions> <permission allow="true">SomeUserPermissions</permission> </permissions> </content>
Note that the "CreateChildren" permission is always required and will disable the entire menu if no granted for a folder.
Also note that the old/untyped simple config still is allowed, the config snippet below will automatically be converted to a "pagelink" as in the example above.
<content id="plain-text" label="create-content.text" icon="text" itemid="cm:content" mimetype="text/plain" permission="SomeUserPermissions"/>