diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d6465f..7992ff6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,19 @@ und dieses Projekt folgt [Semantic Versioning](https://semver.org/spec/v2.0.0.ht --- +## [2.17.0] — 2026-07-09 + +### ✨ Added +- **Datei per Link ODER Upload** (Datenbereitstellung): Das Zugriffs-URL-Feld heißt jetzt + „Ergänzen Sie den Link zu Ihrem Datensatz oder laden Sie die Datei in die Mediathek hoch". Wer eine + Datei über die Mediathek-Box hochlädt, muss die URL **nicht** mehr eintippen — Zugriffs-URL und + Format werden beim Speichern automatisch aus der Datei übernommen. Pflichtprüfung ist erfüllt, + sobald **entweder** ein Link eingetragen **oder** eine Datei hochgeladen wurde. +- **„Auf dem Datenatlas Zivilgesellschaft veröffentlichen"** (optional): Im letzten Wizard-Schritt + (Vorschau) verlinkt ein Button auf [datenatlas-zivilgesellschaft.de](https://datenatlas-zivilgesellschaft.de). + +--- + ## [2.16.0] — 2026-07-08 ### ✨ Changed diff --git a/README.md b/README.md index 8ced30d..16cfd90 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@    - +  📖 [Dokumentation](DOCUMENTATION.md) · 📐 [Technische Spezifikation](TECHNICAL-SPEC.md) · 📝 [Changelog](CHANGELOG.md) · 🛡️ [Security](SECURITY.md) · ⚖️ [Lizenz](LICENSE) diff --git a/assets/css/admin.css b/assets/css/admin.css index 54f2d00..8df5bba 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -857,3 +857,17 @@ color: #a0a5aa; font-style: italic; } + +/* ========================================================================= + Datenatlas Zivilgesellschaft — Veröffentlichen-Abschnitt (Tab 5) + ========================================================================= */ + +.odw-datenatlas-publish { + margin-top: 20px; + padding-top: 16px; + border-top: 1px solid var(--odw-color-border, #c3c4c7); +} + +.odw-datenatlas-publish h4 { + font-size: 14px; +} diff --git a/includes/class-admin.php b/includes/class-admin.php index 42f9cd3..d82387a 100644 --- a/includes/class-admin.php +++ b/includes/class-admin.php @@ -544,10 +544,29 @@ public static function save_file_attachment( int $post_id, \WP_Post $post ): voi update_post_meta( $post_id, '_odw_file_id', $file_id ); if ( $file_id > 0 ) { + $ext = ''; $file_path = get_attached_file( $file_id ); if ( $file_path && file_exists( $file_path ) ) { update_post_meta( $post_id, '_odw_file_size', (int) filesize( $file_path ) ); - update_post_meta( $post_id, '_odw_file_format', strtoupper( (string) pathinfo( $file_path, PATHINFO_EXTENSION ) ) ); + $ext = strtoupper( (string) pathinfo( $file_path, PATHINFO_EXTENSION ) ); + update_post_meta( $post_id, '_odw_file_format', $ext ); + } + + // A media-library upload doubles as the distribution: derive the + // access URL (and format) from the file when the user did not enter + // them manually, so they never have to type the URL twice. + if ( '' === trim( (string) get_post_meta( $post_id, '_odw_access_url', true ) ) ) { + $attachment_url = wp_get_attachment_url( $file_id ); + if ( $attachment_url ) { + update_post_meta( $post_id, '_odw_access_url', esc_url_raw( $attachment_url ) ); + } + } + + if ( '' !== $ext + && '' === trim( (string) get_post_meta( $post_id, '_odw_format', true ) ) + && array() !== ODW_Fields::get_format_meta( $ext ) + ) { + update_post_meta( $post_id, '_odw_format', $ext ); } } else { delete_post_meta( $post_id, '_odw_file_size' ); diff --git a/includes/class-fields.php b/includes/class-fields.php index d76c038..9d7776d 100644 --- a/includes/class-fields.php +++ b/includes/class-fields.php @@ -126,11 +126,10 @@ private static function register_required_fields(): void { ->add_tab( __( '3 — Datenbereitstellung', 'open-data-wizard' ), array( - Field::make( 'text', 'odw_access_url', __( 'Wo kann ich die Datei herunterladen?', 'open-data-wizard' ) ) - ->set_required( true ) + Field::make( 'text', 'odw_access_url', __( 'Ergänzen Sie den Link zu Ihrem Datensatz oder laden Sie die Datei in die Mediathek hoch', 'open-data-wizard' ) ) ->set_attribute( 'placeholder', 'https://beispiel.de/daten/datei.csv' ) ->set_attribute( 'type', 'url' ) - ->set_help_text( __( 'ZUGRIFFS-URL (dcat:accessURL)', 'open-data-wizard' ) . "\n\n" . __( 'Beispiel: https://beispiel.de/daten/datei.csv', 'open-data-wizard' ) ), + ->set_help_text( __( 'ZUGRIFFS-URL (dcat:accessURL)', 'open-data-wizard' ) . "\n\n" . __( 'Zwei Wege — einer genügt: Tragen Sie hier den Link zu Ihrer Datei ein ODER laden Sie die Datei in der Box „Download-Datei (Mediathek)" hoch. Bei einem Upload wird die URL beim Speichern automatisch übernommen; dieses Feld können Sie dann leer lassen.', 'open-data-wizard' ) ), Field::make( 'select', 'odw_format', __( 'In welchem Format ist die Datei?', 'open-data-wizard' ) ) ->add_options( self::get_format_options() ) @@ -416,6 +415,16 @@ private static function register_required_fields(): void { array( Field::make( 'html', 'odw_preview_html' ) ->set_html( self::get_preview_html() ), + + Field::make( 'html', 'odw_datenatlas_publish' ) + ->set_html( + '
' . esc_html__( 'Optional: Machen Sie diesen Datensatz zusätzlich auf dem Datenatlas Zivilgesellschaft auffindbar.', 'open-data-wizard' ) . '
' + . '' + . esc_html__( 'Zum Datenatlas Zivilgesellschaft', 'open-data-wizard' ) . ' ↗' + . '