Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/BB-Open/pkan.dcatapde
Browse files Browse the repository at this point in the history
  • Loading branch information
volkerjaenisch committed Feb 9, 2018
2 parents 1c343b1 + 46906de commit a308e7d
Show file tree
Hide file tree
Showing 26 changed files with 299 additions and 19 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 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: 4 additions & 3 deletions src/pkan/dcatapde/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
<!-- Publish static files -->


<plone:static
name="pkan.dcatapde"
type="plone"
<browser:resourceDirectory
directory="static"
layer="..interfaces.IPkanDcatapdeLayer"
name="pkan.dcatapde"
/>

<browser:page
for="plone.dexterity.interfaces.IDexterityContent"
name="rdf"
Expand Down
11 changes: 6 additions & 5 deletions src/pkan/dcatapde/browser/content_views/harvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pkan.dcatapde.constants import CT_HARVESTER
from pkan.dcatapde.content.harvester_field_config import CT_FIELD_RELATION
from pkan.dcatapde.vocabularies.dcat_field import DcatFieldVocabulary
from plone.protect.utils import addTokenToUrl
from Products.Five import BrowserView

import copy
Expand All @@ -24,11 +25,11 @@ def __call__(self, *args, **kwargs):
self.data.append({
'title': harv.title,
'path': path,
'source_url': harv.url,
'dry_run': path + '/dry_run',
'real_run': path + '/real_run',
'field_config': field_config.absolute_url(),
'reset_fields': path + '/reset_fields',
'source_url': addTokenToUrl(harv.url),
'dry_run': addTokenToUrl(path + '/dry_run'),
'real_run': addTokenToUrl(path + '/real_run'),
'field_config': addTokenToUrl(field_config.absolute_url()),
'reset_fields': addTokenToUrl(path + '/reset_fields'),
})

return super(HarvesterOverview, self).__call__(*args, **kwargs)
Expand Down
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>
105 changes: 105 additions & 0 deletions src/pkan/dcatapde/browser/static/dcatapde.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/* Content Type Icons */
body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-dcat_catalog:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-dcat_catalog:before {
content: '\e825';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-dcat_dataset:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-dcat_dataset:before {
content: '\e808';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-dcat_distribution:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-dcat_distribution:before {
content: '\e81b';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-dct_licensedocument:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-dct_licensedocument:before {
content: '\e80e';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-dct_location:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-dct_location:before {
content: '\e83d';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-dct_mediatypeorextent:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-dct_mediatypeorextent:before {
content: '\e818';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-dct_standard:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-dct_standard:before {
content: '\e80e';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-skos_concept:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-skos_concept:before {
content: '\e80e';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-skos_conceptscheme:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-skos_conceptscheme:before {
content: '\e80e';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-foaf_agent:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-foaf_agent:before {
content: '\e800';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-agentfolder:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-agentfolder:before {
content: '\e801';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-conceptfolder:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-conceptfolder:before {
content: '\e801';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-conceptschemefolder:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-conceptschemefolder:before {
content: '\e801';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-formatfolder:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-formatfolder:before {
content: '\e801';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-licensefolder:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-licensefolder:before {
content: '\e801';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-locationfolder:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-locationfolder:before {
content: '\e801';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-mediatypefolder:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-mediatypefolder:before {
content: '\e801';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-standardsfolder:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-standardsfolder:before {
content: '\e801';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-harvester_field_config:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-harvester_field_config:before {
content: '\e826';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-harvester:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-harvester:before {
content: '\e80c';
}

body#visual-portal-wrapper.pat-plone #edit-zone .contenttype-harvesterfolder:after,
body#visual-portal-wrapper.pat-plone .outer-wrapper .contenttype-harvesterfolder:before {
content: '\e801';
}
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,
),
)
2 changes: 1 addition & 1 deletion src/pkan/dcatapde/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<metadata>
<version>1000</version>
<version>1001</version>
<dependencies>
<dependency>profile-collective.z3cform.datagridfield:default</dependency>
<dependency>profile-pkan.widgets:default</dependency>
Expand Down
17 changes: 17 additions & 0 deletions src/pkan/dcatapde/profiles/default/registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,21 @@
<registry>
<records interface="pkan.dcatapde.interfaces.IPKANBaseSettings" />
<records interface="pkan.dcatapde.interfaces.IPKANFolderSettings" />
<records interface="pkan.dcatapde.interfaces.IPKANImportSettings" />

<records
prefix="plone.resources/pkandcatapde"
interface="Products.CMFPlone.interfaces.IResourceRegistry">
<value key="css">
<element>++resource++pkan.dcatapde/dcatapde.css</element>
</value>
</records>
<records
prefix="plone.bundles/pkandcatapde"
interface='Products.CMFPlone.interfaces.IBundleRegistry'>
<value key="enabled">True</value>
<value key="csscompilation">++resource++pkan.dcatapde/dcatapde.css</value>
<value key="compile">False</value>
<value key="depends">plone</value>
</records>
</registry>
Loading

0 comments on commit a308e7d

Please sign in to comment.