Skip to content

Commit

Permalink
Merge pull request #4 from BB-Open/settings
Browse files Browse the repository at this point in the history
Add PKAN Settings
  • Loading branch information
thomasmassmann committed Feb 6, 2018
2 parents c2687b0 + ae89eff commit 0166e66
Show file tree
Hide file tree
Showing 33 changed files with 468 additions and 46 deletions.
Binary file modified docs/_images/dct_licensedocument_add_form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/settings_base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/settings_folders-folder_agents.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/settings_folders-folder_licenses.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/settings_folders.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions docs/source/configuration/base.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
=============
Base Settings
=============

.. figure:: ../../_images/settings_base.png

PKAN Base Settings
37 changes: 37 additions & 0 deletions docs/source/configuration/folders.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
===============
Folder Settings
===============

.. figure:: ../../_images/settings_folders.png

PKAN Folder Settings


.. figure:: ../../_images/settings_folders-folder_agents.png

Folder Settings: Agents


.. figure:: ../../_images/settings_folders-folder_formats.png

Folder Settings: Formats


.. figure:: ../../_images/settings_folders-folder_licenses.png

Folder Settings: Licenses


.. figure:: ../../_images/settings_folders-folder_locations.png

Folder Settings: Locations


.. figure:: ../../_images/settings_folders-folder_publishers.png

Folder Settings: Publishers


.. figure:: ../../_images/settings_folders-folder_standards.png

Folder Settings: Standards
11 changes: 11 additions & 0 deletions docs/source/configuration/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==========================
Configuration And Settings
==========================

.. toctree::
:maxdepth: 2
:hidden:
:caption: Configuration And Settings

Base Settings <base>
Folders <folders>
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This Plone Add-On adds content types based on DCAT-AP.de for the `Plone CMS <ht
:maxdepth: 2

Installation <install>
Configuration <configuration/index>
Content Types <content_types/index>


Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@
'plone.formwidget.relateditems >= 0.2',
'Products.GenericSetup >= 1.8.2',
'ps.zope.i18nfield >= 0.7',
'requests',
'surf',
'rdflib',
'rdflib-sqlalchemy',
'requests',
'surf',
'vkbeautify',
'z3c.jbot',
'zope.app.content',
],
],

test_requires = [
'plone.app.contenttypes',
Expand Down
14 changes: 4 additions & 10 deletions src/pkan/dcatapde/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,10 @@
xmlns:plone="http://namespaces.plone.org/plone"
i18n_domain="pkan.dcatapde">

<!-- Set overrides folder for Just-a-Bunch-Of-Templates product -->
<include package="z3c.jbot" file="meta.zcml" />
<browser:jbot
directory="overrides"
layer="pkan.dcatapde.interfaces.IPkanDcatapdeLayer"
/>

<include package=".add_views"/>
<include package=".edit_views"/>
<include package=".content_views"/>
<include package=".add_views" />
<include package=".controlpanel "/>
<include package=".edit_views" />
<include package=".content_views" />
<!-- Publish static files -->


Expand Down
2 changes: 2 additions & 0 deletions src/pkan/dcatapde/browser/controlpanel/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
"""Control Panels for pkan.dcatapde."""
26 changes: 26 additions & 0 deletions src/pkan/dcatapde/browser/controlpanel/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""Base controlpanel view."""

from pkan.dcatapde import i18n
from plone.app.registry.browser import controlpanel
from plone.registry.interfaces import IRegistry
from z3c.form import field
from zope.component import getUtility


class SelfHealingRegistryEditForm(controlpanel.RegistryEditForm):
"""Registers the schema if an error occured."""

def getContent(self):
registry = getUtility(IRegistry)
try:
return registry.forInterface( # noqa
self.schema,
prefix=self.schema_prefix,
)
except KeyError:
self.ignoreContext = True
self.fields = field.Fields()
registry.registerInterface(self.schema)
self.status = i18n.STATUS_REGISTRY_UPDATED
return None
20 changes: 20 additions & 0 deletions src/pkan/dcatapde/browser/controlpanel/configure.zcml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="pkan.dcatapde">

<browser:page
class=".settings.PKANBaseSettingsPanelView"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
name="pkan-controlpanel-base"
permission="pkan.dcatapde.controlpanel.PKAN"
/>

<browser:page
class=".settings.PKANFolderSettingsPanelView"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
name="pkan-controlpanel-folders"
permission="pkan.dcatapde.controlpanel.PKAN"
/>

</configure>
41 changes: 41 additions & 0 deletions src/pkan/dcatapde/browser/controlpanel/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
"""PKAN Control Panel."""

from pkan.dcatapde import i18n
from pkan.dcatapde import interfaces
from pkan.dcatapde.browser.controlpanel import base
from plone.app.registry.browser import controlpanel
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from zope.interface import implementer


@implementer(interfaces.IPKANBaseSettings)
class PKANBaseSettingsEditForm(base.SelfHealingRegistryEditForm):
"""PKAN Settings Form."""

description = i18n.HELP_SETTINGS_BASE
label = i18n.LABEL_SETTINGS_BASE
schema = interfaces.IPKANBaseSettings


class PKANBaseSettingsPanelView(controlpanel.ControlPanelFormWrapper):
"""PKAN Settings Control Panel."""

form = PKANBaseSettingsEditForm
index = ViewPageTemplateFile('templates/controlpanel_layout_base.pt')


@implementer(interfaces.IPKANFolderSettings)
class PKANFolderSettingsEditForm(base.SelfHealingRegistryEditForm):
"""PKAN Folder Settings Form."""

description = i18n.HELP_SETTINGS_FOLDERS
label = i18n.LABEL_SETTINGS_FOLDERS
schema = interfaces.IPKANFolderSettings


class PKANFolderSettingsPanelView(controlpanel.ControlPanelFormWrapper):
"""PKAN Folder Settings Control Panel."""

form = PKANFolderSettingsEditForm
index = ViewPageTemplateFile('templates/controlpanel_layout_folders.pt')
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
metal:use-macro="here/prefs_main_template/macros/master"
i18n:domain="pkan.dcatapde">

<body>

<div metal:fill-slot="prefs_configlet_main">

<a id="setup-link" class="link-parent"
tal:attributes="href string:$portal_url/@@overview-controlpanel"
i18n:translate=""
i18n:domain="plone">Site Setup</a>

<h1 class="documentFirstHeading" i18n:translate="">PKAN Settings</h1>

<div metal:use-macro="context/global_statusmessage/macros/portal_message">Portal status message</div>

<div id="content-core">

<div class="autotabs">
<div class="autotoc-nav">
<a href="" class="active"
tal:attributes="href string:${portal_url}/@@pkan-controlpanel-base"
i18n:translate="">Settings</a>
<a href=""
tal:attributes="href string:${portal_url}/@@pkan-controlpanel-folders"
i18n:translate="">Folders</a>
</div>
<span tal:replace="structure view/contents" />
</div>
</div>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
metal:use-macro="here/prefs_main_template/macros/master"
i18n:domain="pkan.dcatapde">

<body>

<div metal:fill-slot="prefs_configlet_main">

<a id="setup-link" class="link-parent"
tal:attributes="href string:$portal_url/@@overview-controlpanel"
i18n:translate=""
i18n:domain="plone">Site Setup</a>

<h1 class="documentFirstHeading" i18n:translate="">PKAN Settings</h1>

<div metal:use-macro="context/global_statusmessage/macros/portal_message">Portal status message</div>

<div id="content-core">

<div class="autotabs">
<div class="autotoc-nav">
<a href=""
tal:attributes="href string:${portal_url}/@@pkan-controlpanel-base"
i18n:translate="">Settings</a>
<a href="" class="active"
tal:attributes="href string:${portal_url}/@@pkan-controlpanel-folders"
i18n:translate="">Folders</a>
</div>
<span tal:replace="structure view/contents" />
</div>
</div>
</div>
</body>
</html>
Empty file.
12 changes: 5 additions & 7 deletions src/pkan/dcatapde/config/templates/controlpanel.pt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<a href=""
id="setup-link"
tal:attributes="href string:$portal_url/plone_control_panel"
i18n:translate="">
i18n:translate=""
i18n:domain="plone">
Site Setup
</a> &rsaquo;

Expand All @@ -30,19 +31,16 @@
<a href=""
class="link-parent"
tal:attributes="href string:${portal_url}/plone_control_panel"
i18n:domain="inqbus.mailcenter"
i18n:domain="plone"
i18n:translate="label_up_to_plone_setup">
Up to Site Setup
</a>

<div class="documentDescription" i18n:translate="">
Here you have access to all controlpanels related to inqbus mailcenter.
Make your choice.
</div>
<div class="documentDescription" i18n:translate="">Here you have access to all controlpanels for PKAN.</div>

<div id="content-core" i18n:translate="">

<p>The list below is a set of controlpanels to configure the main parts of the mailcenter.
<p>The list below is a set of controlpanels to configure PKAN.
</p>

<ul>
Expand Down
3 changes: 2 additions & 1 deletion src/pkan/dcatapde/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<include package="plone.formwidget.relateditems"/>
<include package="ps.zope.i18nfield"/>

<include file="permissions.zcml" />

<include package=".browser" />
<include package=".config" />
<include package=".content" />
Expand All @@ -23,7 +25,6 @@
<include package=".io" />
<include package=".vocabularies" />

<include file="permissions.zcml" />
<include file="upgrades.zcml" />

<genericsetup:registerProfile
Expand Down
29 changes: 24 additions & 5 deletions src/pkan/dcatapde/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,35 @@
# HTML filled with error information from harvesting dry_run
ERROR_HTML_LINE = '<p>Found error {error} on field {field}</p>'

#: Default folder names (relative to portal root)
FOLDER_LICENSES = 'licenses'
#: Default folder shortname for agents.
FOLDER_AGENTS = 'agents'

#: Default folder shortname for concepts.
FOLDER_CONCEPTS = 'concepts'

#: Default folder shortname for conceptschemes.
FOLDER_CONCEPTSCHEMES = 'conceptschemes'

#: Default folder shortname for formats.
FOLDER_FORMATS = 'formats'

#: Default folder shortname for licenses.
FOLDER_LICENSES = 'licenses'

#: Default folder shortname for locations.
FOLDER_LOCATIONS = 'locations'

#: Default folder shortname for mediatypes.
FOLDER_MEDIATYPES = 'mediatypes'
FOLDER_CONCEPTSCHEMES = 'conceptschemes'
FOLDER_CONCEPTS = 'concepts'

# Location of vocabulary sources
#: Default folder shortname for publishers.
FOLDER_PUBLISHERS = 'publishers'

#: Default folder shortname for standards.
FOLDER_STANDARDS = 'standards'


# Location of vocabulary sources
VOCAB_SOURCES = {
CT_DCT_LICENSEDOCUMENT: 'http://www.dcat-ap.de/def/licenses/1_0.rdf',
CT_SKOS_CONCEPT: 'http://publications.europa.eu/mdr/resource/authority'
Expand Down
Loading

0 comments on commit 0166e66

Please sign in to comment.