在使用Plone时,我将DocumentViewer product集成到Plone应用程序中,以帮助查看PDF文件。document viewer插件产品定义了一组可以在控制面板设置中查看的架构/字段,即站点设置->;文档查看器设置。在
您可以查看字段/模式是如何定义的here
现在我想通过在我的示例.产品. 在
我认为我不能使用SchemaExtender,因为它们不是原型。我也尝试过按照by this link提供的说明进行操作,但没有效果。我可以重新安装我的产品,但我添加的字段未显示。在
下面是我的代码示例:
from collective.documentviewer.interfaces import IGlobalDocumentViewerSettings
from collective.documentviewer.interfaces import IDocumentViewerSettings
from zope import schema
from zope.interface import implements
class DocViewerSchemaProvider(object):
implements(IGlobalDocumentViewerSettings)
def getSchema(self):
"""
"""
return IEnhancedDocumentViewerSchema
class IEnhancedDocumentViewerSchema(IDocumentViewerSettings):
"""
Use all the fields from the default schema, and add various extra fields.
"""
folder_location = schema.TextLine(
title=u"Default folder location",
description=u'This folder will be created in the Plone root folder. '
u'Plone client must have write access to directory.',
default=u"files_folder")
有谁能帮助我重写这个特殊的接口吗?在
因为作者(我)并没有让重写变得简单,所以重写会有点复杂。以下步骤是您需要做的。警告,这都是伪代码,所以你可能需要调整一下,让它为你工作。在
首先,通过扩展要自定义的接口来提供自定义接口:
然后,创建用于存储和检索架构设置的设置适配器:
^{pr2}$然后,注册适配器:
然后,使用自定义架构创建一个表单:
然后,为您的产品创建一个自定义层,扩展documentviewer层。这需要两个步骤。首先,添加层接口:
然后用通用设置注册你的图层。添加xml文件,浏览器层.xml,添加到包含以下内容的配置文件中(确保重新安装产品以便注册层)::
最后,使用自定义表单覆盖“全局设置”视图,仅针对已为产品注册的图层:
哇,那太难了。在
相关问题 更多 >
编程相关推荐