Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions assets/css/frontend.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,34 @@
opacity: 0.65;
}

.odw-download-card__button--meta {
margin-left: auto;
font-weight: normal;
opacity: 0.75;
font-size: 0.85em;
}

.odw-download-card__button--meta:hover {
opacity: 1;
}

/* Keywords */
.odw-download-card__keywords {
display: flex;
flex-wrap: wrap;
gap: 0.35rem;
margin-bottom: 1rem;
}

.odw-download-card__keyword {
display: inline-block;
padding: 0.15em 0.6em;
border: 1px solid currentColor;
border-radius: 99px;
font-size: 0.8em;
opacity: 0.6;
}

/* =========================================================================
Responsive
========================================================================= */
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "daimpad/open-data-wizard",
"description": "DCAT-AP 3.0 Open Data Plugin für WordPress — maschinenlesbarer Endpoint für Civora/Piveau-Harvesting",
"description": "DCAT-AP 3.0 Open Data Plugin für WordPress — maschinenlesbarer JSON-LD-Endpoint für offene Daten",
"type": "wordpress-plugin",
"license": "GPL-2.0-or-later",
"require": {
Expand Down
4 changes: 2 additions & 2 deletions docs/I18N_IMPLEMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ xgettext \
**Dateiformat:**
```
# Open Data Wizard Translations
# Copyright (C) 2026 Datenatlas Zivilgesellschaft
# Copyright (C) 2026 nozilla
# This file is distributed under the same license as the Open Data Wizard package.
#
msgid ""
Expand Down Expand Up @@ -244,7 +244,7 @@ grep -c '^msgid ' languages/open-data-wizard.pot

```po
# English translation for Open Data Wizard
# Copyright (C) 2026 Datenatlas Zivilgesellschaft
# Copyright (C) 2026 nozilla
# This file is distributed under the same license as the Open Data Wizard package.
#
msgid ""
Expand Down
2 changes: 1 addition & 1 deletion includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ private static function help_content_api(): string {

ob_start();
?>
<h3><?php esc_html_e( 'Catalog-Endpoint (für Civora/Piveau)', 'open-data-wizard' ); ?></h3>
<h3><?php esc_html_e( 'Catalog-Endpoint (REST API)', 'open-data-wizard' ); ?></h3>
<p><code><?php echo esc_html( $catalog_url ); ?></code></p>
<p><?php esc_html_e( 'Liefert alle veröffentlichten Datensätze als dcat:Catalog (JSON-LD). Unterstützt:', 'open-data-wizard' ); ?></p>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion includes/class-post-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static function init(): void {
*
* Der CPT ist nicht öffentlich (kein Frontend-Permalink), wird aber im
* Admin-Bereich angezeigt und über eigene REST-Endpoints ausgeliefert
* (`show_in_rest => false`, da wir `/datenatlas/v1/` verwenden).
* (`show_in_rest => false`, da wir einen eigenen REST-Namespace verwenden).
*
* Zugriffssteuerung über Standard-WordPress-Capabilities (edit_posts etc.),
* sodass alle Rollen mit Backend-Zugriff Datensätze anlegen können.
Expand Down
2 changes: 1 addition & 1 deletion includes/class-rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* REST API Endpoints für Open Data Wizard
*
* Namespace: /wp-json/datenatlas/v1/
* Namespace: /wp-json/odw/v1/ (alias: /wp-json/datenatlas/v1/)
* Endpoints: GET /catalog, GET /datasets/<id>
*
* @package OpenDataWizard
Expand Down
2 changes: 1 addition & 1 deletion includes/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static function register_settings(): void {
'odw_section_catalog',
__( 'Katalog', 'open-data-wizard' ),
static function (): void {
echo '<p class="description">' . esc_html__( 'Metadaten des Datenkatalogs — erscheinen in der REST-API-Antwort von /wp-json/datenatlas/v1/catalog.', 'open-data-wizard' ) . '</p>';
echo '<p class="description">' . esc_html__( 'Metadaten des Datenkatalogs — erscheinen in der REST-API-Antwort des Catalog-Endpoints.', 'open-data-wizard' ) . '</p>';
},
'odw-settings'
);
Expand Down
2 changes: 1 addition & 1 deletion includes/class-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private static function create_demo_dataset(): int {
'open-data-wizard'
)
);
update_post_meta( $post_id, '_odw_publisher', __( 'Datenatlas Zivilgesellschaft e.V.', 'open-data-wizard' ) );
update_post_meta( $post_id, '_odw_publisher', __( 'Musterorganisation e.V.', 'open-data-wizard' ) );
update_post_meta( $post_id, '_odw_license', 'https://creativecommons.org/publicdomain/zero/1.0/' );
update_post_meta( $post_id, '_odw_language', 'de' );
update_post_meta( $post_id, '_odw_keywords', "Zivilgesellschaft\nEngagement\nOrganisationen\nDemo" );
Expand Down
82 changes: 48 additions & 34 deletions includes/class-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,28 @@ public static function render( $atts ): string {
wp_enqueue_style( 'odw-frontend' );

// --- Metadaten ---
$title = get_the_title( $post );
$theme = (string) get_post_meta( $post_id, '_odw_theme', true );
$license_uri = (string) get_post_meta( $post_id, '_odw_license', true );
$license_label = ODW_Fields::get_license_label( $license_uri );
$quality_level = (string) get_post_meta( $post_id, '_odw_quality_level', true );
$quality_score = (int) get_post_meta( $post_id, '_odw_quality_score', true );
$file_id = (int) get_post_meta( $post_id, '_odw_file_id', true );
$title = get_the_title( $post );
$theme = (string) get_post_meta( $post_id, '_odw_theme', true );
$file_id = (int) get_post_meta( $post_id, '_odw_file_id', true );

// License from first distribution (per-distribution architecture).
$license_label = '';
if ( function_exists( 'carbon_get_post_meta' ) ) {
$distributions = carbon_get_post_meta( $post_id, 'odw_distributions' );
if ( is_array( $distributions ) && ! empty( $distributions ) ) {
$first_dist = $distributions[0];
$license_uri = isset( $first_dist['license'] ) ? (string) $first_dist['license'] : '';
if ( 'sonstige' === $license_uri && ! empty( $first_dist['license_custom'] ) ) {
$license_label = (string) $first_dist['license_custom'];
} elseif ( '' !== $license_uri ) {
$license_label = ODW_Fields::get_license_label( $license_uri );
}
}
}

// Keywords: newline-separated string → array of trimmed, non-empty values.
$keywords_raw = (string) get_post_meta( $post_id, '_odw_keywords', true );
$keywords = array_filter( array_map( 'trim', explode( "\n", $keywords_raw ) ) );

// --- Datei-Informationen aus der Mediathek ---
$file_url = '';
Expand Down Expand Up @@ -106,14 +121,7 @@ public static function render( $atts ): string {
}
}

// --- Qualitätslabel ---
$quality_label = '';
if ( '' !== $quality_level ) {
$quality_label = ODW_Quality::get_level_label( $quality_level );
if ( $quality_score > 0 ) {
$quality_label .= ' (' . $quality_score . '/100)';
}
}
$metadata_url = rest_url( 'datenatlas/v1/datasets/' . $post_id );

// --- HTML aufbauen ---
ob_start();
Expand All @@ -127,28 +135,25 @@ public static function render( $atts ): string {
<?php endif; ?>
</div>

<?php if ( $license_label || $quality_label ) : ?>
<?php if ( $license_label ) : ?>
<dl class="odw-download-card__meta">

<?php if ( $license_label ) : ?>
<div class="odw-download-card__meta-row">
<dt><?php esc_html_e( 'Lizenz', 'open-data-wizard' ); ?></dt>
<dd><?php echo esc_html( $license_label ); ?></dd>
</div>
<?php endif; ?>

<?php if ( $quality_label ) : ?>
<div class="odw-download-card__meta-row">
<dt><?php esc_html_e( 'DCAT-Qualität', 'open-data-wizard' ); ?></dt>
<dd><?php echo esc_html( $quality_label ); ?></dd>
</div>
<?php endif; ?>

</dl>
<?php endif; ?>

<?php if ( '' !== $file_url ) : ?>
<?php if ( ! empty( $keywords ) ) : ?>
<div class="odw-download-card__keywords">
<?php foreach ( $keywords as $keyword ) : ?>
<span class="odw-download-card__keyword"><?php echo esc_html( $keyword ); ?></span>
<?php endforeach; ?>
</div>
<?php endif; ?>

<div class="odw-download-card__footer">
<?php if ( '' !== $file_url ) : ?>
<a
href="<?php echo esc_url( $file_url ); ?>"
class="odw-download-card__button"
Expand All @@ -157,16 +162,25 @@ class="odw-download-card__button"
<?php esc_html_e( 'Herunterladen', 'open-data-wizard' ); ?>
</a>

<?php
$file_info_parts = array_filter( array( $file_format, $file_size ) );
if ( ! empty( $file_info_parts ) ) :
?>
<?php
$file_info_parts = array_filter( array( $file_format, $file_size ) );
if ( ! empty( $file_info_parts ) ) :
?>
<span class="odw-download-card__file-info">
<?php echo esc_html( implode( ' · ', $file_info_parts ) ); ?>
<?php echo esc_html( implode( ' · ', $file_info_parts ) ); ?>
</span>
<?php endif; ?>
<?php endif; ?>

<a
href="<?php echo esc_url( $metadata_url ); ?>"
class="odw-download-card__button odw-download-card__button--meta"
target="_blank"
rel="noopener"
>
<?php esc_html_e( 'Metadaten (JSON-LD)', 'open-data-wizard' ); ?>
</a>
</div>
<?php endif; ?>

</article>
<?php
Expand Down
5 changes: 3 additions & 2 deletions open-data-wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
/**
* Plugin Name: Open Data Wizard
* Plugin URI: https://github.com/daimpad/OpenDataWizard
* Description: DCAT-AP 3.0 konforme Open Data Metadatenverwaltung für zivilgesellschaftliche Organisationen. Bereitstellung als maschinenlesbarer Endpoint für Civora/Piveau-Harvesting.
* Description: DCAT-AP 3.0 konforme Open Data Metadatenverwaltung für WordPress. Bereitstellung als maschinenlesbarer JSON-LD-Endpoint für offene Daten.
* Version: 1.9.0
* Requires at least: 6.4
* Requires PHP: 8.1
* Author: Datenatlas Zivilgesellschaft
* Author: nozilla
* Author URI: https://github.com/daimpad/OpenDataWizard
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: open-data-wizard
Expand Down
2 changes: 1 addition & 1 deletion tests/test-fields-extended.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public function test_build_omits_contact_point_when_empty(): void {
}

// -------------------------------------------------------------------------
// Civora / DCAT-AP.de compliance tests
// DCAT-AP.de compliance tests
// -------------------------------------------------------------------------

/**
Expand Down
Loading