Compare commits

..
6 Commits
Author SHA1 Message Date
deepDiverPaul 9d192c2141 refresh admin interface layouts
Redesign authentication and website manager views with responsive layouts, clearer navigation, and accessibility improvements. Refresh page, menu, file, system information, settings, overview, welcome, page settings, and block thumbnail screens. Add the shared Admin stylesheet and Plugi theme, update the build configuration, and regenerate the admin CSS.
2026-11-25 12:02:54 +01:00
deepDiverPaul 151ac9df4c refresh form extension admin interface
Improve form editing, settings, submission lists, and navigation with responsive layouts and accessibility enhancements. Update the form wrapper block view and regenerate the extension stylesheet. Ignore .agents and skills-lock.json.
2026-11-25 09:59:51 +01:00
deepDiverPaul ca7ee32091 refresh admin interface layouts
Redesign authentication and website manager layouts and views for a responsive, accessible interface. Update page, menu, file, info, and settings screens, and refresh the generated WebsiteManager stylesheet.
2026-11-25 08:01:50 +01:00
deepDiverPaul 82086c725f Merge remote-tracking branch 'origin/dev' into dev 2026-11-24 22:45:38 +01:00
deepDiverPaul f78a63cf5b Merge remote-tracking branch 'origin/dev' into dev 2026-11-24 22:42:37 +01:00
deepDiverPaul 8251f883e6 fix page creation validation and persistence
Validate required page fields and localized translations, detect route collisions, and save pages and translations atomically with rollback on failure. Report creation errors while preserving submitted form values, safely encode Alpine.js values, and add English and German error messages. Return null for failed inserts and add page persistence tests.
2026-11-24 22:40:52 +01:00
26 changed files with 1106 additions and 671 deletions
+2 -1
View File
@@ -17,7 +17,8 @@ cache
uploads uploads
extensions/dev_* extensions/dev_*
docs docs
docs/* .agents
skills-lock.json
# Editor directories and files # Editor directories and files
.vscode/* .vscode/*
@@ -19,17 +19,19 @@ if(isset($_GET['id']))
$isEditing = isset($form['id']) && $form['id'] > 0; $isEditing = isset($form['id']) && $form['id'] > 0;
?> ?>
<div class="mb-6"> <header class="mb-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
<div class="flex items-center gap-3"> <div class="flex items-center gap-3">
<a href="?tab=ext--form" class="btn btn-ghost btn-sm btn-circle"> <a href="?tab=ext--form" class="btn btn-ghost btn-square btn-sm" aria-label="Back to forms" title="Back to forms">
<i class="ph-duotone ph-arrow-left text-xl"></i> <i class="ph-duotone ph-arrow-left text-xl" aria-hidden="true"></i>
</a> </a>
<div> <div class="space-y-1">
<h2 class="text-xl font-bold"><?= $isEditing ? 'Edit form' : 'New form' ?></h2> <p class="text-xs font-semibold uppercase tracking-[0.18em] text-primary">Form builder</p>
<h2 class="text-xl font-bold tracking-tight"><?= $isEditing ? 'Edit form' : 'New form' ?></h2>
<p class="text-sm text-base-content/60"><?= $isEditing ? 'Change your form settings.' : 'Create a new form with fields and actions.' ?></p> <p class="text-sm text-base-content/60"><?= $isEditing ? 'Change your form settings.' : 'Create a new form with fields and actions.' ?></p>
</div> </div>
</div> </div>
</div> <span class="badge badge-outline self-start sm:self-center"><?= $isEditing ? 'Editing form' : 'New form' ?></span>
</header>
<script> <script>
const fields = <?= $form["fields"] ?>; const fields = <?= $form["fields"] ?>;
@@ -37,7 +39,7 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
const finisherDefinitions = <?= json_encode($finisherDefinitions, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT) ?>; const finisherDefinitions = <?= json_encode($finisherDefinitions, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT) ?>;
</script> </script>
<form action="/ext--form/save-form" method="post" x-data="{ <form action="/ext--form/save-form" method="post" class="space-y-6" x-data="{
fields: fields, fields: fields,
finishers: finishers, finishers: finishers,
defaultField: {name: 'form_field', label: 'Form field', type: 'text', required: false, options: []}, defaultField: {name: 'form_field', label: 'Form field', type: 'text', required: false, options: []},
@@ -104,42 +106,52 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
if(isset($form['id'])) echo '<input type="hidden" name="id" value="'.$form['id'].'">'; if(isset($form['id'])) echo '<input type="hidden" name="id" value="'.$form['id'].'">';
?> ?>
<div class="card bg-base-100 shadow mb-6"> <section class="card border border-base-300 bg-base-100 shadow-sm" aria-labelledby="form-basics-title">
<div class="card-body"> <div class="card-body gap-5 p-4 sm:p-6 lg:p-8">
<div class="flex items-center gap-2 mb-4"> <header class="flex items-start gap-3 border-b border-base-300 pb-4">
<i class="ph-duotone ph-text-aa text-2xl text-base-content/60"></i> <span class="grid size-10 shrink-0 place-items-center rounded-xl bg-primary/10 text-primary">
<h3 class="card-title text-lg">Basics</h3> <i class="text-xl ph-duotone ph-text-aa" aria-hidden="true"></i>
</span>
<div>
<h3 class="card-title text-lg" id="form-basics-title">Basics</h3>
<p class="mt-1 text-sm text-base-content/60">Give the form a name that will be easy to identify later.</p>
</div> </div>
<div class="form-control"> </header>
<label class="label"> <div class="form-control w-full max-w-2xl gap-1">
<label class="label" for="form-name">
<span class="label-text font-medium">Form name</span> <span class="label-text font-medium">Form name</span>
<span class="label-text-alt">Required</span>
</label> </label>
<input type="text" name="name" value="<?= $form['name'] ?>" placeholder="e.g. Contact form" class="input input-bordered w-full" required /> <input id="form-name" type="text" name="name" value="<?= phpb_e($form['name']) ?>" placeholder="e.g. Contact form" class="input input-bordered w-full" required aria-describedby="form-name-help" />
<span class="label-text-alt text-base-content/60">A unique name for your form.</span> <span class="label-text-alt mt-1 text-base-content/60" id="form-name-help">A unique name for your form.</span>
</div>
</div> </div>
</div> </div>
</section>
<div class="card bg-base-100 shadow mb-6"> <section class="card border border-base-300 bg-base-100 shadow-sm" aria-labelledby="form-fields-title">
<div class="card-body"> <div class="card-body gap-5 p-4 sm:p-6 lg:p-8">
<div class="flex items-center gap-2 mb-4"> <header class="flex items-start gap-3 border-b border-base-300 pb-4">
<i class="ph-duotone ph-list-dashes text-2xl text-base-content/60"></i> <span class="grid size-10 shrink-0 place-items-center rounded-xl bg-secondary/10 text-secondary">
<h3 class="card-title text-lg">Form fields</h3> <i class="text-xl ph-duotone ph-list-dashes" aria-hidden="true"></i>
</span>
<div>
<h3 class="card-title text-lg" id="form-fields-title">Form fields</h3>
<p class="mt-1 text-sm text-base-content/60">Define the fields people can fill out. Drag a field to change its order.</p>
</div> </div>
<p class="text-sm text-base-content/60 mb-4">Define the fields users can fill out.</p> </header>
<input type="hidden" name="fields" :value="JSON.stringify(fields)"> <input type="hidden" name="fields" :value="JSON.stringify(fields)">
<div x-show="fields.length === 0" class="text-center py-8 border-2 border-dashed border-base-300 rounded-lg"> <div x-show="fields.length === 0" class="rounded-box border border-dashed border-base-300 bg-base-200/40 px-4 py-10 text-center">
<i class="ph-duotone ph-plus-circle text-4xl text-base-content/30"></i> <i class="ph-duotone ph-plus-circle text-4xl text-base-content/30" aria-hidden="true"></i>
<p class="text-sm text-base-content/50 mt-2">No fields added yet</p> <p class="mt-2 text-sm text-base-content/60">No fields added yet</p>
<a href="javascript:void(0)" @click="addField()" class="btn btn-sm btn-primary mt-2">Add your first field</a> <button type="button" @click="addField()" class="btn btn-primary btn-sm mt-3">Add your first field</button>
</div> </div>
<div x-show="fields.length > 0" class="space-y-3"> <div x-show="fields.length > 0" class="space-y-4">
<template x-for="(field, index) in fields"> <template x-for="(field, index) in fields">
<div <div
class="border rounded-lg p-3 bg-base-200/50 transition-colors" class="rounded-box border border-base-300 bg-base-200/40 p-4 shadow-sm transition-colors sm:p-5"
:class="{ :class="{
'border-error': getValidationErrors(field, index).length > 0, 'border-error': getValidationErrors(field, index).length > 0,
'border-base-300': getValidationErrors(field, index).length === 0, 'border-base-300': getValidationErrors(field, index).length === 0,
@@ -151,42 +163,44 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
@drop.prevent="moveField(dragIndex, index)" @drop.prevent="moveField(dragIndex, index)"
@dragend="dragIndex = null" @dragend="dragIndex = null"
> >
<div class="flex items-center gap-2 mb-2"> <div class="mb-3 flex flex-col gap-2 sm:flex-row sm:items-center">
<!-- Drag handle --> <!-- Drag handle -->
<button type="button" class="btn btn-ghost btn-xs btn-square cursor-grab active:cursor-grabbing text-base-content/40 hover:text-base-content" title="Drag to move"> <button type="button" class="btn btn-ghost btn-xs btn-square cursor-grab active:cursor-grabbing text-base-content/40 hover:text-base-content" title="Drag to move" aria-label="Drag to move field">
<i class="ph-duotone ph-dots-six-vertical text-lg"></i> <i class="ph-duotone ph-dots-six-vertical text-lg" aria-hidden="true"></i>
</button> </button>
<span class="text-xs font-mono text-base-content/40 w-6">#[<span x-text="index + 1"></span>]</span> <span class="text-xs font-mono text-base-content/40 w-6">#[<span x-text="index + 1"></span>]</span>
<div class="flex-1"> <div class="w-full flex-1">
<input <input
type="text" type="text"
x-model="field.name" x-model="field.name"
placeholder="Field name" placeholder="Field name"
:aria-label="'Field ' + (index + 1) + ' name'"
class="input input-bordered input-sm w-full" class="input input-bordered input-sm w-full"
:class="{'input-error': getValidationErrors(field, index).some(e => e.includes('Field name'))}" :class="{'input-error': getValidationErrors(field, index).some(e => e.includes('Field name'))}"
/> />
</div> </div>
<div class="flex-1"> <div class="w-full flex-1">
<input <input
type="text" type="text"
x-model="field.label" x-model="field.label"
placeholder="Label" placeholder="Label"
:aria-label="'Field ' + (index + 1) + ' label'"
class="input input-bordered input-sm w-full" class="input input-bordered input-sm w-full"
:class="{'input-error': getValidationErrors(field, index).some(e => e.includes('Label'))}" :class="{'input-error': getValidationErrors(field, index).some(e => e.includes('Label'))}"
/> />
</div> </div>
</div> </div>
<!-- Validation errors --> <!-- Validation errors -->
<div x-show="getValidationErrors(field, index).length > 0" x-transition class="mb-2 p-2 bg-error/10 border border-error/30 rounded text-error text-xs"> <div x-show="getValidationErrors(field, index).length > 0" x-transition class="alert alert-error alert-soft mb-3 px-3 py-2 text-xs" role="alert" aria-live="polite">
<template x-for="(error, errIndex) in getValidationErrors(field, index)"> <template x-for="(error, errIndex) in getValidationErrors(field, index)">
<div :key="errIndex" class="flex items-center gap-1"> <div :key="errIndex" class="flex items-center gap-1">
<i class="ph-duotone ph-warning text-sm"></i> <i class="ph-duotone ph-warning text-sm" aria-hidden="true"></i>
<span x-text="error"></span> <span x-text="error"></span>
</div> </div>
</template> </template>
</div> </div>
<div class="flex items-center gap-2"> <div class="flex flex-wrap items-center gap-2">
<select x-model="field.type" class="select select-bordered select-sm flex-1"> <select x-model="field.type" class="select select-bordered select-sm min-w-40 flex-1" :aria-label="'Field ' + (index + 1) + ' type'">
<option value="text">Text</option> <option value="text">Text</option>
<option value="email">Email</option> <option value="email">Email</option>
<option value="textarea">Text area</option> <option value="textarea">Text area</option>
@@ -196,27 +210,27 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
</select> </select>
<label class="label cursor-pointer gap-2"> <label class="label cursor-pointer gap-2">
<span class="label-text text-sm">Required</span> <span class="label-text text-sm">Required</span>
<input type="checkbox" x-model="field.required" class="checkbox checkbox-sm checkbox-primary" /> <input type="checkbox" x-model="field.required" class="checkbox checkbox-sm checkbox-primary" :aria-label="'Field ' + (index + 1) + ' is required'" />
</label> </label>
<button @click="fields.splice(index, 1)" type="button" class="btn btn-ghost btn-sm btn-circle text-error" title="Remove"> <button @click="fields.splice(index, 1)" type="button" class="btn btn-ghost btn-sm btn-circle text-error" title="Remove" :aria-label="'Remove field ' + (index + 1)">
<i class="ph-duotone ph-trash"></i> <i class="ph-duotone ph-trash"></i>
</button> </button>
</div> </div>
<div x-show="field.type === 'select' || field.type === 'checkbox' || field.type === 'radio'" x-transition class="mt-3 ml-2 pl-4 border-l-2 border-primary/30"> <div x-show="field.type === 'select' || field.type === 'checkbox' || field.type === 'radio'" x-transition class="mt-4 rounded-box border-l-2 border-primary/50 bg-base-100 p-3 sm:ml-2 sm:p-4">
<div class="flex items-center gap-2 mb-2"> <div class="mb-3 flex items-center gap-2">
<span class="text-xs font-medium text-base-content/60 uppercase tracking-wide" x-text="getOptionsLabel(field.type)"></span> <span class="text-xs font-semibold uppercase tracking-wide text-base-content/60" x-text="getOptionsLabel(field.type)"></span>
<a href="javascript:void(0)" @click="field.options.push({label: 'Option', value: 'option'})" class="btn btn-xs btn-ghost btn-primary"> <button type="button" @click="field.options.push({label: 'Option', value: 'option'})" class="btn btn-xs btn-ghost btn-primary">
<i class="ph-duotone ph-plus"></i> <i class="ph-duotone ph-plus" aria-hidden="true"></i>
Add Add
</a> </button>
</div> </div>
<div class="space-y-1"> <div class="space-y-1">
<template x-for="(option, optIndex) in field.options"> <template x-for="(option, optIndex) in field.options">
<div class="flex items-center gap-2"> <div class="flex flex-col gap-2 sm:flex-row sm:items-center">
<span class="text-xs text-base-content/40 w-4">#[<span x-text="optIndex + 1"></span>]</span> <span class="text-xs text-base-content/40 w-4">#[<span x-text="optIndex + 1"></span>]</span>
<input type="text" x-model="option.label" placeholder="Label" class="input input-bordered input-sm flex-1" /> <input type="text" x-model="option.label" placeholder="Label" class="input input-bordered input-sm w-full flex-1" :aria-label="'Field ' + (index + 1) + ' option ' + (optIndex + 1) + ' label'" />
<input type="text" x-model="option.value" placeholder="Value" class="input input-bordered input-sm flex-1" /> <input type="text" x-model="option.value" placeholder="Value" class="input input-bordered input-sm w-full flex-1" :aria-label="'Field ' + (index + 1) + ' option ' + (optIndex + 1) + ' value'" />
<button @click="field.options.splice(optIndex, 1)" type="button" class="btn btn-ghost btn-xs btn-circle text-error" title="Remove"> <button @click="field.options.splice(optIndex, 1)" type="button" class="btn btn-ghost btn-xs btn-circle text-error" title="Remove" :aria-label="'Remove option ' + (optIndex + 1) + ' from field ' + (index + 1)">
<i class="ph-duotone ph-x"></i> <i class="ph-duotone ph-x"></i>
</button> </button>
</div> </div>
@@ -227,51 +241,55 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
</template> </template>
</div> </div>
<div class="mt-4"> <div class="border-t border-base-300 pt-4">
<a href="javascript:void(0)" @click="addField()" class="btn btn-outline btn-sm btn-primary"> <button type="button" @click="addField()" class="btn btn-outline btn-sm btn-primary">
<i class="ph-duotone ph-plus"></i> <i class="ph-duotone ph-plus" aria-hidden="true"></i>
Add field Add field
</a> </button>
</div>
</div> </div>
</div> </div>
</section>
<div class="card bg-base-100 shadow mb-6"> <section class="card border border-base-300 bg-base-100 shadow-sm" aria-labelledby="form-actions-title">
<div class="card-body"> <div class="card-body gap-5 p-4 sm:p-6 lg:p-8">
<div class="flex items-center gap-2 mb-4"> <header class="flex items-start gap-3 border-b border-base-300 pb-4">
<i class="ph-duotone ph-gear text-2xl text-base-content/60"></i> <span class="grid size-10 shrink-0 place-items-center rounded-xl bg-accent/15 text-base-content">
<h3 class="card-title text-lg">Actions</h3> <i class="text-xl ph-duotone ph-gear" aria-hidden="true"></i>
</span>
<div>
<h3 class="card-title text-lg" id="form-actions-title">Actions</h3>
<p class="mt-1 text-sm text-base-content/60">Choose what should happen when someone submits this form.</p>
</div> </div>
<p class="text-sm text-base-content/60 mb-4">What should happen when a form is submitted?</p> </header>
<input type="hidden" name="finishers" :value="JSON.stringify(finishers)"> <input type="hidden" name="finishers" :value="JSON.stringify(finishers)">
<div x-show="finishers.length === 0" class="text-center py-8 border-2 border-dashed border-base-300 rounded-lg"> <div x-show="finishers.length === 0" class="rounded-box border border-dashed border-base-300 bg-base-200/40 px-4 py-10 text-center">
<i class="ph-duotone ph-plus-circle text-4xl text-base-content/30"></i> <i class="ph-duotone ph-plus-circle text-4xl text-base-content/30" aria-hidden="true"></i>
<p class="text-sm text-base-content/50 mt-2">No actions added yet</p> <p class="mt-2 text-sm text-base-content/60">No actions added yet</p>
<a href="javascript:void(0)" @click="addFinisher()" class="btn btn-sm btn-primary mt-2">Add your first action</a> <button type="button" @click="addFinisher()" class="btn btn-primary btn-sm mt-3">Add your first action</button>
</div> </div>
<div x-show="finishers.length > 0" class="space-y-2"> <div x-show="finishers.length > 0" class="space-y-4">
<template x-for="(finisher, index) in finishers"> <template x-for="(finisher, index) in finishers">
<div class="p-3 border border-base-300 rounded-lg bg-base-200/50 space-y-3"> <div class="space-y-4 rounded-box border border-base-300 bg-base-200/40 p-4 shadow-sm sm:p-5">
<div class="flex items-center gap-3"> <div class="flex flex-col gap-3 sm:flex-row sm:items-center">
<span class="text-xs font-mono text-base-content/40">#[<span x-text="index + 1"></span>]</span> <span class="text-xs font-mono text-base-content/40">#[<span x-text="index + 1"></span>]</span>
<select :value="finisher.type" @change="setFinisherType(finisher, $event.target.value)" class="select select-bordered select-sm flex-1"> <select :value="finisher.type" @change="setFinisherType(finisher, $event.target.value)" class="select select-bordered select-sm min-w-40 flex-1" :aria-label="'Action ' + (index + 1) + ' type'">
<template x-for="(definition, type) in finisherDefinitions" :key="type"> <template x-for="(definition, type) in finisherDefinitions" :key="type">
<option :value="type" x-text="definition.label"></option> <option :value="type" x-text="definition.label"></option>
</template> </template>
</select> </select>
<button @click="finishers.splice(index, 1)" type="button" class="btn btn-ghost btn-sm btn-circle text-error" title="Remove"> <button @click="finishers.splice(index, 1)" type="button" class="btn btn-ghost btn-sm btn-circle text-error" title="Remove" :aria-label="'Remove action ' + (index + 1)">
<i class="ph-duotone ph-trash"></i> <i class="ph-duotone ph-trash" aria-hidden="true"></i>
</button> </button>
</div> </div>
<div x-show="getFinisherSettings(finisher.type).length > 0" class="space-y-3 pl-8"> <div x-show="getFinisherSettings(finisher.type).length > 0" class="space-y-4 border-t border-base-300 pt-4 sm:pl-9">
<template x-for="setting in getFinisherSettings(finisher.type)" :key="setting.name"> <template x-for="setting in getFinisherSettings(finisher.type)" :key="setting.name">
<div class="form-control"> <div class="form-control">
<label class="label"><span class="label-text" x-text="setting.label"></span></label> <label class="label" :for="'finisher-' + index + '-' + setting.name"><span class="label-text" x-text="setting.label"></span></label>
<template x-if="setting.type === 'emailField'"> <template x-if="setting.type === 'emailField'">
<select x-model="finisher.options[setting.name]" :required="setting.required || false" class="select select-bordered select-sm w-full"> <select :id="'finisher-' + index + '-' + setting.name" x-model="finisher.options[setting.name]" :required="setting.required || false" class="select select-bordered select-sm w-full">
<option value="">Select an email field</option> <option value="">Select an email field</option>
<template x-for="field in fields.filter(field => field.type === 'email')" :key="field.name"> <template x-for="field in fields.filter(field => field.type === 'email')" :key="field.name">
<option :value="field.name" x-text="field.label + ' (' + field.name + ')' "></option> <option :value="field.name" x-text="field.label + ' (' + field.name + ')' "></option>
@@ -279,42 +297,42 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
</select> </select>
</template> </template>
<template x-if="setting.type === 'select'"> <template x-if="setting.type === 'select'">
<select x-model="finisher.options[setting.name]" :required="setting.required || false" class="select select-bordered select-sm w-full"> <select :id="'finisher-' + index + '-' + setting.name" x-model="finisher.options[setting.name]" :required="setting.required || false" class="select select-bordered select-sm w-full">
<template x-for="option in setting.options || []" :key="option.value"> <template x-for="option in setting.options || []" :key="option.value">
<option :value="option.value" x-text="option.label"></option> <option :value="option.value" x-text="option.label"></option>
</template> </template>
</select> </select>
</template> </template>
<template x-if="setting.type === 'textarea'"> <template x-if="setting.type === 'textarea'">
<textarea x-model="finisher.options[setting.name]" :required="setting.required || false" :placeholder="setting.placeholder || ''" class="textarea textarea-bordered w-full" rows="4"></textarea> <textarea :id="'finisher-' + index + '-' + setting.name" x-model="finisher.options[setting.name]" :required="setting.required || false" :placeholder="setting.placeholder || ''" class="textarea textarea-bordered w-full" rows="4"></textarea>
</template> </template>
<template x-if="!['emailField', 'select', 'textarea'].includes(setting.type)"> <template x-if="!['emailField', 'select', 'textarea'].includes(setting.type)">
<input x-model="finisher.options[setting.name]" :type="setting.type" :required="setting.required || false" :min="setting.min" :max="setting.max" :placeholder="setting.placeholder || ''" class="input input-bordered input-sm w-full" /> <input :id="'finisher-' + index + '-' + setting.name" x-model="finisher.options[setting.name]" :type="setting.type" :required="setting.required || false" :min="setting.min" :max="setting.max" :placeholder="setting.placeholder || ''" class="input input-bordered input-sm w-full" />
</template> </template>
<span x-show="setting.help" class="label-text-alt text-base-content/60 mt-1" x-text="setting.help"></span> <span x-show="setting.help" class="label-text-alt text-base-content/60 mt-1" x-text="setting.help"></span>
</div> </div>
</template> </template>
<span x-show="getFinisherSettings(finisher.type).some(setting => setting.type === 'emailField') && fields.filter(field => field.type === 'email').length === 0" class="label-text-alt text-warning">Add an email field to the form before using this action.</span> <span x-show="getFinisherSettings(finisher.type).some(setting => setting.type === 'emailField') && fields.filter(field => field.type === 'email').length === 0" class="alert alert-warning alert-soft text-sm" role="status">Add an email field to the form before using this action.</span>
</div> </div>
</div> </div>
</template> </template>
</div> </div>
<div class="mt-4"> <div class="border-t border-base-300 pt-4">
<a href="javascript:void(0)" @click="addFinisher()" class="btn btn-outline btn-sm btn-primary"> <button type="button" @click="addFinisher()" class="btn btn-outline btn-sm btn-primary">
<i class="ph-duotone ph-plus"></i> <i class="ph-duotone ph-plus" aria-hidden="true"></i>
Add action Add action
</a> </button>
</div>
</div> </div>
</div> </div>
</section>
<div class="flex justify-end gap-2"> <div class="flex flex-col-reverse gap-2 border-t border-base-300 pt-5 sm:flex-row sm:justify-end">
<a href="?tab=ext--form" class="btn btn-ghost btn-sm"> <a href="?tab=ext--form" class="btn btn-ghost btn-sm sm:min-w-28">
Cancel Cancel
</a> </a>
<button type="submit" class="btn btn-primary btn-sm"> <button type="submit" class="btn btn-primary btn-sm sm:min-w-28">
<i class="ph-duotone ph-floppy-disk"></i> <i class="ph-duotone ph-floppy-disk" aria-hidden="true"></i>
Save Save
</button> </button>
</div> </div>
@@ -1,11 +1,16 @@
<div class="card bg-base-100 shadow"> <section class="card border border-base-300/60 bg-base-100 shadow-sm" aria-labelledby="form-extension-settings-title">
<div class="card-body"> <div class="card-body gap-5 p-4 sm:p-6 lg:p-8">
<div class="flex items-center gap-2 mb-4"> <div class="flex items-start gap-3 border-b border-base-300 pb-5">
<i class="ph-duotone ph-gear text-2xl text-base-content/60"></i> <span class="grid size-11 shrink-0 place-items-center rounded-2xl bg-primary/10 text-primary">
<h3 class="card-title text-lg">Settings</h3> <i class="text-2xl ph-duotone ph-gear" aria-hidden="true"></i>
</span>
<div>
<p class="text-xs font-semibold uppercase tracking-[0.18em] text-primary">Form extension</p>
<h2 class="card-title mt-1 text-xl" id="form-extension-settings-title">Settings</h2>
<p class="mt-1 text-sm text-base-content/60">Configure the global settings for the Form extension.</p>
</div> </div>
<p class="text-sm text-base-content/60 mb-4">Configure the global settings for the Form extension.</p> </div>
<div class="space-y-4"> <div class="space-y-5">
<?php <?php
foreach (\Plugi\Extensions::getSettings('form') as $setting) { foreach (\Plugi\Extensions::getSettings('form') as $setting) {
phpb_render_setting($setting); phpb_render_setting($setting);
@@ -13,4 +18,4 @@
?> ?>
</div> </div>
</div> </div>
</div> </section>
@@ -13,39 +13,42 @@ $entries = $entriesRepository->findWhere('formId', $id);
?> ?>
<div class="mb-6"> <section class="space-y-5">
<header class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
<div class="flex items-center gap-3"> <div class="flex items-center gap-3">
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form']) ?>" class="btn btn-ghost btn-sm btn-circle"> <a href="<?= phpb_url('website_manager', ['tab' => 'ext--form']) ?>" class="btn btn-ghost btn-square btn-sm" aria-label="Back to forms" title="Back to forms">
<i class="ph-duotone ph-arrow-left text-xl"></i> <i class="ph-duotone ph-arrow-left text-xl" aria-hidden="true"></i>
</a> </a>
<div> <div class="space-y-1">
<h2 class="text-xl font-bold"><?= phpb_e($form['name']) ?></h2> <p class="text-xs font-semibold uppercase tracking-[0.18em] text-primary">Form submissions</p>
<h2 class="text-xl font-bold tracking-tight"><?= phpb_e($form['name']) ?></h2>
<p class="text-sm text-base-content/60"><?= count($entries) ?> submission<?= count($entries) !== 1 ? 's' : '' ?> for this form</p> <p class="text-sm text-base-content/60"><?= count($entries) ?> submission<?= count($entries) !== 1 ? 's' : '' ?> for this form</p>
</div> </div>
</div> </div>
</div> <span class="badge badge-outline self-start sm:self-center"><?= count($entries) ?> total</span>
</header>
<?php if (empty($entries)): ?> <?php if (empty($entries)): ?>
<div class="card bg-base-100 shadow"> <div class="card border border-dashed border-base-300 bg-base-100 shadow-sm" role="status">
<div class="card-body items-center text-center py-16"> <div class="card-body items-center gap-3 px-5 py-12 text-center sm:py-16">
<i class="ph-duotone ph-inbox text-6xl text-base-content/20"></i> <span class="grid size-14 place-items-center rounded-2xl bg-info/10 text-info">
<h3 class="card-title text-lg mt-4">No submissions yet</h3> <i class="text-3xl ph-duotone ph-inbox" aria-hidden="true"></i>
<p class="text-base-content/60 mt-1">Submissions will appear here when someone fills out the form.</p> </span>
<h3 class="card-title mt-1 text-lg">No submissions yet</h3>
<p class="max-w-md text-sm leading-relaxed text-base-content/60">Submissions will appear here when someone fills out the form.</p>
</div> </div>
</div> </div>
<?php else: ?> <?php else: ?>
<div class="card bg-base-100 shadow"> <div class="overflow-x-auto rounded-box border border-base-300 bg-base-100">
<div class="card-body p-0"> <table class="table table-zebra w-full min-w-[48rem]">
<div class="overflow-x-auto">
<table class="table w-full">
<thead> <thead>
<tr class="bg-base-200/50"> <tr>
<th class="w-16">ID</th> <th class="w-16">ID</th>
<th class="w-40">Created</th> <th class="w-40">Created</th>
<?php foreach ($fields as $field): ?> <?php foreach ($fields as $field): ?>
<th><?= phpb_e($field['label']) ?></th> <th><?= phpb_e($field['label']) ?></th>
<?php endforeach; ?> <?php endforeach; ?>
<th class="w-12 text-center"><?= phpb_trans('website-manager.actions') ?></th> <th class="w-40 text-right"><?= phpb_trans('website-manager.actions') ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -54,8 +57,8 @@ $entries = $entriesRepository->findWhere('formId', $id);
$createdDate = new DateTime($entry['created'] . ' UTC'); $createdDate = new DateTime($entry['created'] . ' UTC');
$createdDate->setTimezone(new DateTimeZone(date_default_timezone_get())); $createdDate->setTimezone(new DateTimeZone(date_default_timezone_get()));
?> ?>
<tr class="hover:bg-base-200/30"> <tr>
<td class="font-mono text-sm text-base-content/60"><?= phpb_e($entry['id']) ?></td> <td><span class="badge badge-ghost font-mono"><?= phpb_e($entry['id']) ?></span></td>
<td class="text-sm"><?= $createdDate->format('d.m.Y H:i') ?></td> <td class="text-sm"><?= $createdDate->format('d.m.Y H:i') ?></td>
<?php foreach ($fields as $field): <?php foreach ($fields as $field):
$fieldName = $field['name']; $fieldName = $field['name'];
@@ -68,12 +71,12 @@ $entries = $entriesRepository->findWhere('formId', $id);
} }
} }
?> ?>
<td class="text-sm"><?= phpb_e($fieldValue) ?></td> <td class="max-w-72 text-sm"><span class="line-clamp-3 break-words"><?= phpb_e($fieldValue) ?></span></td>
<?php endforeach; ?> <?php endforeach; ?>
<td> <td>
<div class="flex justify-center"> <div class="flex justify-end">
<a href="/ext--form/delete-entry?id=<?= $entry['id'] ?>&formId=<?= $id ?>" class="btn btn-ghost btn-sm btn-circle text-error" title="<?= phpb_trans('website-manager.remove') ?>"> <a href="/ext--form/delete-entry?id=<?= $entry['id'] ?>&formId=<?= $id ?>" class="btn btn-ghost btn-square btn-sm text-error" title="<?= phpb_trans('website-manager.remove') ?>" aria-label="<?= phpb_trans('website-manager.remove') ?> submission <?= phpb_e($entry['id']) ?>">
<i class="ph-duotone ph-trash text-lg"></i> <i class="ph-duotone ph-trash text-lg" aria-hidden="true"></i>
</a> </a>
</div> </div>
</td> </td>
@@ -82,7 +85,6 @@ $entries = $entriesRepository->findWhere('formId', $id);
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
</div>
<?php endif; ?> <?php endif; ?>
</section>
@@ -6,58 +6,60 @@ $forms = $formsRepository->getAll();
?> ?>
<div class="flex items-center justify-between mb-6"> <section class="space-y-5">
<div> <header class="flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between">
<h2 class="text-xl font-bold">Forms</h2> <div class="space-y-1">
<p class="text-xs font-semibold uppercase tracking-[0.18em] text-primary">Form extension</p>
<h2 class="text-xl font-bold tracking-tight text-base-content">Forms</h2>
<p class="text-sm text-base-content/60"><?= count($forms) ?> form<?= count($forms) !== 1 ? 's' : '' ?> available</p> <p class="text-sm text-base-content/60"><?= count($forms) ?> form<?= count($forms) !== 1 ? 's' : '' ?> available</p>
</div> </div>
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm']) ?>" class="btn btn-primary btn-sm"> <a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm']) ?>" class="btn btn-primary">
<i class="ph-duotone ph-plus"></i> <i class="ph-duotone ph-plus" aria-hidden="true"></i>
New form New form
</a> </a>
</div> </header>
<?php if (empty($forms)): ?> <?php if (empty($forms)): ?>
<div class="card bg-base-100 shadow"> <div class="card border border-dashed border-base-300 bg-base-100 shadow-sm" role="status">
<div class="card-body items-center text-center py-16"> <div class="card-body items-center gap-3 px-5 py-12 text-center sm:py-16">
<i class="ph-duotone ph-notebook text-6xl text-base-content/20"></i> <span class="grid size-14 place-items-center rounded-2xl bg-primary/10 text-primary">
<h3 class="card-title text-lg mt-4">No forms yet</h3> <i class="text-3xl ph-duotone ph-notebook" aria-hidden="true"></i>
<p class="text-base-content/60 mt-1">Create your first form to collect submissions from your website.</p> </span>
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm']) ?>" class="btn btn-primary mt-4"> <h3 class="card-title mt-1 text-lg">No forms yet</h3>
<i class="ph-duotone ph-plus"></i> <p class="max-w-md text-sm leading-relaxed text-base-content/60">Create your first form to collect submissions from your website.</p>
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm']) ?>" class="btn btn-primary mt-2">
<i class="ph-duotone ph-plus" aria-hidden="true"></i>
Create your first form Create your first form
</a> </a>
</div> </div>
</div> </div>
<?php else: ?> <?php else: ?>
<div class="card bg-base-100 shadow"> <div class="overflow-x-auto rounded-box border border-base-300 bg-base-100">
<div class="card-body p-0"> <table class="table table-zebra w-full min-w-[36rem]">
<div class="overflow-x-auto">
<table class="table w-full">
<thead> <thead>
<tr class="bg-base-200/50"> <tr>
<th class="w-16">ID</th> <th class="w-16">ID</th>
<th><?= phpb_trans('website-manager.name') ?></th> <th><?= phpb_trans('website-manager.name') ?></th>
<th class="w-16 text-center"><?= phpb_trans('website-manager.actions') ?></th> <th class="w-40 text-right"><?= phpb_trans('website-manager.actions') ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($forms as $form): ?> <?php foreach ($forms as $form): ?>
<tr class="hover:bg-base-200/30"> <tr>
<td class="font-mono text-sm text-base-content/60"><?= phpb_e($form['id']) ?></td> <td><span class="badge badge-ghost font-mono"><?= phpb_e($form['id']) ?></span></td>
<td> <td>
<div class="font-medium"><?= phpb_e($form['name']) ?></div> <div class="font-medium"><?= phpb_e($form['name']) ?></div>
</td> </td>
<td> <td>
<div class="flex items-center justify-center gap-1"> <div class="flex items-center justify-end gap-1">
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'listEntries', 'id' => $form['id']]) ?>" class="btn btn-ghost btn-sm btn-circle" title="View entries"> <a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'listEntries', 'id' => $form['id']]) ?>" class="btn btn-ghost btn-square btn-sm" title="View entries" aria-label="View entries for <?= phpb_e($form['name']) ?>">
<i class="ph-duotone ph-eye text-lg"></i> <i class="ph-duotone ph-eye text-lg" aria-hidden="true"></i>
</a> </a>
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm', 'id' => $form['id']]) ?>" class="btn btn-ghost btn-sm btn-circle" title="<?= phpb_trans('website-manager.edit') ?>"> <a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm', 'id' => $form['id']]) ?>" class="btn btn-ghost btn-square btn-sm" title="<?= phpb_trans('website-manager.edit') ?>" aria-label="<?= phpb_trans('website-manager.edit') ?> <?= phpb_e($form['name']) ?>">
<i class="ph-duotone ph-pencil-line text-lg"></i> <i class="ph-duotone ph-pencil-line text-lg" aria-hidden="true"></i>
</a> </a>
<a href="/ext--form/delete-form?id=<?= $form['id'] ?>" class="btn btn-ghost btn-sm btn-circle text-error" title="<?= phpb_trans('website-manager.remove') ?>"> <a href="/ext--form/delete-form?id=<?= $form['id'] ?>" class="btn btn-ghost btn-square btn-sm text-error" title="<?= phpb_trans('website-manager.remove') ?>" aria-label="<?= phpb_trans('website-manager.remove') ?> <?= phpb_e($form['name']) ?>">
<i class="ph-duotone ph-trash text-lg"></i> <i class="ph-duotone ph-trash text-lg" aria-hidden="true"></i>
</a> </a>
</div> </div>
</td> </td>
@@ -66,7 +68,6 @@ $forms = $formsRepository->getAll();
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
</div>
<?php endif; ?> <?php endif; ?>
</section>
+5 -3
View File
@@ -33,20 +33,22 @@ if (isset($_GET['action']) && array_key_exists($_GET['action'], $modules)) $acti
<?php <?php
if ($modules[$activeModule]['showTabs'] === true): if ($modules[$activeModule]['showTabs'] === true):
?> ?>
<div class="tabs tabs-boxed bg-base-200/50 mb-6"> <nav class="mb-6 overflow-x-auto" aria-label="Form extension navigation">
<div class="tabs tabs-box w-max min-w-full bg-base-200/50">
<?php <?php
foreach ($modules as $name => $module): foreach ($modules as $name => $module):
if ($module['inMenu'] === false) continue; if ($module['inMenu'] === false) continue;
$icon = $module['icon'] ?? 'ph-circle'; $icon = $module['icon'] ?? 'ph-circle';
?> ?>
<a class="tab gap-2 <?= $name === $activeModule ? 'tab-active' : '' ?>" href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => $name]) ?>"> <a class="tab gap-2 <?= $name === $activeModule ? 'tab-active' : '' ?>" <?= $name === $activeModule ? 'aria-current="page"' : '' ?> href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => $name]) ?>">
<i class="ph-duotone <?= $icon ?>"></i> <i class="ph-duotone <?= $icon ?>" aria-hidden="true"></i>
<?= $module['label'] ?> <?= $module['label'] ?>
</a> </a>
<?php <?php
endforeach; endforeach;
?> ?>
</div> </div>
</nav>
<?php <?php
endif; endif;
?> ?>
+102 -15
View File
@@ -185,6 +185,20 @@
} }
} }
@layer utilities { @layer utilities {
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
border-width: 0;
}
.static {
position: static;
}
.mx-auto { .mx-auto {
margin-inline: auto; margin-inline: auto;
} }
@@ -212,15 +226,15 @@
.mb-4 { .mb-4 {
margin-bottom: calc(var(--spacing) * 4); margin-bottom: calc(var(--spacing) * 4);
} }
.mb-5 {
margin-bottom: calc(var(--spacing) * 5);
}
.mb-6 { .mb-6 {
margin-bottom: calc(var(--spacing) * 6); margin-bottom: calc(var(--spacing) * 6);
} }
.ml-1 { .ml-1 {
margin-left: var(--spacing); margin-left: var(--spacing);
} }
.ml-2 {
margin-left: calc(var(--spacing) * 2);
}
.flex { .flex {
display: flex; display: flex;
} }
@@ -239,9 +253,6 @@
.w-6 { .w-6 {
width: calc(var(--spacing) * 6); width: calc(var(--spacing) * 6);
} }
.w-12 {
width: calc(var(--spacing) * 12);
}
.w-16 { .w-16 {
width: calc(var(--spacing) * 16); width: calc(var(--spacing) * 16);
} }
@@ -251,9 +262,18 @@
.w-full { .w-full {
width: 100%; width: 100%;
} }
.w-max {
width: max-content;
}
.max-w-2xl { .max-w-2xl {
max-width: var(--container-2xl); max-width: var(--container-2xl);
} }
.min-w-40 {
min-width: calc(var(--spacing) * 40);
}
.min-w-full {
min-width: 100%;
}
.flex-1 { .flex-1 {
flex: 1; flex: 1;
} }
@@ -263,11 +283,20 @@
.cursor-pointer { .cursor-pointer {
cursor: pointer; cursor: pointer;
} }
.flex-col {
flex-direction: column;
}
.flex-col-reverse {
flex-direction: column-reverse;
}
.flex-wrap {
flex-wrap: wrap;
}
.items-center { .items-center {
align-items: center; align-items: center;
} }
.justify-between { .items-start {
justify-content: space-between; align-items: flex-start;
} }
.justify-center { .justify-center {
justify-content: center; justify-content: center;
@@ -275,6 +304,9 @@
.justify-end { .justify-end {
justify-content: flex-end; justify-content: flex-end;
} }
.justify-start {
justify-content: flex-start;
}
.gap-1 { .gap-1 {
gap: var(--spacing); gap: var(--spacing);
} }
@@ -284,6 +316,9 @@
.gap-3 { .gap-3 {
gap: calc(var(--spacing) * 3); gap: calc(var(--spacing) * 3);
} }
.gap-4 {
gap: calc(var(--spacing) * 4);
}
:where(.space-y-1 > :not(:last-child)) { :where(.space-y-1 > :not(:last-child)) {
--tw-space-y-reverse: 0; --tw-space-y-reverse: 0;
margin-block-start: calc(var(--spacing) * var(--tw-space-y-reverse)); margin-block-start: calc(var(--spacing) * var(--tw-space-y-reverse));
@@ -304,6 +339,11 @@
margin-block-start: calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse)); margin-block-start: calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));
margin-block-end: calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse))); margin-block-end: calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)));
} }
:where(.space-y-5 > :not(:last-child)) {
--tw-space-y-reverse: 0;
margin-block-start: calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));
margin-block-end: calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)));
}
.overflow-x-auto { .overflow-x-auto {
overflow-x: auto; overflow-x: auto;
} }
@@ -324,6 +364,10 @@
border-style: var(--tw-border-style); border-style: var(--tw-border-style);
border-width: 2px; border-width: 2px;
} }
.border-b {
border-bottom-style: var(--tw-border-style);
border-bottom-width: 1px;
}
.border-l-2 { .border-l-2 {
border-left-style: var(--tw-border-style); border-left-style: var(--tw-border-style);
border-left-width: 2px; border-left-width: 2px;
@@ -341,18 +385,42 @@
.p-3 { .p-3 {
padding: calc(var(--spacing) * 3); padding: calc(var(--spacing) * 3);
} }
.px-0 {
padding-inline: 0px;
}
.px-3 {
padding-inline: calc(var(--spacing) * 3);
}
.px-4 {
padding-inline: calc(var(--spacing) * 4);
}
.py-2 {
padding-block: calc(var(--spacing) * 2);
}
.py-8 { .py-8 {
padding-block: calc(var(--spacing) * 8); padding-block: calc(var(--spacing) * 8);
} }
.py-16 { .py-16 {
padding-block: calc(var(--spacing) * 16); padding-block: calc(var(--spacing) * 16);
} }
.pl-4 { .pt-2 {
padding-left: calc(var(--spacing) * 4); padding-top: calc(var(--spacing) * 2);
}
.pb-4 {
padding-bottom: calc(var(--spacing) * 4);
}
.pl-3 {
padding-left: calc(var(--spacing) * 3);
}
.pl-8 {
padding-left: calc(var(--spacing) * 8);
} }
.text-center { .text-center {
text-align: center; text-align: center;
} }
.text-right {
text-align: right;
}
.font-mono { .font-mono {
font-family: var(--font-mono); font-family: var(--font-mono);
} }
@@ -403,14 +471,10 @@
.uppercase { .uppercase {
text-transform: uppercase; text-transform: uppercase;
} }
.shadow { .shadow-sm {
--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)); --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
} }
.shadow-lg {
--tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
}
.transition-colors { .transition-colors {
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to; transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function)); transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
@@ -419,6 +483,29 @@
.active\:cursor-grabbing:active { .active\:cursor-grabbing:active {
cursor: grabbing; cursor: grabbing;
} }
@media (width >= 40rem) {
.sm\:ml-2 {
margin-left: calc(var(--spacing) * 2);
}
.sm\:min-w-28 {
min-width: calc(var(--spacing) * 28);
}
.sm\:flex-row {
flex-direction: row;
}
.sm\:items-center {
align-items: center;
}
.sm\:justify-between {
justify-content: space-between;
}
.sm\:justify-end {
justify-content: flex-end;
}
.sm\:pl-4 {
padding-left: calc(var(--spacing) * 4);
}
}
} }
@layer theme, base, components, utilities; @layer theme, base, components, utilities;
@layer theme; @layer theme;
@@ -7,8 +7,8 @@ if ($id > 0):
$fields = json_decode($form["fields"], true); $fields = json_decode($form["fields"], true);
?> ?>
<div class="max-w-2xl mx-auto"> <div class="mx-auto w-full max-w-2xl">
<div x-data="{data: {fields : {}}, status: 'idle', submitted: false, errorMessage: ''}"> <div x-data="{data: {fields : {}}, status: 'idle', submitted: false, errorMessage: ''}" class="space-y-4">
<form x-show="!submitted" x-transition:leave x-transition:leave-opacity-0 x-on:submit.prevent=" <form x-show="!submitted" x-transition:leave x-transition:leave-opacity-0 x-on:submit.prevent="
status = 'busy'; status = 'busy';
errorMessage = ''; errorMessage = '';
@@ -40,82 +40,99 @@ if ($id > 0):
? $field["options"] ? $field["options"]
: []; : [];
?> ?>
<div class="form-control mb-4"> <div class="form-control mb-5">
<label class="label mb-1"> <?php if ($fieldType === "checkbox" || $fieldType === "radio"): ?>
<fieldset class="space-y-2">
<legend class="label mb-1 px-0">
<span class="label-text font-medium"> <span class="label-text font-medium">
<?= $fieldLabel ?> <?= phpb_e($fieldLabel) ?>
<?php if ($fieldRequired): ?> <?php if ($fieldRequired): ?>
<span class="text-error ml-1">*</span> <span class="ml-1 text-error" aria-hidden="true">*</span>
<span class="sr-only">(required)</span>
<?php endif; ?>
</span>
</legend>
<?php else: ?>
<label for="form-field-<?= phpb_e($fieldName) ?>" class="label mb-1 px-0">
<span class="label-text font-medium">
<?= phpb_e($fieldLabel) ?>
<?php if ($fieldRequired): ?>
<span class="ml-1 text-error" aria-hidden="true">*</span>
<span class="sr-only">(required)</span>
<?php endif; ?> <?php endif; ?>
</span> </span>
</label> </label>
<?php endif; ?>
<?php if ($fieldType === "select"): ?> <?php if ($fieldType === "select"): ?>
<select x-model="data.fields.<?= $fieldName ?>" class="select select-bordered w-full" <?= $fieldRequired <select id="form-field-<?= phpb_e($fieldName) ?>" x-model="data.fields.<?= $fieldName ?>" class="select select-bordered w-full" <?= $fieldRequired
? "required" ? "required"
: "" ?>> : "" ?>>
<option value="" disabled selected>Please select</option> <option value="" disabled selected>Please select</option>
<?php foreach ($fieldOptions as $option): ?> <?php foreach ($fieldOptions as $option): ?>
<option value="<?= $option[ <option value="<?= phpb_e($option[
"value" "value"
] ?>"><?= $option["label"] ?></option> ]) ?>"><?= phpb_e($option["label"]) ?></option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<?php elseif ($fieldType === "checkbox"): ?> <?php elseif ($fieldType === "checkbox"): ?>
<div class="space-y-2"> <div class="space-y-2">
<?php foreach ($fieldOptions as $option): ?> <?php foreach ($fieldOptions as $option): ?>
<label class="label cursor-pointer gap-3"> <label class="label cursor-pointer justify-start gap-3 rounded-box border border-base-300 px-3 py-2">
<span class="label-text"><?= $option[ <input type="checkbox" value="<?= phpb_e($option[
"label"
] ?></span>
<input type="checkbox" value="<?= $option[
"value" "value"
] ?>" x-model="data.fields.<?= $fieldName ?>" class="checkbox checkbox-sm checkbox-primary" /> ]) ?>" x-model="data.fields.<?= $fieldName ?>" class="checkbox checkbox-sm checkbox-primary" />
<span class="label-text"><?= phpb_e($option[
"label"
]) ?></span>
</label> </label>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<?php elseif ($fieldType === "radio"): ?> <?php elseif ($fieldType === "radio"): ?>
<div class="space-y-2"> <div class="space-y-2">
<?php foreach ($fieldOptions as $option): ?> <?php foreach ($fieldOptions as $option): ?>
<label class="label cursor-pointer gap-3"> <label class="label cursor-pointer justify-start gap-3 rounded-box border border-base-300 px-3 py-2">
<span class="label-text"><?= $option[ <input type="radio" name="<?= phpb_e($fieldName) ?>" value="<?= phpb_e($option[
"label"
] ?></span>
<input type="radio" name="<?= $fieldName ?>" value="<?= $option[
"value" "value"
] ?>" x-model="data.fields.<?= $fieldName ?>" class="radio radio-sm radio-primary" /> ]) ?>" x-model="data.fields.<?= $fieldName ?>" class="radio radio-sm radio-primary" />
<span class="label-text"><?= phpb_e($option[
"label"
]) ?></span>
</label> </label>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<?php elseif ($fieldType === "textarea"): ?> <?php elseif ($fieldType === "textarea"): ?>
<textarea x-model="data.fields.<?= $fieldName ?>" class="textarea textarea-bordered w-full" placeholder="<?= $fieldLabel ?>" <?= $fieldRequired <textarea id="form-field-<?= phpb_e($fieldName) ?>" x-model="data.fields.<?= $fieldName ?>" class="textarea textarea-bordered w-full" placeholder="<?= phpb_e($fieldLabel) ?>" <?= $fieldRequired
? "required" ? "required"
: "" ?> rows="4"></textarea> : "" ?> rows="4"></textarea>
<?php else: ?> <?php else: ?>
<input type="<?= $fieldType ?>" x-model="data.fields.<?= $fieldName ?>" class="input input-bordered w-full" placeholder="<?= $fieldLabel ?>" <?= $fieldRequired <input id="form-field-<?= phpb_e($fieldName) ?>" type="<?= phpb_e($fieldType) ?>" x-model="data.fields.<?= $fieldName ?>" class="input input-bordered w-full" placeholder="<?= phpb_e($fieldLabel) ?>" <?= $fieldRequired
? "required" ? "required"
: "" ?>> : "" ?>>
<?php endif; ?> <?php endif; ?>
<?php if ($fieldType === "checkbox" || $fieldType === "radio"): ?>
</fieldset>
<?php endif; ?>
</div> </div>
<?php <?php
endforeach; ?> endforeach; ?>
<div class="mt-6"> <div class="mt-6">
<button type="submit" class="btn btn-primary w-full" :disabled="status === 'busy'"> <button type="submit" class="btn btn-primary w-full" :disabled="status === 'busy'" :aria-busy="status === 'busy'">
<span x-show="status === 'idle'"> <span x-show="status === 'idle'" aria-live="polite">
<i class="ph-duotone ph-paper-plane-tilt"></i> <i class="ph-duotone ph-paper-plane-tilt" aria-hidden="true"></i>
Submit Submit
</span> </span>
<span x-show="status === 'busy'"> <span x-show="status === 'busy'" role="status" aria-live="polite">
<span class="loading loading-spinner loading-sm"></span> <span class="loading loading-spinner loading-sm" aria-hidden="true"></span>
Sending... Sending...
</span> </span>
</button> </button>
</div> </div>
</form> </form>
<div x-show="errorMessage" x-text="errorMessage" class="alert alert-error mt-4" role="alert"></div> <div x-show="errorMessage" x-text="errorMessage" class="alert alert-error mt-4 shadow-sm" role="alert" aria-live="assertive" aria-atomic="true"></div>
<div x-show="submitted" x-transition:enter x-transition:enter-opacity-0 x-transition:enter-delay-100 class="card bg-base-100 shadow-lg mt-4"> <div x-show="submitted" x-transition:enter x-transition:enter-opacity-0 x-transition:enter-delay-100 class="card mt-4 border border-success/30 bg-base-100 shadow-sm" role="status" aria-live="polite">
<div class="card-body items-center text-center"> <div class="card-body items-center text-center">
<div class="w-16 h-16 rounded-full bg-success/20 flex items-center justify-center mb-2"> <div class="mb-2 flex h-16 w-16 items-center justify-center rounded-full bg-success/20">
<i class="ph-duotone ph-check text-3xl text-success"></i> <i class="ph-duotone ph-check text-3xl text-success" aria-hidden="true"></i>
</div> </div>
<h3 class="card-title text-lg">Thank you!</h3> <h3 class="card-title text-lg">Thank you!</h3>
<p class="text-base-content/60">Your message has been sent successfully.</p> <p class="text-base-content/60">Your message has been sent successfully.</p>
@@ -126,10 +143,10 @@ if ($id > 0):
<?php <?php
else: else:
?> ?>
<div class="form-wrapper max-w-2xl mx-auto"> <div class="form-wrapper mx-auto w-full max-w-2xl">
<div class="card bg-base-200 border-2 border-dashed border-base-300"> <div class="card border-2 border-dashed border-base-300 bg-base-200/50">
<div class="card-body items-center text-center py-8"> <div class="card-body items-center py-8 text-center">
<i class="ph-duotone ph-plus-circle text-4xl text-base-content/30"></i> <i class="ph-duotone ph-plus-circle text-4xl text-base-content/30" aria-hidden="true"></i>
<p class="text-sm text-base-content/50 mt-2">Select a form in the settings</p> <p class="text-sm text-base-content/50 mt-2">Select a form in the settings</p>
</div> </div>
</div> </div>
+24 -7
View File
@@ -163,9 +163,12 @@ async function buildWebsiteManagerJs() {
); );
} }
function runTailwindCli({ watch = false } = {}) { function runTailwindCli({
const input = path.resolve(__dirname, 'src/Modules/WebsiteManager/resources/assets/css/style.css'); watch = false,
const output = path.join(DIST_DIR, 'WebsiteManager.css'); input = path.resolve(__dirname, 'src/Modules/WebsiteManager/resources/assets/css/style.css'),
output = path.join(DIST_DIR, 'WebsiteManager.css'),
label = 'WebsiteManager.css',
} = {}) {
const tailwindBin = path.resolve(__dirname, 'node_modules/.bin/tailwindcss'); const tailwindBin = path.resolve(__dirname, 'node_modules/.bin/tailwindcss');
const args = ['-i', input, '-o', output]; const args = ['-i', input, '-o', output];
@@ -194,10 +197,10 @@ function runTailwindCli({ watch = false } = {}) {
if (code === 0) { if (code === 0) {
const duration = (performance.now() - start).toFixed(1); const duration = (performance.now() - start).toFixed(1);
const size = (fs.statSync(output).size / 1024).toFixed(1); const size = (fs.statSync(output).size / 1024).toFixed(1);
console.log(` \x1b[32m✓\x1b[0m CSS dist/WebsiteManager.css (${size} kB, ${duration}ms)`); console.log(` \x1b[32m✓\x1b[0m CSS dist/${label} (${size} kB, ${duration}ms)`);
resolve(); resolve();
} else { } else {
console.error(`\x1b[31mError compiling Tailwind CSS:\x1b[0m\n${stderr}`); console.error(`\x1b[31mError compiling ${label}:\x1b[0m\n${stderr}`);
reject(new Error(`Tailwind CLI exited with code ${code}`)); reject(new Error(`Tailwind CLI exited with code ${code}`));
} }
}); });
@@ -215,6 +218,12 @@ async function buildAll() {
await Promise.all([ await Promise.all([
buildWebsiteManagerJs(), buildWebsiteManagerJs(),
runTailwindCli({ watch: false }), runTailwindCli({ watch: false }),
runTailwindCli({
watch: false,
input: path.resolve(__dirname, 'src/Modules/WebsiteManager/resources/assets/css/admin.css'),
output: path.join(DIST_DIR, 'Admin.css'),
label: 'Admin.css',
}),
buildGrapesHead(), buildGrapesHead(),
buildGrapesBody(), buildGrapesBody(),
buildPageInjectionJs(), buildPageInjectionJs(),
@@ -226,7 +235,15 @@ async function buildAll() {
} }
function startWatch() { function startWatch() {
const tailwindProcess = runTailwindCli({ watch: true }); const tailwindProcesses = [
runTailwindCli({ watch: true }),
runTailwindCli({
watch: true,
input: path.resolve(__dirname, 'src/Modules/WebsiteManager/resources/assets/css/admin.css'),
output: path.join(DIST_DIR, 'Admin.css'),
label: 'Admin.css',
}),
];
const srcDir = path.resolve(__dirname, 'src'); const srcDir = path.resolve(__dirname, 'src');
console.log(`\x1b[36mWatching for changes in ${srcDir}...\x1b[0m\n`); console.log(`\x1b[36mWatching for changes in ${srcDir}...\x1b[0m\n`);
@@ -284,7 +301,7 @@ function startWatch() {
const cleanup = () => { const cleanup = () => {
console.log('\nStopping watchers...'); console.log('\nStopping watchers...');
if (tailwindProcess) tailwindProcess.kill(); tailwindProcesses.forEach((tailwindProcess) => tailwindProcess?.kill());
watcher.close(); watcher.close();
process.exit(0); process.exit(0);
}; };
+2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
@@ -1,22 +1,33 @@
<!doctype html> <!doctype html>
<html lang="<?= phpb_current_language() ?>"> <html lang="<?= phpb_current_language() ?>" class="plugi-admin-theme">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= phpb_trans("auth.title") ?></title> <title><?= phpb_trans("auth.title") ?></title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link href="<?= phpb_asset("WebsiteManager.css") ?>" rel="stylesheet"> <link href="<?= phpb_asset("Admin.css") ?>" rel="stylesheet">
</head> </head>
<body> <body class="min-h-screen bg-base-200 text-base-content antialiased">
<div class="container p-4"> <main class="relative flex min-h-screen flex-col items-center justify-center gap-7 overflow-hidden px-4 py-10">
<div class="pointer-events-none absolute inset-x-0 top-0 h-2 bg-gradient-to-r from-primary via-secondary to-accent" aria-hidden="true"></div>
<section class="card w-full max-w-md border border-base-300 bg-base-100 shadow-xl shadow-base-content/5">
<div class="card-body gap-6 p-6 sm:p-8">
<a href="<?= phpb_url('website_manager') ?>" class="mx-auto flex items-center gap-3 rounded-box focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-primary">
<span class="grid size-11 place-items-center rounded-2xl bg-primary text-primary-content">
<i class="text-2xl ph-bold ph-brackets-square rotate-90" aria-hidden="true"></i>
</span>
<span class="text-xl font-bold tracking-tight text-base-content">Plugi</span>
</a>
<?php require __DIR__ . "/" . $viewFile . ".php"; ?> <?php require __DIR__ . "/" . $viewFile . ".php"; ?>
</div>
</section>
<footer class="my-5 pt-5 text-muted text-center text-small"> <footer class="text-center text-sm text-base-content/60">
<p class="mb-1">Powered by <a href="https://github.com/deepDiverPaul/plugi" target="_blank">Plugi Page Builder</a></p> <p>Powered by <a class="link link-hover" href="https://github.com/deepDiverPaul/plugi" target="_blank" rel="noopener noreferrer">Plugi Page Builder</a></p>
</footer> </footer>
</div> </main>
</body> </body>
</html> </html>
@@ -1,23 +1,33 @@
<div class="py-5 text-center"> <div class="space-y-1 text-center">
<h2><?= phpb_trans('auth.title') ?></h2> <p class="text-xs font-semibold uppercase tracking-[0.18em] text-primary">Secure access</p>
<h1 class="text-2xl font-bold tracking-tight text-base-content"><?= phpb_trans('auth.title') ?></h1>
</div> </div>
<form class="login-form mt-3 flex flex-col gap-3 items-center" method="post" action="<?= phpb_url('auth', ['action' => 'login']) ?>"> <form class="login-form flex w-full flex-col gap-4" method="post" action="<?= phpb_url('auth', ['action' => 'login']) ?>">
<?php phpb_csrf_field(); ?> <?php phpb_csrf_field(); ?>
<?php <?php
if (phpb_flash('message')): if (phpb_flash('message')):
?> ?>
<div class="hidden alert-warning"></div> <div class="hidden alert alert-warning alert-error alert-info alert-success"></div>
<div class="alert alert-<?= phpb_flash('message-type') ?> mb-6"> <div class="alert alert-<?= phpb_flash('message-type') ?> w-full" role="alert">
<i class="text-xl ph-duotone ph-warning"></i> <i class="text-xl ph-duotone ph-warning-circle" aria-hidden="true"></i>
<span><?= phpb_flash('message') ?></span> <span><?= phpb_flash('message') ?></span>
</div> </div>
<?php <?php
endif; endif;
?> ?>
<input type="text" name="username" class="input input-bordered w-full max-w-xs" placeholder="<?= phpb_trans('auth.username') ?>" required autofocus> <label class="form-control w-full gap-2">
<input type="password" name="password" class="input input-bordered w-full max-w-xs" placeholder="<?= phpb_trans('auth.password') ?>" required> <span class="label-text font-medium"><?= phpb_trans('auth.username') ?></span>
<input type="text" name="username" class="input input-bordered w-full" placeholder="<?= phpb_trans('auth.username') ?>" autocomplete="username" required autofocus aria-label="<?= phpb_e(phpb_trans('auth.username')) ?>">
</label>
<label class="form-control w-full gap-2">
<span class="label-text font-medium"><?= phpb_trans('auth.password') ?></span>
<input type="password" name="password" class="input input-bordered w-full" placeholder="<?= phpb_trans('auth.password') ?>" autocomplete="current-password" required aria-label="<?= phpb_e(phpb_trans('auth.password')) ?>">
</label>
<button class="btn btn-outline btn-primary w-full max-w-xs" type="submit"><?= phpb_trans('auth.login-button') ?></button> <button class="btn btn-primary mt-2 w-full" type="submit">
<?= phpb_trans('auth.login-button') ?>
<i class="ph-bold ph-arrow-right" aria-hidden="true"></i>
</button>
</form> </form>
@@ -0,0 +1,82 @@
@import "tailwindcss";
@import "./plugi-theme.css";
@plugin "daisyui" {
themes: false;
}
@plugin "daisyui/theme" {
name: "plugi-light";
default: true;
prefersdark: false;
color-scheme: light;
--color-base-100: var(--plugi-light-base-100);
--color-base-200: var(--plugi-light-base-200);
--color-base-300: var(--plugi-light-base-300);
--color-base-content: var(--plugi-light-base-content);
--color-primary: var(--plugi-light-primary);
--color-primary-content: var(--plugi-light-primary-content);
--color-secondary: var(--plugi-light-secondary);
--color-secondary-content: var(--plugi-light-secondary-content);
--color-accent: var(--plugi-light-accent);
--color-accent-content: var(--plugi-light-accent-content);
--color-neutral: var(--plugi-light-neutral);
--color-neutral-content: var(--plugi-light-neutral-content);
--color-info: var(--plugi-light-info);
--color-info-content: var(--plugi-light-info-content);
--color-success: var(--plugi-light-success);
--color-success-content: var(--plugi-light-success-content);
--color-warning: var(--plugi-light-warning);
--color-warning-content: var(--plugi-light-warning-content);
--color-error: var(--plugi-light-error);
--color-error-content: var(--plugi-light-error-content);
--radius-selector: var(--plugi-light-radius-selector);
--radius-field: var(--plugi-light-radius-field);
--radius-box: var(--plugi-light-radius-box);
--size-selector: var(--plugi-light-size-selector);
--size-field: var(--plugi-light-size-field);
--border: var(--plugi-light-border);
--depth: var(--plugi-light-depth);
--noise: var(--plugi-light-noise);
}
@plugin "daisyui/theme" {
name: "plugi-dark";
default: false;
prefersdark: true;
color-scheme: dark;
--color-base-100: var(--plugi-dark-base-100);
--color-base-200: var(--plugi-dark-base-200);
--color-base-300: var(--plugi-dark-base-300);
--color-base-content: var(--plugi-dark-base-content);
--color-primary: var(--plugi-dark-primary);
--color-primary-content: var(--plugi-dark-primary-content);
--color-secondary: var(--plugi-dark-secondary);
--color-secondary-content: var(--plugi-dark-secondary-content);
--color-accent: var(--plugi-dark-accent);
--color-accent-content: var(--plugi-dark-accent-content);
--color-neutral: var(--plugi-dark-neutral);
--color-neutral-content: var(--plugi-dark-neutral-content);
--color-info: var(--plugi-dark-info);
--color-info-content: var(--plugi-dark-info-content);
--color-success: var(--plugi-dark-success);
--color-success-content: var(--plugi-dark-success-content);
--color-warning: var(--plugi-dark-warning);
--color-warning-content: var(--plugi-dark-warning-content);
--color-error: var(--plugi-dark-error);
--color-error-content: var(--plugi-dark-error-content);
--radius-selector: var(--plugi-dark-radius-selector);
--radius-field: var(--plugi-dark-radius-field);
--radius-box: var(--plugi-dark-radius-box);
--size-selector: var(--plugi-dark-size-selector);
--size-field: var(--plugi-dark-size-field);
--border: var(--plugi-dark-border);
--depth: var(--plugi-dark-depth);
--noise: var(--plugi-dark-noise);
}
@source "../../views";
@source "../../layouts";
@source "../../../../Auth/resources/views";
@source "../../../../../../../extensions/plugi-ext-form/admin/Views";
@source "../../../../../../../extensions/plugi-ext-form/admin/form.php";
@@ -0,0 +1,59 @@
:where(.plugi-admin-theme, .plugi-form-wrapper) {
--plugi-light-base-100: oklch(98% 0.008 250);
--plugi-light-base-200: oklch(95% 0.014 250);
--plugi-light-base-300: oklch(90% 0.022 250);
--plugi-light-base-content: oklch(24% 0.035 255);
--plugi-light-primary: oklch(48% 0.18 250);
--plugi-light-primary-content: oklch(99% 0.006 250);
--plugi-light-secondary: oklch(52% 0.13 190);
--plugi-light-secondary-content: oklch(99% 0.006 190);
--plugi-light-accent: oklch(76% 0.15 72);
--plugi-light-accent-content: oklch(25% 0.05 72);
--plugi-light-neutral: oklch(29% 0.035 255);
--plugi-light-neutral-content: oklch(97% 0.008 255);
--plugi-light-info: oklch(50% 0.16 240);
--plugi-light-info-content: oklch(99% 0.006 240);
--plugi-light-success: oklch(47% 0.15 155);
--plugi-light-success-content: oklch(99% 0.006 155);
--plugi-light-warning: oklch(78% 0.15 82);
--plugi-light-warning-content: oklch(25% 0.05 82);
--plugi-light-error: oklch(52% 0.19 27);
--plugi-light-error-content: oklch(99% 0.006 27);
--plugi-light-radius-selector: 0.75rem;
--plugi-light-radius-field: 0.75rem;
--plugi-light-radius-box: 1rem;
--plugi-light-size-selector: 0.25rem;
--plugi-light-size-field: 0.25rem;
--plugi-light-border: 1px;
--plugi-light-depth: 1;
--plugi-light-noise: 0;
--plugi-dark-base-100: oklch(22% 0.025 255);
--plugi-dark-base-200: oklch(18% 0.025 255);
--plugi-dark-base-300: oklch(30% 0.032 255);
--plugi-dark-base-content: oklch(94% 0.012 255);
--plugi-dark-primary: oklch(74% 0.14 245);
--plugi-dark-primary-content: oklch(21% 0.04 255);
--plugi-dark-secondary: oklch(75% 0.12 188);
--plugi-dark-secondary-content: oklch(19% 0.03 200);
--plugi-dark-accent: oklch(82% 0.13 75);
--plugi-dark-accent-content: oklch(22% 0.05 75);
--plugi-dark-neutral: oklch(31% 0.035 255);
--plugi-dark-neutral-content: oklch(95% 0.01 255);
--plugi-dark-info: oklch(75% 0.13 235);
--plugi-dark-info-content: oklch(20% 0.035 245);
--plugi-dark-success: oklch(74% 0.14 155);
--plugi-dark-success-content: oklch(19% 0.035 155);
--plugi-dark-warning: oklch(82% 0.14 82);
--plugi-dark-warning-content: oklch(22% 0.05 82);
--plugi-dark-error: oklch(73% 0.16 27);
--plugi-dark-error-content: oklch(20% 0.04 27);
--plugi-dark-radius-selector: 0.75rem;
--plugi-dark-radius-field: 0.75rem;
--plugi-dark-radius-box: 1rem;
--plugi-dark-size-selector: 0.25rem;
--plugi-dark-size-field: 0.25rem;
--plugi-dark-border: 1px;
--plugi-dark-depth: 1;
--plugi-dark-noise: 0;
}
@@ -2,18 +2,16 @@
<html lang="<?= phpb_current_language() ?>"> <html lang="<?= phpb_current_language() ?>">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Plugi Page Builder</title> <title>Plugi Page Builder</title>
<link href="<?= phpb_asset('WebsiteManager.css') ?>" rel="stylesheet"> <link href="<?= phpb_asset('WebsiteManager.css') ?>" rel="stylesheet">
</head> </head>
<body class="bg-light"> <body class="min-h-screen bg-base-200 text-base-content">
<div class="container"> <div class="mx-auto min-h-screen w-full max-w-7xl px-4 py-8 sm:px-6 lg:px-8">
<?php <?php require __DIR__ . '/../views/' . $viewFile . '.php'; ?>
require __DIR__ . '/../views/' . $viewFile . '.php';
?>
</div> </div>
<script src="<?= phpb_asset('WebsiteManager.js') ?>"></script> <script src="<?= phpb_asset('WebsiteManager.js') ?>"></script>
@@ -9,82 +9,93 @@ if (isset($_GET['tab'])) {
} }
?> ?>
<!doctype html> <!doctype html>
<html lang="<?= phpb_current_language() ?>"> <html lang="<?= phpb_current_language() ?>" class="plugi-admin-theme">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= phpb_trans('website-manager.title') ?></title> <title><?= phpb_trans('website-manager.title') ?></title>
<link rel="icon" href="/plugi-core/dist/images/logo-color.png"> <link rel="icon" href="/plugi-core/dist/images/logo-color.png">
<?php phpb_registered_assets('admin-header') ?> <?php phpb_registered_assets('admin-header') ?>
<link href="<?= phpb_asset('WebsiteManager.css') ?>" rel="stylesheet"> <link href="<?= phpb_asset('Admin.css') ?>" rel="stylesheet">
<link href="<?= phpb_asset('icons/duotone/style.css') ?>" rel="stylesheet"> <link href="<?= phpb_asset('icons/duotone/style.css') ?>" rel="stylesheet">
<link href="<?= phpb_asset('icons/regular/style.css') ?>" rel="stylesheet"> <link href="<?= phpb_asset('icons/regular/style.css') ?>" rel="stylesheet">
<link href="<?= phpb_asset('icons/bold/style.css') ?>" rel="stylesheet"> <link href="<?= phpb_asset('icons/bold/style.css') ?>" rel="stylesheet">
<?= Extensions::getHtmlBlocks('admin-head') ?> <?= Extensions::getHtmlBlocks('admin-head') ?>
</head> </head>
<body> <body class="min-h-screen bg-base-200 text-base-content antialiased">
<?= Extensions::getHtmlBlocks('admin-body-start') ?> <?= Extensions::getHtmlBlocks('admin-body-start') ?>
<div class="drawer lg:drawer-open"> <div class="drawer min-h-screen bg-base-200 lg:drawer-open">
<input id="my-drawer-2" type="checkbox" class="drawer-toggle" /> <input id="admin-navigation-drawer" type="checkbox" class="drawer-toggle" />
<div class="drawer-content flex flex-col items-center justify-top"> <div class="drawer-content flex min-h-screen min-w-0 flex-col">
<!-- Page content here --> <header class="navbar sticky top-0 z-30 min-h-16 border-b border-base-300 bg-base-100/95 px-3 backdrop-blur sm:px-6">
<div class="navbar lg:hidden bg-base-100"> <div class="navbar-start gap-3">
<div class="navbar-start"> <label for="admin-navigation-drawer" class="btn btn-square btn-ghost drawer-button lg:hidden" aria-label="Open navigation" title="Open navigation">
<label for="my-drawer-2" class="btn btn-square btn-accent drawer-button border-primary"> <i class="text-xl ph-bold ph-list" aria-hidden="true"></i>
<i class="text-lg ph-bold ph-list"></i>
</label> </label>
<div class="leading-tight">
<p class="hidden text-xs font-semibold uppercase tracking-[0.18em] text-base-content/50 sm:block">Plugi workspace</p>
<p class="font-semibold text-base-content"><?= phpb_e($tabs[$activeSlug]['title']) ?></p>
</div> </div>
<div class="navbar-center">
<span class="text-xl text-primary">
<i class="inline-block ph-bold ph-brackets-square rotate-90"></i> <?= phpb_trans('website-manager.title') ?>
</span>
</div> </div>
<div class="navbar-end"> <div class="navbar-end">
<a href="<?= phpb_url('auth', ['action' => 'logout']) ?>" class="btn btn-square btn-ghost"> <a href="<?= phpb_url('auth', ['action' => 'logout']) ?>" class="btn btn-ghost btn-sm lg:hidden">
<i class="text-lg ph ph-sign-out"></i> <i class="ph ph-sign-out" aria-hidden="true"></i>
<span><?= phpb_trans('website-manager.logout') ?></span>
</a> </a>
</div> </div>
</div> </header>
<?php <?php
require __DIR__ . '/../views/' . $viewFile . '.php'; require __DIR__ . '/../views/' . $viewFile . '.php';
?> ?>
<footer class="my-5 pt-5 text-muted text-center text-small"> <footer class="mt-auto px-4 py-6 text-center text-sm text-base-content/60 sm:px-6">
<p class="mb-1">Powered by <a href="https://github.com/deepDiverPaul/plugi" target="_blank">Plugi Page Builder</a></p> <p>Powered by <a class="link link-hover" href="https://github.com/deepDiverPaul/plugi" target="_blank" rel="noopener noreferrer">Plugi Page Builder</a></p>
</footer> </footer>
</div> </div>
<div class="drawer-side"> <div class="drawer-side z-40 lg:z-0">
<label for="my-drawer-2" class="drawer-overlay"></label> <label for="admin-navigation-drawer" aria-label="Close navigation" class="drawer-overlay"></label>
<ul class="menu p-4 w-80 h-full bg-base-200 text-base-content"> <aside class="flex min-h-full w-72 flex-col border-r border-base-300 bg-base-100 p-4 shadow-xl lg:shadow-none">
<!-- Sidebar content here --> <a href="<?= phpb_url('website_manager') ?>" class="flex items-center gap-3 rounded-box px-3 py-4 transition-colors hover:bg-base-200 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary">
<div class="py-5 text-2xl text-center text-primary"> <span class="grid size-11 shrink-0 place-items-center rounded-2xl bg-primary text-primary-content shadow-sm">
<h2"><i class="inline-block ph-bold ph-brackets-square rotate-90"></i> <?= phpb_trans('website-manager.title') ?></h2> <i class="text-2xl ph-bold ph-brackets-square rotate-90" aria-hidden="true"></i>
</div> </span>
<span class="min-w-0">
<span class="block text-lg font-bold leading-tight tracking-tight text-base-content">Plugi</span>
<span class="block text-xs font-medium text-base-content/60">Page Builder</span>
</span>
</a>
<div class="divider my-2"></div>
<nav class="flex-1" aria-label="Website administration">
<ul class="menu menu-md w-full gap-1 px-0">
<li class="menu-title px-3 text-xs uppercase tracking-[0.16em]"><span>Workspace</span></li>
<?php <?php
foreach ($tabs as $slug => $tab) : foreach ($tabs as $slug => $tab) :
?> ?>
<li class="mb-1"> <li>
<a class="<?= phpb_e($slug === $activeSlug ? 'bg-accent text-primary' : '' ) ?>" href="?tab=<?= phpb_e($slug) ?>"> <a class="<?= phpb_e($slug === $activeSlug ? 'menu-active font-semibold' : '' ) ?>" href="?tab=<?= phpb_e($slug) ?>" <?= $slug === $activeSlug ? 'aria-current="page"' : '' ?>>
<?= $tab['icon'] ?: '<i class="ph ph-circles-four"></i>' ?> <?= phpb_e($tab['title']) ?> <?= $tab['icon'] ?: '<i class="ph ph-circles-four"></i>' ?> <?= phpb_e($tab['title']) ?>
</a> </a>
</li> </li>
<?php <?php
endforeach; endforeach;
?> ?>
</ul>
</nav>
<?php <?php
if (phpb_config('auth.use_login')): if (phpb_config('auth.use_login')):
?> ?>
<li class="lg:flex hidden"> <div class="mt-auto border-t border-base-300 pt-4">
<a href="<?= phpb_url('auth', ['action' => 'logout']) ?>" class=""> <a class="btn btn-ghost w-full justify-start" href="<?= phpb_url('auth', ['action' => 'logout']) ?>">
<i class="ph ph-sign-out"></i> <?= phpb_trans('website-manager.logout') ?> <i class="ph ph-sign-out" aria-hidden="true"></i>
<?= phpb_trans('website-manager.logout') ?>
</a> </a>
</li> </div>
<?php <?php
endif; endif;
?> ?>
</ul> </aside>
</div> </div>
</div> </div>
@@ -5,26 +5,24 @@ if (isset($page)) {
} }
?> ?>
<div class="py-5 text-center"> <main class="mx-auto flex w-full max-w-7xl flex-1 flex-col gap-6 px-4 py-6 sm:px-6 lg:px-8 lg:py-8">
<h2><?= phpb_trans('website-manager.title') ?></h2> <header class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
</div> <div class="space-y-1">
<p class="text-xs font-semibold uppercase tracking-[0.18em] text-base-content/50">Page builder maintenance</p>
<div class="row"> <h1 class="text-2xl font-bold tracking-tight text-base-content sm:text-3xl"><?= phpb_trans('website-manager.title') ?></h1>
<div class="col-12">
<div class="manager-panel">
<h4><?= phpb_trans('website-manager.render-thumbs') ?></h4>
<div class="main-spacing">
<iframe class="thumb-renderer" src="<?= phpb_url('pagebuilder', ['route' => 'thumb_generator', 'action' => 'renderNextBlockThumb']) ?>"></iframe>
</div> </div>
<a href="<?= phpb_url('website_manager') ?>" class="btn btn-ghost btn-sm self-start sm:self-auto">
<hr class="mb-3"> <i class="ph ph-arrow-left" aria-hidden="true"></i> <?= phpb_trans('website-manager.back') ?>
<a href="<?= phpb_url('website_manager') ?>" class="btn btn-light btn-sm mr-1">
<?= phpb_trans('website-manager.back') ?>
</a> </a>
</div> </header>
</div>
</div> <section class="card min-w-0 border border-base-300 bg-base-100 shadow-sm">
<div class="card-body min-w-0 gap-5 p-4 sm:p-6">
<div class="space-y-1">
<h2 class="card-title text-lg"><?= phpb_trans('website-manager.render-thumbs') ?></h2>
<p class="text-sm text-base-content/60">This maintenance view renders the next missing block thumbnail.</p>
</div>
<iframe class="thumb-renderer min-h-[32rem] w-full rounded-box border border-base-300 bg-base-100" src="<?= phpb_url('pagebuilder', ['route' => 'thumb_generator', 'action' => 'renderNextBlockThumb']) ?>" title="<?= phpb_e(phpb_trans('website-manager.render-thumbs')) ?>"></iframe>
</div>
</section>
</main>
@@ -1,22 +1,28 @@
<div class="max-w-4xl p-8 mx-auto w-full"> <main class="mx-auto flex w-full max-w-7xl flex-1 flex-col gap-6 px-4 py-6 sm:px-6 lg:px-8 lg:py-8">
<div class="text-center text-3xl font-bold mb-8 mt-2"> <header class="flex items-center gap-4">
<span class="grid size-12 shrink-0 place-items-center rounded-2xl bg-primary/10 text-primary" aria-hidden="true">
<?= $tabs[$activeSlug]['icon'] ?: '<i class="ph ph-circles-four"></i>' ?>
</span>
<div class="space-y-1">
<p class="text-xs font-semibold uppercase tracking-[0.18em] text-base-content/50">Website management</p>
<h1 class="text-2xl font-bold tracking-tight text-base-content sm:text-3xl">
<?= phpb_e($tabs[$activeSlug]['title']) ?> <?= phpb_e($tabs[$activeSlug]['title']) ?>
</h1>
</div> </div>
</header>
<?php <?php
if (phpb_flash('message')): if (phpb_flash('message')):
?> ?>
<div class="hidden alert-success alert-error"></div> <div class="hidden alert alert-success alert-error"></div>
<div class="alert alert-<?= phpb_flash('message-type') ?> mb-6"> <div class="alert alert-<?= phpb_flash('message-type') ?> shadow-sm" role="<?= phpb_flash('message-type') === 'error' ? 'alert' : 'status' ?>">
<?= phpb_flash('message-type') === 'success' ? '<i class="text-xl ph-duotone ph-info"></i>' : '' ?> <?= phpb_flash('message-type') === 'success' ? '<i class="text-xl ph-duotone ph-check-circle" aria-hidden="true"></i>' : '' ?>
<?= phpb_flash('message-type') === 'error' ? '<i class="text-xl ph-duotone ph-warning-circle"></i>' : '' ?> <?= phpb_flash('message-type') === 'error' ? '<i class="text-xl ph-duotone ph-warning-circle" aria-hidden="true"></i>' : '' ?>
<span><?= phpb_flash('message') ?></span> <span><?= phpb_flash('message') ?></span>
</div> </div>
<?php <?php
endif; endif;
?> ?>
<div class=""> <section class="min-w-0">
<?php <?php include $tabs[$activeSlug]['include']; ?>
include $tabs[$activeSlug]['include']; </section>
?> </main>
</div>
</div>
@@ -5,6 +5,7 @@ if (isset($page)) {
} }
$pageTranslations = $page ? $page->getTranslations() : []; $pageTranslations = $page ? $page->getTranslations() : [];
$activeLanguages = phpb_active_languages();
$fieldValue = static function (string $field, ?string $languageCode = null) use ($page, $pageTranslations): string { $fieldValue = static function (string $field, ?string $languageCode = null) use ($page, $pageTranslations): string {
if ($languageCode !== null) { if ($languageCode !== null) {
$postedValues = $_POST[$field] ?? null; $postedValues = $_POST[$field] ?? null;
@@ -23,10 +24,14 @@ $javascriptValue = static function (string $value): string {
?> ?>
<div class="manager-panel p-8 w-full"> <main class="mx-auto flex w-full max-w-5xl flex-1 flex-col justify-center px-4 py-6 sm:px-6 lg:py-8">
<form method="post" action="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => $action]) ?><?= $pageUrlParam ?>"> <section class="card w-full border border-base-300 bg-base-100 shadow-sm">
<div class="card-body gap-6 p-4 sm:p-8">
<form class="space-y-6" method="post" action="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => $action]) ?><?= $pageUrlParam ?>">
<?php phpb_csrf_field(); ?> <?php phpb_csrf_field(); ?>
<div class="text-center text-3xl font-bold mb-8 mt-2"> <header class="space-y-2 border-b border-base-300 pb-5">
<p class="text-xs font-semibold uppercase tracking-[0.18em] text-primary">Page configuration</p>
<h1 class="text-2xl font-bold tracking-tight text-base-content sm:text-3xl">
<?php <?php
if ($action === 'create'): if ($action === 'create'):
echo phpb_trans('website-manager.add-new-page'); echo phpb_trans('website-manager.add-new-page');
@@ -34,32 +39,33 @@ $javascriptValue = static function (string $value): string {
echo phpb_trans('website-manager.edit-page'); echo phpb_trans('website-manager.edit-page');
endif; endif;
?> ?>
</div> </h1>
<p class="max-w-2xl text-sm leading-relaxed text-base-content/60">Set the page type and layout, then configure its route and metadata for each enabled language.</p>
</header>
<?php if (! empty($errorMessage)): ?> <?php if (! empty($errorMessage)): ?>
<div class="alert alert-error mb-6" role="alert"> <div class="alert alert-error" role="alert">
<span><?= phpb_e($errorMessage) ?></span> <span><?= phpb_e($errorMessage) ?></span>
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="max-w-lg p-4 mx-auto" x-data="{type: <?= $javascriptValue($fieldValue('type') !== '' ? $fieldValue('type') : 'static') ?>}"> <div class="w-full space-y-6" x-data="{type: <?= $javascriptValue($fieldValue('type') !== '' ? $fieldValue('type') : 'static') ?>}">
<div class="form-control w-full mb-4"> <section class="grid gap-4 rounded-box border border-base-300 bg-base-200/50 p-4 sm:grid-cols-2 sm:p-5">
<label class="label"> <div class="form-control w-full">
<label class="label" for="name">
<span class="label-text"> <?= phpb_trans('website-manager.name') ?></span> <span class="label-text"> <?= phpb_trans('website-manager.name') ?></span>
<span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span> <span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span>
</label> </label>
<input type="text" id="name" name="name" value="<?= phpb_e($fieldValue('name')) ?>" required class="input input-bordered w-full" /> <input type="text" id="name" name="name" value="<?= phpb_e($fieldValue('name')) ?>" required aria-describedby="page-name-help" class="input input-bordered w-full" />
<label class="label"> <p id="page-name-help" class="label text-sm text-base-content/60"><?= phpb_trans('website-manager.visible-in-page-overview') ?></p>
<span class="label-text-alt"><?= phpb_trans('website-manager.visible-in-page-overview') ?></span>
</label>
</div> </div>
<div class="form-control w-full mb-4"> <div class="form-control w-full">
<label class="label"> <label class="label" for="type">
<span class="label-text"><?= phpb_trans('website-manager.page-type') ?></span> <span class="label-text"><?= phpb_trans('website-manager.page-type') ?></span>
<span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span> <!-- TODO add to lang --> <span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span> <!-- TODO add to lang -->
</label> </label>
<select class="select select-bordered" x-model="type" id="type" name="type" required> <select class="select select-bordered w-full" x-model="type" id="type" name="type" required>
<?php <?php
$types = ['static', 'redirect']; $types = ['static', 'redirect'];
$value = $fieldValue('type'); $value = $fieldValue('type');
@@ -73,13 +79,14 @@ $javascriptValue = static function (string $value): string {
?> ?>
</select> </select>
</div> </div>
</section>
<div class="form-control w-full mb-4" x-show="type !== 'redirect'"> <div class="form-control w-full" x-show="type !== 'redirect'">
<label class="label"> <label class="label" for="layout">
<span class="label-text"><?= phpb_trans('website-manager.layout') ?></span> <span class="label-text"><?= phpb_trans('website-manager.layout') ?></span>
<span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span> <!-- TODO add to lang --> <span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span> <!-- TODO add to lang -->
</label> </label>
<select class="select select-bordered" id="layout" name="layout" required> <select class="select select-bordered w-full" id="layout" name="layout" required>
<?php <?php
$value = $fieldValue('layout'); $value = $fieldValue('layout');
foreach ($theme->getThemeLayouts() as $layout): foreach ($theme->getThemeLayouts() as $layout):
@@ -93,15 +100,27 @@ $javascriptValue = static function (string $value): string {
</select> </select>
</div> </div>
<section class="space-y-4">
<div class="flex flex-col gap-1 sm:flex-row sm:items-end sm:justify-between">
<div>
<h2 class="text-lg font-semibold text-base-content">Localized page details</h2>
<p class="text-sm text-base-content/60">Titles, routes, and metadata can vary by language.</p>
</div>
<span class="badge badge-outline"><?= count($activeLanguages) ?> languages</span>
</div>
<?php <?php
$firstLang = true; $firstLang = true;
foreach (phpb_active_languages() as $languageCode => $languageTranslation): foreach ($activeLanguages as $languageCode => $languageTranslation):
?> ?>
<details class="collapse collapse-plus bg-white mt-6" <?= phpb_e($firstLang ? 'open' : '') ?>> <details class="collapse collapse-arrow border border-base-300 bg-base-100" <?= phpb_e($firstLang ? 'open' : '') ?>>
<summary class="collapse-title text-xl font-medium"><?= phpb_trans('languages.' . $languageCode) ?></summary> <summary class="collapse-title flex min-h-14 items-center text-base font-semibold sm:text-lg">
<div class="collapse-content"> <span><?= phpb_trans('languages.' . $languageCode) ?></span>
<div x-data="{route: <?= $javascriptValue($fieldValue('route', $languageCode)) ?>, empty: true, locale: <?= $javascriptValue($firstLang ? '' : '/' . $languageCode) ?>}" x-init="empty = route.length === 0"> <span class="badge badge-ghost ml-3"><?= phpb_e($languageCode) ?></span>
<div class="form-control w-full mb-2"> </summary>
<div class="collapse-content space-y-5">
<div class="space-y-3" x-data="{route: <?= $javascriptValue($fieldValue('route', $languageCode)) ?>, empty: true, locale: <?= $javascriptValue($firstLang ? '' : '/' . $languageCode) ?>}" x-init="empty = route.length === 0">
<div class="form-control w-full">
<label class="label" for="<?= phpb_e($languageCode) ?>-page-title"> <label class="label" for="<?= phpb_e($languageCode) ?>-page-title">
<span class="label-text"><?= phpb_trans('website-manager.page-title') ?></span> <span class="label-text"><?= phpb_trans('website-manager.page-title') ?></span>
<span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span> <span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span>
@@ -109,37 +128,39 @@ $javascriptValue = static function (string $value): string {
<input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-title" name="title[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($fieldValue('title', $languageCode)) ?>" @input="if(empty){route=`${locale}/${slugify($event.target.value)}`}" :required="type==='static'" /> <input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-title" name="title[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($fieldValue('title', $languageCode)) ?>" @input="if(empty){route=`${locale}/${slugify($event.target.value)}`}" :required="type==='static'" />
</div> </div>
<div class="form-control w-full mb-2" x-show="type === 'static'"> <div class="grid gap-4 md:grid-cols-2" x-show="type === 'static'">
<div class="form-control w-full">
<label class="label" for="<?= phpb_e($languageCode) ?>-page-meta-title"> <label class="label" for="<?= phpb_e($languageCode) ?>-page-meta-title">
<span class="label-text"><?= phpb_trans('website-manager.page-meta-title') ?></span> <span class="label-text"><?= phpb_trans('website-manager.page-meta-title') ?></span>
</label> </label>
<input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-meta-title" name="meta_title[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($fieldValue('meta_title', $languageCode)) ?>" /> <input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-meta-title" name="meta_title[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($fieldValue('meta_title', $languageCode)) ?>" />
</div> </div>
<div class="form-control w-full mb-2" x-show="type === 'static'"> <div class="form-control w-full">
<label class="label" for="<?= phpb_e($languageCode) ?>-page-meta-description"> <label class="label" for="<?= phpb_e($languageCode) ?>-page-meta-description">
<span class="label-text"><?= phpb_trans('website-manager.page-meta-description') ?></span> <span class="label-text"><?= phpb_trans('website-manager.page-meta-description') ?></span>
</label> </label>
<input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-meta-description" name="meta_description[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($fieldValue('meta_description', $languageCode)) ?>" /> <input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-meta-description" name="meta_description[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($fieldValue('meta_description', $languageCode)) ?>" />
</div> </div>
</div>
<div class="form-control w-full mb-2" x-show="type === 'redirect'"> <div class="form-control w-full" x-show="type === 'redirect'">
<label class="label" for="<?= phpb_e($languageCode) ?>-page-target-redirect"> <label class="label" for="<?= phpb_e($languageCode) ?>-page-target-redirect">
<span class="label-text"><?= phpb_trans('website-manager.target-redirect') ?></span> <span class="label-text"><?= phpb_trans('website-manager.target-redirect') ?></span>
</label> </label>
<input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-target-redirect" name="target[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($fieldValue('target', $languageCode)) ?>" /> <input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-target-redirect" name="target[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($fieldValue('target', $languageCode)) ?>" />
</div> </div>
<div class="form-control w-full mb-2"> <div class="form-control w-full">
<label class="label" for="<?= phpb_e($languageCode) ?>-page-route"> <label class="label" for="<?= phpb_e($languageCode) ?>-page-route">
<span class="label-text"><?= phpb_trans('website-manager.route') ?></span> <span class="label-text"><?= phpb_trans('website-manager.route') ?></span>
<span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span> <span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span>
</label> </label>
<div class="join" x-data="{disabled: true}"> <div class="join w-full" x-data="{disabled: true}">
<input type="text" :class="{'join-item': type !== 'redirect'}" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-route" name="route[<?= phpb_e($languageCode) ?>]" x-model="route" :readonly="disabled && type !== 'redirect'" required /> <input type="text" :class="{'join-item': type !== 'redirect'}" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-route" name="route[<?= phpb_e($languageCode) ?>]" x-model="route" :readonly="disabled && type !== 'redirect'" :aria-readonly="disabled && type !== 'redirect'" required />
<button class="btn join-item btn-outline text-2xl" @click.stop.prevent="disabled=!disabled" type="button" x-show="type !== 'redirect'"> <button class="btn join-item btn-outline" @click.stop.prevent="disabled=!disabled" type="button" x-show="type !== 'redirect'" aria-label="<?= phpb_e(phpb_trans('website-manager.edit')) ?>" title="<?= phpb_e(phpb_trans('website-manager.edit')) ?>">
<i class="ph ph-pencil" x-show="disabled"></i> <i class="ph ph-pencil" x-show="disabled" aria-hidden="true"></i>
<i class="ph ph-pencil-slash" x-show="!disabled"></i> <i class="ph ph-pencil-slash" x-show="!disabled" aria-hidden="true"></i>
</button> </button>
</div> </div>
</div> </div>
@@ -151,12 +172,13 @@ $javascriptValue = static function (string $value): string {
$firstLang = false; $firstLang = false;
endforeach; endforeach;
?> ?>
</section>
<div class="text-center mt-8"> <div class="flex flex-col-reverse justify-end gap-3 border-t border-base-300 pt-6 sm:flex-row">
<a href="<?= phpb_url('website_manager') ?>" class="btn btn-light btn-sm mr-1"> <a href="<?= phpb_url('website_manager') ?>" class="btn btn-ghost sm:btn-sm">
<?= phpb_trans('website-manager.back') ?> <?= phpb_trans('website-manager.back') ?>
</a> </a>
<button class="btn btn-primary btn-sm"> <button type="submit" class="btn btn-primary sm:btn-sm">
<?php <?php
if ($action === 'create'): if ($action === 'create'):
echo phpb_trans('website-manager.add-new-page'); echo phpb_trans('website-manager.add-new-page');
@@ -172,3 +194,5 @@ $javascriptValue = static function (string $value): string {
</form> </form>
</div> </div>
</section>
</main>
@@ -1,32 +1,46 @@
<div class="mb-8 flex justify-center"> <section class="card border border-base-300 bg-base-100 shadow-sm">
<input type="file" id="fileupload" class="file-input file-input-bordered file-input-primary w-full max-w-md" name="fileupload" onchange="uploadFile()" onselect="uploadFile()" /> <div class="card-body gap-6 p-4 sm:p-6 lg:p-8">
</div> <div class="flex flex-col gap-5 border-b border-base-300 pb-5 sm:flex-row sm:items-end sm:justify-between">
<div class="space-y-1">
<h2 class="text-xl font-bold tracking-tight text-base-content">Media library</h2>
<p class="text-sm text-base-content/60">Upload and manage the files used across your pages.</p>
</div>
<div class="form-control w-full max-w-md gap-1">
<label class="label" for="fileupload">
<span class="label-text font-medium">Upload a file</span>
<span class="label-text-alt">Choose a file</span>
</label>
<input type="file" id="fileupload" class="file-input file-input-bordered file-input-primary w-full" name="fileupload" onchange="uploadFile()" onselect="uploadFile()" />
</div>
</div>
<div class="flex flex-wrap justify-center gap-4"> <?php if (count($files) === 0) : ?>
<?php <div class="rounded-box border border-dashed border-base-300 bg-base-200/50 px-5 py-12 text-center" role="status">
foreach ($files as $file) : <span class="mx-auto mb-4 grid size-12 place-items-center rounded-2xl bg-info/10 text-info">
?> <i class="text-2xl ph-duotone ph-image" aria-hidden="true"></i>
<div class="relative"> </span>
<img src="<?= phpb_e($file->getUrl()) ?>" alt="<?= phpb_e($file->public_id) ?>" class="h-40 rounded"> <h3 class="font-semibold text-base-content">No files yet</h3>
<div class="absolute top-1 right-1"> <p class="mt-1 text-sm text-base-content/60">Your uploaded files will appear here as a visual library.</p>
<button onclick="deleteFile('<?= phpb_e($file->public_id) ?>')" class="btn btn-error btn-circle btn-sm mb-2"> </div>
<i class="ph-duotone ph-trash"></i> <?php else : ?>
<ul class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
<?php foreach ($files as $file) : ?>
<li class="card overflow-hidden border border-base-300 bg-base-100 shadow-sm transition-shadow hover:shadow-md">
<figure class="relative aspect-video bg-base-200">
<img src="<?= phpb_e($file->getUrl()) ?>" alt="<?= phpb_e($file->public_id) ?>" class="h-full w-full object-cover">
<button type="button" onclick="deleteFile('<?= phpb_e($file->public_id) ?>')" class="btn btn-error btn-square btn-sm absolute right-3 top-3 shadow-sm" aria-label="<?= phpb_e(phpb_trans('website-manager.remove')) ?> <?= phpb_e($file->public_id) ?>" title="<?= phpb_e(phpb_trans('website-manager.remove')) ?>">
<i class="ph-duotone ph-trash" aria-hidden="true"></i>
</button> </button>
</figure>
<div class="card-body gap-1 p-3">
<p class="truncate text-sm font-medium" title="<?= phpb_e($file->public_id) ?>"><?= phpb_e($file->public_id) ?></p>
</div> </div>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div> </div>
<?php </section>
endforeach;
?>
<?php
if (count($files) === 0) :
?>
<div class="relative">
No files...
</div>
<?php
endif;
?>
</div>
<script> <script>
async function uploadFile() { async function uploadFile() {
@@ -3,15 +3,20 @@
use Plugi\Setting; use Plugi\Setting;
?> ?>
<div class="overflow-x-auto"> <section class="space-y-5">
<table class="table table-zebra"> <header class="space-y-1">
<h2 class="text-xl font-bold tracking-tight text-base-content">System information</h2>
<p class="text-sm text-base-content/60">Review runtime details, database health, and installed extensions.</p>
</header>
<div class="overflow-x-auto rounded-box border border-base-300 bg-base-100">
<table class="table table-zebra min-w-[42rem]">
<tbody> <tbody>
<tr> <tr>
<th class="w-36 md:w-60">PHP Version</th> <th scope="row" class="w-36 md:w-60">PHP Version</th>
<td><?= phpversion() ?></td> <td><span class="badge badge-outline"><?= phpversion() ?></span></td>
</tr> </tr>
<tr> <tr>
<th>Database</th> <th scope="row" class="align-top">Database</th>
<td> <td>
<form method="post" action="<?= phpb_url('website_manager', ['route' => 'database', 'action' => 'update']) ?>"> <form method="post" action="<?= phpb_url('website_manager', ['route' => 'database', 'action' => 'update']) ?>">
<?php phpb_csrf_field(); ?> <?php phpb_csrf_field(); ?>
@@ -24,16 +29,17 @@ use Plugi\Setting;
if(!is_array($tableDiff)) $actionNeeded = true; if(!is_array($tableDiff)) $actionNeeded = true;
if(is_array($tableDiff) && empty($tableDiff['columns']) && empty($tableDiff['uniqueKeys'])) continue; if(is_array($tableDiff) && empty($tableDiff['columns']) && empty($tableDiff['uniqueKeys'])) continue;
?> ?>
<div> <div class="rounded-box border border-base-300 bg-base-200/50 px-3 py-2 text-sm">
table <strong><?= phpb_e($table) ?></strong> (<?= phpb_e(is_array($tableDiff) ? (empty($tableDiff['columns']) && empty($tableDiff['uniqueKeys']) ? 'is fine' : 'has diff') : 'is not existent') ?>) Table <strong><?= phpb_e($table) ?></strong>
<span class="text-base-content/60">(<?= phpb_e(is_array($tableDiff) ? (empty($tableDiff['columns']) && empty($tableDiff['uniqueKeys']) ? 'is fine' : 'has diff') : 'is not existent') ?>)</span>
</div> </div>
<?php <?php
if (is_array($tableDiff)) : if (is_array($tableDiff)) :
foreach ($tableDiff['columns'] as $column => $def) : foreach ($tableDiff['columns'] as $column => $def) :
$actionNeeded = true; $actionNeeded = true;
?> ?>
<div class="ml-4"> <div class="ml-4 flex items-center gap-2 text-sm text-base-content/70">
<i class="ph ph-arrow-elbow-down-right"></i> column <strong><?= phpb_e($column) ?></strong> (not existent) <i class="ph ph-arrow-elbow-down-right" aria-hidden="true"></i> Column <strong><?= phpb_e($column) ?></strong> (not existent)
</div> </div>
<?php <?php
endforeach; endforeach;
@@ -44,8 +50,8 @@ use Plugi\Setting;
foreach ($tableDiff['uniqueKeys'] as $key => $def) : foreach ($tableDiff['uniqueKeys'] as $key => $def) :
$actionNeeded = true; $actionNeeded = true;
?> ?>
<div class="ml-4"> <div class="ml-4 flex items-center gap-2 text-sm text-base-content/70">
<i class="ph ph-arrow-elbow-down-right"></i> unique key <strong><?= phpb_e($key) ?></strong> (not existent) <i class="ph ph-arrow-elbow-down-right" aria-hidden="true"></i> Unique key <strong><?= phpb_e($key) ?></strong> (not existent)
</div> </div>
<?php <?php
endforeach; endforeach;
@@ -55,11 +61,17 @@ use Plugi\Setting;
endforeach; endforeach;
if ($actionNeeded) : if ($actionNeeded) :
?> ?>
<button class="btn" type="submit">Update</button> <button class="btn btn-primary" type="submit">
<i class="ph-bold ph-arrows-clockwise" aria-hidden="true"></i>
Update database
</button>
<?php <?php
else : else :
?> ?>
<div>Database is up-to-date. <span class="hidden md:inline text-gray-400">(<?= $phpb_db->getDBDefinitionHash() ?>)</span></div> <div class="alert alert-success alert-soft" role="status">
<i class="ph-duotone ph-check-circle" aria-hidden="true"></i>
<span>Database is up-to-date. <span class="hidden md:inline text-base-content/60">(<?= $phpb_db->getDBDefinitionHash() ?>)</span></span>
</div>
<?php <?php
endif; endif;
?> ?>
@@ -68,45 +80,46 @@ use Plugi\Setting;
</td> </td>
</tr> </tr>
<tr> <tr>
<th class="align-top">Installed extensions</th> <th scope="row" class="align-top">Installed extensions</th>
<td x-data="{show: false}"> <td x-data="{show: false}">
<ul> <ul class="space-y-2">
<?php <?php
foreach (\Plugi\Extensions::getConfigs() as $ext) : foreach (\Plugi\Extensions::getConfigs() as $ext) :
?> ?>
<li> <li class="flex flex-wrap items-center justify-between gap-2 rounded-box border border-base-300 px-3 py-2">
<?= phpb_e($ext['title']) ?> (<?= phpb_e($ext['version']) ?>) <span class="font-medium"><?= phpb_e($ext['title']) ?></span>
<span class="badge badge-ghost"><?= phpb_e($ext['version']) ?></span>
</li> </li>
<?php <?php
endforeach; endforeach;
?> ?>
</ul> </ul>
<div> <div class="mt-3">
<button @click="show = !show" class="btn btn-xs btn-outline" x-text="show ? 'hide' : 'show config'"></button> <button type="button" @click="show = !show" class="btn btn-ghost btn-xs" :aria-expanded="show" aria-controls="installed-extension-config" x-text="show ? 'Hide configuration' : 'Show configuration'"></button>
</div> </div>
<pre class="mt-4" x-show="show"><?php <pre id="installed-extension-config" class="mt-3 max-h-96 overflow-auto rounded-box border border-base-300 bg-base-200 p-4 text-xs" x-show="show"><?php
print_r(\Plugi\Extensions::getConfigs()); print_r(\Plugi\Extensions::getConfigs());
?></pre> ?></pre>
</td> </td>
</tr> </tr>
<tr> <tr>
<th class="align-top">Config</th> <th scope="row" class="align-top">Config</th>
<td x-data="{show: false}"> <td x-data="{show: false}">
<div> <div>
<button @click="show = !show" class="btn btn-xs btn-outline" x-text="show ? 'hide' : 'show'"></button> <button type="button" @click="show = !show" class="btn btn-ghost btn-xs" :aria-expanded="show" aria-controls="application-config" x-text="show ? 'Hide configuration' : 'Show configuration'"></button>
</div> </div>
<pre class="mt-4" x-show="show"><?php <pre id="application-config" class="mt-3 max-h-96 overflow-auto rounded-box border border-base-300 bg-base-200 p-4 text-xs" x-show="show"><?php
print_r(phpb_config()); print_r(phpb_config());
?></pre> ?></pre>
</td> </td>
</tr> </tr>
<tr> <tr>
<th class="align-top">Environment</th> <th scope="row" class="align-top">Environment</th>
<td x-data="{show: false}"> <td x-data="{show: false}">
<div class=""> <div class="">
<button @click="show = !show" class="btn btn-xs btn-outline" x-text="show ? 'hide' : 'show'"></button> <button type="button" @click="show = !show" class="btn btn-ghost btn-xs" :aria-expanded="show" aria-controls="environment-config" x-text="show ? 'Hide values' : 'Show values'"></button>
</div> </div>
<pre class="mt-4" x-show="show"><?php <pre id="environment-config" class="mt-3 max-h-96 overflow-auto rounded-box border border-base-300 bg-base-200 p-4 text-xs" x-show="show"><?php
print_r([ print_r([
'STAGE'=>$_ENV['STAGE'], 'STAGE'=>$_ENV['STAGE'],
'BASE_URL'=>$_ENV['BASE_URL'] 'BASE_URL'=>$_ENV['BASE_URL']
@@ -116,4 +129,5 @@ print_r([
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</section>
@@ -10,32 +10,47 @@ $pages = $pageRepository->getAll();
<form method="post" action="<?= phpb_url('website_manager', ['route' => 'menus', 'action' => 'update', 'tab' => 'menus']) ?>"> <form method="post" action="<?= phpb_url('website_manager', ['route' => 'menus', 'action' => 'update', 'tab' => 'menus']) ?>">
<?php phpb_csrf_field(); ?> <?php phpb_csrf_field(); ?>
<div class="main-spacing" x-data="{menus: <?= phpb_e($menusJson) ?>, pages: <?= phpb_e($menuPagesJson) ?>}"> <div class="space-y-6" x-data="{menus: <?= phpb_e($menusJson) ?>, pages: <?= phpb_e($menuPagesJson) ?>}">
<div class="text-center mb-8"> <header class="flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between">
<div class="space-y-1">
<h2 class="text-xl font-bold tracking-tight text-base-content">Navigation menus</h2>
<p class="text-sm text-base-content/60">Arrange pages and control the order visitors see in your menus.</p>
</div>
<button type="button" @click.stop.prevent="menus.push({name:'New Menu',pages:[]})" class="btn btn-primary"> <button type="button" @click.stop.prevent="menus.push({name:'New Menu',pages:[]})" class="btn btn-primary">
<i class="ph-bold ph-plus" aria-hidden="true"></i>
<?= phpb_trans('website-manager.create-menu'); ?> <?= phpb_trans('website-manager.create-menu'); ?>
</button> </button>
</div> </header>
<div class="flex flex-col gap-12"> <div class="flex flex-col gap-6">
<template x-if="menus.length === 0">
<div class="rounded-box border border-dashed border-base-300 bg-base-100 px-5 py-10 text-center">
<span class="mx-auto mb-3 grid size-11 place-items-center rounded-2xl bg-info/10 text-info">
<i class="text-2xl ph-duotone ph-list-dashes" aria-hidden="true"></i>
</span>
<h3 class="font-semibold text-base-content">No menus created</h3>
<p class="mt-1 text-sm text-base-content/60">Create a menu, then add and arrange pages.</p>
</div>
</template>
<template x-for="(menu, menuIndex) in menus"> <template x-for="(menu, menuIndex) in menus">
<div class=""> <section class="card border border-base-300 bg-base-100 shadow-sm">
<div class="px-6 mb-4 flex justify-between" x-data="{ edit: false }"> <div class="card-body gap-5 p-4 sm:p-6">
<input type="text" x-model="menu.name" class="input input-bordered w-full max-w-xs" x-show="edit" > <div class="flex flex-col gap-4 border-b border-base-300 pb-4 sm:flex-row sm:items-center sm:justify-between" x-data="{ edit: false }">
<div class="text-2xl font-bold" x-text="menu.name" x-show="!edit"></div> <input type="text" x-model="menu.name" class="input input-bordered w-full max-w-md" x-show="edit" aria-label="<?= phpb_e(phpb_trans('website-manager.name')) ?>">
<div> <h3 class="text-lg font-bold text-base-content sm:text-xl" x-text="menu.name" x-show="!edit"></h3>
<a href="javascript:void(0)" class="btn btn-square btn-sm" @click="edit = !edit"> <div class="flex items-center gap-2">
<i class=" text-2xl ph ph-pencil-line"></i> <button type="button" class="btn btn-ghost btn-square btn-sm" @click="edit = !edit" aria-label="<?= phpb_e(phpb_trans('website-manager.edit')) ?>" title="<?= phpb_e(phpb_trans('website-manager.edit')) ?>">
</a> <i class="text-xl ph ph-pencil-line" aria-hidden="true"></i>
<a href="javascript:void(0)" class="btn btn-square btn-sm" @click="if (confirm(`<?= phpb_trans('website-manager.delete-menu') ?> ${menu.name}`) === true) arraymove(menus,menuIndex);"> </button>
<i class=" text-2xl ph ph-trash"></i> <button type="button" class="btn btn-error btn-square btn-sm" @click="if (confirm(`<?= phpb_trans('website-manager.delete-menu') ?> ${menu.name}`) === true) arraymove(menus,menuIndex);" aria-label="<?= phpb_e(phpb_trans('website-manager.remove')) ?>" title="<?= phpb_e(phpb_trans('website-manager.remove')) ?>">
</a> <i class="text-xl ph ph-trash" aria-hidden="true"></i>
<div class="dropdown dropdown-end dropdown-hover" x-show="(menu.pages.length < pages.length)"> </button>
<label tabindex="0" class="btn btn-square btn-sm"> <details class="dropdown dropdown-end" x-show="(menu.pages.length < pages.length)">
<i class=" text-2xl ph ph-list-plus"></i> <summary class="btn btn-ghost btn-square btn-sm list-none" aria-label="Add pages to menu" title="Add pages to menu">
</label> <i class="text-xl ph ph-list-plus" aria-hidden="true"></i>
<ul tabindex="0" class="dropdown-content menu p-2 shadow bg-base-100 rounded-box w-52 z-10"> </summary>
<ul class="dropdown-content menu z-10 mt-2 w-64 rounded-box border border-base-300 bg-base-100 p-2 shadow-lg">
<template x-for="page in pages.filter(p=> !menu.pages.map(m=>m.id).includes(p.id))"> <template x-for="page in pages.filter(p=> !menu.pages.map(m=>m.id).includes(p.id))">
<li> <li>
<a href="javascript:void(0)" @click="menu.pages.push(page)"> <a href="javascript:void(0)" @click="menu.pages.push(page)">
@@ -45,14 +60,19 @@ $pages = $pageRepository->getAll();
</li> </li>
</template> </template>
</ul> </ul>
</div> </details>
</div> </div>
</div> </div>
<input type="hidden" :name="menu.name" :value="menu.pages.map(p=>p.id).join(',')"> <input type="hidden" :name="menu.name" :value="menu.pages.map(p=>p.id).join(',')">
<table class="table table-zebra w-full" x-show="menu.pages.length > 0"> <div class="alert alert-info alert-soft" x-show="menu.pages.length === 0" role="status">
<i class="ph-duotone ph-info" aria-hidden="true"></i>
<span>Add pages to this menu, then use the arrows to arrange their order.</span>
</div>
<div class="overflow-x-auto rounded-box border border-base-300" x-show="menu.pages.length > 0">
<table class="table table-zebra w-full min-w-[42rem]">
<thead> <thead>
<tr> <tr>
<th class="w-5">ID</th> <th class="w-16">ID</th>
<th class="w-5/12"><?= phpb_trans('website-manager.name') ?></th> <th class="w-5/12"><?= phpb_trans('website-manager.name') ?></th>
<th><?= phpb_trans('website-manager.route') ?></th> <th><?= phpb_trans('website-manager.route') ?></th>
<th class="w-36"><?= phpb_trans('website-manager.actions') ?></th> <th class="w-36"><?= phpb_trans('website-manager.actions') ?></th>
@@ -62,29 +82,34 @@ $pages = $pageRepository->getAll();
<template x-for="(page, index) in menu.pages"> <template x-for="(page, index) in menu.pages">
<tr> <tr>
<th x-text="page.id"></th> <th x-text="page.id"></th>
<td x-text="page.title"></td> <td class="font-medium" x-text="page.title"></td>
<td x-text="page.route"></td> <td x-text="page.route"></td>
<td> <td>
<button type="button" @click.stop.prevent="arraymove(menu.pages,index,index-1)" class="btn btn-outline btn-circle btn-sm" :disabled="index === 0"> <div class="flex items-center gap-1">
<i class="ph-duotone ph-arrow-fat-up text-xl"></i> <button type="button" @click.stop.prevent="arraymove(menu.pages,index,index-1)" class="btn btn-ghost btn-square btn-sm" :disabled="index === 0" aria-label="Move page up" title="Move page up">
<i class="ph-duotone ph-arrow-fat-up text-xl" aria-hidden="true"></i>
</button> </button>
<button type="button" @click.stop.prevent="arraymove(menu.pages,index,index+1)" class="btn btn-outline btn-circle btn-sm" :disabled="index === menu.pages.length - 1"> <button type="button" @click.stop.prevent="arraymove(menu.pages,index,index+1)" class="btn btn-ghost btn-square btn-sm" :disabled="index === menu.pages.length - 1" aria-label="Move page down" title="Move page down">
<i class="ph-duotone ph-arrow-fat-down text-xl"></i> <i class="ph-duotone ph-arrow-fat-down text-xl" aria-hidden="true"></i>
</button> </button>
<button @click.stop.prevent="arraymove(menu.pages,index)" class="btn btn-outline btn-circle btn-error btn-sm"> <button type="button" @click.stop.prevent="arraymove(menu.pages,index)" class="btn btn-error btn-square btn-sm" aria-label="Remove page" title="Remove page">
<i class="ph-duotone ph-trash text-xl"></i> <i class="ph-duotone ph-trash text-xl" aria-hidden="true"></i>
</button> </button>
</div>
</td> </td>
</tr> </tr>
</template> </template>
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
</section>
</template> </template>
</div> </div>
<div class="text-center mt-8"> <div class="flex justify-end border-t border-base-300 pt-5">
<button class="btn btn-primary"> <button type="submit" class="btn btn-primary">
<i class="ph-bold ph-floppy-disk" aria-hidden="true"></i>
<?= phpb_trans('website-manager.save-menus'); ?> <?= phpb_trans('website-manager.save-menus'); ?>
</button> </button>
</div> </div>
@@ -1,54 +1,66 @@
<table class="table table-zebra w-full"> <div class="space-y-5">
<header class="flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between">
<div class="space-y-1">
<h2 class="text-xl font-bold tracking-tight text-base-content">Your pages</h2>
<p class="text-sm text-base-content/60">Review routes and open the page editor or page settings.</p>
</div>
<a href="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => 'create']) ?>" class="btn btn-primary">
<i class="ph-bold ph-plus" aria-hidden="true"></i>
<?= phpb_trans('website-manager.add-new-page') ?>
</a>
</header>
<div class="overflow-x-auto rounded-box border border-base-300 bg-base-100">
<table class="table table-zebra w-full min-w-[48rem]">
<thead> <thead>
<tr> <tr>
<th class="w-5">ID</th> <th class="w-16">ID</th>
<th><?= phpb_trans('website-manager.name') ?></th> <th><?= phpb_trans('website-manager.name') ?></th>
<th><?= phpb_trans('website-manager.route') ?></th> <th><?= phpb_trans('website-manager.route') ?></th>
<th class="w-36 md:w-44"><?= phpb_trans('website-manager.actions') ?></th> <th class="w-44"><?= phpb_trans('website-manager.actions') ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php if (empty($pages)): ?>
foreach ($pages as $page):
?>
<tr> <tr>
<td> <td colspan="4" class="py-12 text-center">
<?= phpb_e($page->getId()) ?> <span class="mx-auto mb-3 grid size-11 place-items-center rounded-2xl bg-info/10 text-info">
</td> <i class="text-2xl ph-duotone ph-files" aria-hidden="true"></i>
<td> </span>
<?= phpb_e($page->getName()) ?> <span class="block font-semibold text-base-content">No pages yet</span>
<span class="mt-1 block text-sm text-base-content/60">Add a page to get your site started.</span>
</td> </td>
</tr>
<?php endif; ?>
<?php foreach ($pages as $page): ?>
<tr>
<td><?= phpb_e($page->getId()) ?></td>
<td class="font-medium"><?= phpb_e($page->getName()) ?></td>
<td> <td>
<div class="hidden pl-4 pl-8"></div> <div class="hidden pl-4 pl-8"></div>
<div class="pl-<?= phpb_e((count(explode('/', $page->getRoute()))-2)*4) ?>"> <div class="pl-<?= phpb_e((count(explode('/', $page->getRoute()))-2)*4) ?>">
<?= phpb_e($page->getRoute()) ?> <?= phpb_e($page->getRoute()) ?>
</div> </div>
</td> </td>
<td class="actions"> <td>
<a href="<?= phpb_e(phpb_full_url($page->getRoute())) ?>" title="<?= phpb_trans('website-manager.view') ?>" target="_blank" class="btn btn-light btn-outline btn-sm btn-circle <?= $page->get('type') === 'redirect' ? 'btn-disabled' : '' ?>"> <div class="flex items-center gap-1">
<i class="text-xl ph-duotone ph-eye"></i> <a href="<?= phpb_e(phpb_full_url($page->getRoute())) ?>" title="<?= phpb_trans('website-manager.view') ?>" aria-label="<?= phpb_e(phpb_trans('website-manager.view')) ?>" target="_blank" rel="noopener noreferrer" class="btn btn-ghost btn-square btn-sm <?= $page->get('type') === 'redirect' ? 'btn-disabled' : '' ?>" <?= $page->get('type') === 'redirect' ? 'tabindex="-1" aria-disabled="true"' : '' ?>>
<i class="text-xl ph-duotone ph-eye" aria-hidden="true"></i>
</a> </a>
<a href="<?= phpb_url('pagebuilder', ['page' => $page->getId()]) ?>" class="btn btn-primary hidden md:inline-flex btn-sm btn-circle <?= $page->get('type') === 'redirect' ? 'btn-disabled' : '' ?>" title="<?= phpb_trans('website-manager.edit') ?>"> <a href="<?= phpb_url('pagebuilder', ['page' => $page->getId()]) ?>" class="btn btn-primary btn-square btn-sm <?= $page->get('type') === 'redirect' ? 'btn-disabled' : '' ?>" title="<?= phpb_trans('website-manager.edit') ?>" aria-label="<?= phpb_e(phpb_trans('website-manager.edit')) ?>" <?= $page->get('type') === 'redirect' ? 'tabindex="-1" aria-disabled="true"' : '' ?>>
<i class="text-xl ph-duotone ph-pencil-line"></i> <i class="text-xl ph-duotone ph-pencil-line" aria-hidden="true"></i>
</a> </a>
<a href="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => 'edit', 'page' => $page->getId()]) ?>" title="<?= phpb_trans('website-manager.settings') ?>" class="btn btn-secondary btn-sm btn-circle"> <a href="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => 'edit', 'page' => $page->getId()]) ?>" title="<?= phpb_trans('website-manager.settings') ?>" aria-label="<?= phpb_e(phpb_trans('website-manager.settings')) ?>" class="btn btn-ghost btn-square btn-sm">
<i class="text-xl ph-duotone ph-gear"></i> <i class="text-xl ph-duotone ph-gear" aria-hidden="true"></i>
</a> </a>
<a href="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => 'destroy', 'page' => $page->getId()]) ?>" title="<?= phpb_trans('website-manager.remove') ?>" class="btn btn-error btn-sm btn-circle"> <a href="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => 'destroy', 'page' => $page->getId()]) ?>" title="<?= phpb_trans('website-manager.remove') ?>" aria-label="<?= phpb_e(phpb_trans('website-manager.remove')) ?>" class="btn btn-error btn-square btn-sm">
<i class="text-xl ph-duotone ph-trash"></i> <i class="text-xl ph-duotone ph-trash" aria-hidden="true"></i>
</a> </a>
</div>
</td> </td>
</tr> </tr>
<?php <?php endforeach; ?>
endforeach;
?>
</tbody> </tbody>
</table> </table>
</div>
<div class="text-center mt-8">
<a href="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => 'create']) ?>" class="btn btn-primary">
<?= phpb_trans('website-manager.add-new-page') ?>
</a>
</div> </div>
@@ -7,24 +7,28 @@ $settingIns = phpb_instance('setting');
<form method="post" action="<?= phpb_url('website_manager', ['route' => 'settings', 'action' => 'update', 'tab' => 'settings']) ?>"> <form method="post" action="<?= phpb_url('website_manager', ['route' => 'settings', 'action' => 'update', 'tab' => 'settings']) ?>">
<?php phpb_csrf_field(); ?> <?php phpb_csrf_field(); ?>
<div class="" x-data="{activeTab: 0, tabs: ['Website','Language','Theme','Extensions']}"> <div class="space-y-6" x-data="{activeTab: 0, tabs: ['Website','Language','Theme','Extensions']}">
<div class="tabs mb-6"> <header class="space-y-1">
<div class="border-b border-base-300 grow"></div> <h2 class="text-xl font-bold tracking-tight text-base-content">Site settings</h2>
<p class="text-sm text-base-content/60">Configure language, appearance, and extension options for this site.</p>
</header>
<div class="tabs tabs-border mb-6 max-w-full gap-1 overflow-x-auto" role="tablist" aria-label="Site settings sections">
<template x-for="(tab, index) in tabs"> <template x-for="(tab, index) in tabs">
<a class="tab tab-lifted" x-text="tab" @click="activeTab = index" :class="activeTab === index ? 'tab-active' : ''"></a> <button type="button" class="tab" role="tab" :id="'settings-tab-' + index" :aria-controls="'settings-panel-' + index" :aria-selected="activeTab === index" :tabindex="activeTab === index ? 0 : -1" x-text="tab" @click="activeTab = index" :class="activeTab === index ? 'tab-active' : ''"></button>
</template> </template>
<div class="border-b border-base-300 grow"></div>
</div> </div>
<div class="" x-show="activeTab === 0"> <div id="settings-panel-0" class="rounded-box border border-base-300 bg-base-200/50 p-4 text-sm text-base-content/70 sm:p-5" role="tabpanel" aria-labelledby="settings-tab-0" tabindex="0" x-show="activeTab === 0">
Website-wide options are organized in the Language, Theme, and Extensions sections.
</div> </div>
<div class="" x-show="activeTab === 1"> <div id="settings-panel-1" class="space-y-6" role="tabpanel" aria-labelledby="settings-tab-1" tabindex="0" x-show="activeTab === 1">
<div class="w-full mb-6"> <section class="space-y-4 rounded-box border border-base-300 bg-base-100 p-4 sm:p-6">
<div class="label-text text-left"><?= phpb_trans('website-manager.website-languages') ?></div> <h2 class="text-lg font-semibold"><?= phpb_trans('website-manager.website-languages') ?></h2>
<div class="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
<?php <?php
foreach (phpb_trans('languages') as $locale => $localeText): foreach (phpb_trans('languages') as $locale => $localeText):
?> ?>
<div class="form-control"> <div class="form-control">
<label class="label cursor-pointer"> <label class="flex cursor-pointer items-center justify-between gap-4 rounded-box border border-base-300 bg-base-100 px-4 py-3 transition-colors hover:border-primary/40 hover:bg-base-200/50">
<span class="label-text"><?= phpb_e($localeText) ?></span> <span class="label-text"><?= phpb_e($localeText) ?></span>
<input type="checkbox" name="languages[]" value="<?= phpb_e($locale) ?>" <?= phpb_e($settingIns::has('languages', $locale)) ? 'checked' : '' ?> class="checkbox checkbox-sm" /> <input type="checkbox" name="languages[]" value="<?= phpb_e($locale) ?>" <?= phpb_e($settingIns::has('languages', $locale)) ? 'checked' : '' ?> class="checkbox checkbox-sm" />
</label> </label>
@@ -33,7 +37,9 @@ $settingIns = phpb_instance('setting');
endforeach; endforeach;
?> ?>
</div> </div>
<div class="form-control w-full mb-6"> </section>
<section class="max-w-2xl rounded-box border border-base-300 bg-base-100 p-4 sm:p-6">
<div class="form-control w-full">
<label for="admin_language" class="label"> <label for="admin_language" class="label">
<span class="label-text"><?= phpb_trans('website-manager.admin-language') ?> <strong><?= phpb_current_language() ?></strong></span> <span class="label-text"><?= phpb_trans('website-manager.admin-language') ?> <strong><?= phpb_current_language() ?></strong></span>
</label> </label>
@@ -48,9 +54,11 @@ $settingIns = phpb_instance('setting');
?> ?>
</select> </select>
</div> </div>
</section>
</div> </div>
<div class="" x-show="activeTab === 2"> <div id="settings-panel-2" class="space-y-6" role="tabpanel" aria-labelledby="settings-tab-2" tabindex="0" x-show="activeTab === 2">
<div class="form-control w-full mb-6"> <section class="max-w-2xl rounded-box border border-base-300 bg-base-100 p-4 sm:p-6">
<div class="form-control w-full">
<label for="selected_theme" class="label"> <label for="selected_theme" class="label">
<span class="label-text"><?= phpb_trans('website-manager.selected-theme') ?></span> <span class="label-text"><?= phpb_trans('website-manager.selected-theme') ?></span>
</label> </label>
@@ -65,31 +73,30 @@ $settingIns = phpb_instance('setting');
?> ?>
</select> </select>
</div> </div>
</section>
</div> </div>
<div class="" x-show="activeTab === 3"> <div id="settings-panel-3" class="space-y-6" role="tabpanel" aria-labelledby="settings-tab-3" tabindex="0" x-show="activeTab === 3">
<div class="flex flex-col gap-6"> <div class="flex flex-col gap-4">
<?php <?php
foreach (Extensions::getConfigs() as $extKey => $config): foreach (Extensions::getConfigs() as $extKey => $config):
if(count(Extensions::getSettings($extKey)) === 0){ if(count(Extensions::getSettings($extKey)) === 0){
continue; continue;
} }
?> ?>
<details class="collapse collapse-plus bg-base-200"> <details class="collapse collapse-arrow border border-base-300 bg-base-100">
<summary class="collapse-title text-xl font-medium"><?= phpb_e($config['title']) ?></summary> <summary class="collapse-title text-lg font-semibold"><?= phpb_e($config['title']) ?></summary>
<div class="collapse-content"> <div class="collapse-content">
<div class=""> <div class="space-y-4">
<?php <?php
foreach (Extensions::getSettings($extKey) as $setting): foreach (Extensions::getSettings($extKey) as $setting):
?> ?>
<?php <?php
if ($setting['type'] === 'text'): if ($setting['type'] === 'text'):
?> ?>
<div class="form-control w-full"> <label class="form-control w-full gap-2">
<label class="label">
<span class="label-text"><?= phpb_e($setting['label'] ?: $setting['name']) ?></span> <span class="label-text"><?= phpb_e($setting['label'] ?: $setting['name']) ?></span>
</label>
<input type="text" name="<?= phpb_e($setting['key']) ?>" value="<?= phpb_e($setting['value']) ?>" class="input input-bordered w-full" /> <input type="text" name="<?= phpb_e($setting['key']) ?>" value="<?= phpb_e($setting['value']) ?>" class="input input-bordered w-full" />
</div> </label>
<?php <?php
endif; endif;
?> ?>
@@ -117,8 +124,9 @@ $settingIns = phpb_instance('setting');
?> ?>
</div> </div>
</div> </div>
<div class="text-center mt-8"> <div class="flex justify-end border-t border-base-300 pt-6">
<button class="btn btn-primary "> <button type="submit" class="btn btn-primary">
<i class="ph-bold ph-floppy-disk" aria-hidden="true"></i>
<?= phpb_trans('website-manager.save-settings'); ?> <?= phpb_trans('website-manager.save-settings'); ?>
</button> </button>
</div> </div>
@@ -1,10 +1,21 @@
<div id="welcome-page"> <main id="welcome-page" class="mx-auto flex min-h-full w-full max-w-5xl flex-1 items-center px-4 py-10 sm:px-6 lg:py-16">
<section class="card w-full overflow-hidden border border-base-300 bg-base-100 shadow-xl shadow-base-content/5">
<h1 class="text-center">Welcome to Plugi Page Builder</h1> <div class="h-2 bg-gradient-to-r from-primary via-secondary to-accent" aria-hidden="true"></div>
<div class="card-body items-center gap-7 p-8 text-center sm:p-12 lg:p-16">
<div class="text-center intro-links"> <span class="grid size-20 place-items-center rounded-[1.75rem] bg-primary text-primary-content shadow-lg shadow-primary/20">
<a href="<?= phpb_url('website_manager') ?>">Get started</a> <i class="text-4xl ph-bold ph-brackets-square rotate-90" aria-hidden="true"></i>
<a href="https://github.com/deepDiverPaul/plugi" target="_blank"><i class="fab fa-github"></i> Visit GitHub</a> </span>
<div class="space-y-2">
<p class="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Your site workspace</p>
<h1 class="text-3xl font-bold tracking-tight text-base-content sm:text-4xl">Welcome to Plugi Page Builder</h1>
<p class="mx-auto max-w-xl text-base leading-relaxed text-base-content/70">Manage your pages, menus, and files from one clear, focused workspace.</p>
</div> </div>
<div class="card-actions flex-col gap-3 sm:flex-row">
</div> <a class="btn btn-primary" href="<?= phpb_url('website_manager') ?>">Get started</a>
<a class="btn btn-outline" href="https://github.com/deepDiverPaul/plugi" target="_blank" rel="noopener noreferrer">
Visit GitHub
</a>
</div>
</div>
</section>
</main>