Skip to content

Commit

Permalink
Merge branch 'import_settings' into master.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmassmann committed Feb 9, 2018
2 parents 4a7eb41 + 73c6130 commit 03e9104
Show file tree
Hide file tree
Showing 21 changed files with 159 additions and 1 deletion.
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 modified docs/_images/dct_licensedocument_added.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 modified 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 modified 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.
Binary file added docs/_images/settings_imports.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 modified docs/_images/setup_select_add_on.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/skos_concept_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/skos_concept_added.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/skos_conceptscheme_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/skos_conceptscheme_added.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/imports.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
===============
Import Settings
===============

.. figure:: ../../_images/settings_imports.png

PKAN Import Settings
1 change: 1 addition & 0 deletions docs/source/configuration/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Configuration And Settings

Base Settings <base>
Folders <folders>
Imports <imports>
7 changes: 7 additions & 0 deletions src/pkan/dcatapde/browser/controlpanel/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,11 @@
permission="pkan.dcatapde.controlpanel.PKAN"
/>

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

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

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


Expand Down Expand Up @@ -39,3 +42,48 @@ class PKANFolderSettingsPanelView(controlpanel.ControlPanelFormWrapper):

form = PKANFolderSettingsEditForm
index = ViewPageTemplateFile('templates/controlpanel_layout_folders.pt')


@implementer(interfaces.IPKANImportSettings)
class PKANImportSettingsEditForm(base.SelfHealingRegistryEditForm):
"""PKAN Import Settings Form."""

description = i18n.HELP_SETTINGS_IMPORTS
label = i18n.LABEL_SETTINGS_IMPORTS
schema = interfaces.IPKANImportSettings

buttons = base.SelfHealingRegistryEditForm.buttons.copy()
handlers = base.SelfHealingRegistryEditForm.handlers.copy()

@button.buttonAndHandler(
i18n.BUTTON_IMPORT_DCT_LICENSEDOCUMENT,
name='import_dct_licensedocument',
)
def handle_import_dct_licensedocument(self, action):
url = '/'.join([
api.portal.get().absolute_url(),
constants.FOLDER_LICENSES,
'@@update_licenses',
])
return self.request.response.redirect(url)
return u''

@button.buttonAndHandler(
i18n.BUTTON_IMPORT_SKOS_CONCEPT,
name='import_skos_concept',
)
def handle_import_skos_concept(self, action):
url = '/'.join([
api.portal.get().absolute_url(),
constants.FOLDER_CONCEPTS,
'@@update_themes',
])
return self.request.response.redirect(url)
return u''


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

form = PKANImportSettingsEditForm
index = ViewPageTemplateFile('templates/controlpanel_layout_imports.pt')
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
<a href=""
tal:attributes="href string:${portal_url}/@@pkan-controlpanel-folders"
i18n:translate="">Folders</a>
<a href=""
tal:attributes="href string:${portal_url}/@@pkan-controlpanel-imports"
i18n:translate="">Imports</a>
</div>
<span tal:replace="structure view/contents" />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
<a href="" class="active"
tal:attributes="href string:${portal_url}/@@pkan-controlpanel-folders"
i18n:translate="">Folders</a>
<a href=""
tal:attributes="href string:${portal_url}/@@pkan-controlpanel-imports"
i18n:translate="">Imports</a>
</div>
<span tal:replace="structure view/contents" />
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<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=""
tal:attributes="href string:${portal_url}/@@pkan-controlpanel-folders"
i18n:translate="">Folders</a>
<a href="" class="active"
tal:attributes="href string:${portal_url}/@@pkan-controlpanel-imports"
i18n:translate="">Imports</a>
</div>
<span tal:replace="structure view/contents" />
</div>
</div>
</div>
</body>
</html>
15 changes: 14 additions & 1 deletion src/pkan/dcatapde/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from pkan.dcatapde import constants


BUTTON_IMPORT_DCT_LICENSEDOCUMENT = _(u'Import DCT:LicenseDocument')
BUTTON_IMPORT_SKOS_CONCEPT = _(u'Import SKOS:Concept')

FIELDSET_AGENTS = _(u'Agents')
FIELDSET_DETAILS = _(u'Dates, Geo, etc')
FIELDSET_RELATIONS = _(u'Relations')
Expand Down Expand Up @@ -105,6 +108,13 @@
HELP_RDFS_ISDEFINEDBY = _(u'The URI describing this concept')
HELP_SETTINGS_BASE = _(u'Manage base settings for PKAN.')
HELP_SETTINGS_FOLDERS = _(u'Manage folder settings for PKAN.')
HELP_SETTINGS_IMPORTS = _(u'Manage import settings for PKAN.')
HELP_SETTINGS_IMPORTS_DCT_LICENSEDOCUMENT = _(
u'Define the import sources for DCT:LicenseDocument objects.',
)
HELP_SETTINGS_IMPORTS_SKOS_CONCEPT = _(
u'Define the import sources for SKOS:Concept objects.',
)
HELP_SKOS_INSCHEME = _(u'URI to the concept scheme')


Expand Down Expand Up @@ -154,8 +164,11 @@
LABEL_RDFS_ISDEFINEDBY = _(u'Definition URI')
LABEL_SETTINGS_BASE = _(u'PKAN Base Settings')
LABEL_SETTINGS_FOLDERS = _(u'PKAN Folder Settings')
LABEL_SETTINGS_IMPORTS = _(u'PKAN Import Settings')
LABEL_SETTINGS_IMPORTS_DCT_LICENSEDOCUMENT = _('DCT:LicenseDocument Sources')
LABEL_SETTINGS_IMPORTS_SKOS_CONCEPT = _('SKOS:Concept Sources')
LABEL_SKOS_INSCHEME = _(u'Concept scheme URI')

LABEL_URL = _(u'URL')

STATUS_REGISTRY_UPDATED = _(
u'Registry has been updated. Please reload this page.',
Expand Down
24 changes: 24 additions & 0 deletions src/pkan/dcatapde/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,27 @@ class IPKANFolderSettings(model.Schema):
required=True,
title=i18n.LABEL_FOLDER_STANDARDS,
)


class IPKANImportSettings(model.Schema):
"""PKAN Import Settings."""

dct_licensedocument = schema.List(
default=[constants.VOCAB_SOURCES[constants.CT_DCT_LICENSEDOCUMENT]],
description=i18n.HELP_SETTINGS_IMPORTS_DCT_LICENSEDOCUMENT,
required=False,
title=i18n.LABEL_SETTINGS_IMPORTS_DCT_LICENSEDOCUMENT,
value_type=schema.URI(
title=i18n.LABEL_URL,
),
)

skos_concept = schema.List(
default=[constants.VOCAB_SOURCES[constants.CT_SKOS_CONCEPT]],
description=i18n.HELP_SETTINGS_IMPORTS_SKOS_CONCEPT,
required=False,
title=i18n.LABEL_SETTINGS_IMPORTS_SKOS_CONCEPT,
value_type=schema.URI(
title=i18n.LABEL_URL,
),
)
1 change: 1 addition & 0 deletions src/pkan/dcatapde/profiles/default/registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<registry>
<records interface="pkan.dcatapde.interfaces.IPKANBaseSettings" />
<records interface="pkan.dcatapde.interfaces.IPKANFolderSettings" />
<records interface="pkan.dcatapde.interfaces.IPKANImportSettings" />
</registry>
10 changes: 10 additions & 0 deletions src/pkan/dcatapde/tests/robot/test_settings.robot
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,13 @@ Show how to change the folder settings
Capture and crop page screenshot
... settings_folders-folder_standards.png
... id=formfield-form-widgets-folder_standards


Show how to change the import settings
Enable autologin as Manager
Go to ${PLONE_URL}/@@pkan-controlpanel-imports

Page should contain element id=content
Capture and crop page screenshot
... settings_imports.png
... id=content

0 comments on commit 03e9104

Please sign in to comment.