- Move all plugin files into breznflow/ subdirectory (matches BreznGEO structure) - Add README.md (English) and README.de.md (German) with full documentation - Add GPL-2.0 LICENSE file - Rewrite readme.txt: expanded description, FAQs, external services, changelog Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
75 lines
3.2 KiB
PHP
75 lines
3.2 KiB
PHP
<?php
|
|
/**
|
|
* Template: Wizard step 1 — JSON import.
|
|
*
|
|
* @package BreznFlow
|
|
* @since 1.0.0
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- template file, not global scope
|
|
|
|
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
|
$view_error = isset( $_GET['error'] ) ? sanitize_key( $_GET['error'] ) : '';
|
|
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
|
$view_message = isset( $_GET['message'] ) ? sanitize_text_field( wp_unslash( $_GET['message'] ) ) : '';
|
|
?>
|
|
<div class="wrap breznflow-wizard">
|
|
<h1 class="wp-heading-inline">
|
|
<?php esc_html_e( 'Add Workflow', 'breznflow' ); ?>
|
|
</h1>
|
|
|
|
<div class="breznflow-wizard-steps">
|
|
<span class="breznflow-step active"><?php esc_html_e( '1. Import JSON', 'breznflow' ); ?></span>
|
|
<span class="breznflow-step"><?php esc_html_e( '2. Configure', 'breznflow' ); ?></span>
|
|
<span class="breznflow-step"><?php esc_html_e( '3. Preview & Publish', 'breznflow' ); ?></span>
|
|
</div>
|
|
|
|
<?php if ( 'validation' === $view_error && $view_message ) : ?>
|
|
<div class="notice notice-error"><p><?php echo esc_html( urldecode( $view_message ) ); ?></p></div>
|
|
<?php elseif ( 'empty' === $view_error ) : ?>
|
|
<div class="notice notice-error"><p><?php esc_html_e( 'Please provide a workflow JSON.', 'breznflow' ); ?></p></div>
|
|
<?php endif; ?>
|
|
|
|
<div class="breznflow-card">
|
|
<h2><?php esc_html_e( 'Import n8n Workflow', 'breznflow' ); ?></h2>
|
|
|
|
<div class="breznflow-step1-import-url">
|
|
<label for="breznflow-url"><?php esc_html_e( 'Import from URL (optional)', 'breznflow' ); ?></label>
|
|
<div class="breznflow-url-row">
|
|
<input type="url" id="breznflow-url" class="regular-text" placeholder="https://example.com/workflow.json" />
|
|
<button type="button" class="button" id="breznflow-fetch-url"><?php esc_html_e( 'Fetch', 'breznflow' ); ?></button>
|
|
</div>
|
|
<p class="description"><?php esc_html_e( 'Or paste JSON directly below.', 'breznflow' ); ?></p>
|
|
</div>
|
|
|
|
<div class="breznflow-file-upload">
|
|
<label for="breznflow-file"><?php esc_html_e( 'Upload JSON file', 'breznflow' ); ?></label>
|
|
<input type="file" id="breznflow-file" accept=".json" class="regular-text" />
|
|
</div>
|
|
|
|
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" id="breznflow-step1-form">
|
|
<input type="hidden" name="action" value="breznflow_save_step1" />
|
|
<?php wp_nonce_field( 'breznflow_step1', 'breznflow_nonce' ); ?>
|
|
|
|
<div class="breznflow-json-field">
|
|
<label for="breznflow-json"><?php esc_html_e( 'n8n Workflow JSON', 'breznflow' ); ?></label>
|
|
<textarea name="breznflow_json" id="breznflow-json" rows="16" class="large-text code" required
|
|
placeholder='{"name": "My Workflow", "nodes": [...], "connections": {...}}'></textarea>
|
|
</div>
|
|
|
|
<div id="breznflow-validation-result" hidden></div>
|
|
|
|
<p class="submit">
|
|
<button type="button" class="button button-secondary" id="breznflow-validate-btn">
|
|
<?php esc_html_e( 'Validate JSON', 'breznflow' ); ?>
|
|
</button>
|
|
<button type="submit" class="button button-primary" id="breznflow-step1-submit" disabled>
|
|
<?php esc_html_e( 'Continue to Settings', 'breznflow' ); ?>
|
|
</button>
|
|
</p>
|
|
</form>
|
|
</div>
|
|
</div>
|