Permalink
Browse files

Add the tool and register it with plone.app.registry, only a single t…

…ext field for now, needs to use data grid field or similar
  • Loading branch information...
1 parent 27e87d4 commit c19b439256e5d707a41743ce27df7d5ec69c17f3 Michael Davis committed Nov 8, 2011
@@ -14,6 +14,13 @@
permission="zope2.View"
/>
+ <browser:page
+ for="plone.app.layout.navigation.interfaces.INavigationRoot"
+ name="swordrepositories"
+ class=".sword_repositories_tool.SwordRepositoriesEditFormView"
+ permission="zope2.View"
+ />
+
<genericsetup:registerProfile
name="default"
title="Sword client"
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<object name="portal_controlpanel" meta_type="Plone Control Panel Tool"
+ i18n:domain="plone" xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <configlet title="Sword Repositories" action_id="SwordRepositories" appId="rhaptos.swordclient.plone"
+ category="Products" condition_expr=""
+ icon_expr="string:$portal_url/product_icon.png"
+ url_expr="string:${portal_url}/swordrepositories"
+ visible="True" i18n:attributes="title">
+ <permission>Manage portal</permission>
+ </configlet>
+</object>
@@ -0,0 +1,3 @@
+<registry>
+ <records interface="rhaptos.swordclient.plone.sword_repositories_tool.ISwordRepositoriesSettings" />
+</registry>
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<tool-setup>
+ <required tool_id="sword_repositories_tool"
+ class="rhaptos.swordclient.plone.sword_repositories_tool.SwordRepositoriesTool"/>
+</tool-setup>
@@ -0,0 +1,42 @@
+from Globals import InitializeClass
+from AccessControl import ClassSecurityInfo
+from Products.CMFCore.utils import UniqueObject
+from OFS.SimpleItem import SimpleItem
+from plone.app.registry.browser.controlpanel import RegistryEditForm
+from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper
+
+from zope.interface import Interface
+from zope import schema
+
+from collective.z3cform.datagridfield import DataGridFieldFactory, DictRow
+
+from Products.CMFPlone.PloneBaseTool import PloneBaseTool
+from plone.z3cform import layout
+
+from rhaptos.swordclient.plone import _
+
+class ISwordRepository(Interface):
+ repository_name = schema.TextLine(title=u"Repository Name")
+ repository_url = schema.TextLine(title=u"Repository URL")
+
+class ISwordRepositoriesSettings(Interface):
+ """ Define schema for sword repositories tool"""
+ """sword_repositories = schema.List(title=u"Sword Repositories",
+ value_type=DictRow(title=u"Sword Repository", schema=ISwordRepository))"""
+ sword_repositories = schema.TextLine(title=u"Sword Repositories")
+
+class SwordRepositoriesEditForm(RegistryEditForm):
+ label = _(u"Sword Repositories settings")
+ description = _(u"Please enter details of available SWORD repositories")
+
+ schema = ISwordRepositoriesSettings
+
+class SwordRepositoriesTool(PloneBaseTool, SimpleItem):
+ """The tool for managing connection details for sword repositories"""
+ id = 'sword_repositories_tool'
+ meta_type= 'Sword Repositories Tool'
+
+ security = ClassSecurityInfo()
+
+SwordRepositoriesEditFormView = layout.wrap_form(SwordRepositoriesEditForm, ControlPanelFormWrapper)
+InitializeClass(SwordRepositoriesTool)

0 comments on commit c19b439

Please sign in to comment.